lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | * debugfs.h --- header file for the debugfs program |
| 3 | */ |
| 4 | |
| 5 | #include "ss/ss.h" |
| 6 | #include "ext2fs/ext2_fs.h" |
| 7 | #include "ext2fs/ext2fs.h" |
| 8 | |
| 9 | #ifdef __STDC__ |
| 10 | #define NOARGS void |
| 11 | #else |
| 12 | #define NOARGS |
| 13 | #define const |
| 14 | #endif |
| 15 | |
| 16 | /* |
| 17 | * Flags used by the common argument processing functions |
| 18 | */ |
| 19 | #define CHECK_FS_RW 0x0001 |
| 20 | #define CHECK_FS_BITMAPS 0x0002 |
| 21 | #define CHECK_FS_NOTOPEN 0x0004 |
| 22 | |
| 23 | extern ext2_filsys current_fs; |
| 24 | extern ext2_ino_t root, cwd; |
| 25 | extern int sci_idx; |
| 26 | extern ss_request_table debug_cmds, extent_cmds; |
| 27 | |
| 28 | extern void reset_getopt(void); |
| 29 | extern FILE *open_pager(void); |
| 30 | extern void close_pager(FILE *stream); |
| 31 | extern int check_fs_open(char *name); |
| 32 | extern int check_fs_not_open(char *name); |
| 33 | extern int check_fs_read_write(char *name); |
| 34 | extern int check_fs_bitmaps(char *name); |
| 35 | extern ext2_ino_t string_to_inode(char *str); |
| 36 | extern char *time_to_string(__u32); |
| 37 | extern time_t string_to_time(const char *); |
| 38 | extern unsigned long parse_ulong(const char *str, const char *cmd, |
| 39 | const char *descr, int *err); |
| 40 | extern unsigned long long parse_ulonglong(const char *str, const char *cmd, |
| 41 | const char *descr, int *err); |
| 42 | extern int strtoblk(const char *cmd, const char *str, blk64_t *ret); |
| 43 | extern int common_args_process(int argc, char *argv[], int min_argc, |
| 44 | int max_argc, const char *cmd, |
| 45 | const char *usage, int flags); |
| 46 | extern int common_inode_args_process(int argc, char *argv[], |
| 47 | ext2_ino_t *inode, int flags); |
| 48 | extern int common_block_args_process(int argc, char *argv[], |
| 49 | blk64_t *block, blk64_t *count); |
| 50 | extern int debugfs_read_inode(ext2_ino_t ino, struct ext2_inode * inode, |
| 51 | const char *cmd); |
| 52 | extern int debugfs_read_inode_full(ext2_ino_t ino, struct ext2_inode * inode, |
| 53 | const char *cmd, int bufsize); |
| 54 | extern int debugfs_write_inode(ext2_ino_t ino, struct ext2_inode * inode, |
| 55 | const char *cmd); |
| 56 | extern int debugfs_write_inode_full(ext2_ino_t ino, struct ext2_inode * inode, |
| 57 | const char *cmd, int bufsize); |
| 58 | extern int debugfs_write_new_inode(ext2_ino_t ino, struct ext2_inode * inode, |
| 59 | const char *cmd); |
| 60 | extern int ext2_file_type(unsigned int mode); |
| 61 | |
| 62 | /* ss command functions */ |
| 63 | |
| 64 | /* dump.c */ |
| 65 | extern void do_dump(int argc, char **argv); |
| 66 | extern void do_cat(int argc, char **argv); |
| 67 | extern void do_rdump(int argc, char **argv); |
| 68 | |
| 69 | /* extent_inode.c */ |
| 70 | extern void do_extent_open(int argc, char **argv); |
| 71 | extern void do_extent_close(int argc, char **argv); |
| 72 | extern void do_current_node(int argc, char **argv); |
| 73 | extern void do_root_node(int argc, char **argv); |
| 74 | extern void do_last_leaf(int argc, char **argv); |
| 75 | extern void do_first_sib(int argc, char **argv); |
| 76 | extern void do_last_sib(int argc, char **argv); |
| 77 | extern void do_next_sib(int argc, char **argv); |
| 78 | extern void do_prev_sib(int argc, char **argv); |
| 79 | extern void do_next_leaf(int argc, char **argv); |
| 80 | extern void do_prev_leaf(int argc, char **argv); |
| 81 | extern void do_next(int argc, char **argv); |
| 82 | extern void do_prev(int argc, char **argv); |
| 83 | extern void do_up(int argc, char **argv); |
| 84 | extern void do_down(int argc, char **argv); |
| 85 | extern void do_delete_node(int argc, char **argv); |
| 86 | extern void do_replace_node(int argc, char **argv); |
| 87 | extern void do_split_node(int argc, char **argv); |
| 88 | extern void do_insert_node(int argc, char **argv); |
| 89 | extern void do_set_bmap(int argc, char **argv); |
| 90 | extern void do_print_all(int argc, char **argv); |
| 91 | extern void do_fix_parents(int argc, char **argv); |
| 92 | extern void do_info(int argc, char **argv); |
| 93 | extern void do_goto_block(int argc, char **argv); |
| 94 | |
| 95 | /* htree.c */ |
| 96 | extern void do_htree_dump(int argc, char **argv); |
| 97 | extern void do_dx_hash(int argc, char **argv); |
| 98 | extern void do_dirsearch(int argc, char **argv); |
| 99 | |
| 100 | /* logdump.c */ |
| 101 | extern void do_logdump(int argc, char **argv); |
| 102 | |
| 103 | /* lsdel.c */ |
| 104 | extern void do_lsdel(int argc, char **argv); |
| 105 | |
| 106 | /* icheck.c */ |
| 107 | extern void do_icheck(int argc, char **argv); |
| 108 | |
| 109 | /* ncheck.c */ |
| 110 | extern void do_ncheck(int argc, char **argv); |
| 111 | |
| 112 | /* set_fields.c */ |
| 113 | extern void do_set_super(int argc, char **); |
| 114 | extern void do_set_inode(int argc, char **); |
| 115 | extern void do_set_block_group_descriptor(int argc, char **); |
| 116 | |
| 117 | /* unused.c */ |
| 118 | extern void do_dump_unused(int argc, char **argv); |
| 119 | |
| 120 | /* debugfs.c */ |
| 121 | extern void internal_dump_inode(FILE *, const char *, ext2_ino_t, |
| 122 | struct ext2_inode *, int); |
| 123 | |
| 124 | extern void do_dirty_filesys(int argc, char **argv); |
| 125 | extern void do_open_filesys(int argc, char **argv); |
| 126 | extern void do_close_filesys(int argc, char **argv); |
| 127 | extern void do_lcd(int argc, char **argv); |
| 128 | extern void do_init_filesys(int argc, char **argv); |
| 129 | extern void do_show_super_stats(int argc, char **argv); |
| 130 | extern void do_kill_file(int argc, char **argv); |
| 131 | extern void do_rm(int argc, char **argv); |
| 132 | extern void do_link(int argc, char **argv); |
| 133 | extern void do_undel(int argc, char **argv); |
| 134 | extern void do_unlink(int argc, char **argv); |
| 135 | extern void do_find_free_block(int argc, char **argv); |
| 136 | extern void do_find_free_inode(int argc, char **argv); |
| 137 | extern void do_stat(int argc, char **argv); |
| 138 | extern void do_dump_extents(int argc, char **argv); |
| 139 | extern void do_blocks(int argc, char *argv[]); |
| 140 | |
| 141 | extern void do_chroot(int argc, char **argv); |
| 142 | extern void do_clri(int argc, char **argv); |
| 143 | extern void do_freei(int argc, char **argv); |
| 144 | extern void do_seti(int argc, char **argv); |
| 145 | extern void do_testi(int argc, char **argv); |
| 146 | extern void do_freeb(int argc, char **argv); |
| 147 | extern void do_setb(int argc, char **argv); |
| 148 | extern void do_testb(int argc, char **argv); |
| 149 | extern void do_modify_inode(int argc, char **argv); |
| 150 | extern void do_list_dir(int argc, char **argv); |
| 151 | extern void do_change_working_dir(int argc, char **argv); |
| 152 | extern void do_print_working_directory(int argc, char **argv); |
| 153 | extern void do_write(int argc, char **argv); |
| 154 | extern void do_mknod(int argc, char **argv); |
| 155 | extern void do_mkdir(int argc, char **argv); |
| 156 | extern void do_rmdir(int argc, char **argv); |
| 157 | extern void do_show_debugfs_params(int argc, char **argv); |
| 158 | extern void do_expand_dir(int argc, char **argv); |
| 159 | extern void do_features(int argc, char **argv); |
| 160 | extern void do_bmap(int argc, char **argv); |
| 161 | extern void do_imap(int argc, char **argv); |
| 162 | extern void do_set_current_time(int argc, char **argv); |
| 163 | extern void do_supported_features(int argc, char **argv); |
| 164 | extern void do_punch(int argc, char **argv); |
| 165 | extern void do_symlink(int argc, char **argv); |
| 166 | |
| 167 | extern void do_dump_mmp(int argc, char **argv); |
| 168 | extern void do_set_mmp_value(int argc, char **argv); |
| 169 | |
| 170 | extern void do_freefrag(int argc, char **argv); |
| 171 | extern void do_filefrag(int argc, char *argv[]); |
| 172 | |
| 173 | /* util.c */ |
| 174 | extern time_t string_to_time(const char *arg); |
| 175 | |
| 176 | /* zap.c */ |
| 177 | extern void do_zap_block(int argc, char **argv); |
| 178 | extern void do_block_dump(int argc, char **argv); |