added virtual query tag ability, fsnames query tag,
[platform/upstream/rpm.git] / lib / formats.c
index 2e0f101..a4d4e89 100644 (file)
@@ -13,9 +13,12 @@ static char * depflagsFormat(int_32 type, const void * data,
                             char * formatPrefix, int padding, int element);
 static char * fflagsFormat(int_32 type, const void * data, 
                           char * formatPrefix, int padding, int element);
+static int fsnamesTag(Header h, int_32 * type, void ** data, int_32 * count,
+                     int * freeData);
 static char * permsString(int mode);
 
 const struct headerSprintfExtension rpmHeaderFormats[] = {
+    { HEADER_EXT_TAG, "RPMTAG_FSNAMES", { fsnamesTag } },
     { HEADER_EXT_FORMAT, "depflags", { depflagsFormat } },
     { HEADER_EXT_FORMAT, "fflags", { fflagsFormat } },
     { HEADER_EXT_FORMAT, "perms", { permsFormat } },
@@ -145,3 +148,23 @@ static char * depflagsFormat(int_32 type, const void * data,
 
     return val;
 }
+
+static int fsnamesTag(Header h, int_32 * type, void ** data, int_32 * count,
+                     int * freeData) {
+    char ** list;
+    int i;
+
+    if (rpmGetFilesystemList(&list)) {
+       return 1;
+    }
+
+    *type = RPM_STRING_ARRAY_TYPE;
+    *((char ***) data) = list;
+
+    for (i = 0; list[i]; i++) ;
+    *count = i;
+
+    *freeData = 0;
+
+    return 0; 
+}