add ubi detach support, fix handling for kernel/rootfs ubi partitions
[project/fstools.git] / libfstools / libfstools.h
1 /*
2  * Copyright (C) 2014 John Crispin <blogic@openwrt.org>
3  *
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
7  *
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.
12  */
13
14 #ifndef _FS_STATE_H__
15 #define _FS_STATE_H__
16
17 #include <libubox/list.h>
18 #include <libubox/blob.h>
19
20 enum {
21         FS_NONE,
22         FS_SNAPSHOT,
23         FS_JFFS2,
24         FS_DEADCODE,
25         FS_UBIFS,
26 };
27
28 extern char const *extroot_prefix;
29 extern int mount_extroot(void);
30 extern int mount_snapshot(void);
31 extern int mount_overlay(void);
32
33 extern int mount_move(char *oldroot, char *newroot, char *dir);
34 extern int pivot(char *new, char *old);
35 extern int fopivot(char *rw_root, char *ro_root);
36 extern int ramoverlay(void);
37
38 extern int find_overlay_mount(char *overlay);
39 extern char* find_mount(char *mp);
40 extern char* find_mount_point(char *block, char *fs);
41 extern int find_filesystem(char *fs);
42 extern int find_mtd_block(char *name, char *part, int plen);
43 extern int find_mtd_char(char *name, char *part, int plen);
44
45 extern int jffs2_ready(char *mtd);
46 extern int jffs2_switch(int argc, char **argv);
47
48 extern int handle_whiteout(const char *dir);
49 extern void foreachdir(const char *dir, int (*cb)(const char*));
50
51 #endif