autofs-5.1.4 - use defines for expire type From: Ian Kent The kernel defines for expire type such as an immediate expire shoule be used to clearify what is being requested. AUTOFS_EXP_IMMEDIATE corresponds to a SIGUSR1 prune operation. AUTOFS_EXP_FORCE corresponds to an expire type not yet implemented in the kernel, a SIGUSR2 forced expire. Define it in our internal autofs kernel include file, the kernel will ignore it if it doesn't support it. AUTOFS_EXP_LEAVES is no longer used in autofs version 5. Finally add a define AUTOFS_EXP_NORMAL to indicate we're perfoming a normal expire. Signed-off-by: Ian Kent --- CHANGELOG | 1 + daemon/state.c | 8 ++++---- include/linux/auto_fs4.h | 6 ++++-- include/state.h | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c5ebb7e0..0b7983ea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -28,6 +28,7 @@ xx/xx/2018 autofs-5.1.5 - fix fd leak in rpc_do_create_client(). - add-man page note about extra slashes in paths. - change expire type naming to better reflect usage. +- use defines for expire type. 19/12/2017 autofs-5.1.4 - fix spec file url. diff --git a/daemon/state.c b/daemon/state.c index ab235455..3d91f5b1 100644 --- a/daemon/state.c +++ b/daemon/state.c @@ -645,7 +645,7 @@ static unsigned int st_prepare_shutdown(struct autofs_point *ap) ap->state = ST_SHUTDOWN_PENDING; /* Unmount everything */ - exp = expire_proc(ap, 1); + exp = expire_proc(ap, AUTOFS_EXP_IMMEDIATE); switch (exp) { case EXP_ERROR: case EXP_PARTIAL: @@ -671,7 +671,7 @@ static unsigned int st_force_shutdown(struct autofs_point *ap) ap->state = ST_SHUTDOWN_FORCE; /* Unmount everything */ - exp = expire_proc(ap, 1); + exp = expire_proc(ap, AUTOFS_EXP_FORCE | AUTOFS_EXP_IMMEDIATE); switch (exp) { case EXP_ERROR: case EXP_PARTIAL: @@ -706,7 +706,7 @@ static unsigned int st_prune(struct autofs_point *ap) assert(ap->state == ST_READY); ap->state = ST_PRUNE; - switch (expire_proc(ap, 1)) { + switch (expire_proc(ap, AUTOFS_EXP_IMMEDIATE)) { case EXP_ERROR: case EXP_PARTIAL: if (!ap->submount) @@ -727,7 +727,7 @@ static unsigned int st_expire(struct autofs_point *ap) assert(ap->state == ST_READY); ap->state = ST_EXPIRE; - switch (expire_proc(ap, 0)) { + switch (expire_proc(ap, AUTOFS_EXP_NORMAL)) { case EXP_ERROR: case EXP_PARTIAL: if (!ap->submount) diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h index e02982fa..9196e7bb 100644 --- a/include/linux/auto_fs4.h +++ b/include/linux/auto_fs4.h @@ -27,8 +27,10 @@ #define AUTOFS_PROTO_SUBVERSION 2 /* Mask for expire behaviour */ -#define AUTOFS_EXP_IMMEDIATE 1 -#define AUTOFS_EXP_LEAVES 2 +#define AUTOFS_EXP_NORMAL 0x00 +#define AUTOFS_EXP_IMMEDIATE 0x01 +#define AUTOFS_EXP_LEAVES 0x02 +#define AUTOFS_EXP_FORCE 0x04 #define AUTOFS_TYPE_ANY 0U #define AUTOFS_TYPE_INDIRECT 1U diff --git a/include/state.h b/include/state.h index e3079c20..98f27d3f 100644 --- a/include/state.h +++ b/include/state.h @@ -55,7 +55,7 @@ struct expire_args { unsigned int signaled; struct autofs_point *ap; /* autofs mount we are working on */ enum states state; /* State prune or expire */ - unsigned int how; /* Normal, immediate expire ? */ + unsigned int how; /* Normal, immediate, forced expire ? */ int status; /* Return status */ };