blob: 4a68dd9abe12d68ac89ebe4ffca71200bd806dd3 [file] [log] [blame]
Theodore Ts'o543547a2010-05-17 21:31:56 -04001/*
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
Theodore Ts'o50e1e101997-04-26 13:58:21 +000010#include <sys/types.h> /* Needed by dirent.h on netbsd */
Theodore Ts'o3839e651997-04-26 13:21:57 +000011#include <stdio.h>
Theodore Ts'o50e1e101997-04-26 13:58:21 +000012#include <dirent.h>
Theodore Ts'o3839e651997-04-26 13:21:57 +000013
Theodore Ts'o7c2d2562001-05-21 02:54:21 +000014#include <ext2fs/ext2_fs.h>
Theodore Ts'o3839e651997-04-26 13:21:57 +000015
Theodore Ts'od7b701d1999-09-14 20:17:38 +000016#define E2P_FEATURE_COMPAT 0
17#define E2P_FEATURE_INCOMPAT 1
18#define E2P_FEATURE_RO_INCOMPAT 2
Theodore Ts'o71003512008-02-26 14:26:01 -050019#define E2P_FEATURE_TYPE_MASK 0x03
Theodore Ts'od7b701d1999-09-14 20:17:38 +000020
Theodore Ts'o71003512008-02-26 14:26:01 -050021#define E2P_FEATURE_NEGATE_FLAG 0x80
Theodore Ts'odede39b2000-02-11 04:48:03 +000022
Andreas Dilger03efde82008-08-23 21:42:46 -060023#define E2P_FS_FEATURE 0
24#define E2P_JOURNAL_FEATURE 1
25
Theodore Ts'odede39b2000-02-11 04:48:03 +000026/* `options' for print_flags() */
27
28#define PFOPT_LONG 1 /* Must be 1 for compatibility with `int long_format'. */
29
30
Theodore Ts'o3839e651997-04-26 13:21:57 +000031int fgetflags (const char * name, unsigned long * flags);
32int fgetversion (const char * name, unsigned long * version);
33int fsetflags (const char * name, unsigned long flags);
34int fsetversion (const char * name, unsigned long version);
35int getflags (int fd, unsigned long * flags);
36int getversion (int fd, unsigned long * version);
37int iterate_on_dir (const char * dir_name,
38 int (*func) (const char *, struct dirent *, void *),
39 void * private);
Theodore Ts'o53d39552000-08-14 20:13:32 +000040void list_super(struct ext2_super_block * s);
41void list_super2(struct ext2_super_block * s, FILE *f);
Theodore Ts'o3839e651997-04-26 13:21:57 +000042void print_fs_errors (FILE * f, unsigned short errors);
Theodore Ts'odede39b2000-02-11 04:48:03 +000043void print_flags (FILE * f, unsigned long flags, unsigned options);
Theodore Ts'o3839e651997-04-26 13:21:57 +000044void print_fs_state (FILE * f, unsigned short state);
45int setflags (int fd, unsigned long flags);
46int setversion (int fd, unsigned long version);
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000047
Theodore Ts'o36caf251999-10-26 14:29:22 +000048const char *e2p_feature2string(int compat, unsigned int mask);
Theodore Ts'o022c9252009-04-22 14:35:45 -040049const char *e2p_jrnl_feature2string(int compat, unsigned int mask);
Theodore Ts'od7b701d1999-09-14 20:17:38 +000050int e2p_string2feature(char *string, int *compat, unsigned int *mask);
Theodore Ts'o022c9252009-04-22 14:35:45 -040051int e2p_jrnl_string2feature(char *string, int *compat_type, unsigned int *mask);
Theodore Ts'o36caf251999-10-26 14:29:22 +000052int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array);
Theodore Ts'o71003512008-02-26 14:26:01 -050053int e2p_edit_feature2(const char *str, __u32 *compat_array, __u32 *ok_array,
Theodore Ts'oefc6f622008-08-27 23:07:54 -040054 __u32 *clear_ok_array, int *type_err,
Theodore Ts'o71003512008-02-26 14:26:01 -050055 unsigned int *mask_err);
Theodore Ts'od7b701d1999-09-14 20:17:38 +000056
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000057int e2p_is_null_uuid(void *uu);
58void e2p_uuid_to_str(void *uu, char *out);
Theodore Ts'of61fc0b2002-08-24 00:04:03 -040059const char *e2p_uuid2str(void *uu);
60
61const char *e2p_hash2string(int num);
62int e2p_string2hash(char *string);
Theodore Ts'oa0c3fd52002-10-15 17:43:43 -040063
Theodore Ts'o4a959fe2002-10-20 01:52:52 -040064const char *e2p_mntopt2string(unsigned int mask);
Theodore Ts'oa0c3fd52002-10-15 17:43:43 -040065int e2p_string2mntopt(char *string, unsigned int *mask);
66int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok);
Theodore Ts'o55f4cbd2005-01-05 03:01:06 -050067
68unsigned long parse_num_blocks(const char *arg, int log_block_size);
JP Abgralle0ed7402014-03-19 19:08:39 -070069unsigned long long parse_num_blocks2(const char *arg, int log_block_size);
Theodore Ts'o63253942005-03-19 01:13:22 -050070
71char *e2p_os2string(int os_type);
72int e2p_string2os(char *str);
Theodore Ts'oa8862d92006-08-30 03:08:13 -040073
74unsigned int e2p_percent(int percent, unsigned int base);