summaryrefslogtreecommitdiffstats
path: root/debugfs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 04:59:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 04:59:33 +0000
commit73193347133e750faf27f88fd3ab31ce43aff062 (patch)
treee28a6d9512d1787b1fcbe9167188c9d134bf51d9 /debugfs
parentAdding upstream version 1.47.0. (diff)
downloade2fsprogs-upstream.tar.xz
e2fsprogs-upstream.zip
Adding upstream version 1.47.1.upstream/1.47.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debugfs')
-rw-r--r--debugfs/Makefile.in27
-rw-r--r--debugfs/debugfs.8.in17
-rw-r--r--debugfs/debugfs.c173
-rw-r--r--debugfs/debugfs.h209
-rw-r--r--debugfs/do_journal.c8
-rw-r--r--debugfs/dump.c6
-rw-r--r--debugfs/extent_inode.c52
-rw-r--r--debugfs/filefrag.c2
-rw-r--r--debugfs/htree.c38
-rw-r--r--debugfs/icheck.c2
-rw-r--r--debugfs/journal.c24
-rw-r--r--debugfs/logdump.c13
-rw-r--r--debugfs/ls.c2
-rw-r--r--debugfs/lsdel.c2
-rw-r--r--debugfs/ncheck.c2
-rw-r--r--debugfs/quota.c4
-rw-r--r--debugfs/set_fields.c97
-rw-r--r--debugfs/unused.c2
-rw-r--r--debugfs/util.c14
-rw-r--r--debugfs/xattrs.c8
-rw-r--r--debugfs/zap.c4
21 files changed, 413 insertions, 293 deletions
diff --git a/debugfs/Makefile.in b/debugfs/Makefile.in
index 67f8d0b..50a21e5 100644
--- a/debugfs/Makefile.in
+++ b/debugfs/Makefile.in
@@ -20,7 +20,8 @@ MK_CMDS= _SS_DIR_OVERRIDE=$(srcdir)/../lib/ss ../lib/ss/mk_cmds
DEBUG_OBJS= debug_cmds.o debugfs.o util.o ncheck.o icheck.o ls.o \
lsdel.o dump.o set_fields.o logdump.o htree.o unused.o e2freefrag.o \
filefrag.o extent_cmds.o extent_inode.o zap.o create_inode.o \
- quota.o xattrs.o journal.o revoke.o recovery.o do_journal.o
+ create_inode_libarchive.o quota.o xattrs.o journal.o revoke.o \
+ recovery.o do_journal.o
RO_DEBUG_OBJS= ro_debug_cmds.o ro_debugfs.o util.o ncheck.o icheck.o ls.o \
lsdel.o logdump.o htree.o e2freefrag.o filefrag.o extent_cmds.o \
@@ -31,12 +32,13 @@ SRCS= debug_cmds.c $(srcdir)/debugfs.c $(srcdir)/util.c $(srcdir)/ls.c \
$(srcdir)/dump.c $(srcdir)/set_fields.c ${srcdir}/logdump.c \
$(srcdir)/htree.c $(srcdir)/unused.c ${srcdir}/../misc/e2freefrag.c \
$(srcdir)/filefrag.c $(srcdir)/extent_inode.c $(srcdir)/zap.c \
- $(srcdir)/../misc/create_inode.c $(srcdir)/xattrs.c $(srcdir)/quota.c \
- $(srcdir)/journal.c $(srcdir)/../e2fsck/revoke.c \
+ $(srcdir)/../misc/create_inode.c \
+ $(srcdir)/../misc/create_inode_libarchive.c $(srcdir)/xattrs.c \
+ $(srcdir)/quota.c $(srcdir)/journal.c $(srcdir)/../e2fsck/revoke.c \
$(srcdir)/../e2fsck/recovery.c $(srcdir)/do_journal.c
LIBS= $(LIBSUPPORT) $(LIBEXT2FS) $(LIBE2P) $(LIBSS) $(LIBCOM_ERR) $(LIBBLKID) \
- $(LIBUUID) $(LIBMAGIC) $(SYSLIBS)
+ $(LIBUUID) $(LIBMAGIC) $(SYSLIBS) $(LIBARCHIVE)
DEPLIBS= $(DEPLIBSUPPORT) $(LIBEXT2FS) $(LIBE2P) $(DEPLIBSS) $(DEPLIBCOM_ERR) \
$(DEPLIBBLKID) $(DEPLIBUUID)
@@ -113,6 +115,11 @@ create_inode.o: $(srcdir)/../misc/create_inode.c
$(Q) $(CC) -c $(ALL_CFLAGS) -I$(srcdir) \
$(srcdir)/../misc/create_inode.c -o $@
+create_inode_libarchive.o: $(srcdir)/../misc/create_inode_libarchive.c
+ $(E) " CC $@"
+ $(Q) $(CC) -c $(ALL_CFLAGS) -I$(srcdir) \
+ $(srcdir)/../misc/create_inode_libarchive.c -o $@
+
debugfs.8: $(DEP_SUBSTITUTE) $(srcdir)/debugfs.8.in
$(E) " SUBST $@"
$(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/debugfs.8.in debugfs.8
@@ -356,6 +363,18 @@ create_inode.o: $(srcdir)/../misc/create_inode.c $(top_builddir)/lib/config.h \
$(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \
$(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/fiemap.h \
$(srcdir)/../misc/create_inode.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(top_srcdir)/lib/support/nls-enable.h \
+ $(srcdir)/../misc/create_inode_libarchive.h
+create_inode_libarchive.o: $(srcdir)/../misc/create_inode_libarchive.c \
+ $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \
+ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/../misc/create_inode.h \
+ $(top_srcdir)/lib/et/com_err.h $(top_srcdir)/lib/e2p/e2p.h \
+ $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/ext2fs/ext3_extents.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
+ $(top_builddir)/lib/ext2fs/ext2_err.h \
+ $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \
+ $(top_srcdir)/lib/ext2fs/bitops.h \
+ $(srcdir)/../misc/create_inode_libarchive.h \
$(top_srcdir)/lib/support/nls-enable.h
xattrs.o: $(srcdir)/xattrs.c $(top_builddir)/lib/config.h \
$(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/support/cstring.h \
diff --git a/debugfs/debugfs.8.in b/debugfs/debugfs.8.in
index 5b5329c..7cf5c16 100644
--- a/debugfs/debugfs.8.in
+++ b/debugfs/debugfs.8.in
@@ -268,9 +268,24 @@ number, otherwise use the
.B s_mmp_block
field in the superblock to locate and use the existing MMP block.
.TP
-.BI dx_hash " [-h hash_alg] [-s hash_seed] filename"
+.BI dx_hash " [-cv] [-h hash_alg] [-s hash_seed] filename"
Calculate the directory hash of
.IR filename .
+The
+.I -c
+option will casefold the filename before calculating the hash. The
+.I -v
+option will make the
+.B dx_hash
+command more verbose and print the hash algorithm and hash seed to
+calculate the hash.
+If a file system is open, use the hash_seed and
+default hash_algorithm used by the file system, although these can be
+overridden by the
+.I -h
+and
+.I -s
+options.
The hash algorithm specified with
.I -h
may be
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 9b6321d..909c1df 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -222,7 +222,7 @@ errout:
com_err(device, retval, "while trying to close filesystem");
}
-void do_open_filesys(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_open_filesys(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
int c, err;
@@ -305,7 +305,7 @@ print_usage:
"<device>\n", argv[0]);
}
-void do_lcd(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_lcd(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
if (argc != 2) {
@@ -343,7 +343,7 @@ static void close_filesystem(NOARGS)
return;
}
-void do_close_filesys(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_close_filesys(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
int c;
@@ -372,7 +372,7 @@ void do_close_filesys(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
}
#ifndef READ_ONLY
-void do_init_filesys(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_init_filesys(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct ext2_super_block param;
@@ -433,7 +433,7 @@ static void print_bg_opts(ext2_filsys fs, dgrp_t group, int mask,
}
}
-void do_show_super_stats(int argc, char *argv[],
+void do_show_super_stats(int argc, ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -531,7 +531,7 @@ print_usage:
#ifndef READ_ONLY
void do_dirty_filesys(int argc EXT2FS_ATTR((unused)),
- char **argv EXT2FS_ATTR((unused)),
+ ss_argv_t argv EXT2FS_ATTR((unused)),
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -831,11 +831,13 @@ void internal_dump_inode(FILE *out, const char *prefix,
char frag, fsize;
int os = current_fs->super->s_creator_os;
struct ext2_inode_large *large_inode;
- int is_large_inode = 0;
+ size_t inode_size;
- if (EXT2_INODE_SIZE(current_fs->super) > EXT2_GOOD_OLD_INODE_SIZE)
- is_large_inode = 1;
large_inode = (struct ext2_inode_large *) inode;
+ if (EXT2_INODE_SIZE(current_fs->super) > EXT2_GOOD_OLD_INODE_SIZE)
+ inode_size = ext2fs_inode_actual_size(large_inode);
+ else
+ inode_size = EXT2_GOOD_OLD_INODE_SIZE;
if (LINUX_S_ISDIR(inode->i_mode)) i_type = "directory";
else if (LINUX_S_ISREG(inode->i_mode)) i_type = "regular";
@@ -848,7 +850,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
fprintf(out, "%sInode: %u Type: %s ", prefix, inode_num, i_type);
fprintf(out, "%sMode: 0%03o Flags: 0x%x\n",
prefix, inode->i_mode & 07777, inode->i_flags);
- if (is_large_inode && large_inode->i_extra_isize >= 24) {
+ if (ext2fs_inode_includes(inode_size, i_version_hi)) {
fprintf(out, "%sGeneration: %u Version: 0x%08x:%08x\n",
prefix, inode->i_generation, large_inode->i_version_hi,
inode->osd1.linux1.l_i_version);
@@ -858,7 +860,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
}
fprintf(out, "%sUser: %5d Group: %5d",
prefix, inode_uid(*inode), inode_gid(*inode));
- if (is_large_inode && large_inode->i_extra_isize >= 32)
+ if (ext2fs_inode_includes(inode_size, i_projid))
fprintf(out, " Project: %5d", large_inode->i_projid);
fputs(" Size: ", out);
if (LINUX_S_ISREG(inode->i_mode) || LINUX_S_ISDIR(inode->i_mode))
@@ -895,39 +897,51 @@ void internal_dump_inode(FILE *out, const char *prefix,
}
fprintf(out, "%sFragment: Address: %u Number: %u Size: %u\n",
prefix, inode->i_faddr, frag, fsize);
- if (is_large_inode && large_inode->i_extra_isize >= 24) {
+ if (ext2fs_inode_includes(inode_size, i_ctime_extra))
fprintf(out, "%s ctime: 0x%08x:%08x -- %s", prefix,
inode->i_ctime, large_inode->i_ctime_extra,
- inode_time_to_string(inode->i_ctime,
- large_inode->i_ctime_extra));
+ time_to_string(ext2fs_inode_xtime_get(large_inode,
+ i_ctime)));
+ else
+ fprintf(out, "%sctime: 0x%08x -- %s", prefix, inode->i_ctime,
+ time_to_string((__s32) inode->i_ctime));
+ if (ext2fs_inode_includes(inode_size, i_atime_extra))
fprintf(out, "%s atime: 0x%08x:%08x -- %s", prefix,
inode->i_atime, large_inode->i_atime_extra,
- inode_time_to_string(inode->i_atime,
- large_inode->i_atime_extra));
+ time_to_string(ext2fs_inode_xtime_get(large_inode,
+ i_atime)));
+ else
+ fprintf(out, "%satime: 0x%08x -- %s", prefix, inode->i_atime,
+ time_to_string((__s32) inode->i_atime));
+ if (ext2fs_inode_includes(inode_size, i_mtime_extra))
fprintf(out, "%s mtime: 0x%08x:%08x -- %s", prefix,
inode->i_mtime, large_inode->i_mtime_extra,
- inode_time_to_string(inode->i_mtime,
- large_inode->i_mtime_extra));
+ time_to_string(ext2fs_inode_xtime_get(large_inode,
+ i_mtime)));
+ else
+ fprintf(out, "%smtime: 0x%08x -- %s", prefix, inode->i_mtime,
+ time_to_string((__s32) inode->i_mtime));
+ if (ext2fs_inode_includes(inode_size, i_crtime_extra))
fprintf(out, "%scrtime: 0x%08x:%08x -- %s", prefix,
large_inode->i_crtime, large_inode->i_crtime_extra,
- inode_time_to_string(large_inode->i_crtime,
- large_inode->i_crtime_extra));
- if (inode->i_dtime)
+ time_to_string(ext2fs_inode_xtime_get(large_inode,
+ i_crtime)));
+ if (inode->i_dtime) {
+ if (ext2fs_inode_includes(inode_size, i_ctime_extra)) {
+ time_t tm;
+
+ /* dtime doesn't have its own i_dtime_extra field, so
+ * approximate this with i_ctime_extra instead. */
+ tm = __decode_extra_sec(inode->i_dtime,
+ large_inode->i_ctime_extra);
fprintf(out, "%s dtime: 0x%08x:(%08x) -- %s", prefix,
- large_inode->i_dtime, large_inode->i_ctime_extra,
- inode_time_to_string(inode->i_dtime,
- large_inode->i_ctime_extra));
- } else {
- fprintf(out, "%sctime: 0x%08x -- %s", prefix, inode->i_ctime,
- time_to_string((__s32) inode->i_ctime));
- fprintf(out, "%satime: 0x%08x -- %s", prefix, inode->i_atime,
- time_to_string((__s32) inode->i_atime));
- fprintf(out, "%smtime: 0x%08x -- %s", prefix, inode->i_mtime,
- time_to_string((__s32) inode->i_mtime));
- if (inode->i_dtime)
+ inode->i_dtime, large_inode->i_ctime_extra,
+ time_to_string(tm));
+ } else {
fprintf(out, "%sdtime: 0x%08x -- %s", prefix,
inode->i_dtime,
time_to_string((__s32) inode->i_dtime));
+ }
}
if (EXT2_INODE_SIZE(current_fs->super) > EXT2_GOOD_OLD_INODE_SIZE)
internal_dump_inode_extra(out, prefix, inode_num,
@@ -935,11 +949,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
dump_inode_attributes(out, inode_num);
if (ext2fs_has_feature_metadata_csum(current_fs->super)) {
__u32 crc = inode->i_checksum_lo;
- if (is_large_inode &&
- large_inode->i_extra_isize >=
- (offsetof(struct ext2_inode_large,
- i_checksum_hi) -
- EXT2_GOOD_OLD_INODE_SIZE))
+ if (ext2fs_inode_includes(inode_size, i_checksum_hi))
crc |= ((__u32)large_inode->i_checksum_hi) << 16;
fprintf(out, "Inode checksum: 0x%08x\n", crc);
}
@@ -986,7 +996,7 @@ static void dump_inode(ext2_ino_t inode_num, struct ext2_inode *inode)
close_pager(out);
}
-void do_stat(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_stat(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
@@ -1018,7 +1028,7 @@ void do_stat(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
return;
}
-void do_dump_extents(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_dump_extents(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct ext2_inode inode;
@@ -1090,7 +1100,7 @@ static int print_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
return 0;
}
-void do_blocks(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_blocks(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
@@ -1108,7 +1118,7 @@ void do_blocks(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
return;
}
-void do_chroot(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_chroot(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
@@ -1126,7 +1136,7 @@ void do_chroot(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
#ifndef READ_ONLY
-void do_clri(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_clri(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
@@ -1142,7 +1152,7 @@ void do_clri(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
return;
}
-void do_freei(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_freei(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
unsigned int len = 1;
@@ -1173,7 +1183,7 @@ void do_freei(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
ext2fs_mark_ib_dirty(current_fs);
}
-void do_seti(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_seti(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
unsigned int len = 1;
@@ -1205,7 +1215,7 @@ void do_seti(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
#endif /* READ_ONLY */
-void do_testi(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_testi(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
@@ -1220,7 +1230,7 @@ void do_testi(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
#ifndef READ_ONLY
-void do_freeb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_freeb(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
blk64_t block;
@@ -1240,7 +1250,7 @@ void do_freeb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
ext2fs_mark_bb_dirty(current_fs);
}
-void do_setb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_setb(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
blk64_t block;
@@ -1261,7 +1271,7 @@ void do_setb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
#endif /* READ_ONLY */
-void do_testb(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_testb(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
blk64_t block;
@@ -1348,7 +1358,7 @@ static void modify_u32(char *com, const char *prompt,
}
-void do_modify_inode(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_modify_inode(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct ext2_inode inode;
@@ -1426,7 +1436,7 @@ void do_modify_inode(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
#endif /* READ_ONLY */
-void do_change_working_dir(int argc, char *argv[],
+void do_change_working_dir(int argc, ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -1445,7 +1455,7 @@ void do_change_working_dir(int argc, char *argv[],
return;
}
-void do_print_working_directory(int argc, char *argv[],
+void do_print_working_directory(int argc, ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -1536,7 +1546,7 @@ static void make_link(char *sourcename, char *destname)
}
-void do_link(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_link(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
if (common_args_process(argc, argv, 3, 3, "link",
@@ -1559,7 +1569,7 @@ static int mark_blocks_proc(ext2_filsys fs, blk64_t *blocknr,
return 0;
}
-void do_undel(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_undel(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
@@ -1623,7 +1633,7 @@ static void unlink_file_by_name(char *filename)
return;
}
-void do_unlink(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_unlink(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
if (common_args_process(argc, argv, 2, 2, "link",
@@ -1633,7 +1643,7 @@ void do_unlink(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
unlink_file_by_name(argv[1]);
}
-void do_copy_inode(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_copy_inode(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t src_ino, dest_ino;
@@ -1662,7 +1672,7 @@ void do_copy_inode(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
#endif /* READ_ONLY */
-void do_find_free_block(int argc, char *argv[],
+void do_find_free_block(int argc, ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -1716,7 +1726,7 @@ void do_find_free_block(int argc, char *argv[],
printf("\n");
}
-void do_find_free_inode(int argc, char *argv[],
+void do_find_free_inode(int argc, ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -1758,7 +1768,7 @@ void do_find_free_inode(int argc, char *argv[],
}
#ifndef READ_ONLY
-void do_write(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_write(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
errcode_t retval;
@@ -1772,7 +1782,7 @@ void do_write(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
com_err(argv[0], retval, 0);
}
-void do_mknod(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_mknod(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
unsigned long major, minor;
@@ -1807,9 +1817,12 @@ void do_mknod(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
if (nr == 5) {
- major = strtoul(argv[3], argv+3, 0);
- minor = strtoul(argv[4], argv+4, 0);
- if (major > 65535 || minor > 65535 || argv[3][0] || argv[4][0])
+ char *end1 = NULL, *end2 = NULL;
+
+ major = strtoul(argv[3], &end1, 0);
+ minor = strtoul(argv[4], &end2, 0);
+ if (major > 65535 || minor > 65535 ||
+ (end1 && *end1) || (end2 && *end2))
nr = 0;
}
@@ -1823,7 +1836,7 @@ void do_mknod(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
com_err(argv[0], retval, 0);
}
-void do_mkdir(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_mkdir(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
errcode_t retval;
@@ -1863,7 +1876,7 @@ static void kill_file_by_inode(ext2_ino_t inode)
if (debugfs_read_inode(inode, &inode_buf, 0))
return;
- inode_buf.i_dtime = current_fs->now ? current_fs->now : time(0);
+ ext2fs_set_dtime(current_fs, &inode_buf);
if (debugfs_write_inode(inode, &inode_buf, 0))
return;
if (ext2fs_inode_has_valid_blocks2(current_fs, &inode_buf)) {
@@ -1877,7 +1890,7 @@ static void kill_file_by_inode(ext2_ino_t inode)
}
-void do_kill_file(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_kill_file(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode_num;
@@ -1888,7 +1901,7 @@ void do_kill_file(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
kill_file_by_inode(inode_num);
}
-void do_rm(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_rm(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
int retval;
@@ -1950,7 +1963,7 @@ static int rmdir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
return 0;
}
-void do_rmdir(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_rmdir(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
int retval;
@@ -2009,7 +2022,7 @@ void do_rmdir(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
#endif /* READ_ONLY */
void do_show_debugfs_params(int argc EXT2FS_ATTR((unused)),
- char *argv[] EXT2FS_ATTR((unused)),
+ ss_argv_t argv EXT2FS_ATTR((unused)),
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -2021,7 +2034,7 @@ void do_show_debugfs_params(int argc EXT2FS_ATTR((unused)),
}
#ifndef READ_ONLY
-void do_expand_dir(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_expand_dir(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
@@ -2036,7 +2049,7 @@ void do_expand_dir(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
return;
}
-void do_features(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_features(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
int i;
@@ -2058,7 +2071,7 @@ void do_features(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
#endif /* READ_ONLY */
-void do_bmap(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_bmap(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
@@ -2123,7 +2136,7 @@ void do_bmap(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
fputc('\n', stdout);
}
-void do_imap(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_imap(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
@@ -2155,7 +2168,7 @@ void do_imap(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
-void do_idump(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_idump(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct ext2_inode_large *inode;
@@ -2226,7 +2239,7 @@ err:
}
#ifndef READ_ONLY
-void do_set_current_time(int argc, char *argv[],
+void do_set_current_time(int argc, ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -2287,7 +2300,7 @@ static int find_supp_feature(__u32 *supp, int feature_type, char *name)
return 0;
}
-void do_supported_features(int argc, char *argv[],
+void do_supported_features(int argc, ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -2317,7 +2330,7 @@ void do_supported_features(int argc, char *argv[],
}
#ifndef READ_ONLY
-void do_punch(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_punch(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
@@ -2353,7 +2366,7 @@ void do_punch(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
}
-void do_fallocate(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_fallocate(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
@@ -2390,7 +2403,7 @@ void do_fallocate(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
}
-void do_symlink(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_symlink(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
errcode_t retval;
@@ -2407,7 +2420,7 @@ void do_symlink(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
#endif /* READ_ONLY */
#if CONFIG_MMP
-void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[],
+void do_dump_mmp(int argc EXT2FS_ATTR((unused)), ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -2473,7 +2486,7 @@ void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[],
}
#else
void do_dump_mmp(int argc EXT2FS_ATTR((unused)),
- char *argv[] EXT2FS_ATTR((unused)),
+ ss_argv_t argv EXT2FS_ATTR((unused)),
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h
index 39bc024..88d929c 100644
--- a/debugfs/debugfs.h
+++ b/debugfs/debugfs.h
@@ -36,7 +36,6 @@ extern int check_fs_not_open(char *name);
extern int check_fs_read_write(char *name);
extern int check_fs_bitmaps(char *name);
extern ext2_ino_t string_to_inode(char *str);
-extern char *inode_time_to_string(__u32 xtime, __u32 xtime_extra);
extern char *time_to_string(__s64);
extern __s64 string_to_time(const char *);
extern unsigned long parse_ulong(const char *str, const char *cmd,
@@ -45,12 +44,12 @@ extern unsigned long long parse_ulonglong(const char *str, const char *cmd,
const char *descr, int *err);
extern int strtoblk(const char *cmd, const char *str, const char *errmsg,
blk64_t *ret);
-extern int common_args_process(int argc, char *argv[], int min_argc,
+extern int common_args_process(int argc, ss_argv_t 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[],
+extern int common_inode_args_process(int argc, ss_argv_t argv,
ext2_ino_t *inode, int flags);
-extern int common_block_args_process(int argc, char *argv[],
+extern int common_block_args_process(int argc, ss_argv_t argv,
blk64_t *block, blk64_t *count);
extern int debugfs_read_inode(ext2_ino_t ino, struct ext2_inode * inode,
const char *cmd);
@@ -67,60 +66,60 @@ extern int ext2_file_type(unsigned int mode);
/* ss command functions */
/* dump.c */
-extern void do_dump(int argc, char **argv, int sci_idx, void *infop);
-extern void do_cat(int argc, char **argv, int sci_idx, void *infop);
-extern void do_rdump(int argc, char **argv, int sci_idx, void *infop);
+extern void do_dump(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_cat(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_rdump(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* extent_inode.c */
-extern void do_extent_open(int argc, char **argv, int sci_idx, void *infop);
-extern void do_extent_close(int argc, char **argv, int sci_idx, void *infop);
-extern void do_current_node(int argc, char **argv, int sci_idx, void *infop);
-extern void do_root_node(int argc, char **argv, int sci_idx, void *infop);
-extern void do_last_leaf(int argc, char **argv, int sci_idx, void *infop);
-extern void do_first_sib(int argc, char **argv, int sci_idx, void *infop);
-extern void do_last_sib(int argc, char **argv, int sci_idx, void *infop);
-extern void do_next_sib(int argc, char **argv, int sci_idx, void *infop);
-extern void do_prev_sib(int argc, char **argv, int sci_idx, void *infop);
-extern void do_next_leaf(int argc, char **argv, int sci_idx, void *infop);
-extern void do_prev_leaf(int argc, char **argv, int sci_idx, void *infop);
-extern void do_next(int argc, char **argv, int sci_idx, void *infop);
-extern void do_prev(int argc, char **argv, int sci_idx, void *infop);
-extern void do_up(int argc, char **argv, int sci_idx, void *infop);
-extern void do_down(int argc, char **argv, int sci_idx, void *infop);
-extern void do_delete_node(int argc, char **argv, int sci_idx, void *infop);
-extern void do_replace_node(int argc, char **argv, int sci_idx, void *infop);
-extern void do_split_node(int argc, char **argv, int sci_idx, void *infop);
-extern void do_insert_node(int argc, char **argv, int sci_idx, void *infop);
-extern void do_set_bmap(int argc, char **argv, int sci_idx, void *infop);
-extern void do_print_all(int argc, char **argv, int sci_idx, void *infop);
-extern void do_fix_parents(int argc, char **argv, int sci_idx, void *infop);
-extern void do_info(int argc, char **argv, int sci_idx, void *infop);
-extern void do_goto_block(int argc, char **argv, int sci_idx, void *infop);
+extern void do_extent_open(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_extent_close(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_current_node(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_root_node(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_last_leaf(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_first_sib(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_last_sib(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_next_sib(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_prev_sib(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_next_leaf(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_prev_leaf(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_next(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_prev(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_up(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_down(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_delete_node(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_replace_node(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_split_node(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_insert_node(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_set_bmap(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_print_all(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_fix_parents(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_info(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_goto_block(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* htree.c */
-extern void do_htree_dump(int argc, char **argv, int sci_idx, void *infop);
-extern void do_dx_hash(int argc, char **argv, int sci_idx, void *infop);
-extern void do_dirsearch(int argc, char **argv, int sci_idx, void *infop);
+extern void do_htree_dump(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_dx_hash(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_dirsearch(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* logdump.c */
-extern void do_logdump(int argc, char **argv, int sci_idx, void *infop);
+extern void do_logdump(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* lsdel.c */
-extern void do_lsdel(int argc, char **argv, int sci_idx, void *infop);
+extern void do_lsdel(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* icheck.c */
-extern void do_icheck(int argc, char **argv, int sci_idx, void *infop);
+extern void do_icheck(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* ncheck.c */
-extern void do_ncheck(int argc, char **argv, int sci_idx, void *infop);
+extern void do_ncheck(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* set_fields.c */
-extern void do_set_super(int argc, char **, int sci_idx, void *infop);
-extern void do_set_inode(int argc, char **, int sci_idx, void *infop);
-extern void do_set_block_group_descriptor(int argc, char **, int sci_idx, void *infop);
+extern void do_set_super(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_set_inode(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_set_block_group_descriptor(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* unused.c */
-extern void do_dump_unused(int argc, char **argv, int sci_idx, void *infop);
+extern void do_dump_unused(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* debugfs.c */
extern ss_request_table *extra_cmds;
@@ -128,68 +127,68 @@ extern const char *debug_prog_name;
extern void internal_dump_inode(FILE *, const char *, ext2_ino_t,
struct ext2_inode *, int);
-extern void do_dirty_filesys(int argc, char **argv, int sci_idx, void *infop);
-extern void do_open_filesys(int argc, char **argv, int sci_idx, void *infop);
-extern void do_close_filesys(int argc, char **argv, int sci_idx, void *infop);
-extern void do_lcd(int argc, char **argv, int sci_idx, void *infop);
-extern void do_init_filesys(int argc, char **argv, int sci_idx, void *infop);
-extern void do_show_super_stats(int argc, char **argv, int sci_idx, void *infop);
-extern void do_kill_file(int argc, char **argv, int sci_idx, void *infop);
-extern void do_rm(int argc, char **argv, int sci_idx, void *infop);
-extern void do_link(int argc, char **argv, int sci_idx, void *infop);
-extern void do_undel(int argc, char **argv, int sci_idx, void *infop);
-extern void do_unlink(int argc, char **argv, int sci_idx, void *infop);
-extern void do_copy_inode(int argc, char *argv[], int sci_idx, void *infop);
-extern void do_find_free_block(int argc, char **argv, int sci_idx, void *infop);
-extern void do_find_free_inode(int argc, char **argv, int sci_idx, void *infop);
-extern void do_stat(int argc, char **argv, int sci_idx, void *infop);
-extern void do_dump_extents(int argc, char **argv, int sci_idx, void *infop);
-extern void do_blocks(int argc, char *argv[], int sci_idx, void *infop);
-
-extern void do_chroot(int argc, char **argv, int sci_idx, void *infop);
-extern void do_clri(int argc, char **argv, int sci_idx, void *infop);
-extern void do_freei(int argc, char **argv, int sci_idx, void *infop);
-extern void do_seti(int argc, char **argv, int sci_idx, void *infop);
-extern void do_testi(int argc, char **argv, int sci_idx, void *infop);
-extern void do_freeb(int argc, char **argv, int sci_idx, void *infop);
-extern void do_setb(int argc, char **argv, int sci_idx, void *infop);
-extern void do_testb(int argc, char **argv, int sci_idx, void *infop);
-extern void do_modify_inode(int argc, char **argv, int sci_idx, void *infop);
-extern void do_list_dir(int argc, char **argv, int sci_idx, void *infop);
-extern void do_change_working_dir(int argc, char **argv, int sci_idx, void *infop);
-extern void do_print_working_directory(int argc, char **argv, int sci_idx, void *infop);
-extern void do_write(int argc, char **argv, int sci_idx, void *infop);
-extern void do_mknod(int argc, char **argv, int sci_idx, void *infop);
-extern void do_mkdir(int argc, char **argv, int sci_idx, void *infop);
-extern void do_rmdir(int argc, char **argv, int sci_idx, void *infop);
-extern void do_show_debugfs_params(int argc, char **argv, int sci_idx, void *infop);
-extern void do_expand_dir(int argc, char **argv, int sci_idx, void *infop);
-extern void do_features(int argc, char **argv, int sci_idx, void *infop);
-extern void do_bmap(int argc, char **argv, int sci_idx, void *infop);
-extern void do_imap(int argc, char **argv, int sci_idx, void *infop);
-extern void do_idump(int argc, char *argv[], int sci_idx, void *infop);
-extern void do_set_current_time(int argc, char **argv, int sci_idx, void *infop);
-extern void do_supported_features(int argc, char **argv, int sci_idx, void *infop);
-extern void do_punch(int argc, char **argv, int sci_idx, void *infop);
-extern void do_fallocate(int argc, char **argv, int sci_idx, void *infop);
-extern void do_symlink(int argc, char **argv, int sci_idx, void *infop);
-
-extern void do_dump_mmp(int argc, char **argv, int sci_idx, void *infop);
-extern void do_set_mmp_value(int argc, char **argv, int sci_idx, void *infop);
-
-extern void do_freefrag(int argc, char **argv, int sci_idx, void *infop);
-extern void do_filefrag(int argc, char *argv[], int sci_idx, void *infop);
+extern void do_dirty_filesys(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_open_filesys(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_close_filesys(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_lcd(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_init_filesys(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_show_super_stats(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_kill_file(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_rm(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_link(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_undel(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_unlink(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_copy_inode(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_find_free_block(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_find_free_inode(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_stat(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_dump_extents(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_blocks(int argc, ss_argv_t argv, int sci_idx, void *infop);
+
+extern void do_chroot(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_clri(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_freei(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_seti(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_testi(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_freeb(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_setb(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_testb(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_modify_inode(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_list_dir(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_change_working_dir(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_print_working_directory(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_write(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_mknod(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_mkdir(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_rmdir(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_show_debugfs_params(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_expand_dir(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_features(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_bmap(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_imap(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_idump(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_set_current_time(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_supported_features(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_punch(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_fallocate(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_symlink(int argc, ss_argv_t argv, int sci_idx, void *infop);
+
+extern void do_dump_mmp(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_set_mmp_value(int argc, ss_argv_t argv, int sci_idx, void *infop);
+
+extern void do_freefrag(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_filefrag(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* do_journal.c */
-extern void do_journal_write(int argc, char *argv[], int sci_idx, void *infop);
-extern void do_journal_open(int argc, char *argv[], int sci_idx, void *infop);
-extern void do_journal_close(int argc, char *argv[], int sci_idx, void *infop);
-extern void do_journal_run(int argc, char *argv[], int sci_idx, void *infop);
+extern void do_journal_write(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_journal_open(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_journal_close(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_journal_run(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* quota.c */
-extern void do_list_quota(int argc, char *argv[], int sci_idx, void *infop);
-extern void do_get_quota(int argc, char *argv[], int sci_idx, void *infop);
+extern void do_list_quota(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_get_quota(int argc, ss_argv_t argv, int sci_idx, void *infop);
/* util.c */
extern __s64 string_to_time(const char *arg);
@@ -198,13 +197,13 @@ extern void do_byte_hexdump(FILE *fp, unsigned char *buf, size_t bufsize);
/* xattrs.c */
void dump_inode_attributes(FILE *out, ext2_ino_t ino);
-void do_get_xattr(int argc, char **argv, int sci_idx, void *infop);
-void do_set_xattr(int argc, char **argv, int sci_idx, void *infop);
-void do_rm_xattr(int argc, char **argv, int sci_idx, void *infop);
-void do_list_xattr(int argc, char **argv, int sci_idx, void *infop);
+void do_get_xattr(int argc, ss_argv_t argv, int sci_idx, void *infop);
+void do_set_xattr(int argc, ss_argv_t argv, int sci_idx, void *infop);
+void do_rm_xattr(int argc, ss_argv_t argv, int sci_idx, void *infop);
+void do_list_xattr(int argc, ss_argv_t argv, int sci_idx, void *infop);
void raw_inode_xattr_dump(FILE *f, unsigned char *buf, unsigned int len);
void block_xattr_dump(FILE *f, unsigned char *buf, unsigned int len);
/* zap.c */
-extern void do_zap_block(int argc, char **argv, int sci_idx, void *infop);
-extern void do_block_dump(int argc, char **argv, int sci_idx, void *infop);
+extern void do_zap_block(int argc, ss_argv_t argv, int sci_idx, void *infop);
+extern void do_block_dump(int argc, ss_argv_t argv, int sci_idx, void *infop);
diff --git a/debugfs/do_journal.c b/debugfs/do_journal.c
index 38439c6..116ca84 100644
--- a/debugfs/do_journal.c
+++ b/debugfs/do_journal.c
@@ -534,7 +534,7 @@ error:
return err;
}
-void do_journal_write(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_journal_write(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
blk64_t *blist = NULL, *rlist = NULL;
@@ -862,7 +862,7 @@ static void update_64bit_flag(journal_t *journal)
jbd2_set_feature_64bit(journal);
}
-void do_journal_open(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_journal_open(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
int opt, enable_csum = 0, csum_ver = 3;
@@ -933,7 +933,7 @@ void do_journal_open(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
void do_journal_close(int argc EXT2FS_ATTR((unused)),
- char *argv[] EXT2FS_ATTR((unused)),
+ ss_argv_t argv EXT2FS_ATTR((unused)),
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -945,7 +945,7 @@ void do_journal_close(int argc EXT2FS_ATTR((unused)),
ext2fs_close_journal(current_fs, &current_journal);
}
-void do_journal_run(int argc EXT2FS_ATTR((unused)), char *argv[],
+void do_journal_run(int argc EXT2FS_ATTR((unused)), ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
diff --git a/debugfs/dump.c b/debugfs/dump.c
index 42f5204..4ab7cad 100644
--- a/debugfs/dump.c
+++ b/debugfs/dump.c
@@ -144,7 +144,7 @@ static void dump_file(const char *cmdname, ext2_ino_t ino, int fd,
return;
}
-void do_dump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_dump(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
@@ -323,7 +323,7 @@ static int rdump_dirent(struct ext2_dir_entry *dirent,
return 0;
}
-void do_rdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_rdump(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct stat st;
@@ -368,7 +368,7 @@ void do_rdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
}
}
-void do_cat(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_cat(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
diff --git a/debugfs/extent_inode.c b/debugfs/extent_inode.c
index e4e815e..6ef054d 100644
--- a/debugfs/extent_inode.c
+++ b/debugfs/extent_inode.c
@@ -48,7 +48,7 @@ static void dbg_print_extent(char *desc, struct ext2fs_extent *extent)
}
-static int common_extent_args_process(int argc, char *argv[], int min_argc,
+static int common_extent_args_process(int argc, ss_argv_t argv, int min_argc,
int max_argc, const char *cmd,
const char *usage, int flags)
{
@@ -65,7 +65,7 @@ static int common_extent_args_process(int argc, char *argv[], int min_argc,
static char *orig_prompt, *extent_prompt;
-void do_extent_open(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_extent_open(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
@@ -115,7 +115,7 @@ void do_extent_open(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
return;
}
-void do_extent_close(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_extent_close(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
int ret;
@@ -139,7 +139,7 @@ void do_extent_close(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
static void generic_goto_node(const char *my_name, int argc,
- char **argv, int op)
+ ss_argv_t argv, int op)
{
struct ext2fs_extent extent;
errcode_t retval;
@@ -161,85 +161,85 @@ static void generic_goto_node(const char *my_name, int argc,
dbg_print_extent(0, &extent);
}
-void do_current_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_current_node(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("current_node", argc, argv, EXT2_EXTENT_CURRENT);
}
-void do_root_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_root_node(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("root_node", argc, argv, EXT2_EXTENT_ROOT);
}
-void do_last_leaf(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_last_leaf(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("last_leaf", argc, argv, EXT2_EXTENT_LAST_LEAF);
}
-void do_first_sib(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_first_sib(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("first_sib", argc, argv, EXT2_EXTENT_FIRST_SIB);
}
-void do_last_sib(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_last_sib(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("next_sib", argc, argv, EXT2_EXTENT_LAST_SIB);
}
-void do_next_sib(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_next_sib(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("next_sib", argc, argv, EXT2_EXTENT_NEXT_SIB);
}
-void do_prev_sib(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_prev_sib(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("prev_sib", argc, argv, EXT2_EXTENT_PREV_SIB);
}
-void do_next_leaf(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_next_leaf(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("next_leaf", argc, argv, EXT2_EXTENT_NEXT_LEAF);
}
-void do_prev_leaf(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_prev_leaf(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("prev_leaf", argc, argv, EXT2_EXTENT_PREV_LEAF);
}
-void do_next(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_next(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("next", argc, argv, EXT2_EXTENT_NEXT);
}
-void do_prev(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_prev(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("prev", argc, argv, EXT2_EXTENT_PREV);
}
-void do_up(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_up(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("up", argc, argv, EXT2_EXTENT_UP);
}
-void do_down(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_down(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
generic_goto_node("down", argc, argv, EXT2_EXTENT_DOWN);
}
-void do_delete_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_delete_node(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct ext2fs_extent extent;
@@ -262,7 +262,7 @@ void do_delete_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
dbg_print_extent(0, &extent);
}
-void do_replace_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_replace_node(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
const char *usage = "[--uninit] <lblk> <len> <pblk>";
@@ -307,7 +307,7 @@ void do_replace_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
generic_goto_node(NULL, argc, argv, EXT2_EXTENT_CURRENT);
}
-void do_split_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_split_node(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
errcode_t retval;
@@ -324,7 +324,7 @@ void do_split_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
generic_goto_node(NULL, argc, argv, EXT2_EXTENT_CURRENT);
}
-void do_insert_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_insert_node(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
const char *usage = "[--after] [--uninit] <lblk> <len> <pblk>";
@@ -383,7 +383,7 @@ void do_insert_node(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
generic_goto_node(NULL, argc, argv, EXT2_EXTENT_CURRENT);
}
-void do_set_bmap(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_set_bmap(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
const char *usage = "[--uninit] <lblk> <pblk>";
@@ -432,7 +432,7 @@ void do_set_bmap(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
dbg_print_extent(0, &extent);
}
-void do_print_all(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_print_all(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
const char *usage = "[--leaf-only|--reverse|--reverse-leaf]";
@@ -484,7 +484,7 @@ void do_print_all(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
}
}
-void do_fix_parents(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_fix_parents(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
errcode_t retval;
@@ -500,7 +500,7 @@ void do_fix_parents(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
}
}
-void do_info(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_info(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct ext2fs_extent extent;
@@ -535,7 +535,7 @@ void do_info(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
info.max_uninit_len);
}
-void do_goto_block(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_goto_block(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
errcode_t retval;
diff --git a/debugfs/filefrag.c b/debugfs/filefrag.c
index 31c1440..9bda65d 100644
--- a/debugfs/filefrag.c
+++ b/debugfs/filefrag.c
@@ -264,7 +264,7 @@ static void dir_iterate(ext2_ino_t ino, struct filefrag_struct *fs)
}
}
-void do_filefrag(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_filefrag(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct filefrag_struct fs;
diff --git a/debugfs/htree.c b/debugfs/htree.c
index a9f9211..a100815 100644
--- a/debugfs/htree.c
+++ b/debugfs/htree.c
@@ -245,7 +245,7 @@ errout:
-void do_htree_dump(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_htree_dump(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
@@ -329,21 +329,31 @@ errout:
/*
* This function prints the hash of a given file.
*/
-void do_dx_hash(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_dx_hash(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_dirhash_t hash, minor_hash;
errcode_t err;
- int c;
+ int c, verbose = 0;
int hash_version = 0;
- __u32 hash_seed[4];
+ __u32 hash_seed[4] = { 0, };
int hash_flags = 0;
const struct ext2fs_nls_table *encoding = NULL;
- hash_seed[0] = hash_seed[1] = hash_seed[2] = hash_seed[3] = 0;
+ if (current_fs) {
+ hash_seed[0] = current_fs->super->s_hash_seed[0];
+ hash_seed[1] = current_fs->super->s_hash_seed[1];
+ hash_seed[2] = current_fs->super->s_hash_seed[2];
+ hash_seed[3] = current_fs->super->s_hash_seed[3];
+
+ hash_version = current_fs->super->s_def_hash_version;
+ if (hash_version <= EXT2_HASH_TEA &&
+ current_fs->super->s_flags & EXT2_FLAGS_UNSIGNED_HASH)
+ hash_version += 3;
+ }
reset_getopt();
- while ((c = getopt(argc, argv, "h:s:ce:")) != EOF) {
+ while ((c = getopt(argc, argv, "h:s:ce:v")) != EOF) {
switch (c) {
case 'h':
hash_version = e2p_string2hash(optarg);
@@ -368,14 +378,17 @@ void do_dx_hash(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
return;
}
break;
+ case 'v':
+ verbose = 1;
+ break;
default:
goto print_usage;
}
}
if (optind != argc-1) {
print_usage:
- com_err(argv[0], 0, "usage: dx_hash [-h hash_alg] "
- "[-s hash_seed] [-c] [-e encoding] filename");
+ com_err(argv[0], 0, "usage: dx_hash [-cv] [-h hash_alg] "
+ "[-s hash_seed] [-e encoding] filename");
return;
}
err = ext2fs_dirhash2(hash_version, argv[optind],
@@ -388,6 +401,13 @@ void do_dx_hash(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
printf("Hash of %s is 0x%0x (minor 0x%0x)\n", argv[optind],
hash, minor_hash);
+ if (verbose) {
+ char uuid_str[37];
+
+ uuid_unparse((__u8 *) hash_seed, uuid_str);
+ printf(" using hash algorithm %d and hash_seed %s\n",
+ hash_version, uuid_str);
+ }
}
/*
@@ -405,7 +425,7 @@ static int search_dir_block(ext2_filsys fs, blk64_t *blocknr,
e2_blkcnt_t blockcnt, blk64_t ref_blk,
int ref_offset, void *priv_data);
-void do_dirsearch(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_dirsearch(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t inode;
diff --git a/debugfs/icheck.c b/debugfs/icheck.c
index ed6e950..175d12c 100644
--- a/debugfs/icheck.c
+++ b/debugfs/icheck.c
@@ -53,7 +53,7 @@ static int icheck_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
return 0;
}
-void do_icheck(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_icheck(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct block_walk_struct bw;
diff --git a/debugfs/journal.c b/debugfs/journal.c
index 5bac0d3..04611ac 100644
--- a/debugfs/journal.c
+++ b/debugfs/journal.c
@@ -245,6 +245,8 @@ void wait_on_buffer(struct buffer_head *bh)
static void ext2fs_clear_recover(ext2_filsys fs, int error)
{
+ time_t s_mtime;
+
ext2fs_clear_feature_journal_needs_recovery(fs->super);
/* if we had an error doing journal recovery, we need a full fsck */
@@ -254,8 +256,9 @@ static void ext2fs_clear_recover(ext2_filsys fs, int error)
* If we replayed the journal by definition the file system
* was mounted since the last time it was checked
*/
- if (fs->super->s_lastcheck >= fs->super->s_mtime)
- fs->super->s_lastcheck = fs->super->s_mtime - 1;
+ s_mtime = ext2fs_get_tstamp(fs->super, s_mtime);
+ if (ext2fs_get_tstamp(fs->super, s_lastcheck) >= s_mtime)
+ ext2fs_set_tstamp(fs->super, s_lastcheck, s_mtime - 1);
ext2fs_mark_super_dirty(fs);
}
@@ -789,6 +792,8 @@ errcode_t ext2fs_run_ext3_journal(ext2_filsys *fsp)
char *fsname;
int fsflags;
int fsblocksize;
+ char *save;
+ __u16 s_error_state;
if (!(fs->flags & EXT2_FLAG_RW))
return EXT2_ET_FILE_RO;
@@ -808,6 +813,12 @@ errcode_t ext2fs_run_ext3_journal(ext2_filsys *fsp)
if (stats && stats->bytes_written)
kbytes_written = stats->bytes_written >> 10;
+ save = malloc(EXT4_S_ERR_LEN);
+ if (save)
+ memcpy(save, ((char *) fs->super) + EXT4_S_ERR_START,
+ EXT4_S_ERR_LEN);
+ s_error_state = fs->super->s_state & EXT2_ERROR_FS;
+
ext2fs_mmp_stop(fs);
fsname = fs->device_name;
fs->device_name = NULL;
@@ -818,11 +829,15 @@ errcode_t ext2fs_run_ext3_journal(ext2_filsys *fsp)
retval = ext2fs_open(fsname, fsflags, 0, fsblocksize, io_ptr, fsp);
ext2fs_free_mem(&fsname);
if (retval)
- return retval;
+ goto outfree;
fs = *fsp;
fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
fs->super->s_kbytes_written += kbytes_written;
+ fs->super->s_state |= s_error_state;
+ if (save)
+ memcpy(((char *) fs->super) + EXT4_S_ERR_START, save,
+ EXT4_S_ERR_LEN);
/* Set the superblock flags */
ext2fs_clear_recover(fs, recover_retval != 0);
@@ -832,6 +847,9 @@ errcode_t ext2fs_run_ext3_journal(ext2_filsys *fsp)
* the EXT2_ERROR_FS flag in the fs superblock if needed.
*/
retval = ext2fs_check_ext3_journal(fs);
+
+outfree:
+ free(save);
return retval ? retval : recover_retval;
}
diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index b600228..324ed42 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -52,6 +52,7 @@ static int64_t dump_counts;
static blk64_t block_to_dump, bitmap_to_dump, inode_block_to_dump;
static unsigned int group_to_dump, inode_offset_to_dump;
static ext2_ino_t inode_to_dump;
+static bool wrapped_flag;
struct journal_source
{
@@ -80,10 +81,12 @@ static void dump_fc_block(FILE *out_file, char *buf, int blocksize,
static void do_hexdump (FILE *, char *, int);
#define WRAP(jsb, blocknr, maxlen) \
- if (blocknr >= (maxlen)) \
- blocknr -= (maxlen - be32_to_cpu((jsb)->s_first));
+ if (blocknr >= (maxlen)) { \
+ blocknr -= (maxlen - be32_to_cpu((jsb)->s_first)); \
+ wrapped_flag = true; \
+ }
-void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_logdump(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
int c;
@@ -115,6 +118,7 @@ void do_logdump(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
inode_block_to_dump = ANY_BLOCK;
inode_to_dump = -1;
dump_counts = -1;
+ wrapped_flag = false;
reset_getopt();
while ((c = getopt (argc, argv, "ab:ci:f:OsSn:")) != EOF) {
@@ -477,8 +481,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
if (dump_old && (dump_counts != -1) && (cur_counts >= dump_counts))
break;
- if ((blocknr == first_transaction_blocknr) &&
- (cur_counts != 0) && dump_old && (dump_counts != -1)) {
+ if ((blocknr == first_transaction_blocknr) && dump_old && wrapped_flag) {
fprintf(out_file, "Dump all %lld journal records.\n",
(long long) cur_counts);
break;
diff --git a/debugfs/ls.c b/debugfs/ls.c
index 525f084..613ad73 100644
--- a/debugfs/ls.c
+++ b/debugfs/ls.c
@@ -179,7 +179,7 @@ static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
return 0;
}
-void do_list_dir(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_list_dir(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct ext2_inode inode;
diff --git a/debugfs/lsdel.c b/debugfs/lsdel.c
index 52c7419..a09fa83 100644
--- a/debugfs/lsdel.c
+++ b/debugfs/lsdel.c
@@ -71,7 +71,7 @@ static int lsdel_proc(ext2_filsys fs,
return 0;
}
-void do_lsdel(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_lsdel(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct lsdel_struct lsd;
diff --git a/debugfs/ncheck.c b/debugfs/ncheck.c
index 963b3a1..1410e7c 100644
--- a/debugfs/ncheck.c
+++ b/debugfs/ncheck.c
@@ -90,7 +90,7 @@ static int ncheck_proc(struct ext2_dir_entry *dirent,
return 0;
}
-void do_ncheck(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_ncheck(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
struct inode_walk_struct iw;
diff --git a/debugfs/quota.c b/debugfs/quota.c
index 1da1e03..7d8e82f 100644
--- a/debugfs/quota.c
+++ b/debugfs/quota.c
@@ -102,7 +102,7 @@ static int list_quota_callback(struct dquot *dq,
return 0;
}
-void do_list_quota(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_list_quota(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
errcode_t retval;
@@ -132,7 +132,7 @@ void do_list_quota(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
}
-void do_get_quota(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_get_quota(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
int err, type;
diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c
index f916dea..bfe8a13 100644
--- a/debugfs/set_fields.c
+++ b/debugfs/set_fields.c
@@ -71,7 +71,9 @@ static errcode_t parse_string(struct field_set_info *info, char *field, char *ar
static errcode_t parse_uuid(struct field_set_info *info, char *field, char *arg);
static errcode_t parse_hashalg(struct field_set_info *info, char *field, char *arg);
static errcode_t parse_encoding(struct field_set_info *info, char *field, char *arg);
-static errcode_t parse_time(struct field_set_info *info, char *field, char *arg);
+static errcode_t parse_sb_time(struct field_set_info *info, char *field, char *arg);
+static errcode_t parse_ino_time(struct field_set_info *info, char *field, char *arg);
+
static errcode_t parse_bmap(struct field_set_info *info, char *field, char *arg);
static errcode_t parse_gd_csum(struct field_set_info *info, char *field, char *arg);
static errcode_t parse_inode_csum(struct field_set_info *info, char *field,
@@ -99,15 +101,16 @@ static struct field_set_info super_fields[] = {
{ "blocks_per_group", &set_sb.s_blocks_per_group, NULL, 4, parse_uint },
{ "clusters_per_group", &set_sb.s_clusters_per_group, NULL, 4, parse_uint },
{ "inodes_per_group", &set_sb.s_inodes_per_group, NULL, 4, parse_uint },
- { "mtime", &set_sb.s_mtime, NULL, 4, parse_time },
- { "wtime", &set_sb.s_wtime, NULL, 4, parse_time },
+ { "mtime", &set_sb.s_mtime, &set_sb.s_mtime_hi, 5, parse_sb_time },
+ { "wtime", &set_sb.s_wtime, &set_sb.s_wtime_hi, 5, parse_sb_time },
{ "mnt_count", &set_sb.s_mnt_count, NULL, 2, parse_uint },
{ "max_mnt_count", &set_sb.s_max_mnt_count, NULL, 2, parse_int },
/* s_magic */
{ "state", &set_sb.s_state, NULL, 2, parse_uint },
{ "errors", &set_sb.s_errors, NULL, 2, parse_uint },
{ "minor_rev_level", &set_sb.s_minor_rev_level, NULL, 2, parse_uint },
- { "lastcheck", &set_sb.s_lastcheck, NULL, 4, parse_time },
+ { "lastcheck", &set_sb.s_lastcheck, &set_sb.s_lastcheck_hi, 5,
+ parse_sb_time },
{ "checkinterval", &set_sb.s_checkinterval, NULL, 4, parse_uint },
{ "creator_os", &set_sb.s_creator_os, NULL, 4, parse_uint },
{ "rev_level", &set_sb.s_rev_level, NULL, 4, parse_uint },
@@ -139,7 +142,8 @@ static struct field_set_info super_fields[] = {
{ "desc_size", &set_sb.s_desc_size, NULL, 2, parse_uint },
{ "default_mount_opts", &set_sb.s_default_mount_opts, NULL, 4, parse_uint },
{ "first_meta_bg", &set_sb.s_first_meta_bg, NULL, 4, parse_uint },
- { "mkfs_time", &set_sb.s_mkfs_time, NULL, 4, parse_time },
+ { "mkfs_time", &set_sb.s_mkfs_time, &set_sb.s_mkfs_time_hi, 5,
+ parse_sb_time },
{ "jnl_blocks", &set_sb.s_jnl_blocks[0], NULL, 4, parse_uint, FLAG_ARRAY,
17 },
{ "min_extra_isize", &set_sb.s_min_extra_isize, NULL, 2, parse_uint },
@@ -167,12 +171,14 @@ static struct field_set_info super_fields[] = {
{ "checksum_type", &set_sb.s_checksum_type, NULL, 1, parse_uint },
{ "encryption_level", &set_sb.s_encryption_level, NULL, 1, parse_uint },
{ "error_count", &set_sb.s_error_count, NULL, 4, parse_uint },
- { "first_error_time", &set_sb.s_first_error_time, NULL, 4, parse_time },
+ { "first_error_time", &set_sb.s_first_error_time,
+ &set_sb.s_first_error_time_hi, 5, parse_sb_time },
{ "first_error_ino", &set_sb.s_first_error_ino, NULL, 4, parse_uint },
{ "first_error_block", &set_sb.s_first_error_block, NULL, 8, parse_uint },
{ "first_error_func", &set_sb.s_first_error_func, NULL, 32, parse_string },
{ "first_error_line", &set_sb.s_first_error_line, NULL, 4, parse_uint },
- { "last_error_time", &set_sb.s_last_error_time, NULL, 4, parse_time },
+ { "last_error_time", &set_sb.s_last_error_time,
+ &set_sb.s_last_error_time_hi, 5, parse_sb_time },
{ "last_error_ino", &set_sb.s_last_error_ino, NULL, 4, parse_uint },
{ "last_error_block", &set_sb.s_last_error_block, NULL, 8, parse_uint },
{ "last_error_func", &set_sb.s_last_error_func, NULL, 32, parse_string },
@@ -193,13 +199,13 @@ static struct field_set_info inode_fields[] = {
2, parse_uint },
{ "size", &set_inode.i_size, &set_inode.i_size_high, 4, parse_uint },
{ "atime", &set_inode.i_atime, &set_inode.i_atime_extra,
- 4, parse_time },
+ 4, parse_ino_time },
{ "ctime", &set_inode.i_ctime, &set_inode.i_ctime_extra,
- 4, parse_time },
+ 4, parse_ino_time },
{ "mtime", &set_inode.i_mtime, &set_inode.i_mtime_extra,
- 4, parse_time },
+ 4, parse_ino_time },
{ "dtime", &set_inode.i_dtime, NULL,
- 4, parse_time },
+ 4, parse_ino_time },
{ "gid", &set_inode.i_gid, &set_inode.osd2.linux2.l_i_gid_high,
2, parse_uint },
{ "links_count", &set_inode.i_links_count, NULL, 2, parse_uint },
@@ -236,7 +242,7 @@ static struct field_set_info inode_fields[] = {
{ "atime_extra", &set_inode.i_atime_extra, NULL,
4, parse_uint, FLAG_ALIAS },
{ "crtime", &set_inode.i_crtime, &set_inode.i_crtime_extra,
- 4, parse_time },
+ 4, parse_ino_time },
{ "crtime_extra", &set_inode.i_crtime_extra, NULL,
4, parse_uint, FLAG_ALIAS },
{ "projid", &set_inode.i_projid, NULL, 4, parse_uint },
@@ -441,6 +447,9 @@ static struct field_set_info *find_field(struct field_set_info *fields,
* Note: info->size == 6 is special; this means a base size 4 bytes,
* and secondary (high) size of 2 bytes. This is needed for the
* special case of i_blocks_high and i_file_acl_high.
+ *
+ * Similarly, info->size == 5 is for superblock timestamps, which have
+ * a 4-byte primary field and a 1-byte _hi field.
*/
static errcode_t parse_uint(struct field_set_info *info, char *field,
char *arg)
@@ -449,7 +458,8 @@ static errcode_t parse_uint(struct field_set_info *info, char *field,
int suffix = check_suffix(field);
char *tmp;
void *field1 = info->ptr, *field2 = info->ptr2;
- int size = (info->size == 6) ? 4 : info->size;
+ unsigned int size = (info->size == 6 || info->size == 5) ? 4 :
+ info->size;
union {
__u64 *ptr64;
__u32 *ptr32;
@@ -477,7 +487,7 @@ static errcode_t parse_uint(struct field_set_info *info, char *field,
}
mask = ~0ULL >> ((8 - size) * 8);
limit = ~0ULL >> ((8 - info->size) * 8);
- if (field2 && info->size != 6)
+ if (field2 && (info->size != 6 && info->size != 5))
limit = ~0ULL >> ((8 - info->size*2) * 8);
if (num > limit) {
@@ -504,13 +514,14 @@ static errcode_t parse_uint(struct field_set_info *info, char *field,
return 0;
n = (size == 8) ? 0 : (num >> (size*8));
u.ptr8 = (__u8 *) field2;
- if (info->size == 6)
- size = 2;
+ if (info->size > size)
+ size = info->size - size;
switch (size) {
case 8:
/* Should never get here */
- fprintf(stderr, "64-bit field %s has a second 64-bit field\n"
- "defined; BUG?!?\n", info->name);
+ fprintf(stderr,
+ "64-bit field %s has a second 64-bit field defined; BUG?!?\n",
+ info->name);
*u.ptr64 = 0;
break;
case 4:
@@ -572,18 +583,19 @@ static errcode_t parse_string(struct field_set_info *info,
return 0;
}
-static errcode_t parse_time(struct field_set_info *info,
- char *field, char *arg)
+static errcode_t parse_sb_time(struct field_set_info *info,
+ char *field, char *arg)
{
__s64 t;
__u32 t_low, t_high;
- __u32 *ptr_low, *ptr_high;
+ __u32 *ptr_low;
+ __u8 *ptr_high;
if (check_suffix(field))
return parse_uint(info, field, arg);
ptr_low = (__u32 *) info->ptr;
- ptr_high = (__u32 *) info->ptr2;
+ ptr_high = (__u8 *) info->ptr2;
t = string_to_time(arg);
@@ -600,6 +612,34 @@ static errcode_t parse_time(struct field_set_info *info,
return 0;
}
+static errcode_t parse_ino_time(struct field_set_info *info,
+ char *field, char *arg)
+{
+ __s64 t;
+ __u32 t_low, t_high;
+ __u32 *ptr_low, *ptr_high;
+
+ if (check_suffix(field))
+ return parse_uint(info, field, arg);
+
+ ptr_low = (__u32 *) info->ptr;
+ ptr_high = (__u32 *) info->ptr2;
+
+ t = string_to_time(arg);
+
+ if (t == -1) {
+ fprintf(stderr, "Couldn't parse '%s' for field %s.\n",
+ arg, info->name);
+ return EINVAL;
+ }
+ t_low = (__u32) t;
+ t_high = __encode_extra_time(t, 0);
+ *ptr_low = t_low;
+ if (ptr_high)
+ *ptr_high = t_high;
+ return 0;
+}
+
static errcode_t parse_uuid(struct field_set_info *info,
char *field EXT2FS_ATTR((unused)), char *arg)
{
@@ -781,7 +821,8 @@ static void print_possible_fields(struct field_set_info *fields)
type = "UUID";
else if (ss->func == parse_hashalg)
type = "hash algorithm";
- else if (ss->func == parse_time)
+ else if ((ss->func == parse_sb_time) ||
+ (ss->func == parse_ino_time))
type = "date/time";
else if (ss->func == parse_bmap)
type = "set physical->logical block map";
@@ -803,7 +844,7 @@ static void print_possible_fields(struct field_set_info *fields)
}
-void do_set_super(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_set_super(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
const char *usage = "<field> <value>\n"
@@ -831,7 +872,7 @@ void do_set_super(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
}
-void do_set_inode(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_set_inode(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
const char *usage = "<inode> <field> <value>\n"
@@ -873,7 +914,7 @@ void do_set_inode(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
}
-void do_set_block_group_descriptor(int argc, char *argv[],
+void do_set_block_group_descriptor(int argc, ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
@@ -953,7 +994,7 @@ static errcode_t parse_mmp_clear(struct field_set_info *info,
}
#ifdef CONFIG_MMP
-void do_set_mmp_value(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_set_mmp_value(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
const char *usage = "<field> <value>\n"
@@ -1013,7 +1054,7 @@ void do_set_mmp_value(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
}
#else
void do_set_mmp_value(int argc EXT2FS_ATTR((unused)),
- char *argv[] EXT2FS_ATTR((unused)),
+ ss_argv_t argv EXT2FS_ATTR((unused)),
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
diff --git a/debugfs/unused.c b/debugfs/unused.c
index 08191a0..3d97cc4 100644
--- a/debugfs/unused.c
+++ b/debugfs/unused.c
@@ -25,7 +25,7 @@ extern char *optarg;
#include "debugfs.h"
-void do_dump_unused(int argc EXT2FS_ATTR((unused)), char **argv,
+void do_dump_unused(int argc EXT2FS_ATTR((unused)), ss_argv_t argv,
int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
diff --git a/debugfs/util.c b/debugfs/util.c
index 9e88054..00ab6f6 100644
--- a/debugfs/util.c
+++ b/debugfs/util.c
@@ -191,14 +191,6 @@ int check_fs_bitmaps(char *name)
return 0;
}
-char *inode_time_to_string(__u32 xtime, __u32 xtime_extra)
-{
- __s64 t = (__s32) xtime;
-
- t += (__s64) (xtime_extra & EXT4_EPOCH_MASK) << 32;
- return time_to_string(t);
-}
-
/*
* This function takes a __s64 time value and converts it to a string,
* using ctime
@@ -355,7 +347,7 @@ int strtoblk(const char *cmd, const char *str, const char *errmsg,
* This is a common helper function used by the command processing
* routines
*/
-int common_args_process(int argc, char *argv[], int min_argc, int max_argc,
+int common_args_process(int argc, ss_argv_t argv, int min_argc, int max_argc,
const char *cmd, const char *usage, int flags)
{
if (argc < min_argc || argc > max_argc) {
@@ -381,7 +373,7 @@ int common_args_process(int argc, char *argv[], int min_argc, int max_argc,
* do_testi, etc. Basically, any command which takes a single
* argument which is a file/inode number specifier.
*/
-int common_inode_args_process(int argc, char *argv[],
+int common_inode_args_process(int argc, ss_argv_t argv,
ext2_ino_t *inode, int flags)
{
if (common_args_process(argc, argv, 2, 2, argv[0], "<file>", flags))
@@ -396,7 +388,7 @@ int common_inode_args_process(int argc, char *argv[],
/*
* This is a helper function used by do_freeb, do_setb, and do_testb
*/
-int common_block_args_process(int argc, char *argv[],
+int common_block_args_process(int argc, ss_argv_t argv,
blk64_t *block, blk64_t *count)
{
int err;
diff --git a/debugfs/xattrs.c b/debugfs/xattrs.c
index cd042bc..b518941 100644
--- a/debugfs/xattrs.c
+++ b/debugfs/xattrs.c
@@ -117,7 +117,7 @@ out:
err = ext2fs_xattrs_close(&h);
}
-void do_list_xattr(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_list_xattr(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
@@ -138,7 +138,7 @@ void do_list_xattr(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
dump_inode_attributes(stdout, ino);
}
-void do_get_xattr(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_get_xattr(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
@@ -236,7 +236,7 @@ out2:
fclose(fp);
}
-void do_set_xattr(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_set_xattr(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
@@ -320,7 +320,7 @@ out2:
}
}
-void do_rm_xattr(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)),
+void do_rm_xattr(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
ext2_ino_t ino;
diff --git a/debugfs/zap.c b/debugfs/zap.c
index f862482..8d1e842 100644
--- a/debugfs/zap.c
+++ b/debugfs/zap.c
@@ -25,7 +25,7 @@ extern char *optarg;
#include "debugfs.h"
-void do_zap_block(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_zap_block(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
unsigned long pattern = 0;
@@ -171,7 +171,7 @@ errout:
return;
}
-void do_block_dump(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
+void do_block_dump(int argc, ss_argv_t argv, int sci_idx EXT2FS_ATTR((unused)),
void *infop EXT2FS_ATTR((unused)))
{
unsigned char *buf;