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

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