Ian Kent cc58c1
autofs-5.0.6 - update ->timeout() function to not return timeout
Ian Kent cc58c1
Ian Kent cc58c1
From: Ian Kent <ikent@redhat.com>
Ian Kent cc58c1
Ian Kent cc58c1
The value returned by the ->timeout() autofs control interface
Ian Kent cc58c1
function is not used so make that usage explict by not using a
Ian Kent cc58c1
pass by address parameter. This saves having to take care to
Ian Kent cc58c1
always use a temporary storage location when using the function.
Ian Kent cc58c1
---
Ian Kent cc58c1
Ian Kent cc58c1
 CHANGELOG               |    1 +
Ian Kent cc58c1
 daemon/direct.c         |    6 +++---
Ian Kent cc58c1
 daemon/indirect.c       |    2 +-
Ian Kent cc58c1
 include/dev-ioctl-lib.h |    2 +-
Ian Kent cc58c1
 lib/dev-ioctl-lib.c     |   15 +++++++--------
Ian Kent cc58c1
 lib/master_parse.y      |    3 +--
Ian Kent cc58c1
 lib/mounts.c            |    4 ++--
Ian Kent cc58c1
 7 files changed, 16 insertions(+), 17 deletions(-)
Ian Kent cc58c1
Ian Kent cc58c1
Ian Kent cc58c1
--- autofs-5.0.6.orig/CHANGELOG
Ian Kent cc58c1
+++ autofs-5.0.6/CHANGELOG
Ian Kent cc58c1
@@ -44,6 +44,7 @@
Ian Kent cc58c1
 - fix libtirpc name clash.
Ian Kent cc58c1
 - report map not read when debug logging.
Ian Kent cc58c1
 - duplicate parent options for included maps.
Ian Kent cc58c1
+- update ->timeout() function to not return timeout.
Ian Kent cc58c1
 
Ian Kent cc58c1
 28/06/2011 autofs-5.0.6
Ian Kent cc58c1
 -----------------------
Ian Kent cc58c1
--- autofs-5.0.6.orig/daemon/direct.c
Ian Kent cc58c1
+++ autofs-5.0.6/daemon/direct.c
Ian Kent cc58c1
@@ -302,7 +302,7 @@ static int unlink_active_mounts(struct a
Ian Kent cc58c1
 				return 0;
Ian Kent cc58c1
 			}
Ian Kent cc58c1
 
Ian Kent cc58c1
-			ops->timeout(ap->logopt, ioctlfd, &tout);
Ian Kent cc58c1
+			ops->timeout(ap->logopt, ioctlfd, tout);
Ian Kent cc58c1
 
Ian Kent cc58c1
 			if (save_ioctlfd == -1)
Ian Kent cc58c1
 				ops->close(ap->logopt, ioctlfd);
Ian Kent cc58c1
@@ -424,7 +424,7 @@ int do_mount_autofs_direct(struct autofs
Ian Kent cc58c1
 		goto out_umount;
Ian Kent cc58c1
 	}
Ian Kent cc58c1
 
Ian Kent cc58c1
-	ops->timeout(ap->logopt, ioctlfd, &timeout);
Ian Kent cc58c1
+	ops->timeout(ap->logopt, ioctlfd, timeout);
Ian Kent cc58c1
 	notify_mount_result(ap, me->key, str_direct);
Ian Kent cc58c1
 	cache_set_ino_index(me->mc, me->key, st.st_dev, st.st_ino);
Ian Kent cc58c1
 	ops->close(ap->logopt, ioctlfd);
Ian Kent cc58c1
@@ -771,7 +771,7 @@ int mount_autofs_offset(struct autofs_po
Ian Kent cc58c1
 		goto out_umount;
Ian Kent cc58c1
 	}
Ian Kent cc58c1
 
Ian Kent cc58c1
-	ops->timeout(ap->logopt, ioctlfd, &timeout);
Ian Kent cc58c1
+	ops->timeout(ap->logopt, ioctlfd, timeout);
Ian Kent cc58c1
 	cache_set_ino_index(me->mc, me->key, st.st_dev, st.st_ino);
Ian Kent cc58c1
 	if (ap->logopt & LOGOPT_DEBUG)
Ian Kent cc58c1
 		notify_mount_result(ap, mountpoint, str_offset);
