aboutsummaryrefslogtreecommitdiff
path: root/debugfs/util.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1997-04-29 14:53:37 +0000
committerTheodore Ts'o <tytso@mit.edu>1997-04-29 14:53:37 +0000
commit1e3472c5f37ca3686dd69b079d4d02a302f5798d (patch)
treef8c01b8e3875f425d9de9b3ef6171f739d1273e8 /debugfs/util.c
parentfc6d9d519aef67735918bf02c0fa8c9222008f76 (diff)
downloade2fsprogs-1e3472c5f37ca3686dd69b079d4d02a302f5798d.tar.gz
Many files:
Checked in e2fsprogs 1.05
Diffstat (limited to 'debugfs/util.c')
-rw-r--r--debugfs/util.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/debugfs/util.c b/debugfs/util.c
index 24957fb5..c8eeae17 100644
--- a/debugfs/util.c
+++ b/debugfs/util.c
@@ -11,6 +11,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
+#include <time.h>
#include "debugfs.h"
@@ -56,7 +57,7 @@ ino_t string_to_inode(char *str)
return(atoi(str+1));
}
- retval = ext2fs_namei(fs, root, cwd, str, &ino);
+ retval = ext2fs_namei(current_fs, root, cwd, str, &ino);
if (retval) {
com_err(str, retval, "");
return 0;
@@ -70,7 +71,7 @@ ino_t string_to_inode(char *str)
*/
int check_fs_open(char *name)
{
- if (!fs) {
+ if (!current_fs) {
com_err(name, 0, "Filesystem not open");
return 1;
}
@@ -83,12 +84,39 @@ int check_fs_open(char *name)
*/
int check_fs_not_open(char *name)
{
- if (fs) {
+ if (current_fs) {
com_err(name, 0,
"Filesystem %s is still open. Close it first.\n",
- fs->device_name);
+ current_fs->device_name);
return 1;
}
return 0;
}
+/*
+ * This routine returns 1 if a filesystem is not opened read/write,
+ * and prints an error message to that effect.
+ */
+int check_fs_read_write(char *name)
+{
+ if (!(current_fs->flags & EXT2_FLAG_RW)) {
+ com_err(name, 0, "Filesystem opened read/only");
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * This function takes a __u32 time value and converts it to a string,
+ * using ctime
+ */
+char *time_to_string(__u32 cl)
+{
+ time_t t = (time_t) cl;
+
+ return ctime(&t);
+}
+
+
+
+