]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
ChangeLog, Makefile.in, e2p.h, pf.c:
authorTheodore Ts'o <tytso@mit.edu>
Fri, 11 Feb 2000 04:48:03 +0000 (04:48 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 11 Feb 2000 04:48:03 +0000 (04:48 +0000)
  Makefile.in: Install the e2p.h header.
  e2p.h, pf.c (print_flags): Change the third parameter of print_flags()
   to be an option parameter, although we only support one option at this
   point.
  pf.c (print_flags): Updated to use a more generic structure for
   storing the ext2 inode flags.  Add support for the (current) set of
   compression flags.

lib/e2p/ChangeLog
lib/e2p/Makefile.in
lib/e2p/e2p.h
lib/e2p/pf.c

index afdcfa6f1387e3478f38409d7a302481d6a62c20..ac3c6a4d06d954d56af79b861dde40c9c5c4adf8 100644 (file)
@@ -1,3 +1,15 @@
+2000-02-10  Theodore Ts'o  <tytso@valinux.com>
+
+       * Makefile.in: Install the e2p.h header.
+       
+       * e2p.h, pf.c (print_flags): Change the third parameter of
+               print_flags() to be an option parameter, although we only
+               support one option at this point.
+
+       * pf.c (print_flags): Updated to use a more generic structure for
+               storing the ext2 inode flags.  Add support for the
+               (current) set of compression flags.  
+       
 1999-11-19    <tytso@valinux.com>
 
        * Makefile.in (distclean): Remove TAGS and Makefile.in.old from
index 5ee673b06425df0a8d9a56dc0deccfb65109984a..c33b1ba9b7a46df1eb57c9a660f57299ff455d23 100644 (file)
@@ -28,6 +28,8 @@ SRCS=         $(srcdir)/feature.c $(srcdir)/fgetflags.c \
                $(srcdir)/setflags.c $(srcdir)/setversion.c \
                $(srcdir)/uuid.c
 
+HFILES= e2p.h
+
 LIBRARY= libe2p
 LIBDIR= e2p
 
@@ -69,16 +71,21 @@ BSDLIB_INSTALL_DIR = $(root_libdir)
 @BSDLIB_CMT@   $(CC) $(ALL_CFLAGS) -fpic -o pic/$*.o -c $<
 
 installdirs::
-       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
+       $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir) \
+               $(DESTDIR)$(includedir)/e2p
 
 install:: all installdirs 
        $(INSTALL_DATA) libe2p.a $(DESTDIR)$(libdir)/libe2p.a
        $(CHMOD) 644 $(DESTDIR)$(libdir)/libe2p.a
        -$(RANLIB) $(DESTDIR)$(libdir)/libe2p.a
        $(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libe2p.a
+       for i in $(HFILES); do \
+         $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/e2p/$$i; \
+       done
 
 uninstall::
        $(RM) -f $(DESTDIR)$(libdir)/libe2p.a
+       $(RM) -rf $(DESTDIR)$(includedir)/e2p
 
 clean::
        $(RM) -f \#* *.s *.o *.a *~ *.bak core profiled/* checker/*
index 9f5636c7980ab10ec2f7c2574f3e26f0259541ce..07af08b6ec9bdb15724e8a4314f6f8a5d89e5541 100644 (file)
@@ -8,6 +8,12 @@
 #define E2P_FEATURE_INCOMPAT   1
 #define E2P_FEATURE_RO_INCOMPAT        2
 
+
+/* `options' for print_flags() */
+
+#define PFOPT_LONG  1 /* Must be 1 for compatibility with `int long_format'. */
+
+
 int fgetflags (const char * name, unsigned long * flags);
 int fgetversion (const char * name, unsigned long * version);
 int fsetflags (const char * name, unsigned long flags);
@@ -19,7 +25,7 @@ int iterate_on_dir (const char * dir_name,
                    void * private);
 void list_super (struct ext2_super_block * s);
 void print_fs_errors (FILE * f, unsigned short errors);
-void print_flags (FILE * f, unsigned long flags, int long_format);
+void print_flags (FILE * f, unsigned long flags, unsigned options);
 void print_fs_state (FILE * f, unsigned short state);
 int setflags (int fd, unsigned long flags);
 int setversion (int fd, unsigned long version);
index 8ef00b8255aceb6d09f74db2951fd14f70cf4481..91bd59ec8129816d9226ace562c8f6b864b8e38d 100644 (file)
 
 #include "e2p.h"
 
-static const unsigned long flags_array[] = {
-       EXT2_SECRM_FL,
-       EXT2_UNRM_FL,
-       EXT2_COMPR_FL,
-       EXT2_SYNC_FL,
-#ifdef EXT2_IMMUTABLE_FL
-       EXT2_IMMUTABLE_FL,
-#endif
-#ifdef EXT2_APPEND_FL
-       EXT2_APPEND_FL,
-#endif
-#ifdef EXT2_NODUMP_FL
-       EXT2_NODUMP_FL,
-#endif
-#ifdef EXT2_NOATIME_FL
-       EXT2_NOATIME_FL,
-#endif
-       0};
+struct flags_name {
+       unsigned long   flag;
+       char            *short_name;
+       char            *long_name;
+};
 
-static const char * short_flags[] = {
-       "s",
-       "u",
-       "c",
-       "S",
-#ifdef EXT2_IMMUTABLE_FL
-       "i",
-#endif
-#ifdef EXT2_APPEND_FL
-       "a",
-#endif
-#ifdef EXT2_NODUMP_FL
-       "d",
-#endif
-#ifdef EXT2_NOATIME_FL
-       "A",
-#endif
-       NULL};
+static struct flags_name flags_array[] = {
+       { EXT2_SECRM_FL, "s", "Secure_Deletion" },
+       { EXT2_UNRM_FL, "u" , "Undelete" },
+       { EXT2_SYNC_FL, "S", "Synchronous_Updates" },
+       { EXT2_IMMUTABLE_FL, "i", "Immutable" },
+       { EXT2_APPEND_FL, "a", "Append_Only" },
+       { EXT2_NODUMP_FL, "d", "No_Dump" },
+       { EXT2_NOATIME_FL, "A", "No_Atime" },
+       { EXT2_COMPR_FL, "c", "Compression_requested" },
+       { EXT2_COMPRBLK_FL, "B", "Compressed_file" },
+       { EXT2_DIRTY_FL, "D", "Compressed dirty file" },
+       { EXT2_NOCOMP_FL, "X", "Raw_access" },
+       { EXT2_ECOMPR_FL, "E", "Compression_Error" },
+       { 0, NULL, NULL }
+};
 
-static const char * long_flags[] = {
-       "Secure_Deletion, ",
-       "Undelete, ",
-       "Compressed_File, ",
-       "Synchronous_Updates, ",
-#ifdef EXT2_IMMUTABLE_FL
-       "Immutable, ",
-#endif
-#ifdef EXT2_NODUMP_FL
-       "Append_Only, ",
-#endif
-#ifdef EXT2_NODUMP_FL
-       "No_Dump, ",
-#endif
-#ifdef EXT2_NOATIME_FL
-       "No_Atime, ",
-#endif
-       NULL};
-
-void print_flags (FILE * f, unsigned long flags, int long_format)
+void print_flags (FILE * f, unsigned long flags, unsigned options)
 {
-       int i;
-       const char ** flags_names;
-
-       if (long_format)
-               flags_names = long_flags;
-       else
-               flags_names = short_flags;
+       int long_opt = (options & PFOPT_LONG);
+       struct flags_name *fp;
+       int     first = 1;
 
-       for (i = 0; flags_array[i] != 0; i++)
-       {
-               if (flags & flags_array[i])
-                       fprintf (f, flags_names[i]);
-               else
-                       fprintf (f, "-");
+       for (fp = flags_array; fp->flag != 0; fp++) {
+               if (flags & fp->flag) {
+                       if (long_opt) {
+                               if (first)
+                                       first = 0;
+                               else
+                                       fputs(", ", f);
+                               fputs(fp->long_name, f);
+                       } else
+                               fputs(fp->short_name, f);
+               } else {
+                       if (!long_opt)
+                               fputs("-", f);
+               }
        }
+       if (long_opt && first)
+               fputs("---", f);
 }
+