Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/e2fsprogs/e2fs_lib.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 532 by niro, Sat Sep 1 22:45:15 2007 UTC revision 816 by niro, Fri Apr 24 18:33:46 2009 UTC
# Line 12  Line 12 
12  #define HAVE_EXT2_IOCTLS 1  #define HAVE_EXT2_IOCTLS 1
13    
14  #if INT_MAX == LONG_MAX  #if INT_MAX == LONG_MAX
15  #define IF_LONG_IS_SAME(x) x  #define IF_LONG_IS_SAME(...) __VA_ARGS__
16  #define IF_LONG_IS_WIDER(x)  #define IF_LONG_IS_WIDER(...)
17  #else  #else
18  #define IF_LONG_IS_SAME(x)  #define IF_LONG_IS_SAME(...)
19  #define IF_LONG_IS_WIDER(x) x  #define IF_LONG_IS_WIDER(...) __VA_ARGS__
20  #endif  #endif
21    
22  static void close_silently(int fd)  static void close_silently(int fd)
# Line 141  int fgetsetflags(const char *name, unsig Line 141  int fgetsetflags(const char *name, unsig
141    
142    
143  /* Print file attributes on an ext2 file system */  /* Print file attributes on an ext2 file system */
144  struct flags_name {  const uint32_t e2attr_flags_value[] = {
145   unsigned long flag;  #ifdef ENABLE_COMPRESSION
146   char short_name;   EXT2_COMPRBLK_FL,
147   const char *long_name;   EXT2_DIRTY_FL,
148     EXT2_NOCOMPR_FL,
149     EXT2_ECOMPR_FL,
150    #endif
151     EXT2_INDEX_FL,
152     EXT2_SECRM_FL,
153     EXT2_UNRM_FL,
154     EXT2_SYNC_FL,
155     EXT2_DIRSYNC_FL,
156     EXT2_IMMUTABLE_FL,
157     EXT2_APPEND_FL,
158     EXT2_NODUMP_FL,
159     EXT2_NOATIME_FL,
160     EXT2_COMPR_FL,
161     EXT3_JOURNAL_DATA_FL,
162     EXT2_NOTAIL_FL,
163     EXT2_TOPDIR_FL
164  };  };
165    
166  static const struct flags_name flags_array[] = {  const char e2attr_flags_sname[] =
  { EXT2_SECRM_FL, 's', "Secure_Deletion" },  
  { EXT2_UNRM_FL, 'u' , "Undelete" },  
  { EXT2_SYNC_FL, 'S', "Synchronous_Updates" },  
  { EXT2_DIRSYNC_FL, 'D', "Synchronous_Directory_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" },  
167  #ifdef ENABLE_COMPRESSION  #ifdef ENABLE_COMPRESSION
168   { EXT2_COMPRBLK_FL, 'B', "Compressed_File" },   "BZXE"
  { EXT2_DIRTY_FL, 'Z', "Compressed_Dirty_File" },  
  { EXT2_NOCOMPR_FL, 'X', "Compression_Raw_Access" },  
  { EXT2_ECOMPR_FL, 'E', "Compression_Error" },  
169  #endif  #endif
170   { EXT3_JOURNAL_DATA_FL, 'j', "Journaled_Data" },   "I"
171   { EXT2_INDEX_FL, 'I', "Indexed_directory" },   "suSDiadAcjtT";
172   { EXT2_NOTAIL_FL, 't', "No_Tailmerging" },  
173   { EXT2_TOPDIR_FL, 'T', "Top_of_Directory_Hierarchies" },  static const char e2attr_flags_lname[] =
174   { 0, '\0', NULL }  #ifdef ENABLE_COMPRESSION
175  };   "Compressed_File" "\0"
176     "Compressed_Dirty_File" "\0"
177     "Compression_Raw_Access" "\0"
178     "Compression_Error" "\0"
179    #endif
180     "Indexed_directory" "\0"
181     "Secure_Deletion" "\0"
182     "Undelete" "\0"
183     "Synchronous_Updates" "\0"
184     "Synchronous_Directory_Updates" "\0"
185     "Immutable" "\0"
186     "Append_Only" "\0"
187     "No_Dump" "\0"
188     "No_Atime" "\0"
189     "Compression_Requested" "\0"
190     "Journaled_Data" "\0"
191     "No_Tailmerging" "\0"
192     "Top_of_Directory_Hierarchies" "\0"
193     /* Another trailing NUL is added by compiler */;
194    
195  void print_flags(FILE *f, unsigned long flags, unsigned options)  void print_e2flags(FILE *f, unsigned long flags, unsigned options)
196  {  {
197   const struct flags_name *fp;   const uint32_t *fv;
198     const char *fn;
199    
200     fv = e2attr_flags_value;
201   if (options & PFOPT_LONG) {   if (options & PFOPT_LONG) {
202   int first = 1;   int first = 1;
203   for (fp = flags_array; fp->short_name; fp++) {   fn = e2attr_flags_lname;
204   if (flags & fp->flag) {   do {
205     if (flags & *fv) {
206   if (!first)   if (!first)
207   fputs(", ", f);   fputs(", ", f);
208   fputs(fp->long_name, f);   fputs(fn, f);
209   first = 0;   first = 0;
210   }   }
211   }   fv++;
212     fn += strlen(fn) + 1;
213     } while (*fn);
214   if (first)   if (first)
215   fputs("---", f);   fputs("---", f);
216   } else {   } else {
217   for (fp = flags_array; fp->short_name; fp++) {   fn = e2attr_flags_sname;
218     do  {
219   char c = '-';   char c = '-';
220   if (flags & fp->flag)   if (flags & *fv)
221   c = fp->short_name;   c = *fn;
222   fputc(c, f);   fputc(c, f);
223   }   fv++;
224     fn++;
225     } while (*fn);
226   }   }
227  }  }

Legend:
Removed from v.532  
changed lines
  Added in v.816