Blame SOURCES/autofs-5.1.3-add-function-ext_mount_inuse.patch

304803
autofs-5.1.3 - add function ext_mount_inuse()
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
Add function to check if a path is an amd externally managed mount.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG        |    1 +
304803
 include/mounts.h |    1 +
304803
 lib/mounts.c     |   17 +++++++++++++++++
304803
 3 files changed, 19 insertions(+)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -279,6 +279,7 @@
304803
 - fix possible memory leak during amd parse.
304803
 - remove path restriction of amd external mount.
304803
 - add function umount_amd_ext_mount().
304803
+- add function ext_mount_inuse().
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/include/mounts.h
304803
+++ autofs-5.0.7/include/mounts.h
304803
@@ -98,6 +98,7 @@ char *make_options_string(char *path, in
304803
 char *make_mnt_name_string(char *path);
304803
 int ext_mount_add(struct list_head *, const char *, unsigned int);
304803
 int ext_mount_remove(struct list_head *, const char *);
304803
+int ext_mount_inuse(const char *);
304803
 struct mnt_list *get_mnt_list(const char *table, const char *path, int include);
304803
 struct mnt_list *reverse_mnt_list(struct mnt_list *list);
304803
 void free_mnt_list(struct mnt_list *list);
304803
--- autofs-5.0.7.orig/lib/mounts.c
304803
+++ autofs-5.0.7/lib/mounts.c
304803
@@ -768,6 +768,23 @@ done:
304803
 	return ret;
304803
 }
304803
 
304803
+int ext_mount_inuse(const char *path)
304803
+{
304803
+	struct ext_mount *em;
304803
+	int ret = 0;
304803
+
304803
+	pthread_mutex_lock(&ext_mount_hash_mutex);
304803
+	em = ext_mount_lookup(path);
304803
+	if (!em)
304803
+		goto done;
304803
+
304803
+	if (!list_empty(&em->mounts))
304803
+		ret = 1;
304803
+done:
304803
+	pthread_mutex_unlock(&ext_mount_hash_mutex);
304803
+	return ret;
304803
+}
304803
+
304803
 /*
304803
  * Get list of mounts under path in longest->shortest order
304803
  */