Whamcloud - gitweb
EX-9585 lipe: add lipe_find3 projid option
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 13 Apr 2024 05:38:00 +0000 (23:38 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 15 Apr 2024 09:56:35 +0000 (09:56 +0000)
Add an option to print the project ID for a file with the
"-printf" argument, both as long option %{projid} as well
as short option and "%LP" that is compatible with "lfs find".

Sort all of the existing and new options alphabetically so that
it is easier to see which ones are implemented in the future.

Update the lipe-find3.1 man page and add a test case.

Test-Parameters: trivial testlist=sanity-lipe-find3.sh
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I18d2d3cc161c8aa92eb27c33b06214b6f5ce7057
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54784
Reviewed-by: Vitaliy Kuznetsov <vkuznetsov@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lipe/man/lipe_find3.1
lipe/src/lipe_find3/lf3_parse_format.c

index 3446110..6ab7fc4 100644 (file)
@@ -297,15 +297,15 @@ Print \fIformat\fP to the standard output, interpreting '\e' escapes
 and '%' directives. The supported directives include most supported by
 \fBfind\fP(1) and the following extensions:
 .RS
-.IP %{fid}, %LF
+.IP %{stripe-count},%Lc
+stripe count of last instantiated component
+.IP %{fid},%LF
 file FID
-.IP %{projid}
-numerical project ID
-.IP %{mirror-count}, %LN
+.IP %{mirror-count},%LN
 FLR mirror count
-.IP %{stripe-count}, %Lc
-stripe count of last instantiated component
-.IP %{stripe-size}, %LS
+.IP %{projid},%LP
+numerical project ID
+.IP %{stripe-size},%LS
 stripe size of last instantiated component
 .IP %{xattr:NAME}
 contents of NAME xattr as a string
index 5d40f1e..b8725eb 100644 (file)
@@ -245,17 +245,20 @@ width:
        case 'L': /* formats like lfs find */
                c = fmt[n++];
                switch (c) {
-               case 'S':
-                       LF3_EMIT_N('d', "(lov-stripe-size)");
-                       break;
                case 'c':
                        LF3_EMIT_N('d', "(lov-stripe-count)");
                        break;
+               case 'F':
+                       LF3_EMIT_S('a', "(file-fid)");
+                       break;
                case 'N':
                        LF3_EMIT_N('d', "(lov-mirror-count)");
                        break;
-               case 'F':
-                       LF3_EMIT_S('a', "(file-fid)");
+               case 'P':
+                       LF3_EMIT_N('d', "(projid)");
+                       break;
+               case 'S':
+                       LF3_EMIT_N('d', "(lov-stripe-size)");
                        break;
                }
                break;
@@ -319,14 +322,14 @@ width:
                // pools
                if (strcmp(ext, "fid") == 0)
                        LF3_EMIT_S('a', "(file-fid)");
-               else if (strcmp(ext, "stripe-size") == 0)
-                       LF3_EMIT_N('d', "(lov-stripe-size)", ext);
-               else if (strcmp(ext, "stripe-count") == 0)
-                       LF3_EMIT_N('d', "(lov-stripe-count)", ext);
                else if (strcmp(ext, "mirror-count") == 0)
                        LF3_EMIT_N('d', "(lov-mirror-count)", ext);
                else if (strcmp(ext, "projid") == 0)
-                       LF3_EMIT_N('d', "(%s)", ext);
+                       LF3_EMIT_N('d', "(projid)", ext);
+               else if (strcmp(ext, "stripe-count") == 0)
+                       LF3_EMIT_N('d', "(lov-stripe-count)", ext);
+               else if (strcmp(ext, "stripe-size") == 0)
+                       LF3_EMIT_N('d', "(lov-stripe-size)", ext);
                else if (strstartswith(ext, "xattr:"))
                        LF3_EMIT_S('a', "(or (xattr-ref-string %Q) %Q)", ext + strlen("xattr:"), "");
                else