1543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o/* 2543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * e2p.h --- header file for the e2p library 3543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * 4543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * %Begin-Header% 5543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * This file may be redistributed under the terms of the GNU Library 6543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * General Public License, version 2. 7543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o * %End-Header% 8543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o */ 9543547a52a20cb7e69d74921b2f691078fd55d83Theodore Ts'o 1050e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#include <sys/types.h> /* Needed by dirent.h on netbsd */ 113839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o#include <stdio.h> 1250e1e10fa0ac12a3e2a9d20a75ee9041873cda96Theodore Ts'o#include <dirent.h> 133839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 147c2d25699f2da458ba8201a375b00562d7a2469eTheodore Ts'o#include <ext2fs/ext2_fs.h> 153839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o 16d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o#define E2P_FEATURE_COMPAT 0 17d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o#define E2P_FEATURE_INCOMPAT 1 18d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o#define E2P_FEATURE_RO_INCOMPAT 2 197100351d352903aa84cb2978ef9389ee5b0b09adTheodore Ts'o#define E2P_FEATURE_TYPE_MASK 0x03 20d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o 217100351d352903aa84cb2978ef9389ee5b0b09adTheodore Ts'o#define E2P_FEATURE_NEGATE_FLAG 0x80 22dede39bbb8ef92920f26875de7d5cc64a319e033Theodore Ts'o 2303efde8abe79c80ff369206d06d4f1e476b08f53Andreas Dilger#define E2P_FS_FEATURE 0 2403efde8abe79c80ff369206d06d4f1e476b08f53Andreas Dilger#define E2P_JOURNAL_FEATURE 1 2503efde8abe79c80ff369206d06d4f1e476b08f53Andreas Dilger 26dede39bbb8ef92920f26875de7d5cc64a319e033Theodore Ts'o/* `options' for print_flags() */ 27dede39bbb8ef92920f26875de7d5cc64a319e033Theodore Ts'o 28dede39bbb8ef92920f26875de7d5cc64a319e033Theodore Ts'o#define PFOPT_LONG 1 /* Must be 1 for compatibility with `int long_format'. */ 29dede39bbb8ef92920f26875de7d5cc64a319e033Theodore Ts'o 30dede39bbb8ef92920f26875de7d5cc64a319e033Theodore Ts'o 313839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oint fgetflags (const char * name, unsigned long * flags); 323839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oint fgetversion (const char * name, unsigned long * version); 333839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oint fsetflags (const char * name, unsigned long flags); 343839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oint fsetversion (const char * name, unsigned long version); 353839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oint getflags (int fd, unsigned long * flags); 363839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oint getversion (int fd, unsigned long * version); 373839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oint iterate_on_dir (const char * dir_name, 383839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o int (*func) (const char *, struct dirent *, void *), 393839e65723771b85975f4263102dd3ceec4523cTheodore Ts'o void * private); 4053d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ovoid list_super(struct ext2_super_block * s); 4153d3955001593b668b15e2d10b3a191f689f9779Theodore Ts'ovoid list_super2(struct ext2_super_block * s, FILE *f); 423839e65723771b85975f4263102dd3ceec4523cTheodore Ts'ovoid print_fs_errors (FILE * f, unsigned short errors); 43dede39bbb8ef92920f26875de7d5cc64a319e033Theodore Ts'ovoid print_flags (FILE * f, unsigned long flags, unsigned options); 443839e65723771b85975f4263102dd3ceec4523cTheodore Ts'ovoid print_fs_state (FILE * f, unsigned short state); 453839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oint setflags (int fd, unsigned long flags); 463839e65723771b85975f4263102dd3ceec4523cTheodore Ts'oint setversion (int fd, unsigned long version); 471e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'o 4836caf25f8d61eb8ffddc9895463bce5807e96808Theodore Ts'oconst char *e2p_feature2string(int compat, unsigned int mask); 49022c925c5a2e92269f5795ba85719f75874e8424Theodore Ts'oconst char *e2p_jrnl_feature2string(int compat, unsigned int mask); 50d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'oint e2p_string2feature(char *string, int *compat, unsigned int *mask); 51022c925c5a2e92269f5795ba85719f75874e8424Theodore Ts'oint e2p_jrnl_string2feature(char *string, int *compat_type, unsigned int *mask); 5236caf25f8d61eb8ffddc9895463bce5807e96808Theodore Ts'oint e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array); 537100351d352903aa84cb2978ef9389ee5b0b09adTheodore Ts'oint e2p_edit_feature2(const char *str, __u32 *compat_array, __u32 *ok_array, 54efc6f628e15de95bcd13e4f0ee223cb42115d520Theodore Ts'o __u32 *clear_ok_array, int *type_err, 557100351d352903aa84cb2978ef9389ee5b0b09adTheodore Ts'o unsigned int *mask_err); 56d7b701ded6fda284d7c77cd5ac48c2607ff72b13Theodore Ts'o 571e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'oint e2p_is_null_uuid(void *uu); 581e3472c5f37ca3686dd69b079d4d02a302f5798dTheodore Ts'ovoid e2p_uuid_to_str(void *uu, char *out); 59f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'oconst char *e2p_uuid2str(void *uu); 60f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'o 61f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'oconst char *e2p_hash2string(int num); 62f61fc0b5d98ef2455252d596e7b20131526d6762Theodore Ts'oint e2p_string2hash(char *string); 63a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'o 644a959fe6f18a3b6023234a66f4455f7ec660b8b4Theodore Ts'oconst char *e2p_mntopt2string(unsigned int mask); 65a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'oint e2p_string2mntopt(char *string, unsigned int *mask); 66a0c3fd5e4cdc2e0b032c9ace89d960a622069c32Theodore Ts'oint e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok); 6755f4cbd96e0029f0ff67c4913192d87bf52fd149Theodore Ts'o 6855f4cbd96e0029f0ff67c4913192d87bf52fd149Theodore Ts'ounsigned long parse_num_blocks(const char *arg, int log_block_size); 69e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrallunsigned long long parse_num_blocks2(const char *arg, int log_block_size); 7063253946309651c1015947d522e2ba4b35a807a5Theodore Ts'o 7163253946309651c1015947d522e2ba4b35a807a5Theodore Ts'ochar *e2p_os2string(int os_type); 7263253946309651c1015947d522e2ba4b35a807a5Theodore Ts'oint e2p_string2os(char *str); 73a8862d9e90d0d94761ba28dbbf9674308fd7d7c0Theodore Ts'o 74a8862d9e90d0d94761ba28dbbf9674308fd7d7c0Theodore Ts'ounsigned int e2p_percent(int percent, unsigned int base); 75