Blame SOURCES/autofs-5.1.4-use-defines-for-expire-type.patch

beb904
autofs-5.1.4 - use defines for expire type
beb904
beb904
From: Ian Kent <raven@themaw.net>
beb904
beb904
The kernel defines for expire type such as an immediate expire
beb904
shoule be used to clearify what is being requested.
beb904
beb904
AUTOFS_EXP_IMMEDIATE corresponds to a SIGUSR1 prune operation.
beb904
beb904
AUTOFS_EXP_FORCE corresponds to an expire type not yet implemented in
beb904
the kernel, a SIGUSR2 forced expire. Define it in our internal autofs
beb904
kernel include file, the kernel will ignore it if it doesn't support it.
beb904
beb904
AUTOFS_EXP_LEAVES is no longer used in autofs version 5.
beb904
beb904
Finally add a define AUTOFS_EXP_NORMAL to indicate we're perfoming a
beb904
normal expire.
beb904
beb904
Signed-off-by: Ian Kent <raven@themaw.net>
beb904
---
beb904
 CHANGELOG                |    1 +
beb904
 daemon/state.c           |    8 ++++----
beb904
 include/linux/auto_fs4.h |    6 ++++--
beb904
 include/state.h          |    2 +-
beb904
 4 files changed, 10 insertions(+), 7 deletions(-)
beb904
beb904
--- autofs-5.1.4.orig/CHANGELOG
beb904
+++ autofs-5.1.4/CHANGELOG
beb904
@@ -111,6 +111,7 @@ xx/xx/2018 autofs-5.1.5
beb904
 - use a valid timeout in lookup_prune_one_cache().
beb904
 - dont prune offset map entries.
beb904
 - simplify sss source stale check.
beb904
+- use defines for expire type.
beb904
 
beb904
 19/12/2017 autofs-5.1.4
beb904
 - fix spec file url.
beb904
--- autofs-5.1.4.orig/daemon/state.c
beb904
+++ autofs-5.1.4/daemon/state.c
beb904
@@ -634,7 +634,7 @@ static unsigned int st_prepare_shutdown(
beb904
 	ap->state = ST_SHUTDOWN_PENDING;
beb904
 
beb904
 	/* Unmount everything */
beb904
-	exp = expire_proc(ap, 1);
beb904
+	exp = expire_proc(ap, AUTOFS_EXP_IMMEDIATE);
beb904
 	switch (exp) {
beb904
 	case EXP_ERROR:
beb904
 	case EXP_PARTIAL:
beb904
@@ -660,7 +660,7 @@ static unsigned int st_force_shutdown(st
beb904
 	ap->state = ST_SHUTDOWN_FORCE;
beb904
 
beb904
 	/* Unmount everything */
beb904
-	exp = expire_proc(ap, 1);
beb904
+	exp = expire_proc(ap, AUTOFS_EXP_FORCE | AUTOFS_EXP_IMMEDIATE);
beb904
 	switch (exp) {
beb904
 	case EXP_ERROR:
beb904
 	case EXP_PARTIAL:
beb904
@@ -695,7 +695,7 @@ static unsigned int st_prune(struct auto
beb904
 	assert(ap->state == ST_READY);
beb904
 	ap->state = ST_PRUNE;
beb904
 
beb904
-	switch (expire_proc(ap, 1)) {
beb904
+	switch (expire_proc(ap, AUTOFS_EXP_IMMEDIATE)) {
beb904
 	case EXP_ERROR:
beb904
 	case EXP_PARTIAL:
beb904
 		if (!ap->submount)
beb904
@@ -716,7 +716,7 @@ static unsigned int st_expire(struct aut
beb904
 	assert(ap->state == ST_READY);
beb904
 	ap->state = ST_EXPIRE;
beb904
 
beb904
-	switch (expire_proc(ap, 0)) {
beb904
+	switch (expire_proc(ap, AUTOFS_EXP_NORMAL)) {
beb904
 	case EXP_ERROR:
beb904
 	case EXP_PARTIAL:
beb904
 		if (!ap->submount)
beb904
--- autofs-5.1.4.orig/include/linux/auto_fs4.h
beb904
+++ autofs-5.1.4/include/linux/auto_fs4.h
beb904
@@ -27,8 +27,10 @@
beb904
 #define AUTOFS_PROTO_SUBVERSION		2
beb904
 
beb904
 /* Mask for expire behaviour */
beb904
-#define AUTOFS_EXP_IMMEDIATE		1
beb904
-#define AUTOFS_EXP_LEAVES		2
beb904
+#define AUTOFS_EXP_NORMAL		0x00
beb904
+#define AUTOFS_EXP_IMMEDIATE		0x01
beb904
+#define AUTOFS_EXP_LEAVES		0x02
beb904
+#define AUTOFS_EXP_FORCE		0x04
beb904
 
beb904
 #define AUTOFS_TYPE_ANY			0U
beb904
 #define AUTOFS_TYPE_INDIRECT		1U
beb904
--- autofs-5.1.4.orig/include/state.h
beb904
+++ autofs-5.1.4/include/state.h
beb904
@@ -55,7 +55,7 @@ struct expire_args {
beb904
 	unsigned int signaled;
beb904
 	struct autofs_point *ap; /* autofs mount we are working on */
beb904
 	enum states state;	 /* State prune or expire */
beb904
-	unsigned int how;	 /* Normal, immediate expire ? */
beb904
+	unsigned int how;	 /* Normal, immediate, forced expire ? */
beb904
 	int status;		 /* Return status */
beb904
 };
beb904