1997-04-26 21:21:57 +08:00
|
|
|
/*
|
|
|
|
* debugfs.h --- header file for the debugfs program
|
|
|
|
*/
|
|
|
|
|
2012-12-23 07:50:33 +08:00
|
|
|
#include "ss/ss.h"
|
Many files:
badblocks.c, chattr.c, dumpe2fs.c, e2image.c, findsuper.c, lsattr.c,
mke2fs.c, mklost+found.c, tune2fs.c, util.c: Change location of
ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, resize2fs.h:
resize2fs.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, debugfs.h:
debugfs.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, e2fsck.h, scantest.c:
e2fsck.h, scantest.c: Change location of ext2_fs.h to be
ext2fs/ext2_fs.h
ChangeLog, Makefile.in, tst_uuid.c, uuid_time.c:
tst_uuid.c, uuid_time.c: Remove unneeded #include of ext2_fs.h
ChangeLog, Makefile.in, e2p.h:
e2p.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, test_icount.c, test_rel.c:
test_icount.c, test_rel.c: Change location of ext2_fs.h to be
ext2fs/ext2_fs.h
2001-05-14 19:45:38 +08:00
|
|
|
#include "ext2fs/ext2_fs.h"
|
1997-04-26 21:21:57 +08:00
|
|
|
#include "ext2fs/ext2fs.h"
|
2014-03-07 00:00:25 +08:00
|
|
|
#include "../misc/create_inode.h"
|
1997-04-26 21:21:57 +08:00
|
|
|
|
1997-04-26 21:58:21 +08:00
|
|
|
#ifdef __STDC__
|
|
|
|
#define NOARGS void
|
|
|
|
#else
|
|
|
|
#define NOARGS
|
|
|
|
#define const
|
|
|
|
#endif
|
|
|
|
|
2002-01-03 17:55:25 +08:00
|
|
|
/*
|
|
|
|
* Flags used by the common argument processing functions
|
|
|
|
*/
|
|
|
|
#define CHECK_FS_RW 0x0001
|
|
|
|
#define CHECK_FS_BITMAPS 0x0002
|
|
|
|
#define CHECK_FS_NOTOPEN 0x0004
|
|
|
|
|
1997-04-29 22:51:31 +08:00
|
|
|
extern ext2_filsys current_fs;
|
2001-01-11 23:26:39 +08:00
|
|
|
extern ext2_ino_t root, cwd;
|
2012-12-23 07:50:33 +08:00
|
|
|
extern int sci_idx;
|
|
|
|
extern ss_request_table debug_cmds, extent_cmds;
|
1997-04-26 21:21:57 +08:00
|
|
|
|
util.c, ls.c, logdump.c, htree.c, dump.c, debugfs.h, debugfs.c, ChangeLog:
util.c (reset_getopt), debugfs.c (do_open_filesys,
do_show_super_stats), ls.c (do_list_dir), dump.c (do_dump),
htree.c (do_htree_dump, do_dx_hash), logdump.c (do_logdump):
Define and use a new function, reset_getopt(), which does whatever
is necessary to reset getopt() again. This is different for
different implementations, so the portabilty issues are a bit of a
nightmare. (Addresses Debian bug #192834)
2003-05-14 11:03:43 +08:00
|
|
|
extern void reset_getopt(void);
|
1997-04-26 21:21:57 +08:00
|
|
|
extern FILE *open_pager(void);
|
|
|
|
extern void close_pager(FILE *stream);
|
|
|
|
extern int check_fs_open(char *name);
|
|
|
|
extern int check_fs_not_open(char *name);
|
1997-04-29 22:51:31 +08:00
|
|
|
extern int check_fs_read_write(char *name);
|
2000-05-28 00:04:00 +08:00
|
|
|
extern int check_fs_bitmaps(char *name);
|
2001-01-11 23:26:39 +08:00
|
|
|
extern ext2_ino_t string_to_inode(char *str);
|
1997-04-29 22:51:31 +08:00
|
|
|
extern char *time_to_string(__u32);
|
2005-09-25 09:56:38 +08:00
|
|
|
extern time_t string_to_time(const char *);
|
2002-01-03 17:55:25 +08:00
|
|
|
extern unsigned long parse_ulong(const char *str, const char *cmd,
|
|
|
|
const char *descr, int *err);
|
2009-09-08 10:46:17 +08:00
|
|
|
extern unsigned long long parse_ulonglong(const char *str, const char *cmd,
|
|
|
|
const char *descr, int *err);
|
2013-12-31 05:43:46 +08:00
|
|
|
extern int strtoblk(const char *cmd, const char *str, const char *errmsg,
|
|
|
|
blk64_t *ret);
|
2002-01-03 17:55:25 +08:00
|
|
|
extern int common_args_process(int argc, char *argv[], int min_argc,
|
|
|
|
int max_argc, const char *cmd,
|
|
|
|
const char *usage, int flags);
|
|
|
|
extern int common_inode_args_process(int argc, char *argv[],
|
|
|
|
ext2_ino_t *inode, int flags);
|
|
|
|
extern int common_block_args_process(int argc, char *argv[],
|
2009-09-08 10:46:17 +08:00
|
|
|
blk64_t *block, blk64_t *count);
|
2002-01-03 17:55:25 +08:00
|
|
|
extern int debugfs_read_inode(ext2_ino_t ino, struct ext2_inode * inode,
|
|
|
|
const char *cmd);
|
2005-12-11 10:50:30 +08:00
|
|
|
extern int debugfs_read_inode_full(ext2_ino_t ino, struct ext2_inode * inode,
|
|
|
|
const char *cmd, int bufsize);
|
2002-01-03 17:55:25 +08:00
|
|
|
extern int debugfs_write_inode(ext2_ino_t ino, struct ext2_inode * inode,
|
|
|
|
const char *cmd);
|
2011-09-16 01:38:41 +08:00
|
|
|
extern int debugfs_write_inode_full(ext2_ino_t ino, struct ext2_inode * inode,
|
|
|
|
const char *cmd, int bufsize);
|
2005-03-21 09:05:22 +08:00
|
|
|
extern int debugfs_write_new_inode(ext2_ino_t ino, struct ext2_inode * inode,
|
|
|
|
const char *cmd);
|
2012-01-18 06:08:39 +08:00
|
|
|
extern int ext2_file_type(unsigned int mode);
|
1997-04-26 21:21:57 +08:00
|
|
|
|
1997-04-26 21:58:21 +08:00
|
|
|
/* ss command functions */
|
|
|
|
|
|
|
|
/* dump.c */
|
|
|
|
extern void do_dump(int argc, char **argv);
|
|
|
|
extern void do_cat(int argc, char **argv);
|
2001-01-11 23:26:39 +08:00
|
|
|
extern void do_rdump(int argc, char **argv);
|
1997-04-26 21:58:21 +08:00
|
|
|
|
2013-01-15 03:41:46 +08:00
|
|
|
/* extent_inode.c */
|
|
|
|
extern void do_extent_open(int argc, char **argv);
|
|
|
|
extern void do_extent_close(int argc, char **argv);
|
|
|
|
extern void do_current_node(int argc, char **argv);
|
|
|
|
extern void do_root_node(int argc, char **argv);
|
|
|
|
extern void do_last_leaf(int argc, char **argv);
|
|
|
|
extern void do_first_sib(int argc, char **argv);
|
|
|
|
extern void do_last_sib(int argc, char **argv);
|
|
|
|
extern void do_next_sib(int argc, char **argv);
|
|
|
|
extern void do_prev_sib(int argc, char **argv);
|
|
|
|
extern void do_next_leaf(int argc, char **argv);
|
|
|
|
extern void do_prev_leaf(int argc, char **argv);
|
|
|
|
extern void do_next(int argc, char **argv);
|
|
|
|
extern void do_prev(int argc, char **argv);
|
|
|
|
extern void do_up(int argc, char **argv);
|
|
|
|
extern void do_down(int argc, char **argv);
|
|
|
|
extern void do_delete_node(int argc, char **argv);
|
|
|
|
extern void do_replace_node(int argc, char **argv);
|
|
|
|
extern void do_split_node(int argc, char **argv);
|
|
|
|
extern void do_insert_node(int argc, char **argv);
|
|
|
|
extern void do_set_bmap(int argc, char **argv);
|
|
|
|
extern void do_print_all(int argc, char **argv);
|
|
|
|
extern void do_fix_parents(int argc, char **argv);
|
|
|
|
extern void do_info(int argc, char **argv);
|
|
|
|
extern void do_goto_block(int argc, char **argv);
|
|
|
|
|
2002-10-14 11:56:28 +08:00
|
|
|
/* htree.c */
|
|
|
|
extern void do_htree_dump(int argc, char **argv);
|
|
|
|
extern void do_dx_hash(int argc, char **argv);
|
|
|
|
extern void do_dirsearch(int argc, char **argv);
|
|
|
|
|
2001-06-01 23:36:05 +08:00
|
|
|
/* logdump.c */
|
|
|
|
extern void do_logdump(int argc, char **argv);
|
|
|
|
|
1997-04-26 21:58:21 +08:00
|
|
|
/* lsdel.c */
|
|
|
|
extern void do_lsdel(int argc, char **argv);
|
|
|
|
|
|
|
|
/* icheck.c */
|
|
|
|
extern void do_icheck(int argc, char **argv);
|
|
|
|
|
|
|
|
/* ncheck.c */
|
|
|
|
extern void do_ncheck(int argc, char **argv);
|
|
|
|
|
2004-12-22 09:37:36 +08:00
|
|
|
/* set_fields.c */
|
2001-01-13 01:23:52 +08:00
|
|
|
extern void do_set_super(int argc, char **);
|
2004-12-22 09:37:36 +08:00
|
|
|
extern void do_set_inode(int argc, char **);
|
2007-08-04 06:56:01 +08:00
|
|
|
extern void do_set_block_group_descriptor(int argc, char **);
|
2001-01-13 01:23:52 +08:00
|
|
|
|
2003-12-07 14:28:50 +08:00
|
|
|
/* unused.c */
|
|
|
|
extern void do_dump_unused(int argc, char **argv);
|
|
|
|
|
1997-04-26 21:58:21 +08:00
|
|
|
/* debugfs.c */
|
2008-08-28 11:07:54 +08:00
|
|
|
extern void internal_dump_inode(FILE *, const char *, ext2_ino_t,
|
2001-03-30 04:49:58 +08:00
|
|
|
struct ext2_inode *, int);
|
|
|
|
|
ChangeLog, Makefile.in, bmap.c, bmove.c, ext2fs.h, jump.funcs:
ext2fs.h: If __STRICT_ANSI__ is defined and we're on a platform with
32 bit longs, then we need to manually define __s64 and __u64, since
the current kernel header files don't define these if __STRICT_ANSI__
is defined. This is a problem if we are compiling with full GCC
warnings, since we do need 64 bit support.
Makefile.in (OBJS): Remove bmove.o from files to be built, since we're
not using ext2fs_move_blocks() and there is some question as to its
usefulness in its current form.
bmap.c (block_bmap): Remove unused function.
bmove.c (process_block): Fix -Wall warning.
ChangeLog, debugfs.c, debugfs.h, dump.c:
debugfs.h: Add declaration for do_dirty_filsys() to prevent -Wall
warnings.
debugfs.c (copy_file):
dump.c (dump_file): Fix -Wall warning caused by signed/unsigned mismatch.
1998-03-30 09:27:25 +08:00
|
|
|
extern void do_dirty_filesys(int argc, char **argv);
|
1997-04-26 21:58:21 +08:00
|
|
|
extern void do_open_filesys(int argc, char **argv);
|
|
|
|
extern void do_close_filesys(int argc, char **argv);
|
2001-01-11 23:26:39 +08:00
|
|
|
extern void do_lcd(int argc, char **argv);
|
1997-04-26 21:58:21 +08:00
|
|
|
extern void do_init_filesys(int argc, char **argv);
|
|
|
|
extern void do_show_super_stats(int argc, char **argv);
|
|
|
|
extern void do_kill_file(int argc, char **argv);
|
|
|
|
extern void do_rm(int argc, char **argv);
|
|
|
|
extern void do_link(int argc, char **argv);
|
2002-01-03 18:10:04 +08:00
|
|
|
extern void do_undel(int argc, char **argv);
|
1997-04-26 21:58:21 +08:00
|
|
|
extern void do_unlink(int argc, char **argv);
|
|
|
|
extern void do_find_free_block(int argc, char **argv);
|
|
|
|
extern void do_find_free_inode(int argc, char **argv);
|
|
|
|
extern void do_stat(int argc, char **argv);
|
2011-06-11 22:58:25 +08:00
|
|
|
extern void do_dump_extents(int argc, char **argv);
|
2011-07-10 00:13:40 +08:00
|
|
|
extern void do_blocks(int argc, char *argv[]);
|
1997-04-26 21:58:21 +08:00
|
|
|
|
|
|
|
extern void do_chroot(int argc, char **argv);
|
|
|
|
extern void do_clri(int argc, char **argv);
|
|
|
|
extern void do_freei(int argc, char **argv);
|
|
|
|
extern void do_seti(int argc, char **argv);
|
|
|
|
extern void do_testi(int argc, char **argv);
|
|
|
|
extern void do_freeb(int argc, char **argv);
|
|
|
|
extern void do_setb(int argc, char **argv);
|
|
|
|
extern void do_testb(int argc, char **argv);
|
|
|
|
extern void do_modify_inode(int argc, char **argv);
|
|
|
|
extern void do_list_dir(int argc, char **argv);
|
|
|
|
extern void do_change_working_dir(int argc, char **argv);
|
|
|
|
extern void do_print_working_directory(int argc, char **argv);
|
|
|
|
extern void do_write(int argc, char **argv);
|
|
|
|
extern void do_mknod(int argc, char **argv);
|
|
|
|
extern void do_mkdir(int argc, char **argv);
|
|
|
|
extern void do_rmdir(int argc, char **argv);
|
|
|
|
extern void do_show_debugfs_params(int argc, char **argv);
|
|
|
|
extern void do_expand_dir(int argc, char **argv);
|
2002-10-14 11:56:28 +08:00
|
|
|
extern void do_features(int argc, char **argv);
|
|
|
|
extern void do_bmap(int argc, char **argv);
|
2003-05-05 23:35:04 +08:00
|
|
|
extern void do_imap(int argc, char **argv);
|
2005-12-11 10:50:30 +08:00
|
|
|
extern void do_set_current_time(int argc, char **argv);
|
2009-07-12 11:23:16 +08:00
|
|
|
extern void do_supported_features(int argc, char **argv);
|
2010-07-22 21:39:04 +08:00
|
|
|
extern void do_punch(int argc, char **argv);
|
2013-01-05 04:00:59 +08:00
|
|
|
extern void do_symlink(int argc, char **argv);
|
2001-03-30 04:49:58 +08:00
|
|
|
|
2011-11-18 04:35:00 +08:00
|
|
|
extern void do_dump_mmp(int argc, char **argv);
|
|
|
|
extern void do_set_mmp_value(int argc, char **argv);
|
|
|
|
|
2011-11-15 12:31:24 +08:00
|
|
|
extern void do_freefrag(int argc, char **argv);
|
2011-11-18 04:15:38 +08:00
|
|
|
extern void do_filefrag(int argc, char *argv[]);
|
2013-01-15 03:41:46 +08:00
|
|
|
|
2013-12-17 07:56:36 +08:00
|
|
|
/* util.c */
|
|
|
|
extern time_t string_to_time(const char *arg);
|
|
|
|
|
2013-01-15 03:41:46 +08:00
|
|
|
/* zap.c */
|
|
|
|
extern void do_zap_block(int argc, char **argv);
|
|
|
|
extern void do_block_dump(int argc, char **argv);
|