summaryrefslogtreecommitdiffstats
path: root/libmount/src/fs.c
diff options
context:
space:
mode:
authorTim Hildering2019-03-04 19:15:08 +0100
committerKarel Zak2019-03-08 11:40:20 +0100
commit9d5eb4c46405413a8dd69d01f4e094f4390944d1 (patch)
treec367420b5f2821714ae1eaf8bbde261f2825e6a9 /libmount/src/fs.c
parentsu: add note about ECHO on --pty (diff)
downloadkernel-qcow2-util-linux-9d5eb4c46405413a8dd69d01f4e094f4390944d1.tar.gz
kernel-qcow2-util-linux-9d5eb4c46405413a8dd69d01f4e094f4390944d1.tar.xz
kernel-qcow2-util-linux-9d5eb4c46405413a8dd69d01f4e094f4390944d1.zip
libmount: improve fs referencing in tables
* Added member 'struct libmnt_table *tab' to libmnt_fs structure. * Added 'mnt_fs_get_table()'. * Removed overhead from 'mnt_table_{insert,move,remove}_fs(). * Added check to 'mnt_table_set_iter()' that entry is member of table. [kzak@redhat.com: - add to libmount.sys - add to docs - cleanup commit message - set fs->tab = NULL before mnt_unref_fs() in mnt_table_remove_fs()] Signed-off-by: Tim Hildering <hilderingt@posteo.net> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/fs.c')
-rw-r--r--libmount/src/fs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libmount/src/fs.c b/libmount/src/fs.c
index 9971d6ae3..147398955 100644
--- a/libmount/src/fs.c
+++ b/libmount/src/fs.c
@@ -190,6 +190,7 @@ struct libmnt_fs *mnt_copy_fs(struct libmnt_fs *dest,
return NULL;
}
+ dest->tab = NULL;
dest->id = src->id;
dest->parent = src->parent;
dest->devno = src->devno;
@@ -446,6 +447,22 @@ int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path)
}
/**
+ * mnt_fs_get_table:
+ * @fs: table entry
+ * @tb: table that contains @fs
+ *
+ * Returns: 0 or negative number on error (if @fs or @tb is NULL).
+ */
+int mnt_fs_get_table(struct libmnt_fs *fs, struct libmnt_table **tb)
+{
+ if (!fs || !tb)
+ return -EINVAL;
+
+ *tb = fs->tab;
+ return 0;
+}
+
+/**
* mnt_fs_streq_target:
* @fs: fs
* @path: mount point