Ian Kent cc58c1
--- autofs-5.0.6.orig/daemon/indirect.c
Ian Kent cc58c1
+++ autofs-5.0.6/daemon/indirect.c
Ian Kent cc58c1
@@ -172,7 +172,7 @@ static int do_mount_autofs_indirect(stru
Ian Kent cc58c1
 	ap->dev = st.st_dev;	/* Device number for mount point checks */
Ian Kent cc58c1
 	ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
Ian Kent cc58c1
 
Ian Kent cc58c1
-	ops->timeout(ap->logopt, ap->ioctlfd, &timeout);
Ian Kent cc58c1
+	ops->timeout(ap->logopt, ap->ioctlfd, timeout);
Ian Kent cc58c1
 	if (ap->logopt & LOGOPT_DEBUG)
Ian Kent cc58c1
 		notify_mount_result(ap, root, str_indirect);
Ian Kent cc58c1
 	else
Ian Kent cc58c1
--- autofs-5.0.6.orig/include/dev-ioctl-lib.h
Ian Kent cc58c1
+++ autofs-5.0.6/include/dev-ioctl-lib.h
Ian Kent cc58c1
@@ -45,7 +45,7 @@ struct ioctl_ops {
Ian Kent cc58c1
 	int (*send_fail)(unsigned int, int, unsigned int, int);
Ian Kent cc58c1
 	int (*setpipefd)(unsigned int, int, int);
Ian Kent cc58c1
 	int (*catatonic)(unsigned int, int);
Ian Kent cc58c1
-	int (*timeout)(unsigned int, int, time_t *);
Ian Kent cc58c1
+	int (*timeout)(unsigned int, int, time_t);
Ian Kent cc58c1
 	int (*requestor)(unsigned int, int, const char *, uid_t *, gid_t *);
Ian Kent cc58c1
 	int (*expire)(unsigned int, int, const char *, unsigned int);
Ian Kent cc58c1
 	int (*askumount)(unsigned int, int, unsigned int *);
Ian Kent cc58c1
--- autofs-5.0.6.orig/lib/dev-ioctl-lib.c
Ian Kent cc58c1
+++ autofs-5.0.6/lib/dev-ioctl-lib.c
Ian Kent cc58c1
@@ -55,7 +55,7 @@ static int dev_ioctl_send_ready(unsigned
Ian Kent cc58c1
 static int dev_ioctl_send_fail(unsigned int, int, unsigned int, int);
Ian Kent cc58c1
 static int dev_ioctl_setpipefd(unsigned int, int, int);
Ian Kent cc58c1
 static int dev_ioctl_catatonic(unsigned int, int);
Ian Kent cc58c1
-static int dev_ioctl_timeout(unsigned int, int, time_t *);
Ian Kent cc58c1
+static int dev_ioctl_timeout(unsigned int, int, time_t);
Ian Kent cc58c1
 static int dev_ioctl_requestor(unsigned int, int, const char *, uid_t *, gid_t *);
Ian Kent cc58c1
 static int dev_ioctl_expire(unsigned int, int, const char *, unsigned int);
Ian Kent cc58c1
 static int dev_ioctl_askumount(unsigned int, int, unsigned int *);
Ian Kent cc58c1
@@ -69,7 +69,7 @@ static int ioctl_close(unsigned int, int
Ian Kent cc58c1
 static int ioctl_send_ready(unsigned int, int, unsigned int);
Ian Kent cc58c1
 static int ioctl_send_fail(unsigned int, int, unsigned int, int);
Ian Kent cc58c1
 static int ioctl_catatonic(unsigned int, int);
Ian Kent cc58c1
-static int ioctl_timeout(unsigned int, int, time_t *);
Ian Kent cc58c1
+static int ioctl_timeout(unsigned int, int, time_t);
Ian Kent cc58c1
 static int ioctl_expire(unsigned int, int, const char *, unsigned int);
Ian Kent cc58c1
 static int ioctl_askumount(unsigned int, int, unsigned int *);
Ian Kent cc58c1
 
Ian Kent cc58c1
@@ -577,25 +577,24 @@ static int ioctl_catatonic(unsigned int
Ian Kent cc58c1
 }
Ian Kent cc58c1
 
Ian Kent cc58c1
 /* Set the autofs mount timeout */
Ian Kent cc58c1
-static int dev_ioctl_timeout(unsigned int logopt, int ioctlfd, time_t *timeout)
Ian Kent cc58c1
+static int dev_ioctl_timeout(unsigned int logopt, int ioctlfd, time_t timeout)
Ian Kent cc58c1
 {
Ian Kent cc58c1
 	struct autofs_dev_ioctl param;
Ian Kent cc58c1
 
Ian Kent cc58c1
 	init_autofs_dev_ioctl(¶m;;
Ian Kent cc58c1
 	param.ioctlfd = ioctlfd;
Ian Kent cc58c1
-	param.timeout.timeout = *timeout;
Ian Kent cc58c1
+	param.timeout.timeout = timeout;
Ian Kent cc58c1
 
Ian Kent cc58c1
 	if (ioctl(ctl.devfd, AUTOFS_DEV_IOCTL_TIMEOUT, &param) == -1)
Ian Kent cc58c1
 		return -1;
Ian Kent cc58c1
 
Ian Kent cc58c1
-	*timeout = param.timeout.timeout;
Ian Kent cc58c1
-
Ian Kent cc58c1
 	return 0;
Ian Kent cc58c1
 }
Ian Kent cc58c1
 
Ian Kent cc58c1
-static int ioctl_timeout(unsigned int logopt, int ioctlfd, time_t *timeout)
Ian Kent cc58c1
+static int ioctl_timeout(unsigned int logopt, int ioctlfd, time_t timeout)
Ian Kent cc58c1
 {
Ian Kent cc58c1
-	return ioctl(ioctlfd, AUTOFS_IOC_SETTIMEOUT, timeout);
Ian Kent cc58c1
+	time_t tout = timeout;
Ian Kent cc58c1
+	return ioctl(ioctlfd, AUTOFS_IOC_SETTIMEOUT, &tout);
Ian Kent cc58c1
 }
Ian Kent cc58c1
 
Ian Kent cc58c1
 /*
Ian Kent cc58c1
--- autofs-5.0.6.orig/lib/master_parse.y
Ian Kent cc58c1
+++ autofs-5.0.6/lib/master_parse.y
Ian Kent cc58c1
@@ -801,7 +801,6 @@ int master_parse_entry(const char *buffe
Ian Kent cc58c1
 	} else {
Ian Kent cc58c1
 		struct ioctl_ops *ops = get_ioctl_ops();
Ian Kent cc58c1
 		struct autofs_point *ap = entry->ap;
Ian Kent cc58c1
-		time_t tout = timeout;
Ian Kent cc58c1
 
Ian Kent cc58c1
 		/*
Ian Kent cc58c1
 		 * Second and subsequent instances of a mount point
Ian Kent cc58c1
@@ -811,7 +810,7 @@ int master_parse_entry(const char *buffe
Ian Kent cc58c1
 			ap->exp_timeout = timeout;
Ian Kent cc58c1
 			ap->exp_runfreq = (ap->exp_timeout + CHECK_RATIO - 1) / CHECK_RATIO;
Ian Kent cc58c1
 			if (ap->ioctlfd != -1 && ap->type == LKP_INDIRECT)
Ian Kent cc58c1
-				ops->timeout(ap->logopt, ap->ioctlfd, &tout);
Ian Kent cc58c1
+				ops->timeout(ap->logopt, ap->ioctlfd, timeout);
Ian Kent cc58c1
 		}
Ian Kent cc58c1
 	}
Ian Kent cc58c1
 	if (random_selection)
Ian Kent cc58c1
--- autofs-5.0.6.orig/lib/mounts.c
Ian Kent cc58c1
+++ autofs-5.0.6/lib/mounts.c
Ian Kent cc58c1
@@ -1404,7 +1404,7 @@ static int remount_active_mount(struct a
Ian Kent cc58c1
 
Ian Kent cc58c1
 	/* Re-reading the map, set timeout and return */
Ian Kent cc58c1
 	if (ap->state == ST_READMAP) {
Ian Kent cc58c1
-		ops->timeout(ap->logopt, fd, &timeout);
Ian Kent cc58c1
+		ops->timeout(ap->logopt, fd, timeout);
Ian Kent cc58c1
 		ops->close(ap->logopt, fd);
Ian Kent cc58c1
 		return REMOUNT_READ_MAP;
Ian Kent cc58c1
 	}
Ian Kent cc58c1
@@ -1426,7 +1426,7 @@ static int remount_active_mount(struct a
Ian Kent cc58c1
 		ops->close(ap->logopt, fd);
Ian Kent cc58c1
 		return REMOUNT_OPEN_FAIL;
Ian Kent cc58c1
 	}
Ian Kent cc58c1
-	ops->timeout(ap->logopt, fd, &timeout);
Ian Kent cc58c1
+	ops->timeout(ap->logopt, fd, timeout);
Ian Kent cc58c1
 	if (fstat(fd, &st) == -1) {
Ian Kent cc58c1
 		error(ap->logopt,
Ian Kent cc58c1
 		      "failed to stat %s mount %s", str_type, path);