vfs: Export file system uuid via /proc/<pid>/mountinfo
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Sat, 29 Jan 2011 13:13:38 +0000 (18:43 +0530)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 15 Mar 2011 06:21:45 +0000 (02:21 -0400)
We add a per superblock uuid field. File systems should
update the uuid in the fill_super callback

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c
include/linux/fs.h

index d1edf26025dcb018ec434309aacc839f9dbf2cfb..dffe6f49ab93da1a30c767c5a8345bdf754f0102 100644 (file)
@@ -1002,6 +1002,18 @@ const struct seq_operations mounts_op = {
        .show   = show_vfsmnt
 };
 
+static int uuid_is_nil(u8 *uuid)
+{
+       int i;
+       u8  *cp = (u8 *)uuid;
+
+       for (i = 0; i < 16; i++) {
+               if (*cp++)
+                       return 0;
+       }
+       return 1;
+}
+
 static int show_mountinfo(struct seq_file *m, void *v)
 {
        struct proc_mounts *p = m->private;
@@ -1040,6 +1052,10 @@ static int show_mountinfo(struct seq_file *m, void *v)
        if (IS_MNT_UNBINDABLE(mnt))
                seq_puts(m, " unbindable");
 
+       if (!uuid_is_nil(mnt->mnt_sb->s_uuid))
+               /* print the uuid */
+               seq_printf(m, " uuid:%pU", mnt->mnt_sb->s_uuid);
+
        /* Filesystem specific data */
        seq_puts(m, " - ");
        show_type(m, sb);
index 3f64630c0e101851d49cefb98bbe8341e70fa571..f2143e0942c21969776cd86836d21fae0f1cc53f 100644 (file)
@@ -1408,6 +1408,7 @@ struct super_block {
        wait_queue_head_t       s_wait_unfrozen;
 
        char s_id[32];                          /* Informational name */
+       u8 s_uuid[16];                          /* UUID */
 
        void                    *s_fs_info;     /* Filesystem private info */
        fmode_t                 s_mode;