DECL_PIOCTL(PSetCellStatus);
DECL_PIOCTL(PFlushVolumeData);
DECL_PIOCTL(PGetVnodeXStatus);
+DECL_PIOCTL(PGetVnodeXStatus2);
DECL_PIOCTL(PSetSysName);
DECL_PIOCTL(PSetSPrefs);
DECL_PIOCTL(PSetSPrefs33);
PPrefetchFromTape, /* 66 -- MR-AFS: prefetch file from tape */
PResidencyCmd, /* 67 -- MR-AFS: generic commnd interface */
PBogus, /* 68 -- arla: fetch stats */
+ PGetVnodeXStatus2, /* 69 - get caller access and some vcache status */
};
static int (*(CpioctlSw[])) () = {
mode = PRSFS_READ;
if (!afs_AccessOK(avc, mode, areq, CHECK_MODE_BITS))
return EACCES;
+
+ memset(&stat, 0, sizeof(struct vcxstat));
stat.fid = avc->fid;
hset32(stat.DataVersion, hgetlo(avc->m.DataVersion));
stat.lock = avc->lock;
}
+DECL_PIOCTL(PGetVnodeXStatus2)
+{
+ register afs_int32 code;
+ struct vcxstat2 stat;
+ afs_int32 mode;
+
+ if (!avc)
+ return EINVAL;
+ code = afs_VerifyVCache(avc, areq);
+ if (code)
+ return code;
+ if (vType(avc) == VDIR)
+ mode = PRSFS_LOOKUP;
+ else
+ mode = PRSFS_READ;
+ if (!afs_AccessOK(avc, mode, areq, CHECK_MODE_BITS))
+ return EACCES;
+
+ memset(&stat, 0, sizeof(struct vcxstat2));
+
+ stat.cbExpires = avc->cbExpires;
+ stat.anyAccess = avc->anyAccess;
+ stat.mvstat = avc->mvstat;
+ stat.callerAccess = afs_GetAccessBits(avc, ~0, areq);
+
+ memcpy(aout, (char *)&stat, sizeof(struct vcxstat2));
+ *aoutSize = sizeof(struct vcxstat2);
+ return 0;
+}
+
/* We require root for local sysname changes, but not for remote */
/* (since we don't really believe remote uids anyway) */
/* outname[] shouldn't really be needed- this is left as an excercise */
#define VIOC_PREFETCHTAPE _VICEIOCTL(66) /* MR-AFS prefetch from tape */
#define VIOC_RESIDENCY_CMD _VICEIOCTL(67) /* generic MR-AFS cmds */
#define VIOC_STATISTICS _VICEIOCTL(68) /* arla: fetch statistics */
+#define VIOC_GETVCXSTATUS2 _VICEIOCTL(69) /* vcache statistics */
/* Coordinated 'C' pioctl's */
#define VIOC_NEWALIAS _CVICEIOCTL(1) /* create new cell alias */
afs_int32 rights;
};
+struct vcxstat2 {
+ afs_int32 callerAccess;
+ afs_int32 cbExpires;
+ afs_int32 anyAccess;
+ char mvstat;
+};
+
static void
ZapAcl(acl)
struct Acl *acl;
return error;
}
+static int
+GetCallerAccess(struct cmd_syndesc *as, char *arock)
+{
+ struct cmd_item *ti;
+ int error = 0;
+
+ SetDotDefault(&as->parms[0].items);
+ for (ti = as->parms[0].items; ti; ti = ti->next) {
+ afs_int32 code;
+ struct ViceIoctl blob;
+ struct vcxstat2 stat;
+ blob.out_size = sizeof(struct vcxstat2);
+ blob.in_size = 0;
+ blob.out = &stat;
+ code = pioctl(ti->data, VIOC_GETVCXSTATUS2, &blob, 1);
+ if (code) {
+ Die(errno, ti->data);
+ error = 1;
+ continue;
+ }
+ printf("Callers access to %s is ", ti->data);
+ PRights(stat.callerAccess, 0);
+ printf("\n");
+ }
+ return error;
+}
+
static int
FlushVolumeCmd(struct cmd_syndesc *as, char *arock)
{
cmd_AddParm(ts, "-if", CMD_FLAG, CMD_OPTIONAL, "initial file acl");
cmd_CreateAlias(ts, "la");
+ ts = cmd_CreateSyntax("getcalleraccess", GetCallerAccess, 0,
+ "list callers access");
+ cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
+ cmd_CreateAlias(ts, "gca");
+
ts = cmd_CreateSyntax("cleanacl", CleanACLCmd, 0,
"clean up access control list");
cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");