#include <afsconfig.h>
#include "afs/param.h"
-RCSID
- ("$Header$");
#include "afs/sysincludes.h" /* Standard vendor system headers */
#ifdef AFS_OBSD_ENV
#define DECL_PIOCTL(x) static int x(struct vcache *avc, int afun, struct vrequest *areq, \
char *ain, char *aout, afs_int32 ainSize, afs_int32 *aoutSize, \
- struct AFS_UCRED **acred)
+ AFS_UCRED **acred)
/* Prototypes for pioctl routines */
DECL_PIOCTL(PGetFID);
DECL_PIOCTL(PRxStatProc);
DECL_PIOCTL(PRxStatPeer);
DECL_PIOCTL(PPrefetchFromTape);
-DECL_PIOCTL(PResidencyCmd);
+DECL_PIOCTL(PFsCmd);
DECL_PIOCTL(PCallBackAddr);
DECL_PIOCTL(PDiscon);
DECL_PIOCTL(PNFSNukeCreds);
DECL_PIOCTL(PNewUuid);
DECL_PIOCTL(PPrecache);
+DECL_PIOCTL(PGetPAG);
#if defined(AFS_CACHE_BYPASS)
DECL_PIOCTL(PSetCachingThreshold);
DECL_PIOCTL(PSetCachingBlkSize);
/* Prototypes for private routines */
#ifdef AFS_NEED_CLIENTCONTEXT
static int HandleClientContext(struct afs_ioctl *ablob, int *com,
- struct AFS_UCRED **acred,
- struct AFS_UCRED *credp);
+ AFS_UCRED **acred,
+ AFS_UCRED *credp);
#endif
int HandleIoctl(register struct vcache *avc, register afs_int32 acom,
struct afs_ioctl *adata);
int afs_HandlePioctl(struct vnode *avp, afs_int32 acom,
register struct afs_ioctl *ablob, int afollow,
- struct AFS_UCRED **acred);
-static int Prefetch(char *apath, struct afs_ioctl *adata, int afollow,
- struct AFS_UCRED *acred);
+ AFS_UCRED **acred);
+static int Prefetch(iparmtype apath, struct afs_ioctl *adata, int afollow,
+ AFS_UCRED *acred);
typedef int (*pioctlFunction) (struct vcache *, int, struct vrequest *,
char *, char *, afs_int32, afs_int32 *,
- struct AFS_UCRED **);
+ AFS_UCRED **);
static pioctlFunction VpioctlSw[] = {
PBogus, /* 0 */
PBogus, /* 64 -- arla: force cache check */
PBogus, /* 65 -- arla: break callback */
PPrefetchFromTape, /* 66 -- MR-AFS: prefetch file from tape */
- PResidencyCmd, /* 67 -- MR-AFS: generic commnd interface */
+ PFsCmd, /* 67 -- RXOSD: generic commnd interface */
PBogus, /* 68 -- arla: fetch stats */
PGetVnodeXStatus2, /* 69 - get caller access and some vcache status */
};
PBogus, /* 0 */
PBogus, /* 0 */
PPrecache, /* 12 */
+ PGetPAG, /* 13 */
};
-static int (*(OpioctlSw[])) () = {
+static pioctlFunction OpioctlSw[] = {
PBogus, /* 0 */
PNFSNukeCreds, /* 1 -- nuke all creds for NFS client */
#if defined(AFS_CACHE_BYPASS)
return code; /* so far, none implemented */
}
-
#ifdef AFS_AIX_ENV
/* For aix we don't temporarily bypass ioctl(2) but rather do our
* thing directly in the vnode layer call, VNOP_IOCTL; thus afs_ioctl
#ifdef AFS_LINUX22_ENV
return -code;
#else
- setuerror(code);
- return;
+ return (setuerror(code), code);
#endif
#endif
#endif
#endif /* AFS_SUN5_ENV */
#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
return (code);
+#else
+ return 0;
#endif
}
#endif /* AFS_SGI_ENV */
int
#ifdef AFS_SUN5_ENV
afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow,
- rval_t *vvp, struct AFS_UCRED *credp)
+ rval_t *vvp, AFS_UCRED *credp)
#else
-#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#ifdef AFS_DARWIN100_ENV
+afs_syscall64_pioctl(user_addr_t path, unsigned int com, user_addr_t cmarg,
+ int follow, AFS_UCRED *credp)
+#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow,
- struct AFS_UCRED *credp)
+ AFS_UCRED *credp)
#else
afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow)
#endif
{
struct afs_ioctl data;
#ifdef AFS_NEED_CLIENTCONTEXT
- struct AFS_UCRED *tmpcred = NULL;
+ AFS_UCRED *tmpcred = NULL;
+#endif
+#if defined(AFS_NEED_CLIENTCONTEXT) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+ AFS_UCRED *foreigncreds = NULL;
#endif
- struct AFS_UCRED *foreigncreds = NULL;
register afs_int32 code = 0;
struct vnode *vp = NULL;
#ifdef AFS_AIX41_ENV
foreigncreds ? foreigncreds : credp);
#else
#ifdef AFS_LINUX22_ENV
- code = gop_lookupname(path, AFS_UIOUSER, follow, &dp);
+ code = gop_lookupname_user(path, AFS_UIOUSER, follow, &dp);
if (!code)
vp = (struct vnode *)dp->d_inode;
#else
- code = gop_lookupname(path, AFS_UIOUSER, follow, &vp);
+ code = gop_lookupname_user(path, AFS_UIOUSER, follow, &vp);
#endif /* AFS_LINUX22_ENV */
#endif /* AFS_AIX41_ENV */
AFS_GLOCK();
#endif
}
+#ifdef AFS_DARWIN100_ENV
+int
+afs_syscall_pioctl(char * path, unsigned int com, caddr_t cmarg,
+ int follow, AFS_UCRED *credp)
+{
+ return afs_syscall64_pioctl(CAST_USER_ADDR_T(path), com,
+ CAST_USER_ADDR_T((unsigned int)cmarg), follow,
+ credp);
+}
+#endif
+
#define MAXPIOCTLTOKENLEN \
(3*sizeof(afs_int32)+MAXKTCTICKETLEN+sizeof(struct ClearToken)+MAXKTCREALMLEN)
int
afs_HandlePioctl(struct vnode *avp, afs_int32 acom,
register struct afs_ioctl *ablob, int afollow,
- struct AFS_UCRED **acred)
+ AFS_UCRED **acred)
{
struct vcache *avc;
struct vrequest treq;
i = tcell->cellNum;
afs_PutCell(tcell, READ_LOCK);
if (set_parent_pag) {
- afs_int32 pag;
+ afs_uint32 pag;
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
#if defined(AFS_DARWIN_ENV)
struct proc *p = current_proc(); /* XXX */
register afs_int32 i;
register struct unixuser *tu;
register char *cp;
- afs_int32 iterator;
+ afs_int32 iterator = 0;
int newStyle;
AFS_STATCNT(PGetTokens);
}
static int
-Prefetch(char *apath, struct afs_ioctl *adata, int afollow,
- struct AFS_UCRED *acred)
+Prefetch(iparmtype apath, struct afs_ioctl *adata, int afollow,
+ AFS_UCRED *acred)
{
register char *tp;
register afs_int32 code;
return EACCES;
}
+/*!
+ * VIOC_GETPAG (13) - Get PAG value
+ *
+ * \ingroup pioctl
+ *
+ * \param[in] ain not in use
+ * \param[out] aout PAG value or NOPAG
+ *
+ * \retval E2BIG Error not enough space to copy out value
+ *
+ * \post get PAG value for the caller's cred
+ */
+DECL_PIOCTL(PGetPAG)
+{
+ afs_int32 pag;
+
+ if (*aoutSize < sizeof(afs_int32)) {
+ return E2BIG;
+ }
+
+ pag = PagInCred(*acred);
+
+ memcpy(aout, (char *)&pag, sizeof(afs_int32));
+ *aoutSize = sizeof(afs_int32);
+ return 0;
+}
+
DECL_PIOCTL(PPrecache)
{
afs_int32 newValue;
#define PIOCTL_HEADER 6
static int
HandleClientContext(struct afs_ioctl *ablob, int *com,
- struct AFS_UCRED **acred, struct AFS_UCRED *credp)
+ AFS_UCRED **acred, AFS_UCRED *credp)
{
char *ain, *inData;
afs_uint32 hostaddr;
afs_int32 uid, g0, g1, i, code, pag, exporter_type, isroot = 0;
struct afs_exporter *exporter, *outexporter;
- struct AFS_UCRED *newcred;
+ AFS_UCRED *newcred;
struct unixuser *au;
afs_uint32 comp = *com & 0xff00;
afs_uint32 h, l;
return code;
}
-DECL_PIOCTL(PResidencyCmd)
+DECL_PIOCTL(PFsCmd)
{
register afs_int32 code;
struct afs_conn *tc;
struct vcache *tvc;
- struct ResidencyCmdInputs *Inputs;
- struct ResidencyCmdOutputs *Outputs;
+ struct FsCmdInputs *Inputs;
+ struct FsCmdOutputs *Outputs;
struct VenusFid tfid;
struct AFSFid *Fid;
- Inputs = (struct ResidencyCmdInputs *)ain;
- Outputs = (struct ResidencyCmdOutputs *)aout;
+ Inputs = (struct FsCmdInputs *)ain;
+ Outputs = (struct FsCmdOutputs *)aout;
if (!avc)
return EINVAL;
- if (!ain || ainSize != sizeof(struct ResidencyCmdInputs))
+ if (!ain || ainSize != sizeof(struct FsCmdInputs))
return EINVAL;
Fid = &Inputs->fid;
if (tc) {
RX_AFS_GUNLOCK();
code =
- RXAFS_ResidencyCmd(tc->id, Fid, Inputs,
- (struct ResidencyCmdOutputs *)aout);
+ RXAFS_FsCmd(tc->id, Fid, Inputs,
+ (struct FsCmdOutputs *)aout);
RX_AFS_GLOCK();
} else
code = -1;
afs_PutVCache(tvc);
if (!code) {
- *aoutSize = sizeof(struct ResidencyCmdOutputs);
+ *aoutSize = sizeof(struct FsCmdOutputs);
}
return code;
}
DECL_PIOCTL(PNFSNukeCreds)
{
- afs_uint32 addr, code;
+ afs_uint32 addr;
register afs_int32 i;
register struct unixuser *tu;