DECL_PIOCTL(PPrefetchFromTape);
DECL_PIOCTL(PResidencyCmd);
DECL_PIOCTL(PCallBackAddr);
-
+DECL_PIOCTL(PNewUuid);
/*
* A macro that says whether we're going to need HandleClientContext().
* This is currently used only by the nfs translator.
PNewAlias, /* 1 -- create new cell alias */
PListAliases, /* 2 -- list cell aliases */
PCallBackAddr, /* 3 -- request addr for callback rxcon */
+ PBogus, /* 0 */
+ PBogus, /* 0 */
+ PBogus, /* 0 */
+ PBogus, /* 0 */
+ PBogus, /* 0 */
+ PNewUuid, /* 9 -- generate new uuid */
};
#define PSetClientContext 99 /* Special pioctl to setup caller's creds */
return code;
}
+DECL_PIOCTL(PNewUuid)
+{
+ /*AFS_STATCNT(PNewUuid); */
+ if (!afs_resourceinit_flag) /* afs deamons havn't started yet */
+ return EIO; /* Inappropriate ioctl for device */
+
+ if (!afs_osi_suser(acred))
+ return EACCES;
+
+ ObtainWriteLock(&afs_xinterface, 555);
+ afs_uuid_create(&afs_cb_interface.uuid);
+ ReleaseWriteLock(&afs_xinterface);
+ ForceAllNewConnections();
+}
+
DECL_PIOCTL(PCallBackAddr)
{
#ifndef UKERNEL
} /*afs_CountServers */
+void
+ForceAllNewConnections()
+{
+ int srvAddrCount;
+ struct srvAddr **addrs;
+ struct srvAddr *sa;
+ afs_int32 i, j;
+
+ ObtainReadLock(&afs_xserver); /* Necessary? */
+ ObtainReadLock(&afs_xsrvAddr);
+
+ srvAddrCount = 0;
+ for (i = 0; i < NSERVERS; i++) {
+ for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) {
+ srvAddrCount++;
+ }
+ }
+
+ addrs = afs_osi_Alloc(srvAddrCount * sizeof(*addrs));
+ j = 0;
+ for (i = 0; i < NSERVERS; i++) {
+ for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) {
+ if (j >= srvAddrCount)
+ break;
+ addrs[j++] = sa;
+ }
+ }
+
+ ReleaseReadLock(&afs_xsrvAddr);
+ ReleaseReadLock(&afs_xserver);
+ for (i = 0; i < j; i++) {
+ sa = addrs[i];
+ ForceNewConnections(sa);
+ }
+}
+
/* check down servers (if adown), or running servers (if !adown) */
void
afs_CheckServers(int adown, struct cell *acellp)
#define VIOC_NEWALIAS _CVICEIOCTL(1) /* create new cell alias */
#define VIOC_GETALIAS _CVICEIOCTL(2) /* get alias info */
#define VIOC_CBADDR _CVICEIOCTL(3) /* push callback addr */
+#define VIOC_NEWUUID _CVICEIOCTL(9) /* new uuid */
#endif /* AFS_VENUS_H */
static struct ubik_client *uclient;
static int GetClientAddrsCmd(), SetClientAddrsCmd(), FlushMountCmd();
-static int RxStatProcCmd(), RxStatPeerCmd(), GetFidCmd();
+static int RxStatProcCmd(), RxStatPeerCmd(), GetFidCmd(), NewUuidCmd();
extern char *hostutil_GetNameByINet();
extern struct hostent *hostutil_GetHostByName();
return error;
}
+static int
+NewUuidCmd(struct cmd_syndesc *as, char *arock)
+{
+ afs_int32 code;
+ struct ViceIoctl blob;
+
+ blob.in_size = 0;
+ blob.out_size = 0;
+ code = pioctl(0, VIOC_NEWUUID, &blob, 1);
+ if (code) {
+ Die(errno, 0);
+ return 1;
+ }
+
+ printf("New uuid generated.\n");
+ return 0;
+}
+
static int
FlushCmd(struct cmd_syndesc *as, char *arock)
{
"get fid for file(s)");
cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
+ ts = cmd_CreateSyntax("newuuid", NewUuidCmd, 0,
+ "force a new uuid");
+
code = cmd_Dispatch(argc, argv);
if (rxInitDone)
rx_Finalize();