summaryrefslogtreecommitdiffstats
path: root/include/list.h
diff options
context:
space:
mode:
authorKarel Zak2012-03-09 13:11:24 +0100
committerKarel Zak2012-03-09 13:11:24 +0100
commit7293e97a42586ba552497bf7c8ab21e15b114541 (patch)
treeac979c32ed0db7c8e9c3d0fcc077d0432b45216f /include/list.h
parentlsblk: add --version switch (diff)
downloadkernel-qcow2-util-linux-7293e97a42586ba552497bf7c8ab21e15b114541.tar.gz
kernel-qcow2-util-linux-7293e97a42586ba552497bf7c8ab21e15b114541.tar.xz
kernel-qcow2-util-linux-7293e97a42586ba552497bf7c8ab21e15b114541.zip
libmount: fix "already mounted" detection on systems with mtab
For systems with regular mtab the fs->root should be ignored in "already mounted" heuristic. Reported-by: Matt Burgess <matthew@linuxfromscratch.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/list.h')
-rw-r--r--include/list.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/list.h b/include/list.h
index 3ce46caa2..d8c3bf018 100644
--- a/include/list.h
+++ b/include/list.h
@@ -166,6 +166,10 @@ _INLINE_ void list_splice(struct list_head *list, struct list_head *head)
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+#define list_first_entry(head, type, member) \
+ ((head) && (head)->next != (head) ? list_entry((head)->next, type, member) : NULL)
+
/**
* list_for_each - iterate over elements in a list
* @pos: the &struct list_head to use as a loop counter.