diff options
author | Theodore Ts'o <tytso@mit.edu> | 1997-04-29 14:53:37 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 1997-04-29 14:53:37 +0000 |
commit | 1e3472c5f37ca3686dd69b079d4d02a302f5798d (patch) | |
tree | f8c01b8e3875f425d9de9b3ef6171f739d1273e8 /lib/e2p | |
parent | fc6d9d519aef67735918bf02c0fa8c9222008f76 (diff) | |
download | android_external_e2fsprogs-1e3472c5f37ca3686dd69b079d4d02a302f5798d.tar.gz android_external_e2fsprogs-1e3472c5f37ca3686dd69b079d4d02a302f5798d.tar.bz2 android_external_e2fsprogs-1e3472c5f37ca3686dd69b079d4d02a302f5798d.zip |
Many files:
Checked in e2fsprogs 1.05
Diffstat (limited to 'lib/e2p')
-rw-r--r-- | lib/e2p/ChangeLog | 17 | ||||
-rw-r--r-- | lib/e2p/MAKELOG | 181 | ||||
-rw-r--r-- | lib/e2p/Makefile.in | 13 | ||||
-rw-r--r-- | lib/e2p/e2p.h | 3 | ||||
-rw-r--r-- | lib/e2p/fgetflags.c | 2 | ||||
-rw-r--r-- | lib/e2p/fgetversion.c | 2 | ||||
-rw-r--r-- | lib/e2p/fsetflags.c | 2 | ||||
-rw-r--r-- | lib/e2p/fsetversion.c | 2 | ||||
-rw-r--r-- | lib/e2p/getflags.c | 2 | ||||
-rw-r--r-- | lib/e2p/getversion.c | 2 | ||||
-rw-r--r-- | lib/e2p/ls.c | 138 | ||||
-rw-r--r-- | lib/e2p/pe.c | 2 | ||||
-rw-r--r-- | lib/e2p/pf.c | 1 | ||||
-rw-r--r-- | lib/e2p/ps.c | 2 | ||||
-rw-r--r-- | lib/e2p/setflags.c | 2 | ||||
-rw-r--r-- | lib/e2p/setversion.c | 2 | ||||
-rw-r--r-- | lib/e2p/uuid.c | 65 |
17 files changed, 226 insertions, 212 deletions
diff --git a/lib/e2p/ChangeLog b/lib/e2p/ChangeLog index 2422e73d..fe4fa5e9 100644 --- a/lib/e2p/ChangeLog +++ b/lib/e2p/ChangeLog @@ -1,3 +1,20 @@ +Sat Sep 7 14:48:35 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * ls.c (interval_string): Pretty print the check interval. + +Tue Aug 6 14:12:36 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * ls.c (list_super): Display the OS, volume label, last mounted, + and UUID field if present. + +Mon Jun 24 09:55:58 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * ps.c, pf.c, pe.c, ls.c, setversion.c, setflags.c, getversion.c, + fsetversion.c, fsetflags.c, fgetversion.c, fgetflags.c, + getflags.c: Remove include of ext2_fs.h, since it's + included by e2p.h; this also solves a sys/types.h vs + linux/types.h inclusion ordering problem with the GNU libc. + Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu> * Release of E2fsprogs version 1.04 diff --git a/lib/e2p/MAKELOG b/lib/e2p/MAKELOG deleted file mode 100644 index 27e4420d..00000000 --- a/lib/e2p/MAKELOG +++ /dev/null @@ -1,181 +0,0 @@ -gcc -O2 -fomit-frame-pointer -I.. -c pe.c -In file included from pe.c:19: -/usr/include/linux/ext2_fs.h:127: parse error before `__u32' -/usr/include/linux/ext2_fs.h:127: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:128: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:129: parse error before `aclh_acle_count' -/usr/include/linux/ext2_fs.h:129: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:130: parse error before `aclh_first_acle' -/usr/include/linux/ext2_fs.h:130: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:135: parse error before `__u32' -/usr/include/linux/ext2_fs.h:135: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:136: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:137: parse error before `acle_type' -/usr/include/linux/ext2_fs.h:137: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:138: parse error before `acle_tag' -/usr/include/linux/ext2_fs.h:138: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:139: parse error before `acle_pad1' -/usr/include/linux/ext2_fs.h:139: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:140: parse error before `acle_next' -/usr/include/linux/ext2_fs.h:140: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:149: parse error before `__u32' -/usr/include/linux/ext2_fs.h:149: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:150: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:151: parse error before `bg_inode_table' -/usr/include/linux/ext2_fs.h:151: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:152: parse error before `bg_free_blocks_count' -/usr/include/linux/ext2_fs.h:152: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:153: parse error before `bg_free_inodes_count' -/usr/include/linux/ext2_fs.h:153: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:158: parse error before `__u32' -/usr/include/linux/ext2_fs.h:158: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:159: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:160: parse error before `bg_inode_table' -/usr/include/linux/ext2_fs.h:160: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:161: parse error before `bg_free_blocks_count' -/usr/include/linux/ext2_fs.h:161: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:162: parse error before `bg_free_inodes_count' -/usr/include/linux/ext2_fs.h:162: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:163: parse error before `bg_used_dirs_count' -/usr/include/linux/ext2_fs.h:163: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:164: parse error before `bg_pad' -/usr/include/linux/ext2_fs.h:164: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:165: parse error before `bg_reserved' -/usr/include/linux/ext2_fs.h:165: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:166: parse error before `}' -/usr/include/linux/ext2_fs.h:213: parse error before `__u16' -/usr/include/linux/ext2_fs.h:213: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:214: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:215: parse error before `i_size' -/usr/include/linux/ext2_fs.h:215: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:216: parse error before `i_atime' -/usr/include/linux/ext2_fs.h:216: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:217: parse error before `i_ctime' -/usr/include/linux/ext2_fs.h:217: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:218: parse error before `i_mtime' -/usr/include/linux/ext2_fs.h:218: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:219: parse error before `i_dtime' -/usr/include/linux/ext2_fs.h:219: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:220: parse error before `i_gid' -/usr/include/linux/ext2_fs.h:220: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:221: parse error before `i_links_count' -/usr/include/linux/ext2_fs.h:221: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:222: parse error before `i_blocks' -/usr/include/linux/ext2_fs.h:222: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:223: parse error before `i_flags' -/usr/include/linux/ext2_fs.h:223: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:226: parse error before `__u32' -/usr/include/linux/ext2_fs.h:226: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:226: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:227: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:229: parse error before `__u32' -/usr/include/linux/ext2_fs.h:229: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:230: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:232: parse error before `__u32' -/usr/include/linux/ext2_fs.h:232: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:233: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:234: parse error before `}' -/usr/include/linux/ext2_fs.h:234: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:235: parse error before `i_block' -/usr/include/linux/ext2_fs.h:235: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:236: parse error before `i_version' -/usr/include/linux/ext2_fs.h:236: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:237: parse error before `i_file_acl' -/usr/include/linux/ext2_fs.h:237: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:238: parse error before `i_dir_acl' -/usr/include/linux/ext2_fs.h:238: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:239: parse error before `i_faddr' -/usr/include/linux/ext2_fs.h:239: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:242: parse error before `__u8' -/usr/include/linux/ext2_fs.h:242: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:242: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:243: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:244: parse error before `i_pad1' -/usr/include/linux/ext2_fs.h:244: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:245: parse error before `l_i_reserved2' -/usr/include/linux/ext2_fs.h:245: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:246: parse error before `}' -/usr/include/linux/ext2_fs.h:246: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:248: parse error before `__u8' -/usr/include/linux/ext2_fs.h:248: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:249: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:250: parse error before `h_i_mode_high' -/usr/include/linux/ext2_fs.h:250: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:251: parse error before `h_i_uid_high' -/usr/include/linux/ext2_fs.h:251: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:252: parse error before `h_i_gid_high' -/usr/include/linux/ext2_fs.h:252: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:253: parse error before `h_i_author' -/usr/include/linux/ext2_fs.h:253: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:254: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:256: parse error before `__u8' -/usr/include/linux/ext2_fs.h:256: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:257: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:258: parse error before `m_pad1' -/usr/include/linux/ext2_fs.h:258: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:259: parse error before `m_i_reserved2' -/usr/include/linux/ext2_fs.h:259: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:260: parse error before `}' -/usr/include/linux/ext2_fs.h:260: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:261: parse error before `}' -/usr/include/linux/ext2_fs.h:261: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:262: parse error before `}' -/usr/include/linux/ext2_fs.h:329: parse error before `__u32' -/usr/include/linux/ext2_fs.h:329: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:330: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:331: parse error before `s_r_blocks_count' -/usr/include/linux/ext2_fs.h:331: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:332: parse error before `s_free_blocks_count' -/usr/include/linux/ext2_fs.h:332: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:333: parse error before `s_free_inodes_count' -/usr/include/linux/ext2_fs.h:333: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:334: parse error before `s_first_data_block' -/usr/include/linux/ext2_fs.h:334: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:335: parse error before `s_log_block_size' -/usr/include/linux/ext2_fs.h:335: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:336: parse error before `s_log_frag_size' -/usr/include/linux/ext2_fs.h:336: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:337: parse error before `s_blocks_per_group' -/usr/include/linux/ext2_fs.h:337: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:338: parse error before `s_frags_per_group' -/usr/include/linux/ext2_fs.h:338: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:339: parse error before `s_inodes_per_group' -/usr/include/linux/ext2_fs.h:339: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:340: parse error before `s_mtime' -/usr/include/linux/ext2_fs.h:340: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:341: parse error before `s_wtime' -/usr/include/linux/ext2_fs.h:341: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:342: parse error before `s_mnt_count' -/usr/include/linux/ext2_fs.h:342: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:343: parse error before `s_max_mnt_count' -/usr/include/linux/ext2_fs.h:343: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:344: parse error before `s_magic' -/usr/include/linux/ext2_fs.h:344: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:345: parse error before `s_state' -/usr/include/linux/ext2_fs.h:345: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:346: parse error before `s_errors' -/usr/include/linux/ext2_fs.h:346: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:347: parse error before `s_pad' -/usr/include/linux/ext2_fs.h:347: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:348: parse error before `s_lastcheck' -/usr/include/linux/ext2_fs.h:348: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:349: parse error before `s_checkinterval' -/usr/include/linux/ext2_fs.h:349: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:350: parse error before `s_creator_os' -/usr/include/linux/ext2_fs.h:350: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:351: parse error before `s_rev_level' -/usr/include/linux/ext2_fs.h:351: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:352: parse error before `s_def_resuid' -/usr/include/linux/ext2_fs.h:352: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:353: parse error before `s_def_resgid' -/usr/include/linux/ext2_fs.h:353: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:354: parse error before `s_reserved' -/usr/include/linux/ext2_fs.h:354: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:355: parse error before `}' -/usr/include/linux/ext2_fs.h:372: parse error before `__u32' -/usr/include/linux/ext2_fs.h:372: warning: no semicolon at end of struct or union -/usr/include/linux/ext2_fs.h:373: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:374: parse error before `name_len' -/usr/include/linux/ext2_fs.h:374: warning: data definition has no type or storage class -/usr/include/linux/ext2_fs.h:376: parse error before `}' -make: *** [pe.o] Error 1 diff --git a/lib/e2p/Makefile.in b/lib/e2p/Makefile.in index 97f3fbcc..4c433dcd 100644 --- a/lib/e2p/Makefile.in +++ b/lib/e2p/Makefile.in @@ -9,6 +9,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ top_builddir = ../.. +my_dir = lib/e2p INSTALL = @INSTALL@ @MCONFIG@ @@ -17,14 +18,15 @@ all:: OBJS= fgetflags.o fsetflags.o fgetversion.o fsetversion.o \ getflags.o getversion.o iod.o ls.o pe.o pf.o ps.o \ - setflags.o setversion.o + setflags.o setversion.o uuid.o SRCS= $(srcdir)/fgetflags.c $(srcdir)/fsetflags.c \ $(srcdir)/fgetversion.c $(srcdir)/fsetversion.c \ $(srcdir)/getflags.c $(srcdir)/getversion.c \ $(srcdir)/iod.c $(srcdir)/ls.c $(srcdir)/pe.c \ $(srcdir)/pf.c $(srcdir)/ps.c \ - $(srcdir)/setflags.c $(srcdir)/setversion.c + $(srcdir)/setflags.c $(srcdir)/setversion.c \ + $(srcdir)/uuid.c LIBRARY= libe2p LIBDIR= e2p @@ -38,7 +40,7 @@ DLL_STUB = libe2p DLL_MYDIR = e2p DLL_INSTALL_DIR = $(libdir) -ELF_VERSION = 2.1 +ELF_VERSION = 2.2 ELF_SO_VERSION = 2 ELF_IMAGE = libe2p ELF_MYDIR = e2p @@ -90,15 +92,16 @@ distclean:: clean # the Makefile.in file # fgetflags.o: $(srcdir)/fgetflags.c $(srcdir)/e2p.h -fsetflags.o: $(srcdir)/fsetflags.c $(srcdir)/e2p.h +fsetflags.o: $(srcdir)/fsetflags.c $(srcdir)/e2p.h fgetversion.o: $(srcdir)/fgetversion.c $(srcdir)/e2p.h fsetversion.o: $(srcdir)/fsetversion.c $(srcdir)/e2p.h getflags.o: $(srcdir)/getflags.c $(srcdir)/e2p.h getversion.o: $(srcdir)/getversion.c $(srcdir)/e2p.h iod.o: $(srcdir)/iod.c $(srcdir)/e2p.h -ls.o: $(srcdir)/ls.c $(srcdir)/e2p.h +ls.o: $(srcdir)/ls.c $(srcdir)/e2p.h pe.o: $(srcdir)/pe.c $(srcdir)/e2p.h pf.o: $(srcdir)/pf.c $(srcdir)/e2p.h ps.o: $(srcdir)/ps.c $(srcdir)/e2p.h setflags.o: $(srcdir)/setflags.c $(srcdir)/e2p.h setversion.o: $(srcdir)/setversion.c $(srcdir)/e2p.h +uuid.o: $(srcdir)/uuid.c diff --git a/lib/e2p/e2p.h b/lib/e2p/e2p.h index dc2dbe57..fa4a03bd 100644 --- a/lib/e2p/e2p.h +++ b/lib/e2p/e2p.h @@ -19,3 +19,6 @@ void print_flags (FILE * f, unsigned long flags, int long_format); void print_fs_state (FILE * f, unsigned short state); int setflags (int fd, unsigned long flags); int setversion (int fd, unsigned long version); + +int e2p_is_null_uuid(void *uu); +void e2p_uuid_to_str(void *uu, char *out); diff --git a/lib/e2p/fgetflags.c b/lib/e2p/fgetflags.c index 099446d0..f01de269 100644 --- a/lib/e2p/fgetflags.c +++ b/lib/e2p/fgetflags.c @@ -27,8 +27,6 @@ #include <sys/ioctl.h> #endif -#include <linux/ext2_fs.h> - #include "e2p.h" int fgetflags (const char * name, unsigned long * flags) diff --git a/lib/e2p/fgetversion.c b/lib/e2p/fgetversion.c index ba4eec44..fea376b0 100644 --- a/lib/e2p/fgetversion.c +++ b/lib/e2p/fgetversion.c @@ -23,8 +23,6 @@ #include <fcntl.h> #include <sys/ioctl.h> -#include <linux/ext2_fs.h> - #include "e2p.h" int fgetversion (const char * name, unsigned long * version) diff --git a/lib/e2p/fsetflags.c b/lib/e2p/fsetflags.c index 06aabba4..92e558be 100644 --- a/lib/e2p/fsetflags.c +++ b/lib/e2p/fsetflags.c @@ -27,8 +27,6 @@ #include <sys/ioctl.h> #endif -#include <linux/ext2_fs.h> - #include "e2p.h" int fsetflags (const char * name, unsigned long flags) diff --git a/lib/e2p/fsetversion.c b/lib/e2p/fsetversion.c index 1443fb50..49c7c364 100644 --- a/lib/e2p/fsetversion.c +++ b/lib/e2p/fsetversion.c @@ -23,8 +23,6 @@ #include <fcntl.h> #include <sys/ioctl.h> -#include <linux/ext2_fs.h> - #include "e2p.h" int fsetversion (const char * name, unsigned long version) diff --git a/lib/e2p/getflags.c b/lib/e2p/getflags.c index ac014a70..8c476a37 100644 --- a/lib/e2p/getflags.c +++ b/lib/e2p/getflags.c @@ -23,8 +23,6 @@ #include <sys/ioctl.h> #endif -#include <linux/ext2_fs.h> - #include "e2p.h" int getflags (int fd, unsigned long * flags) diff --git a/lib/e2p/getversion.c b/lib/e2p/getversion.c index 309dfb6f..be76b60a 100644 --- a/lib/e2p/getversion.c +++ b/lib/e2p/getversion.c @@ -19,8 +19,6 @@ #endif #include <sys/ioctl.h> -#include <linux/ext2_fs.h> - #include "e2p.h" int getversion (int fd, unsigned long * version) diff --git a/lib/e2p/ls.c b/lib/e2p/ls.c index 0bd217bc..55e0bbe6 100644 --- a/lib/e2p/ls.c +++ b/lib/e2p/ls.c @@ -9,16 +9,71 @@ * Public License */ +#include <stdio.h> #include <sys/types.h> +#include <string.h> #include <grp.h> #include <pwd.h> -#include <stdio.h> #include <time.h> -#include <linux/ext2_fs.h> - #include "e2p.h" +/* + * The ext2fs library private definition of the ext2 superblock, so we + * don't have to depend on the kernel's definition of the superblock, + * which might not have the latest features. + */ +struct ext2fs_sb { + __u32 s_inodes_count; /* Inodes count */ + __u32 s_blocks_count; /* Blocks count */ + __u32 s_r_blocks_count; /* Reserved blocks count */ + __u32 s_free_blocks_count; /* Free blocks count */ + __u32 s_free_inodes_count; /* Free inodes count */ + __u32 s_first_data_block; /* First Data Block */ + __u32 s_log_block_size; /* Block size */ + __s32 s_log_frag_size; /* Fragment size */ + __u32 s_blocks_per_group; /* # Blocks per group */ + __u32 s_frags_per_group; /* # Fragments per group */ + __u32 s_inodes_per_group; /* # Inodes per group */ + __u32 s_mtime; /* Mount time */ + __u32 s_wtime; /* Write time */ + __u16 s_mnt_count; /* Mount count */ + __s16 s_max_mnt_count; /* Maximal mount count */ + __u16 s_magic; /* Magic signature */ + __u16 s_state; /* File system state */ + __u16 s_errors; /* Behaviour when detecting errors */ + __u16 s_minor_rev_level; /* minor revision level */ + __u32 s_lastcheck; /* time of last check */ + __u32 s_checkinterval; /* max. time between checks */ + __u32 s_creator_os; /* OS */ + __u32 s_rev_level; /* Revision level */ + __u16 s_def_resuid; /* Default uid for reserved blocks */ + __u16 s_def_resgid; /* Default gid for reserved blocks */ + /* + * These fields are for EXT2_DYNAMIC_REV superblocks only. + * + * Note: the difference between the compatible feature set and + * the incompatible feature set is that if there is a bit set + * in the incompatible feature set that the kernel doesn't + * know about, it should refuse to mount the filesystem. + * + * e2fsck's requirements are more strict; if it doesn't know + * about a feature in either the compatible or incompatible + * feature set, it must abort and not try to meddle with + * things it doesn't understand... + */ + __u32 s_first_ino; /* First non-reserved inode */ + __u16 s_inode_size; /* size of inode structure */ + __u16 s_block_group_nr; /* block group # of this superblock */ + __u32 s_feature_compat; /* compatible feature set */ + __u32 s_feature_incompat; /* incompatible feature set */ + __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __u8 s_uuid[16]; /* 128-bit uuid for volume */ + char s_volume_name[16]; /* volume name */ + char s_last_mounted[64]; /* directory where last mounted */ + __u32 s_reserved[206]; /* Padding to the end of the block */ +}; + static void print_user (unsigned short uid) { struct passwd *pw; @@ -43,6 +98,51 @@ static void print_group (unsigned short gid) printf ("(group %s)\n", gr->gr_name); } +#define MONTH_INT (86400 * 30) +#define WEEK_INT (86400 * 7) +#define DAY_INT (86400) +#define HOUR_INT (60 * 60) +#define MINUTE_INT (60) + +static char *interval_string(unsigned int secs) +{ + static char buf[256], tmp[80]; + int hr, min, num; + + buf[0] = 0; + + if (secs >= MONTH_INT) { + num = secs / MONTH_INT; + secs -= num*MONTH_INT; + sprintf(buf, "%d month%s", num, (num>1) ? "s" : ""); + } + if (secs >= WEEK_INT) { + num = secs / WEEK_INT; + secs -= num*WEEK_INT; + sprintf(tmp, "%s%d week%s", buf[0] ? ", " : "", + num, (num>1) ? "s" : ""); + strcat(buf, tmp); + } + if (secs >= DAY_INT) { + num = secs / DAY_INT; + secs -= num*DAY_INT; + sprintf(tmp, "%s%d day%s", buf[0] ? ", " : "", + num, (num>1) ? "s" : ""); + strcat(buf, tmp); + } + if (secs > 0) { + hr = secs / HOUR_INT; + secs -= hr*HOUR_INT; + min = secs / MINUTE_INT; + secs -= min*MINUTE_INT; + sprintf(tmp, "%s%d:%02d:%02d", buf[0] ? ", " : "", + hr, min, secs); + strcat(buf, tmp); + } + return buf; +} + + #ifndef EXT2_INODE_SIZE #define EXT2_INODE_SIZE(s) sizeof(struct ext2_inode) #endif @@ -50,20 +150,43 @@ static void print_group (unsigned short gid) void list_super (struct ext2_super_block * s) { int inode_blocks_per_group; + struct ext2fs_sb *sb = (struct ext2fs_sb *) s; + char buf[80]; + const char *os; inode_blocks_per_group = (((s->s_inodes_per_group * EXT2_INODE_SIZE(s)) + EXT2_BLOCK_SIZE(s) - 1) / EXT2_BLOCK_SIZE(s)); - printf ("Filesystem magic number: 0x%04X\n", s->s_magic); printf ("Filesystem revision #: %d\n", s->s_rev_level); + if (sb->s_volume_name[0]) { + memset(buf, 0, sizeof(buf)); + strncpy(buf, sb->s_volume_name, sizeof(sb->s_volume_name)); + printf("Filesystem volume name: %s\n", buf); + } + if (sb->s_last_mounted[0]) { + memset(buf, 0, sizeof(buf)); + strncpy(buf, sb->s_last_mounted, sizeof(sb->s_last_mounted)); + printf("Last mounted on: %s\n", buf); + } + if (!e2p_is_null_uuid(sb->s_uuid)) { + e2p_uuid_to_str(sb->s_uuid, buf); + printf("Filesystem UUID: %s\n", buf); + } printf ("Filesystem state: "); print_fs_state (stdout, s->s_state); printf ("\n"); printf ("Errors behavior: "); print_fs_errors (stdout, s->s_errors); printf ("\n"); + switch (s->s_creator_os) { + case EXT2_OS_LINUX: os = "Linux"; break; + case EXT2_OS_HURD: os = "GNU"; break; + case EXT2_OS_MASIX: os = "Masix"; break; + default: os = "unknown"; break; + } + printf ("Filesystem OS type: %s\n", os); printf ("Inode count: %u\n", s->s_inodes_count); printf ("Block count: %u\n", s->s_blocks_count); printf ("Reserved block count: %u\n", s->s_r_blocks_count); @@ -81,7 +204,8 @@ void list_super (struct ext2_super_block * s) printf ("Mount count: %u\n", s->s_mnt_count); printf ("Maximum mount count: %d\n", s->s_max_mnt_count); printf ("Last checked: %s", ctime ((time_t *) &s->s_lastcheck)); - printf ("Check interval: %u\n", s->s_checkinterval); + printf ("Check interval: %u (%s)\n", s->s_checkinterval, + interval_string(s->s_checkinterval)); if (s->s_checkinterval) { time_t next; @@ -102,3 +226,7 @@ void list_super (struct ext2_super_block * s) } #endif } + + + + diff --git a/lib/e2p/pe.c b/lib/e2p/pe.c index efc74b3a..4cce6911 100644 --- a/lib/e2p/pe.c +++ b/lib/e2p/pe.c @@ -16,8 +16,6 @@ #include <stdio.h> -#include <linux/ext2_fs.h> - #include "e2p.h" void print_fs_errors (FILE * f, unsigned short errors) diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c index e4f072f2..ec18dcb8 100644 --- a/lib/e2p/pf.c +++ b/lib/e2p/pf.c @@ -15,7 +15,6 @@ */ #include <stdio.h> -#include <linux/ext2_fs.h> #include "e2p.h" diff --git a/lib/e2p/ps.c b/lib/e2p/ps.c index 441d6dc8..bec8b419 100644 --- a/lib/e2p/ps.c +++ b/lib/e2p/ps.c @@ -16,8 +16,6 @@ #include <stdio.h> -#include <linux/ext2_fs.h> - #include "e2p.h" void print_fs_state (FILE * f, unsigned short state) diff --git a/lib/e2p/setflags.c b/lib/e2p/setflags.c index 06f127f2..654ec9dc 100644 --- a/lib/e2p/setflags.c +++ b/lib/e2p/setflags.c @@ -24,8 +24,6 @@ #include <sys/ioctl.h> #endif -#include <linux/ext2_fs.h> - #include "e2p.h" int setflags (int fd, unsigned long flags) diff --git a/lib/e2p/setversion.c b/lib/e2p/setversion.c index f2c48cd9..3210f514 100644 --- a/lib/e2p/setversion.c +++ b/lib/e2p/setversion.c @@ -19,8 +19,6 @@ #endif #include <sys/ioctl.h> -#include <linux/ext2_fs.h> - #include "e2p.h" int setversion (int fd, unsigned long version) diff --git a/lib/e2p/uuid.c b/lib/e2p/uuid.c new file mode 100644 index 00000000..82462e83 --- /dev/null +++ b/lib/e2p/uuid.c @@ -0,0 +1,65 @@ +/* + * uuid.c -- utility routines for manipulating UUID's. + */ + +#include <stdio.h> +#include <linux/types.h> + +struct uuid { + __u32 time_low; + __u16 time_mid; + __u16 time_hi_and_version; + __u16 clock_seq; + __u8 node[6]; +}; + +/* Returns 1 if the uuid is the NULL uuid */ +int e2p_is_null_uuid(void *uu) +{ + __u8 *cp; + int i; + + for (i=0, cp = uu; i < 16; i++) + if (*cp) + return 0; + return 1; +} + +static void e2p_unpack_uuid(void *in, struct uuid *uu) +{ + __u8 *ptr = in; + __u32 tmp; + + tmp = *ptr++; + tmp = (tmp << 8) | *ptr++; + tmp = (tmp << 8) | *ptr++; + tmp = (tmp << 8) | *ptr++; + uu->time_low = tmp; + + tmp = *ptr++; + tmp = (tmp << 8) | *ptr++; + uu->time_mid = tmp; + + tmp = *ptr++; + tmp = (tmp << 8) | *ptr++; + uu->time_hi_and_version = tmp; + + tmp = *ptr++; + tmp = (tmp << 8) | *ptr++; + uu->clock_seq = tmp; + + memcpy(uu->node, ptr, 6); +} + +void e2p_uuid_to_str(void *uu, char *out) +{ + struct uuid uuid; + + e2p_unpack_uuid(uu, &uuid); + sprintf(out, + "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + uuid.time_low, uuid.time_mid, uuid.time_hi_and_version, + uuid.clock_seq >> 8, uuid.clock_seq & 0xFF, + uuid.node[0], uuid.node[1], uuid.node[2], + uuid.node[3], uuid.node[4], uuid.node[5]); +} |