From d335c636e25d268631c8408cf6b1aa04b6043f88 Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Fri, 14 Jul 2006 18:48:18 +0000 Subject: [PATCH] discon-20060714 Implement PDiscon. Right now only sets nat mode. Untested. --- src/afs/afs_pioctl.c | 26 ++++++++++++++++++++++++++ src/afs/afs_prototypes.h | 1 + 2 files changed, 27 insertions(+) diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 2c4599b4c..d7a6a0b6e 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -90,6 +90,7 @@ DECL_PIOCTL(PRxStatPeer); DECL_PIOCTL(PPrefetchFromTape); DECL_PIOCTL(PResidencyCmd); DECL_PIOCTL(PCallBackAddr); +DECL_PIOCTL(PDiscon); /* * A macro that says whether we're going to need HandleClientContext(). @@ -192,6 +193,8 @@ static int (*(CpioctlSw[])) () = { PNewAlias, /* 1 -- create new cell alias */ PListAliases, /* 2 -- list cell aliases */ PCallBackAddr, /* 3 -- request addr for callback rxcon */ + PBogus, /* 4 */ + PDiscon, /* 5 -- get/set discon mode */ }; #define PSetClientContext 99 /* Special pioctl to setup caller's creds */ @@ -3967,3 +3970,26 @@ DECL_PIOCTL(PCallBackAddr) #endif /* UKERNEL */ return 0; } + +DECL_PIOCTL(PDiscon) +{ +#ifdef AFS_DISCON_ENV + static afs_int32 mode; + + if (ainSize == sizeof(afs_int32)) { + memcpy(&mode, ain, sizeof(afs_int32)); + + /* 3 is magic, should be a #define. */ + afs_SetCheckServerNATmode(mode == 3); + } else if (ainSize != 0) { + return EINVAL; + } + + /* Return new mode */ + memcpy(aout, &mode, sizeof(afs_int32)); + *aoutSize = sizeof(struct VenusFid); + return 0; +#else + return EINVAL; +#endif +} diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 25762d19c..1db40fe16 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -277,6 +277,7 @@ extern struct brequest *afs_BQueue(register short aopcode, struct AFS_UCRED *acred, afs_size_t asparm0, afs_size_t asparm1, void *apparm0); +extern void afs_SetCheckServerNATmode(int isnat); extern void afs_CheckServerDaemon(void); extern int afs_CheckRootVolume(void); extern void afs_BRelease(register struct brequest *ab); -- 2.39.5