static int PGetCPrefs(), PSetCPrefs(); /* client network addresses */
static int PGetInitParams(), PFlushMount(), PRxStatProc(), PRxStatPeer();
static int PGetRxkcrypt(), PSetRxkcrypt();
+static int PPrefetchFromTape(), PResidencyCmd();
int PExportAfs();
static int HandleClientContext(struct afs_ioctl *ablob, int *com, struct AFS_UCRED **acred, struct AFS_UCRED *credp);
PNoop, /* 63 -- arla: print xfs status */
PNoop, /* 64 -- arla: force cache check */
PNoop, /* 65 -- arla: break callback */
+ PPrefetchFromTape, /* 66 -- MR-AFS: prefetch file from tape */
+ PResidencyCmd, /* 67 -- MR-AFS: generic commnd interface */
};
#define PSetClientContext 99 /* Special pioctl to setup caller's creds */
return code;
}
+static PPrefetchFromTape(avc, afun, areq, ain, aout, ainSize, aoutSize)
+ struct vcache *avc;
+ int afun;
+ struct vrequest *areq;
+ char *ain, *aout;
+ afs_int32 ainSize;
+ afs_int32 *aoutSize; /* set this */
+{
+ register afs_int32 code, code1;
+ afs_int32 bytes;
+ struct conn *tc;
+ struct rx_call *tcall;
+ struct AFSVolSync tsync;
+ struct AFSFetchStatus OutStatus;
+ struct AFSCallBack CallBack;
+ struct VenusFid tfid;
+ struct AFSFid *Fid;
+ struct vcache *tvc;
+ XSTATS_DECLS;
+
+ AFS_STATCNT(PSetAcl);
+ if (!avc)
+ return EINVAL;
+
+ if (ain && (ainSize == 3 * sizeof(afs_int32)))
+ Fid = (struct AFSFid *) ain;
+ else
+ Fid = &avc->fid.Fid;
+ tfid.Cell = avc->fid.Cell;
+ tfid.Fid.Volume = Fid->Volume;
+ tfid.Fid.Vnode = Fid->Vnode;
+ tfid.Fid.Unique = Fid->Unique;
+
+ tvc = afs_GetVCache(&tfid, areq, (afs_int32 *)0, (struct vcache *)0,
+ WRITE_LOCK);
+ if (!tvc) {
+ afs_Trace3(afs_iclSetp, CM_TRACE_PREFETCHCMD,
+ ICL_TYPE_POINTER, tvc,
+ ICL_TYPE_FID, &tfid,
+ ICL_TYPE_FID, &avc->fid);
+ return ENOENT;
+ }
+ afs_Trace3(afs_iclSetp, CM_TRACE_PREFETCHCMD,
+ ICL_TYPE_POINTER, tvc,
+ ICL_TYPE_FID, &tfid,
+ ICL_TYPE_FID, &tvc->fid);
+
+ do {
+ tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK);
+ if (tc) {
+
+#ifdef RX_ENABLE_LOCKS
+ AFS_GUNLOCK();
+#endif /* RX_ENABLE_LOCKS */
+ tcall = rx_NewCall(tc->id);
+ code = StartRXAFS_FetchData(tcall,
+ (struct AFSFid *) &tvc->fid.Fid, 0, 0);
+ if (!code) {
+ bytes = rx_Read(tcall, (char *) aout, sizeof(afs_int32));
+ code = EndRXAFS_FetchData(tcall, &OutStatus, &CallBack, &tsync);
+ }
+ code1 = rx_EndCall(tcall, code);
+#ifdef RX_ENABLE_LOCKS
+ AFS_GLOCK();
+#endif /* RX_ENABLE_LOCKS */
+ } else
+ code = -1;
+ } while
+ (afs_Analyze(tc, code, &tvc->fid, areq,
+ AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK,
+ (struct cell *)0));
+ /* This call is done only to have the callback things handled correctly */
+ afs_FetchStatus(tvc, &tfid, areq, &OutStatus);
+ afs_PutVCache(tvc, WRITE_LOCK);
+
+ if (!code) {
+ *aoutSize = sizeof(afs_int32);
+ }
+ return code;
+}
+
+static PResidencyCmd(avc, afun, areq, ain, aout, ainSize, aoutSize)
+struct vcache *avc;
+int afun;
+struct vrequest *areq;
+char *ain, *aout;
+afs_int32 ainSize;
+afs_int32 *aoutSize; /* set this */
+{
+ register afs_int32 code;
+ struct conn *tc;
+ struct vcache *tvc;
+ struct ResidencyCmdInputs *Inputs;
+ struct ResidencyCmdOutputs *Outputs;
+ struct VenusFid tfid;
+ struct AFSFid *Fid;
+
+ Inputs = (struct ResidencyCmdInputs *) ain;
+ Outputs = (struct ResidencyCmdOutputs *) aout;
+ if (!avc) return EINVAL;
+ if (!ain || ainSize != sizeof(struct ResidencyCmdInputs)) return EINVAL;
+
+ Fid = &Inputs->fid;
+ if (!Fid->Volume)
+ Fid = &avc->fid.Fid;
+
+ tfid.Cell = avc->fid.Cell;
+ tfid.Fid.Volume = Fid->Volume;
+ tfid.Fid.Vnode = Fid->Vnode;
+ tfid.Fid.Unique = Fid->Unique;
+
+ tvc = afs_GetVCache(&tfid, areq, (afs_int32 *)0, (struct vcache *)0,
+ WRITE_LOCK);
+ afs_Trace3(afs_iclSetp, CM_TRACE_RESIDCMD,
+ ICL_TYPE_POINTER, tvc,
+ ICL_TYPE_INT32, Inputs->command,
+ ICL_TYPE_FID, &tfid);
+ if (!tvc)
+ return ENOENT;
+
+ if (Inputs->command) {
+ do {
+ tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK);
+ if (tc) {
+#ifdef RX_ENABLE_LOCKS
+ AFS_GUNLOCK();
+#endif /* RX_ENABLE_LOCKS */
+ code = RXAFS_ResidencyCmd(tc->id, Fid,
+ Inputs,
+ (struct ResidencyCmdOutputs *) aout);
+#ifdef RX_ENABLE_LOCKS
+ AFS_GLOCK();
+#endif /* RX_ENABLE_LOCKS */
+ } else
+ code = -1;
+ } while
+ (afs_Analyze(tc, code, &tvc->fid, areq,
+ AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK,
+ (struct cell *)0));
+ /* This call is done to have the callback things handled correctly */
+ afs_FetchStatus(tvc, &tfid, areq, &Outputs->status);
+ } else { /* just a status request, return also link data */
+ code = 0;
+ Outputs->code = afs_FetchStatus(tvc, &tfid, areq, &Outputs->status);
+ Outputs->chars[0] = 0;
+ if (vType(tvc) == VLNK) {
+ ObtainWriteLock(&tvc->lock,555);
+ if (afs_HandleLink(tvc, areq) == 0)
+ strncpy((char *) &Outputs->chars, tvc->linkData, MAXCMDCHARS);
+ ReleaseWriteLock(&tvc->lock);
+ }
+ }
+
+ afs_PutVCache(tvc, WRITE_LOCK);
+
+ if (!code) {
+ *aoutSize = sizeof(struct ResidencyCmdOutputs);
+ }
+ return code;
+}
#define AFS_STATS_FS_RPCIDX_XSTATSVERSION 26
#define AFS_STATS_FS_RPCIDX_GETXSTATS 27
#define AFS_STATS_FS_RPCIDX_XLOOKUP 28
+#define AFS_STATS_FS_RPCIDX_RESIDENCYRPCS 29
#define AFS_STATS_NUM_FS_RPC_OPS 29
ec CM_TRACE_READPAGE, "Ireadpage ip 0x%lx pp 0x%x count 0x%x code %x"
ec CM_TRACE_UPDATEPAGE, "Iupdatepage ip 0x%lx pp 0x%x count 0x%x code %d"
ec CM_TRACE_VM_CLOSE, "VMclose ip 0x%lx mapcnt %d opens %d XoW %d"
+ ec CM_TRACE_PREFETCHCMD, "PrefetchCmd tvc 0x%x tfid (%d:%d.%d.%d) fid (%d:%d.%d.%d)"
+ ec CM_TRACE_RESIDCMD, "ResidencyCmd tvc 0x%x command %d fid (%d:%d.%d.%d)"
end
#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */
#define AFS_SYSCALL 137
+#define AFS_64BIT_ENV
#define AFS_64BIT_IOPS_ENV 1
#define AFS_NAMEI_ENV 1 /* User space interface to file system */
#include <afs/afs_sysnames.h>
#ifdef AFS_64BIT_ENV
typedef int afs_int32;
typedef unsigned int afs_uint32;
+typedef long long afs_int64;
+typedef unsigned long long afs_uint64;
+ #define ZeroInt64(a) (a) = 0
+ #define AssignInt64(a, b) *(a) = (b)
+ #define AddInt64(a,b,c) *(c) = (a) + (b)
+ #define SubtractInt64(a,b,c) *(c) = (a) - (b)
+ #define CompareInt64(a,b) (a) - (b)
+ #define NonZeroInt64(a) (a)
+ #define Int64ToInt32(a) (a) & 0xFFFFFFFFL
+ #define FillInt64(t,h,l) (t) = (h); (t) <<= 32; (t) |= (l);
+ #define SplitInt64(t,h,l) (h) = (t) >> 32; (l) = (t) & 0xFFFFFFFF;
#else /* AFS_64BIT_ENV */
typedef long afs_int32;
typedef unsigned long afs_uint32;
+
+ struct Int64 {
+ afs_int32 high;
+ afs_uint32 low;
+ };
+ typedef struct Int64 afs_int64;
+
+ struct u_Int64 {
+ afs_uint32 high;
+ afs_uint32 low;
+ };
+ typedef struct u_Int64 afs_uint64;
+ #define ZeroInt64(a) (a).high = (a).low = 0
+ #define AssignInt64(a, b) (b)->high = (a).high; (b)->low = (a).low
+ #define NonZeroInt64(a) (a).low || (a).high
+ #define Int64ToInt32(a) (a).low
+ #define FillInt64(t,h,l) (t).high = (h); (t).low = (l);
+ #define SplitInt64(t,h,l) (h) = (t).high; (l) = (t).low;
#endif /* AFS_64BIT_ENV */
+/* AFS_64BIT_CLIENT should presently be set only for AFS_64BIT_ENV systems */
+
+#ifdef AFS_64BIT_CLIENT
+typedef afs_int64 afs_size_t;
+typedef afs_uint64 afs_offs_t;
+#else /* AFS_64BIT_CLIENT */
+typedef afs_int32 afs_size_t;
+typedef afs_uint32 afs_offs_t;
+#endif /* AFS_64BIT_CLIENT */
+
/* you still have to include <netinet/in.h> to make these work */
#define hton32 htonl
#define VIOC_RXSTAT_PEER _VICEIOCTL(54) /* Control peer RX stats */
#define VIOC_GETRXKCRYPT _VICEIOCTL(55) /* Set rxkad enc flag */
#define VIOC_SETRXKCRYPT _VICEIOCTL(56) /* Set rxkad enc flag */
-
+#define VIOC_PREFETCHTAPE _VICEIOCTL(66) /* MR-AFS prefetch from tape */
+#define VIOC_RESIDENCY_CMD _VICEIOCTL(67) /* generic MR-AFS cmds */
#endif /* AFS_VENUS_H */
typedef afs_int32 ViceIds<FLUSHMAX>;
typedef afs_int32 IPAddrs<FLUSHMAX>;
+%#define MAXCMDINT64S 3
+%#define MAXCMDINT32S 200
+%#define MAXCMDCHARS 256
+
+struct ResidencyCmdInputs {
+ afs_int32 command;
+ struct AFSFid fid;
+ afs_int64 int64s[MAXCMDINT64S];
+ afs_uint32 int32s[MAXCMDINT32S];
+ char chars[MAXCMDCHARS];
+};
+
+struct ResidencyCmdOutputs {
+ afs_int32 code;
+ struct AFSFetchStatus status;
+ afs_int64 int64s[MAXCMDINT64S];
+ afs_uint32 int32s[MAXCMDINT32S];
+ char chars[MAXCMDCHARS];
+};
+
package RXAFS_
prefix S
statindex 7
AFSCallBack *CallBack,
AFSVolSync *Sync
) = 163;
+
+ResidencyCmd(
+ IN AFSFid *Fid,
+ IN struct ResidencyCmdInputs *Inputs,
+ OUT struct ResidencyCmdOutputs *Outputs
+) = 220;
osi_timeout.o \
osi_vm.o \
xdr.o \
+ xdr_int64.o \
xdr_array.o
AFSNOIAUTHOBJS = \
# Common objects
xdr.o: $(RX)/xdr.c
$(CRULE1);
+xdr_int64.o: $(RX)/xdr_int64.c
+ $(CRULE1);
xdr_array.o: $(RX)/xdr_array.c
$(CRULE1);
osi_vm.o \
osi_vnodeops.o \
xdr.o \
+ xdr_int64.o \
xdr_array.o
AFS_OS_NFSOBJS =
$(CRULE1);
xdr.o: $(RX)/xdr.c
$(CRULE1);
+xdr_int64.o: $(RX)/xdr_int64.c
+ $(CRULE1);
xdr_array.o: $(RX)/xdr_array.c
$(CRULE1);
XDROBJS =\
xdr_arrayn.o \
xdr_rx.o \
+ xdr_int64.o \
xdr_afsuuid.o \
AFS_component_version_number.o
xdr.o: ${RX}/xdr.c
${CCRULE};
+xdr_int64.o: ${RX}/xdr_int64.c
+ ${CCRULE};
+
xdr_array.o: ${RX}/xdr_array.c
${CCRULE};
$(UOBJ)/hostparse.o \
$(UOBJ)/Krxstat.ss.o \
$(UOBJ)/Krxstat.xdr.o \
- $(UOBJ)/rxstat.o
+ $(UOBJ)/rxstat.o \
+ $(UOBJ)/xdr_int64.o
AFSWEBOBJ = \
$(WEBOBJ)/afs_atomlist.o \
$(CRULE1);
$(UOBJ)/xdr_rx.o: $(RX)/xdr_rx.c
$(CRULE1);
+$(UOBJ)/xdr_int64.o: $(RX)/xdr_int64.c
+ $(CRULE1);
$(UOBJ)/afs_usrops.o: $(AFS)/afs_usrops.c
$(CRULE1);
$(UOBJ)/afs_uuid.o: $(AFS)/afs_uuid.c
XDROBJS = xdr_arrayn.o xdr_rx.o xdr_afsuuid.o
RXOBJS = rx_clock.o rx_event.o rx_user.o rx_lwp.o rx.o rx_null.o rx_globals.o \
- rx_getaddr.o rx_misc.o rx_packet.o rx_rdwr.o rx_trace.o rx_conncache.o
+ rx_getaddr.o rx_misc.o rx_packet.o rx_rdwr.o rx_trace.o rx_conncache.o \
+ xdr_int64.o
MULTIOBJS = rx_multi.o
rx_null.c rx_null.h rx_queue.h rx_getaddr.c rx_packet.c rx_packet.h \
rx_multi.h rx_kcommon.h rx_kcommon.c \
xdr.c xdr.h xdr_array.c xdr_arrayn.c xdr_rx.c rx_misc.c rx_rdwr.c \
- xdr_afsuuid.c rx_trace.h
+ xdr_afsuuid.c rx_trace.h xdr_int64.c
UKSRCS = $(KSRCS) rx_conncache.c
include ../config/Makefile.version
extern bool_t xdr_reference();
extern bool_t xdr_wrapstring();
extern bool_t xdr_vector();
+extern bool_t xdr_int64();
+extern bool_t xdr_uint64();
/*
* These are the public routines for the various implementations of
--- /dev/null
+
+/*
+ * XDR routine for int64 (long long or struct)
+ */
+
+#if defined(KERNEL) && !defined(UKERNEL)
+#include "afs/param.h"
+#ifdef AFS_LINUX20_ENV
+#include "../h/string.h"
+#define bzero(A,C) memset((A), 0, (C))
+#else
+#include <sys/param.h>
+#include <sys/systm.h>
+#endif
+#else
+#include <stdio.h>
+#endif
+#include "xdr.h"
+#if defined(KERNEL) && !defined(UKERNEL)
+#ifdef AFS_DEC_ENV
+#include <afs/longc_procs.h>
+#endif
+#endif
+
+#ifndef lint
+static char sccsid[] = "@(#)xdr_array.c 1.1 86/02/03 Copyr 1984 Sun Micro";
+#endif
+
+#ifdef AFS_64BIT_ENV
+/*
+ * XDR afs_int64 integers
+ */
+bool_t
+xdr_int64(xdrs, ulp)
+ register XDR *xdrs;
+ afs_int64 *ulp;
+{
+ static afs_int32 high;
+ static afs_uint32 low;
+
+ if (xdrs->x_op == XDR_DECODE) {
+ if (!XDR_GETINT32(xdrs, (afs_int32 *) &high)) return (FALSE);
+ if (!XDR_GETINT32(xdrs, (afs_int32 *) &low)) return (FALSE);
+ *ulp = high;
+ *ulp <<= 32;
+ *ulp += low;
+ return (TRUE);
+ }
+ if (xdrs->x_op == XDR_ENCODE) {
+ high = (*ulp >> 32);
+ low = *ulp & 0xFFFFFFFFL;
+ if (!XDR_PUTINT32(xdrs, (afs_int32 *) &high)) return (FALSE);
+ return (XDR_PUTINT32(xdrs, (afs_int32 *) &low));
+ }
+ if (xdrs->x_op == XDR_FREE)
+ return (TRUE);
+ return (FALSE);
+}
+
+/*
+ * XDR afs_int64 integers
+ */
+bool_t
+xdr_uint64(xdrs, ulp)
+ register XDR *xdrs;
+ afs_uint64 *ulp;
+{
+ static afs_uint32 high;
+ static afs_uint32 low;
+
+ if (xdrs->x_op == XDR_DECODE) {
+ if (!XDR_GETINT32(xdrs, (afs_uint32 *) &high)) return (FALSE);
+ if (!XDR_GETINT32(xdrs, (afs_uint32 *) &low)) return (FALSE);
+ *ulp = high;
+ *ulp <<= 32;
+ *ulp += low;
+ return (TRUE);
+ }
+ if (xdrs->x_op == XDR_ENCODE) {
+ high = (*ulp >> 32);
+ low = *ulp & 0xFFFFFFFFL;
+ if (!XDR_PUTINT32(xdrs, (afs_uint32 *) &high)) return (FALSE);
+ return (XDR_PUTINT32(xdrs, (afs_uint32 *) &low));
+ }
+ if (xdrs->x_op == XDR_FREE)
+ return (TRUE);
+ return (FALSE);
+}
+#else /* AFS_64BIT_ENV */
+/*
+ * XDR afs_int64 integers
+ */
+bool_t
+xdr_int64(xdrs, ulp)
+ register XDR *xdrs;
+ afs_int64 *ulp;
+{
+ if (xdrs->x_op == XDR_DECODE) {
+ if (!XDR_GETINT32(xdrs, (afs_int32 *) &ulp->high)) return (FALSE);
+ return (XDR_GETINT32(xdrs, (afs_int32 *) &ulp->low));
+ }
+ if (xdrs->x_op == XDR_ENCODE) {
+ if (!XDR_PUTINT32(xdrs, (afs_int32 *) &ulp->high)) return (FALSE);
+ return (XDR_PUTINT32(xdrs, (afs_int32 *) &ulp->low));
+ }
+ if (xdrs->x_op == XDR_FREE)
+ return (TRUE);
+ return (FALSE);
+}
+
+/*
+ * XDR afs_uint64 integers
+ */
+bool_t
+xdr_uint64(xdrs, ulp)
+ register XDR *xdrs;
+ afs_uint64 *ulp;
+{
+ if (xdrs->x_op == XDR_DECODE) {
+ if (!XDR_GETINT32(xdrs, (afs_uint32 *) &ulp->high)) return (FALSE);
+ return (XDR_GETINT32(xdrs, (afs_uint32 *) &ulp->low));
+ }
+ if (xdrs->x_op == XDR_ENCODE) {
+ if (!XDR_PUTINT32(xdrs, (afs_uint32 *) &ulp->high)) return (FALSE);
+ return (XDR_PUTINT32(xdrs, (afs_uint32 *) &ulp->low));
+ }
+ if (xdrs->x_op == XDR_FREE)
+ return (TRUE);
+ return (FALSE);
+}
+#endif /* AFS_64BIT_ENV */
f_print(fout, "#ifndef xdr_afs_uint32\n");
f_print(fout, "#define xdr_afs_uint32 xdr_u_int\n");
f_print(fout, "#endif\n");
+ f_print(fout, "#ifndef xdr_afs_int64\n");
+ f_print(fout, "#define xdr_afs_int64 xdr_int64\n");
+ f_print(fout, "#endif\n");
+ f_print(fout, "#ifndef xdr_afs_uint64\n");
+ f_print(fout, "#define xdr_afs_uint64 xdr_uint64\n");
+ f_print(fout, "#endif\n");
#else
#error Need to do some work here...
#endif
f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
f_print(fout, "#include \"../rx/xdr.h\"\n");
f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
+ f_print(fout, "extern bool_t xdr_int64();\n");
+ f_print(fout, "extern bool_t xdr_uint64();\n");
f_print(fout, "#include \"../rpc/xdr.h\"\n");
f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
f_print(fout, "#endif /* XDR_GETLONG */\n");
return EINVAL;
}
+SRXAFS_ResidencyCmd (tcon, Fid, Inputs, Outputs)
+ struct rx_connection *tcon;
+ struct AFSFid *Fid;
+ struct ResidencyCmdInputs *Inputs;
+ struct ResidencyCmdOutputs *Outputs;
+{
+ return EINVAL;
+}