Whamcloud - gitweb
65702a7ea89f207737ec42cea11967984d23396b
[tools/e2fsprogs.git] / lib / e2p / e2p.h
1 /*
2  * e2p.h --- header file for the e2p library
3  *
4  * %Begin-Header%
5  * This file may be redistributed under the terms of the GNU Library
6  * General Public License, version 2.
7  * %End-Header%
8  */
9
10 #include <sys/types.h>          /* Needed by dirent.h on netbsd */
11 #include <stdio.h>
12 #include <dirent.h>
13
14 #include <ext2fs/ext2_fs.h>
15
16 #define E2P_FEATURE_COMPAT      0
17 #define E2P_FEATURE_INCOMPAT    1
18 #define E2P_FEATURE_RO_INCOMPAT 2
19 #define E2P_FEATURE_TYPE_MASK   0x03
20
21 #define E2P_FEATURE_NEGATE_FLAG 0x80
22
23 #define E2P_FS_FEATURE          0
24 #define E2P_JOURNAL_FEATURE     1
25
26 /* `options' for print_flags() */
27
28 #define PFOPT_LONG  1 /* Must be 1 for compatibility with `int long_format'. */
29
30
31 int fgetflags (const char * name, unsigned long * flags);
32 int fgetversion (const char * name, unsigned long * version);
33 int fsetflags (const char * name, unsigned long flags);
34 int fsetversion (const char * name, unsigned long version);
35 int fgetproject(const char *name, unsigned long *project);
36 int fsetproject(const char *name, unsigned long project);
37 int getflags (int fd, unsigned long * flags);
38 int getversion (int fd, unsigned long * version);
39 int iterate_on_dir (const char * dir_name,
40                     int (*func) (const char *, struct dirent *, void *),
41                     void * private_arg);
42 void list_super(struct ext2_super_block * s);
43 void list_super2(struct ext2_super_block * s, FILE *f);
44 void print_fs_errors (FILE * f, unsigned short errors);
45 void print_flags (FILE * f, unsigned long flags, unsigned options);
46 void print_fs_state (FILE * f, unsigned short state);
47 int setflags (int fd, unsigned long flags);
48 int setversion (int fd, unsigned long version);
49
50 #define E2P_LIST_JOURNAL_FLAG_FC                0x1
51 void e2p_list_journal_super(FILE *f, char *journal_sb_buf,
52                             int exp_block_size, int flags);
53
54 void e2p_feature_to_string(int compat, unsigned int mask, char *buf,
55                            size_t buf_len);
56 const char *e2p_feature2string(int compat, unsigned int mask);
57 const char *e2p_jrnl_feature2string(int compat, unsigned int mask);
58 int e2p_string2feature(char *string, int *compat, unsigned int *mask);
59 int e2p_jrnl_string2feature(char *string, int *compat_type, unsigned int *mask);
60 int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array);
61 int e2p_edit_feature2(const char *str, __u32 *compat_array, __u32 *ok_array,
62                       __u32 *clear_ok_array, int *type_err,
63                       unsigned int *mask_err);
64
65 int e2p_is_null_uuid(void *uu);
66 void e2p_uuid_to_str(void *uu, char *out);
67 const char *e2p_uuid2str(void *uu);
68
69 const char *e2p_hash2string(int num);
70 int e2p_string2hash(char *string);
71
72 const char *e2p_mntopt2string(unsigned int mask);
73 int e2p_string2mntopt(char *string, unsigned int *mask);
74 int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok);
75
76 unsigned long parse_num_blocks(const char *arg, int log_block_size);
77 unsigned long long parse_num_blocks2(const char *arg, int log_block_size);
78
79 char *e2p_os2string(int os_type);
80 int e2p_string2os(char *str);
81
82 unsigned int e2p_percent(int percent, unsigned int base);
83
84 const char *e2p_encmode2string(int num);
85 int e2p_string2encmode(char *string);
86
87 int e2p_str2encoding(const char *string);
88 const char *e2p_encoding2str(int encoding);
89 int e2p_get_encoding_flags(int encoding);
90 int e2p_str2encoding_flags(int encoding, char *param, __u16 *flags);
91
92 const char *e2p_errcode2str(int err);