print named file attribute flags in wimlib_print_dentry()
authorEric Biggers <ebiggers3@gmail.com>
Fri, 17 Aug 2012 16:06:05 +0000 (11:06 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 17 Aug 2012 16:06:05 +0000 (11:06 -0500)
src/dentry.c
src/dentry.h

index 5cdc002f60e12a99ac2ee289623e7dd351f850a5..1c93792fd9ed0556f9d0914336c4b386dac2e795 100644 (file)
@@ -309,14 +309,42 @@ int print_dentry_full_path(struct dentry *dentry, void *ignore)
        return 0;
 }
 
+struct file_attr_flag {
+       u32 flag;
+       const char *name;
+};
+struct file_attr_flag file_attr_flags[] = {
+       {WIM_FILE_ATTRIBUTE_READONLY,           "READONLY"},
+       {WIM_FILE_ATTRIBUTE_HIDDEN,             "HIDDEN"},
+       {WIM_FILE_ATTRIBUTE_SYSTEM,             "SYSTEM"},
+       {WIM_FILE_ATTRIBUTE_DIRECTORY,          "DIRECTORY"},
+       {WIM_FILE_ATTRIBUTE_ARCHIVE,            "ARCHIVE"},
+       {WIM_FILE_ATTRIBUTE_DEVICE,             "DEVICE"},
+       {WIM_FILE_ATTRIBUTE_NORMAL,             "NORMAL"},
+       {WIM_FILE_ATTRIBUTE_TEMPORARY,          "TEMPORARY"},
+       {WIM_FILE_ATTRIBUTE_SPARSE_FILE,        "SPARSE_FILE"},
+       {WIM_FILE_ATTRIBUTE_REPARSE_POINT,      "REPARSE_POINT"},
+       {WIM_FILE_ATTRIBUTE_COMPRESSED,         "COMPRESSED"},
+       {WIM_FILE_ATTRIBUTE_OFFLINE,            "OFFLINE"},
+       {WIM_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED,"NOT_CONTENT_INDEXED"},
+       {WIM_FILE_ATTRIBUTE_ENCRYPTED,          "ENCRYPTED"},
+       {WIM_FILE_ATTRIBUTE_VIRTUAL,            "VIRTUAL"},
+};
+
 /* Prints a directory entry.  @lookup_table is a pointer to the lookup table, or
  * NULL if the resource entry for the dentry is not to be printed. */
 int print_dentry(struct dentry *dentry, void *lookup_table)
 {
        struct lookup_table_entry *lte;
+       unsigned i;
+
        printf("[DENTRY]\n");
        printf("Length            = %"PRIu64"\n", dentry->length);
        printf("Attributes        = 0x%x\n", dentry->attributes);
+       for (i = 0; i < ARRAY_LEN(file_attr_flags); i++)
+               if (file_attr_flags[i].flag & dentry->attributes)
+                       printf("    WIM_FILE_ATTRIBUTE_%s is set\n",
+                               file_attr_flags[i].name);
 #ifdef ENABLE_SECURITY_DATA
        printf("Security ID       = %d\n", dentry->security_id);
 #endif
index cf36e2256ed5e7ed498f1128e78059009b59e9d7..51675295739e4a1b8303bb415b7d9a76499edfd8 100644 (file)
@@ -112,21 +112,21 @@ struct dentry {
        int refcnt;
 };
 
-#define WIM_FILE_ATTRIBUTE_READONLY            0x1
-#define WIM_FILE_ATTRIBUTE_HIDDEN              0x2
-#define WIM_FILE_ATTRIBUTE_SYSTEM              0x4
-#define WIM_FILE_ATTRIBUTE_DIRECTORY           0x10
-#define WIM_FILE_ATTRIBUTE_ARCHIVE             0x20
-#define WIM_FILE_ATTRIBUTE_DEVICE              0x40
-#define WIM_FILE_ATTRIBUTE_NORMAL              0x80
-#define WIM_FILE_ATTRIBUTE_TEMPORARY           0x100
-#define WIM_FILE_ATTRIBUTE_SPARSE_FILE         0x200
-#define WIM_FILE_ATTRIBUTE_REPARSE_POINT       0x400
-#define WIM_FILE_ATTRIBUTE_COMPRESSED          0x800
-#define WIM_FILE_ATTRIBUTE_OFFLINE             0x1000
-#define WIM_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x2000
-#define WIM_FILE_ATTRIBUTE_ENCRYPTED           0x4000
-#define WIM_FILE_ATTRIBUTE_VIRTUAL             0x10000
+#define WIM_FILE_ATTRIBUTE_READONLY            0x00000001
+#define WIM_FILE_ATTRIBUTE_HIDDEN              0x00000002
+#define WIM_FILE_ATTRIBUTE_SYSTEM              0x00000004
+#define WIM_FILE_ATTRIBUTE_DIRECTORY           0x00000010
+#define WIM_FILE_ATTRIBUTE_ARCHIVE             0x00000020
+#define WIM_FILE_ATTRIBUTE_DEVICE              0x00000040
+#define WIM_FILE_ATTRIBUTE_NORMAL              0x00000080
+#define WIM_FILE_ATTRIBUTE_TEMPORARY           0x00000100
+#define WIM_FILE_ATTRIBUTE_SPARSE_FILE         0x00000200
+#define WIM_FILE_ATTRIBUTE_REPARSE_POINT       0x00000400
+#define WIM_FILE_ATTRIBUTE_COMPRESSED          0x00000800
+#define WIM_FILE_ATTRIBUTE_OFFLINE             0x00001000
+#define WIM_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
+#define WIM_FILE_ATTRIBUTE_ENCRYPTED           0x00004000
+#define WIM_FILE_ATTRIBUTE_VIRTUAL             0x00010000
 
 extern void stbuf_to_dentry(const struct stat *stbuf, struct dentry *dentry);