$(srcdir)/ncheck.c $(srcdir)/icheck.c $(srcdir)/lsdel.c \
$(srcdir)/dump.c
-LIBS= $(LIBEXT2FS) $(LIBSS) $(LIBCOM_ERR) $(LIBUUID)
-DEPLIBS= $(LIBEXT2FS) $(LIBSS) $(LIBCOM_ERR) $(LIBUUID)
+LIBS= $(LIBEXT2FS) $(LIBE2P) $(LIBSS) $(LIBCOM_ERR) $(LIBUUID)
+DEPLIBS= $(LIBEXT2FS) $(LIBE2P) $(LIBSS) $(LIBCOM_ERR) $(LIBUUID)
.c.o:
$(CC) -c $(ALL_CFLAGS) $< -o $@
# the Makefile.in file
#
debug_cmds.o: debug_cmds.c $(top_srcdir)/lib/ss/ss.h \
- $(top_srcdir)/lib/ss/copyright.h $(top_builddir)/lib/ss/ss_err.h
+ $(top_builddir)/lib/ss/ss_err.h
debugfs.o: $(srcdir)/debugfs.c $(top_srcdir)/lib/et/com_err.h \
- $(top_srcdir)/lib/ss/ss.h $(top_srcdir)/lib/ss/copyright.h \
- $(top_builddir)/lib/ss/ss_err.h $(srcdir)/debugfs.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
- $(top_srcdir)/lib/uuid/uuid.h $(srcdir)/../version.h
+ $(top_srcdir)/lib/ss/ss.h $(top_builddir)/lib/ss/ss_err.h \
+ $(srcdir)/debugfs.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
+ $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
+ $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/uuid/uuid.h \
+ $(srcdir)/../version.h
util.o: $(srcdir)/util.c $(srcdir)/debugfs.h \
$(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/et/com_err.h \
$(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
Expand the directory
.IR filespec .
.TP
+.I feature [fs_feature] [-fs_feature] ...
+Set or clear various filesystem features in the superblock. After setting
+or clearing any filesystem features that were requested, print the current
+state of the filesystem feature set.
+.TP
.I find_free_block [goal]
Find the first free block, starting from
.I goal
Take the requested list of inode numbers, and print a listing of pathnames
to those inodes.
.TP
-.I open [-w] device
-Open a file system for editing.
+.I open [-w] [-f] device
+Open a filesystem for editing. The
+.I -w
+flag causes the filesystem to be opened for writing. The
+.I -f
+flag forces the filesystem to be opened even if there are some unknown
+or incompatible filesystem features which would normally
+prevent the filesystem from being opened.
.TP
.I pwd
Print the current working directory.
.I filespec
as in use in the inode bitmap.
.TP
-.I show_super_stats
-List the contents of the super block.
+.I show_super_stats [-h]
+List the contents of the super block and the block group descriptors. If the
+.I -h
+flag is given, only print out the superblock contents.
.TP
.I stat filespec
Display the contents of the inode structure of the inode
#ifdef HAVE_OPTRESET
optreset = 1; /* Makes BSD getopt happy */
#endif
- while ((c = getopt (argc, argv, "w")) != EOF) {
+ while ((c = getopt (argc, argv, "wf")) != EOF) {
switch (c) {
case 'w':
- open_flags = EXT2_FLAG_RW;
+ open_flags |= EXT2_FLAG_RW;
+ break;
+ case 'f':
+ open_flags |= EXT2_FLAG_FORCE;
break;
default:
com_err(argv[0], 0, usage);
return;
}
+static void print_features(struct ext2fs_sb * s, FILE *f)
+{
+#ifdef EXT2_DYNAMIC_REV
+ int i, j, printed=0;
+__u32 *mask = &s->s_feature_compat, m;
+
+ printf ("Filesystem features:");
+ for (i=0; i <3; i++,mask++) {
+ for (j=0,m=1; j < 32; j++, m<<=1) {
+ if (*mask & m) {
+ fprintf(f, " %s", e2p_feature2string(i, m));
+ printed++;
+ }
+ }
+ }
+ if (printed == 0)
+ printf("(none)");
+ printf("\n");
+#endif
+}
+
void do_show_super_stats(int argc, char *argv[])
{
int i;
FILE *out;
struct ext2fs_sb *sb;
struct ext2_group_desc *gdp;
+ int c, header_only = 0;
char buf[80];
const char *none = "(none)";
+ const char *usage = "Usage: show_super [-h]";
- if (argc > 1) {
- com_err(argv[0], 0, "Usage: show_super");
+ optind = 0;
+#ifdef HAVE_OPTRESET
+ optreset = 1; /* Makes BSD getopt happy */
+#endif
+ while ((c = getopt (argc, argv, "h")) != EOF) {
+ switch (c) {
+ case 'h':
+ header_only++;
+ break;
+ default:
+ com_err(argv[0], 0, usage);
+ return;
+ }
+ }
+ if (optind != argc) {
+ com_err(argv[0], 0, usage);
return;
}
if (check_fs_open(argv[0]))
else
strcpy(buf, none);
fprintf(out, "Filesystem UUID = %s\n", buf);
+ print_features(sb, out);
fprintf(out, "Last mount time = %s", time_to_string(sb->s_mtime));
fprintf(out, "Last write time = %s", time_to_string(sb->s_wtime));
fprintf(out, "Mount counts = %d (maximal = %d)\n",
(current_fs->group_desc_count != 1) ? "s" : "",
current_fs->desc_blocks,
(current_fs->desc_blocks != 1) ? "s" : "");
+
+ if (header_only) {
+ close_pager(out);
+ return;
+ }
gdp = ¤t_fs->group_desc[0];
for (i = 0; i < current_fs->group_desc_count; i++, gdp++)
return;
}
+ if (check_fs_read_write(argv[0]))
+ return;
+
cp = strrchr(argv[1], '/');
if (cp) {
*cp = 0;
if (check_fs_open(argv[0]))
return;
+ if (check_fs_read_write(argv[0]))
+ return;
+
inode_num = string_to_inode(argv[1]);
if (!inode_num) {
com_err(argv[0], 0, "Cannot find file");
if (check_fs_open(argv[0]))
return;
+ if (check_fs_read_write(argv[0]))
+ return;
+
retval = ext2fs_namei(current_fs, root, cwd, argv[1], &inode_num);
if (retval) {
com_err(argv[0], retval, "while trying to resolve filename");
return;
}
+void do_features(int argc, char *argv[])
+{
+ int i;
+
+ if (check_fs_open(argv[0]))
+ return;
+
+ if ((argc != 1) && check_fs_read_write(argv[0]))
+ return;
+ for (i=1; i < argc; i++) {
+ if (e2p_edit_feature(argv[i],
+ ¤t_fs->super->s_feature_compat))
+ com_err(argv[0], 0, "Unknown feature: %s\n",
+ argv[i]);
+ else
+ ext2fs_mark_super_dirty(current_fs);
+ }
+ print_features((struct ext2fs_sb *) current_fs->super, stdout);
+}
+
static int source_file(const char *cmd_file, int sci_idx)
{
FILE *f;