summaryrefslogtreecommitdiffstats
path: root/libmount/src/fs.c
diff options
context:
space:
mode:
authorKarel Zak2012-06-28 15:40:16 +0200
committerKarel Zak2012-06-28 15:40:16 +0200
commitf7f29b564073831c9d1a8cdf9deaf039c0bcb1b6 (patch)
treeb63b6c298626fea30d2461832cec42e48f56bc11 /libmount/src/fs.c
parentfindmnt: add --task <tid> option (diff)
downloadkernel-qcow2-util-linux-f7f29b564073831c9d1a8cdf9deaf039c0bcb1b6.tar.gz
kernel-qcow2-util-linux-f7f29b564073831c9d1a8cdf9deaf039c0bcb1b6.tar.xz
kernel-qcow2-util-linux-f7f29b564073831c9d1a8cdf9deaf039c0bcb1b6.zip
libmount: save task ID for mountinfo tiles
Add new function mnt_fs_get_tid() to get task ID for the given filesystem. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/fs.c')
-rw-r--r--libmount/src/fs.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libmount/src/fs.c b/libmount/src/fs.c
index 543ffb153..ff930806f 100644
--- a/libmount/src/fs.c
+++ b/libmount/src/fs.c
@@ -139,6 +139,7 @@ struct libmnt_fs *mnt_copy_fs(struct libmnt_fs *dest,
dest->id = src->id;
dest->parent = src->parent;
dest->devno = src->devno;
+ dest->tid = src->tid;
if (cpy_str_at_offset(dest, src, offsetof(struct libmnt_fs, source)))
goto err;
@@ -1158,6 +1159,18 @@ dev_t mnt_fs_get_devno(struct libmnt_fs *fs)
}
/**
+ * mnt_fs_get_tid:
+ * @fs: /proc/<tid>/mountinfo entry
+ *
+ * Returns: TID (task ID) for filesystems read from mountinfo file
+ */
+pid_t mnt_fs_get_tid(struct libmnt_fs *fs)
+{
+ assert(fs);
+ return fs ? fs->tid : 0;
+}
+
+/**
* mnt_fs_get_option:
* @fs: fstab/mtab/mountinfo entry pointer
* @name: option name
@@ -1406,7 +1419,10 @@ int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file)
fprintf(file, "parent: %d\n", mnt_fs_get_parent_id(fs));
if (mnt_fs_get_devno(fs))
fprintf(file, "devno: %d:%d\n", major(mnt_fs_get_devno(fs)),
- minor(mnt_fs_get_devno(fs)));
+ minor(mnt_fs_get_devno(fs)));
+ if (mnt_fs_get_tid(fs))
+ fprintf(file, "tid: %d\n", mnt_fs_get_tid(fs));
+
return 0;
}