blob: bad2d6ac9d70c88fcac18e766739ab0dfb53ef7a [file] [log] [blame]
Denis Vlasenkoc4f623e2006-12-26 01:30:59 +00001/* vi: set sw=4 ts=4: */
Denis Vlasenkob6adbf12007-05-26 19:00:18 +00002#include "libbb.h"
Denis Vlasenkoc4f623e2006-12-26 01:30:59 +00003#include <sys/types.h> /* Needed by dirent.h on netbsd */
4#include <stdio.h>
5#include <dirent.h>
6
7#include "../ext2fs/ext2_fs.h"
8
9#define E2P_FEATURE_COMPAT 0
10#define E2P_FEATURE_INCOMPAT 1
11#define E2P_FEATURE_RO_INCOMPAT 2
12#ifndef EXT3_FEATURE_INCOMPAT_EXTENTS
13#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040
14#endif
15
Denis Vlasenko53354ac2008-06-07 15:10:29 +000016/* `options' for print_e2flags() */
Denis Vlasenkoc4f623e2006-12-26 01:30:59 +000017
18#define PFOPT_LONG 1 /* Must be 1 for compatibility with `int long_format'. */
19
20/*int fgetversion (const char * name, unsigned long * version);*/
21/*int fsetversion (const char * name, unsigned long version);*/
22int fgetsetversion(const char * name, unsigned long * get_version, unsigned long set_version);
23#define fgetversion(name, version) fgetsetversion(name, version, 0)
24#define fsetversion(name, version) fgetsetversion(name, NULL, version)
25
26/*int fgetflags (const char * name, unsigned long * flags);*/
27/*int fsetflags (const char * name, unsigned long flags);*/
28int fgetsetflags(const char * name, unsigned long * get_flags, unsigned long set_flags);
29#define fgetflags(name, flags) fgetsetflags(name, flags, 0)
30#define fsetflags(name, flags) fgetsetflags(name, NULL, flags)
31
32int getflags (int fd, unsigned long * flags);
33int getversion (int fd, unsigned long * version);
34int iterate_on_dir (const char * dir_name,
35 int (*func) (const char *, struct dirent *, void *),
36 void * private);
37/*void list_super(struct ext2_super_block * s);*/
38void list_super2(struct ext2_super_block * s, FILE *f);
39#define list_super(s) list_super2(s, stdout)
Denis Vlasenkodefc1ea2008-06-27 02:52:20 +000040void print_fs_errors (FILE *f, unsigned short errors);
41void print_flags (FILE *f, unsigned long flags, unsigned options);
42void print_fs_state (FILE *f, unsigned short state);
Denis Vlasenkoc4f623e2006-12-26 01:30:59 +000043int setflags (int fd, unsigned long flags);
44int setversion (int fd, unsigned long version);
45
46const char *e2p_feature2string(int compat, unsigned int mask);
47int e2p_string2feature(char *string, int *compat, unsigned int *mask);
48int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array);
49
50int e2p_is_null_uuid(void *uu);
51void e2p_uuid_to_str(void *uu, char *out);
52const char *e2p_uuid2str(void *uu);
53
54const char *e2p_hash2string(int num);
55int e2p_string2hash(char *string);
56
57const char *e2p_mntopt2string(unsigned int mask);
58int e2p_string2mntopt(char *string, unsigned int *mask);
59int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok);
60
61unsigned long parse_num_blocks(const char *arg, int log_block_size);
62
63char *e2p_os2string(int os_type);
64int e2p_string2os(char *str);