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

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