summaryrefslogtreecommitdiff
path: root/debugfs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2000-05-27 16:04:00 +0000
committerTheodore Ts'o <tytso@mit.edu>2000-05-27 16:04:00 +0000
commitd61f6176024865007d5a0da49c61c21e9d498007 (patch)
tree39cf6e79127e554e6ecfe99fd0488ccfa880fb63 /debugfs
parent275ec02c28295a549dc26717919b0d04ac40ee27 (diff)
downloade2fsprogs-d61f6176024865007d5a0da49c61c21e9d498007.tar.gz
Makefile.in:
Fix stupid dependency bug. ChangeLog, debugfs.c, debugfs.h, util.c: debugfs.c (do_testb, do_testi): Call check_fs_bitmaps to avoid coredumping if the bitmaps aren't loaded. util.c (check_fs_bitmaps): New function which checks whether or not the bitmaps are loaded.
Diffstat (limited to 'debugfs')
-rw-r--r--debugfs/ChangeLog8
-rw-r--r--debugfs/debugfs.c4
-rw-r--r--debugfs/debugfs.h1
-rw-r--r--debugfs/util.c14
4 files changed, 27 insertions, 0 deletions
diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog
index ae9e3b78..eda81e96 100644
--- a/debugfs/ChangeLog
+++ b/debugfs/ChangeLog
@@ -1,3 +1,11 @@
+2000-05-27 Theodore Ts'o <tytso@valinux.com>
+
+ * debugfs.c (do_testb, do_testi): Call check_fs_bitmaps to avoid
+ coredumping if the bitmaps aren't loaded.
+
+ * util.c (check_fs_bitmaps): New function which checks whether or
+ not the bitmaps are loaded.
+
2000-05-23 Aaron Crane <aaronc@pobox.com>
* debugfs.8.in: Documented new behaviour.
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 1a93d583..46471d18 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -612,6 +612,8 @@ void do_testi(int argc, char *argv[])
}
if (check_fs_open(argv[0]))
return;
+ if (check_fs_bitmaps(argv[0]))
+ return;
inode = string_to_inode(argv[1]);
if (!inode)
return;
@@ -682,6 +684,8 @@ void do_testb(int argc, char *argv[])
}
if (check_fs_open(argv[0]))
return;
+ if (check_fs_bitmaps(argv[0]))
+ return;
block = strtoul(argv[1], &tmp, 0);
if (!block || *tmp) {
com_err(argv[0], 0, "No block 0");
diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h
index f2917e1b..f5d3d534 100644
--- a/debugfs/debugfs.h
+++ b/debugfs/debugfs.h
@@ -20,6 +20,7 @@ extern void close_pager(FILE *stream);
extern int check_fs_open(char *name);
extern int check_fs_not_open(char *name);
extern int check_fs_read_write(char *name);
+extern int check_fs_bitmaps(char *name);
extern ino_t string_to_inode(char *str);
extern char *time_to_string(__u32);
diff --git a/debugfs/util.c b/debugfs/util.c
index c8eeae17..66a0bea8 100644
--- a/debugfs/util.c
+++ b/debugfs/util.c
@@ -107,6 +107,20 @@ int check_fs_read_write(char *name)
}
/*
+ * This routine returns 1 if a filesystem is doesn't have its inode
+ * and block bitmaps loaded, and prints an error message to that
+ * effect.
+ */
+int check_fs_bitmaps(char *name)
+{
+ if (!current_fs->block_map || !current_fs->inode_map) {
+ com_err(name, 0, "Filesystem bitmaps not loaded");
+ return 1;
+ }
+ return 0;
+}
+
+/*
* This function takes a __u32 time value and converts it to a string,
* using ctime
*/