2 * Copyright (C) 2014 John Crispin <blogic@openwrt.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 2.1
6 * as published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
17 #include <libubox/list.h>
18 #include <libubox/blob.h>
27 typedef int (*backend_cli_t)(int argc, char **argv);
28 typedef int (*backend_mount_t)(void);
29 typedef int (*backend_info_t)(void);
31 extern char const *extroot_prefix;
33 struct backend_handler
42 struct list_head list;
47 backend_mount_t mount;
49 struct backend_handler *handlers;
52 void register_backend(struct backend *);
53 struct backend* find_backend(char *);
54 int backend_mount(char *name);
57 static void __attribute__((constructor)) \
58 register_##x(void) { \
59 register_backend(&x); \
62 int mount_move(char *oldroot, char *newroot, char *dir);
63 int pivot(char *new, char *old);
64 int fopivot(char *rw_root, char *ro_root);
67 int find_overlay_mount(char *overlay);
68 char* find_mount(char *mp);
69 char* find_mount_point(char *block, char *fs);
70 int find_filesystem(char *fs);
71 int find_mtd_block(char *name, char *part, int plen);
72 int find_mtd_char(char *name, char *part, int plen);
74 int jffs2_ready(char *mtd);
75 int jffs2_switch(int argc, char **argv);
77 int handle_whiteout(const char *dir);
78 void foreachdir(const char *dir, int (*cb)(const char*));