]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: add FREQ and PASSNO columns
authorKarel Zak <kzak@redhat.com>
Thu, 14 Mar 2013 09:50:37 +0000 (10:50 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 14 Mar 2013 09:50:37 +0000 (10:50 +0100)
 ... to provide all information from fstab.

Reported-by: Roger Leigh <rleigh@codelibre.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/findmnt.c

index 506fd726de8e96aa3050284484856ded1a55bf59..4fbcd8c155f5c12a0c156b61412d9edd1bccfaa2 100644 (file)
@@ -86,6 +86,8 @@ enum {
        COL_ID,
        COL_OPT_FIELDS,
        COL_PROPAGATION,
+       COL_FREQ,
+       COL_PASSNO,
 
        FINDMNT_NCOLUMNS
 };
@@ -130,7 +132,9 @@ static struct colinfo infos[FINDMNT_NCOLUMNS] = {
        [COL_TID]          = { "TID",             4, TT_FL_RIGHT, N_("task ID") },
        [COL_ID]           = { "ID",              2, TT_FL_RIGHT, N_("mount ID") },
        [COL_OPT_FIELDS]   = { "OPT-FIELDS",   0.10, TT_FL_TRUNC, N_("optional mount fields") },
-       [COL_PROPAGATION]  = { "PROPAGATION",  0.10, 0, N_("VFS propagation flags") }
+       [COL_PROPAGATION]  = { "PROPAGATION",  0.10, 0, N_("VFS propagation flags") },
+       [COL_FREQ]         = { "FREQ",            1, TT_FL_RIGHT, N_("dump(8) frequency in days [fstab only]") },
+       [COL_PASSNO]       = { "PASSNO",          1, TT_FL_RIGHT, N_("pass number on parallel fsck(8) [fstab only]") }
 };
 
 /* global flags */
@@ -579,6 +583,18 @@ static const char *get_data(struct libmnt_fs *fs, int num)
                        str = n;
                }
                break;
+       case COL_FREQ:
+               if (!mnt_fs_is_kernel(fs)) {
+                       xasprintf(&tmp, "%d", mnt_fs_get_freq(fs));
+                       str = tmp;
+               }
+               break;
+       case COL_PASSNO:
+               if (!mnt_fs_is_kernel(fs)) {
+                       xasprintf(&tmp, "%d", mnt_fs_get_passno(fs));
+                       str = tmp;
+               }
+               break;
        default:
                break;
        }