[Ocfs2-tools-commits] smushran commits r1301 - in
trunk/debugfs.ocfs2: . include
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Feb 15 15:11:22 PST 2007
Author: smushran
Date: 2007-02-15 15:11:20 -0800 (Thu, 15 Feb 2007)
New Revision: 1301
Modified:
trunk/debugfs.ocfs2/dump.c
trunk/debugfs.ocfs2/include/utils.h
trunk/debugfs.ocfs2/utils.c
Log:
debugfs: Display descriptions of compat/incompat/rocompat flags
The stats command now displays the descriptions of the above flags.
Signed-off-by: mfasheh
Modified: trunk/debugfs.ocfs2/dump.c
===================================================================
--- trunk/debugfs.ocfs2/dump.c 2007-02-15 23:09:37 UTC (rev 1300)
+++ trunk/debugfs.ocfs2/dump.c 2007-02-15 23:11:20 UTC (rev 1301)
@@ -36,7 +36,14 @@
{
int i;
char *str;
+ GString *compat = NULL;
+ GString *incompat = NULL;
+ GString *rocompat = NULL;
+ compat = g_string_new(NULL);
+ incompat = g_string_new(NULL);
+ rocompat = g_string_new(NULL);
+
fprintf(out, "\tRevision: %u.%u\n", sb->s_major_rev_level, sb->s_minor_rev_level);
fprintf(out, "\tMount Count: %u Max Mount Count: %u\n", sb->s_mnt_count,
sb->s_max_mnt_count);
@@ -47,10 +54,18 @@
fprintf(out, "\tCheck Interval: %u Last Check: %s", sb->s_checkinterval, str);
fprintf(out, "\tCreator OS: %u\n", sb->s_creator_os);
- fprintf(out, "\tFeature Compat: %u Incompat: %u RO Compat: %u\n",
- sb->s_feature_compat, sb->s_feature_incompat,
- sb->s_feature_ro_compat);
+ get_compat_flag(sb->s_feature_compat, compat);
+ get_incompat_flag(sb->s_feature_incompat, incompat);
+ get_rocompat_flag(sb->s_feature_ro_compat, rocompat);
+
+ fprintf(out, "\tFeature Compat: %u %s\n", sb->s_feature_compat,
+ compat->str);
+ fprintf(out, "\tFeature Incompat: %u %s\n", sb->s_feature_incompat,
+ incompat->str);
+ fprintf(out, "\tFeature RO compat: %u %s\n", sb->s_feature_ro_compat,
+ rocompat->str);
+
fprintf(out, "\tRoot Blknum: %"PRIu64" System Dir Blknum: %"PRIu64"\n",
sb->s_root_blkno,
sb->s_system_dir_blkno);
@@ -69,6 +84,10 @@
fprintf(out, "%02X", sb->s_uuid[i]);
fprintf(out, "\n");
+ g_string_free(compat, 1);
+ g_string_free(incompat, 1);
+ g_string_free(rocompat, 1);
+
return ;
}
Modified: trunk/debugfs.ocfs2/include/utils.h
===================================================================
--- trunk/debugfs.ocfs2/include/utils.h 2007-02-15 23:09:37 UTC (rev 1300)
+++ trunk/debugfs.ocfs2/include/utils.h 2007-02-15 23:11:20 UTC (rev 1301)
@@ -33,6 +33,9 @@
int verbose;
} rdump_opts;
+void get_incompat_flag(uint32_t flag, GString *str);
+void get_compat_flag(uint32_t flag, GString *str);
+void get_rocompat_flag(uint32_t flag, GString *str);
void get_vote_flag (uint32_t flag, GString *str);
void get_publish_flag (uint32_t flag, GString *str);
void get_journal_block_type (uint32_t jtype, GString *str);
Modified: trunk/debugfs.ocfs2/utils.c
===================================================================
--- trunk/debugfs.ocfs2/utils.c 2007-02-15 23:09:37 UTC (rev 1300)
+++ trunk/debugfs.ocfs2/utils.c 2007-02-15 23:11:20 UTC (rev 1301)
@@ -28,6 +28,57 @@
extern dbgfs_gbls gbls;
+void get_incompat_flag(uint32_t flag, GString *str)
+{
+ if (flag & OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV)
+ g_string_append(str, "Heartbeat ");
+
+ if (flag & OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG)
+ g_string_append(str, "AbortedResize ");
+
+ if (flag & OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT)
+ g_string_append(str, "Local ");
+
+ if (flag & OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC)
+ g_string_append(str, "Sparse ");
+
+ if (flag & ~(OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV |
+ OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG |
+ OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT |
+ OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC))
+ g_string_append(str, "Unknown ");
+
+ if (!str->len)
+ g_string_append(str, "None");
+
+ return;
+}
+
+void get_compat_flag(uint32_t flag, GString *str)
+{
+ if (flag & OCFS2_FEATURE_COMPAT_BACKUP_SB)
+ g_string_append(str, "BackupSuper ");
+
+ if (flag & ~(OCFS2_FEATURE_COMPAT_BACKUP_SB))
+ g_string_append(str, "Unknown ");
+
+ if (!str->len)
+ g_string_append(str, "None");
+
+ return;
+}
+
+void get_rocompat_flag(uint32_t flag, GString *str)
+{
+ if (flag)
+ g_string_append(str, "Unknown ");
+
+ if (!str->len)
+ g_string_append(str, "None");
+
+ return;
+}
+
/*
* get_vote_flag()
*
More information about the Ocfs2-tools-commits
mailing list