* directory or online at http://www.openafs.org/dl/license10.html
*/
+#include <afsconfig.h>
#include <afs/param.h>
+
+RCSID("$Header$");
+
#include <afs/afs_args.h>
#include <rx/xdr.h>
#include <sys/ioctl.h>
#ifdef AFS_AIX32_ENV
#include <signal.h>
#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+
#undef VIRTUE
#undef VICE
#include "afs/prs_fs.h"
#include <afs/volser.h>
#include <afs/vlserver.h>
#include <afs/cmd.h>
-#include <strings.h>
#include <afs/afsutil.h>
#include <stdlib.h>
#include <assert.h>
extern char *hostutil_GetNameByINet();
extern struct hostent *hostutil_GetHostByName();
-extern afs_int32 VL_GetEntryByNameO();
-extern int errno;
+
extern struct cmd_syndesc *cmd_CreateSyntax();
static char pn[] = "fs";
static int rxInitDone = 0;
* Determine whether either the -id or -if switches are present, and
* return 0, 1 or 2, as appropriate. Abort if both switches are present.
*/
-static int getidf(as, id)
- struct cmd_syndesc *as;
- int id; /* Offset of -id switch; -if is next switch */
+/* int id; Offset of -id switch; -if is next switch */
+static int getidf(struct cmd_syndesc *as, int id)
{
int idf = 0;
return idf;
}
-static int PRights(arights, dfs)
- afs_int32 arights;
- int dfs;
+static int PRights(afs_int32 arights, int dfs)
{
if (!dfs) {
if (arights & PRSFS_READ) printf("r");
}
/* this function returns TRUE (1) if the file is in AFS, otherwise false (0) */
-static int InAFS(apath)
- char *apath;
+static int InAFS(char *apath)
{
struct ViceIoctl blob;
afs_int32 code;
}
/* return a static pointer to a buffer */
-static char *Parent(apath)
- char *apath;
+static char *Parent(char *apath)
{
char *tp;
strcpy(tspace, apath);
- tp = rindex(tspace, '/');
+ tp = strrchr(tspace, '/');
if (tp) {
*tp = 0;
}
enum rtype {add, destroy, deny};
-static afs_int32 Convert(arights, dfs, rtypep)
- char *arights;
- int dfs;
- enum rtype *rtypep;
+static afs_int32 Convert(char *arights, int dfs, enum rtype *rtypep)
{
int i, len;
afs_int32 mode;
return mode;
}
-static struct AclEntry *FindList(alist, aname)
- struct AclEntry *alist;
- char *aname;
+static struct AclEntry *FindList(struct AclEntry *alist, char *aname)
{
while (alist) {
if (!foldcmp(alist->name, aname)) return alist;
}
/* if no parm specified in a particular slot, set parm to be "." instead */
-static void SetDotDefault(aitemp)
- struct cmd_item **aitemp;
+static void SetDotDefault(struct cmd_item **aitemp)
{
struct cmd_item *ti;
if (*aitemp) return; /* already has value */
*aitemp = ti;
}
-static void ChangeList(al, plus, aname, arights)
- struct Acl *al;
- afs_int32 plus;
- char *aname;
- afs_int32 arights;
+static void ChangeList(struct Acl *al, afs_int32 plus, char *aname, afs_int32 arights)
{
struct AclEntry *tlist;
tlist = (plus ? al->pluslist : al->minuslist);
}
}
-static void ZapList(alist)
- struct AclEntry *alist;
+static void ZapList(struct AclEntry *alist)
{
struct AclEntry *tp, *np;
for (tp = alist; tp; tp = np) {
}
}
-static int PruneList(ae, dfs)
- struct AclEntry **ae;
- int dfs;
+static int PruneList(struct AclEntry **ae, int dfs)
{
struct AclEntry **lp;
struct AclEntry *te, *ne;
return ctr;
}
-static char *SkipLine(astr)
- char *astr;
+static char *SkipLine(char *astr)
{
while (*astr !='\n') astr++;
astr++;
* assume that the acl is AFS: for DFS, the user can always resort to
* acl_edit, but for AFS there may be no other way out).
*/
-static struct Acl *EmptyAcl(astr)
- char *astr;
+static struct Acl *EmptyAcl(char *astr)
{
struct Acl *tp;
int junk;
return tp;
}
-static struct Acl *ParseAcl(astr)
- char *astr;
+static struct Acl *ParseAcl(char *astr)
{
int nplus, nminus, i, trights;
char tname[MAXNAME];
return ta;
}
-static PrintStatus(status, name, offmsg)
- VolumeStatus *status;
- char *name;
- char *offmsg;
+static int PrintStatus(VolumeStatus *status, char *name, char *offmsg)
{
printf("Volume status for vid = %u named %s\n",status->Vid, name);
if (*offmsg != 0)
else printf("unlimited\n");
printf("Current blocks used are %d\n",status->BlocksInUse);
printf("The partition has %d blocks available out of %d\n\n",status->PartBlocksAvail, status->PartMaxBlocks);
+ return 0;
}
-static QuickPrintStatus(status, name)
- VolumeStatus *status;
- char *name;
+static int QuickPrintStatus(VolumeStatus *status, char *name)
{
double QuotaUsed =0.0;
double PartUsed =0.0;
printf(" <<WARNING\n");
}
else printf("\n");
+ return 0;
}
-static QuickPrintSpace(status, name)
- VolumeStatus *status;
- char *name;
+static int QuickPrintSpace(VolumeStatus *status, char *name)
{
double PartUsed =0.0;
int WARN = 0;
printf(" <<WARNING\n");
}
else printf("\n");
+ return 0;
}
-static char *AclToString(acl)
- struct Acl *acl;
+static char *AclToString(struct Acl *acl)
{
static char mydata[MAXSIZE];
char tstring[MAXSIZE];
return mydata;
}
-static SetACLCmd(as)
- struct cmd_syndesc *as;
+static int SetACLCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
}
-static CopyACLCmd(as)
- struct cmd_syndesc *as;
+static int CopyACLCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
}
/* pioctl() call to get the cellname of a pathname */
-static afs_int32 GetCell(fname, cellname)
- char *fname, *cellname;
+static afs_int32 GetCell(char *fname, char *cellname)
{
afs_int32 code;
struct ViceIoctl blob;
blob.out = cellname;
code = pioctl(fname, VIOC_FILE_CELL_NAME, &blob, 1);
- return code;
+ return code ? errno : 0;
}
/* Check if a username is valid: If it contains only digits (or a
* negative sign), then it might be bad. We then query the ptserver
* to see.
*/
-static BadName(aname, fname)
- char *aname, *fname;
+static BadName(char *aname, char *fname)
{
afs_int32 tc, code, id;
char *nm;
/* clean up an access control list of its bad entries; return 1 if we made
any changes to the list, and 0 otherwise */
-static CleanAcl(aa, fname)
- struct Acl *aa;
- char *fname; /* The file name */
+static CleanAcl(struct Acl *aa, char *fname)
{
struct AclEntry *te, **le, *ne;
int changes;
/* clean up an acl to not have bogus entries */
-static CleanACLCmd(as)
- struct cmd_syndesc *as;
+static int CleanACLCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct Acl *ta = 0;
return error;
}
-static ListACLCmd(as)
- struct cmd_syndesc *as;
+static int ListACLCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct Acl *ta;
return error;
}
-static FlushVolumeCmd(as)
- struct cmd_syndesc *as;
+static int FlushVolumeCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
return error;
}
-static FlushCmd(as)
- struct cmd_syndesc *as;
+static int FlushCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
}
/* all this command does is repackage its args and call SetVolCmd */
-static SetQuotaCmd(as)
- struct cmd_syndesc *as;
+static int SetQuotaCmd(struct cmd_syndesc *as)
{
struct cmd_syndesc ts;
/* copy useful stuff from our command slot; we may later have to reorder */
- bcopy(as, &ts, sizeof(ts)); /* copy whole thing */
+ memcpy(&ts, as, sizeof(ts)); /* copy whole thing */
return SetVolCmd(&ts);
}
-static SetVolCmd(as)
- struct cmd_syndesc *as;
+static int SetVolCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
blob.in = space;
status = (VolumeStatus *)space;
status->MinQuota = status->MaxQuota = -1;
- offmsg = (char *) 0;
+ offmsg = NULL;
if (as->parms[1].items) {
code = util_GetInt32(as->parms[1].items->data, &status->MaxQuota);
if (code) {
return error;
}
-static ExamineCmd(as)
- struct cmd_syndesc *as;
+static int ExamineCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
return error;
}
-static ListQuotaCmd(as)
- struct cmd_syndesc *as;
+static int ListQuotaCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
return error;
}
-static WhereIsCmd(as)
- struct cmd_syndesc *as;
+static int WhereIsCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
blob.out_size = MAXSIZE;
blob.in_size = 0;
blob.out = space;
- bzero(space, sizeof(space));
+ memset(space, 0, sizeof(space));
code = pioctl(ti->data, VIOCWHEREIS, &blob, 1);
if (code) {
Die(errno, ti->data);
}
-static DiskFreeCmd(as)
- struct cmd_syndesc *as;
+static int DiskFreeCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
return error;
}
-static QuotaCmd(as)
- struct cmd_syndesc *as;
+static int QuotaCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
return error;
}
-static ListMountCmd(as)
- struct cmd_syndesc *as;
+static int ListMountCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
* name (we know there is one) and splice in the symlink value.
*/
if (true_name[0] != '/') {
- last_component = (char *) rindex(orig_name, '/');
+ last_component = (char *) strrchr(orig_name, '/');
strcpy(++last_component, true_name);
strcpy(true_name, orig_name);
}
/*
* Find rightmost slash, if any.
*/
- last_component = (char *) rindex(true_name, '/');
+ last_component = (char *) strrchr(true_name, '/');
if (last_component) {
/*
* Found it. Designate everything before it as the parent directory,
blob.in_size = strlen(last_component)+1;
blob.out_size = MAXSIZE;
blob.out = space;
- bzero(space, MAXSIZE);
+ memset(space, 0, MAXSIZE);
code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, &blob, 1);
return error;
}
-static MakeMountCmd(as)
- struct cmd_syndesc *as;
+static MakeMountCmd(struct cmd_syndesc *as)
{
afs_int32 code;
char *cellName, *volName, *tmpName;
if (as->parms[2].items) /* cell name specified */
cellName = as->parms[2].items->data;
else
- cellName = (char *) 0;
+ cellName = NULL;
volName = as->parms[1].items->data;
if (strlen(volName) >= 64) {
/* Check for a cellname in the volume specification, and complain
* if it doesn't match what was specified with -cell */
- if (tmpName = index(volName, ':')) {
+ if (tmpName = strchr(volName, ':')) {
*tmpName = '\0';
if (cellName) {
if (strcasecmp(cellName,volName)) {
* (or ``.'' if none is provided)
* tp: Set to point to the actual name of the mount point to nuke.
*/
-static RemoveMountCmd(as)
- struct cmd_syndesc *as;
+static int RemoveMountCmd(struct cmd_syndesc *as)
{
afs_int32 code=0;
struct ViceIoctl blob;
for(ti=as->parms[0].items; ti; ti=ti->next) {
/* once per file */
- tp = (char *) rindex(ti->data, '/');
+ tp = (char *) strrchr(ti->data, '/');
if (tp) {
strncpy(tbuffer, ti->data, code=tp-ti->data); /* the dir name */
tbuffer[code] = 0;
/*
*/
-static CheckServersCmd(as)
- struct cmd_syndesc *as;
+static int CheckServersCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
struct afsconf_cell info;
struct chservinfo checkserv;
- bzero(&checkserv,sizeof(struct chservinfo));
+ memset(&checkserv, 0, sizeof(struct chservinfo));
blob.in_size=sizeof(struct chservinfo);
blob.in=(caddr_t)&checkserv;
blob.out_size = MAXSIZE;
blob.out = space;
- bzero(space, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */
+ memset(space, 0, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */
/* prepare flags for checkservers command */
temp = 2; /* default to checking local cell only */
Die(errno, 0);
return 1;
}
- bcopy(space, &temp, sizeof(afs_int32));
+ memcpy(&temp, space, sizeof(afs_int32));
if (checkserv.tinterval >= 0) {
if (checkserv.tinterval > 0)
printf("The new down server probe interval (%d secs) is now in effect (old interval was %d secs)\n",
else {
printf("These servers unavailable due to network or server problems: ");
for(j=0; ; j++) {
- bcopy(space + j*sizeof(afs_int32), &temp, sizeof(afs_int32));
+ memcpy(&temp, space + j*sizeof(afs_int32), sizeof(afs_int32));
if (temp == 0) break;
tp = hostutil_GetNameByINet(temp);
printf(" %s", tp);
return code;
}
-static MessagesCmd(as)
- struct cmd_syndesc *as;
+static int MessagesCmd(struct cmd_syndesc *as)
{
afs_int32 code=0;
struct ViceIoctl blob;
struct gaginfo gagflags;
struct cmd_item *show;
- bzero (&gagflags, sizeof(struct gaginfo));
+ memset(&gagflags, 0, sizeof(struct gaginfo));
blob.in_size = sizeof(struct gaginfo);
blob.in = (caddr_t) &gagflags;
blob.out_size = MAXSIZE;
blob.out = space;
- bzero(space, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */
+ memset(space, 0, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */
if (show = as->parms[0].items) {
if (!strcasecmp (show->data, "user"))
return 0;
}
-static CheckVolumesCmd(as)
- struct cmd_syndesc *as;
+static int CheckVolumesCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
return 0;
}
-static SetCacheSizeCmd(as)
- struct cmd_syndesc *as;
+static int SetCacheSizeCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
printf("'fs setcache' not allowed on memory cache based cache managers.\n");
}
else {
- Die(errno, (char *) 0);
+ Die(errno, NULL);
}
return 1;
}
}
#define MAXGCSIZE 16
-static GetCacheParmsCmd(as)
- struct cmd_syndesc *as;
+static int GetCacheParmsCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
afs_int32 parms[MAXGCSIZE];
memset(parms, '\0', sizeof parms); /* avoid Purify UMR error */
- blob.in = (char *) 0;
+ blob.in = NULL;
blob.in_size = 0;
blob.out_size = sizeof(parms);
blob.out = (char *) parms;
code = pioctl(0, VIOCGETCACHEPARMS, &blob, 1);
if (code) {
- Die(errno, (char *) 0);
+ Die(errno, NULL);
return 1;
}
printf("AFS using %d of the cache's available %d 1K byte blocks.\n",
return 0;
}
-static ListCellsCmd(as)
- struct cmd_syndesc *as;
+static int ListCellsCmd(struct cmd_syndesc *as)
{
afs_int32 code;
afs_int32 i, j;
for(i=0;;i++) {
tp = space;
- bcopy(&i, tp, sizeof(afs_int32));
+ memcpy(tp, &i, sizeof(afs_int32));
blob.out_size = MAXSIZE;
blob.in_size = sizeof(afs_int32);
blob.in = space;
afs_int32 addr;
char *name, tbuffer[20];
- bcopy(tp + j*sizeof(afs_int32), &addr, sizeof(afs_int32));
+ memcpy(&addr, tp + j*sizeof(afs_int32), sizeof(afs_int32));
if (addr == 0) break;
if (resolve) {
return 0;
}
-static NewCellCmd(as)
- struct cmd_syndesc *as;
+static int ListAliasesCmd(struct cmd_syndesc *as)
+{
+ afs_int32 code, i;
+ char *tp, *aliasName, *realName;
+ struct ViceIoctl blob;
+
+ for(i=0;;i++) {
+ tp = space;
+ memcpy(tp, &i, sizeof(afs_int32));
+ blob.out_size = MAXSIZE;
+ blob.in_size = sizeof(afs_int32);
+ blob.in = space;
+ blob.out = space;
+ code = pioctl(0, VIOC_GETALIAS, &blob, 1);
+ if (code < 0) {
+ if (errno == EDOM) break; /* done with the list */
+ Die(errno, 0);
+ return 1;
+ }
+ tp = space;
+ aliasName = tp;
+ tp += strlen(aliasName) + 1;
+ realName = tp;
+ printf("Alias %s for cell %s\n", aliasName, realName);
+ }
+ return 0;
+}
+
+static int NewCellCmd(struct cmd_syndesc *as)
{
afs_int32 code, linkedstate=0, size=0, *lp;
struct ViceIoctl blob;
* MAXCELLHOSTS (8) servers. To determine which we are talking to,
* do a GETCELL pioctl and pass it a magic number. If an array of
* 8 comes back, its a 3.5 client. If not, its a 3.4 client.
+ * If we get back EDOM, there are no cells in the kernel yet,
+ * and we'll assume a 3.5 client.
*/
tp = space;
lp = (afs_int32 *)tp;
blob.in = space;
blob.out = space;
code = pioctl(0, VIOCGETCELL, &blob, 1);
- if (code < 0) {
+ if (code < 0 && errno != EDOM) {
Die(errno, 0);
return 1;
}
- tp = space;
- cellname = tp + MAXCELLHOSTS*sizeof(afs_int32);
- scount = ((cellname[0] != '\0') ? MAXCELLHOSTS : MAXHOSTS);
+ if (code < 1 && errno == EDOM) {
+ scount = MAXHOSTS;
+ } else {
+ tp = space;
+ cellname = tp + MAXCELLHOSTS*sizeof(afs_int32);
+ scount = ((cellname[0] != '\0') ? MAXCELLHOSTS : MAXHOSTS);
+ }
/* Now setup and do the NEWCELL pioctl call */
- bzero(space, (scount+1) * sizeof(afs_int32));
+ memset(space, 0, (scount+1) * sizeof(afs_int32));
tp = space;
lp = (afs_int32 *)tp;
*lp++ = 0x12345678;
pn, ti->data);
}
else {
- bcopy(thp->h_addr, tp, sizeof(afs_int32));
+ memcpy(tp, thp->h_addr, sizeof(afs_int32));
tp += sizeof(afs_int32);
}
}
return 0;
}
-static WhichCellCmd(as)
- struct cmd_syndesc *as;
+static int NewAliasCmd(struct cmd_syndesc *as)
+{
+ afs_int32 code;
+ struct ViceIoctl blob;
+ char *tp;
+ char *aliasName, *realName;
+
+ /* Now setup and do the NEWCELL pioctl call */
+ aliasName = as->parms[0].items->data;
+ realName = as->parms[1].items->data;
+ tp = space;
+ strcpy(tp, aliasName);
+ tp += strlen(aliasName) + 1;
+ strcpy(tp, realName);
+ tp += strlen(realName) + 1;
+
+ blob.in_size = tp - space;
+ blob.in = space;
+ blob.out_size = 0;
+ blob.out = space;
+ code = pioctl(0, VIOC_NEWALIAS, &blob, 1);
+ if (code < 0) {
+ if (errno == EEXIST) {
+ fprintf(stderr, "%s: cell name `%s' in use by an existing cell.\n",
+ pn, aliasName);
+ } else {
+ Die(errno, 0);
+ }
+ return 1;
+ }
+ return 0;
+}
+
+static int WhichCellCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct cmd_item *ti;
if (errno == ENOENT)
fprintf(stderr,"%s: no such cell as '%s'\n", pn, ti->data);
else
- Die(code, ti->data);
+ Die(errno, ti->data);
error = 1;
continue;
}
return error;
}
-static WSCellCmd(as)
- struct cmd_syndesc *as;
+static int WSCellCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
blob.in_size = 0;
- blob.in = (char *) 0;
+ blob.in = NULL;
blob.out_size = MAXSIZE;
blob.out = space;
- code = pioctl((char *) 0, VIOC_GET_WS_CELL, &blob, 1);
+ code = pioctl(NULL, VIOC_GET_WS_CELL, &blob, 1);
if (code) {
- Die(errno, (char *) 0);
+ Die(errno, NULL);
return 1;
}
}
*/
-static MonitorCmd(as)
- struct cmd_syndesc *as;
+static int MonitorCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
return 1;
}
}
- else bcopy(thp->h_addr, &hostAddr, sizeof(afs_int32));
+ else memcpy(&hostAddr, thp->h_addr, sizeof(afs_int32));
}
}
else {
return 0;
}
-static SysNameCmd(as)
- struct cmd_syndesc *as;
+static int SysNameCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
struct cmd_item *ti;
char *input = space;
- afs_int32 setp = 1;
+ afs_int32 setp = 0;
ti = as->parms[0].items;
- if (!ti) setp = 0;
blob.in = space;
blob.out = space;
blob.out_size = MAXSIZE;
blob.in_size = sizeof(afs_int32);
- bcopy(&setp, input, sizeof(afs_int32));
input += sizeof(afs_int32);
- if (ti) {
- strcpy(input, ti->data);
+ for(; ti; ti=ti->next) {
+ setp++;
blob.in_size += strlen(ti->data) + 1;
+ if (blob.in_size > MAXSIZE) {
+ fprintf(stderr, "%s: sysname%s too long.\n", pn, setp > 1 ? "s" : "");
+ return 1;
+ }
+ strcpy(input, ti->data);
input += strlen(ti->data);
*(input++) = '\0';
}
+ memcpy(space, &setp, sizeof(afs_int32));
code = pioctl(0, VIOC_AFS_SYSNAME, &blob, 1);
if (code) {
Die(errno, 0);
return 1;
}
if (setp) {
- printf("%s: new sysname set.\n", pn);
+ printf("%s: new sysname%s set.\n", pn, setp > 1 ? " list" : "");
return 0;
}
input = space;
- bcopy(input, &setp, sizeof(afs_int32));
+ memcpy(&setp, input, sizeof(afs_int32));
input += sizeof(afs_int32);
if (!setp) {
fprintf(stderr, "No sysname name value was found\n");
return 1;
}
- printf("Current sysname is '%s'\n", input);
+ printf("Current sysname%s is", setp>1 ? " list" : "");
+ for(;setp>0;--setp) {
+ printf(" \'%s\'", input);
+ input += strlen(input) + 1;
+ }
+ printf("\n");
return 0;
}
static char *exported_types[] = {"null", "nfs", ""};
-static ExportAfsCmd(as)
- struct cmd_syndesc *as;
+static int ExportAfsCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
}
-static GetCellCmd(as)
- struct cmd_syndesc *as;
+static int GetCellCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
return error;
}
-static SetCellCmd(as)
- struct cmd_syndesc *as;
+static int SetCellCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
return error;
}
-static GetCellName(cellName, info)
- char *cellName;
- struct afsconf_cell *info;
+static int GetCellName(char *cellName, struct afsconf_cell *info)
{
struct afsconf_dir *tdir;
int code;
}
-static VLDBInit(noAuthFlag, info)
- int noAuthFlag;
- struct afsconf_cell *info;
+static int VLDBInit(int noAuthFlag, struct afsconf_cell *info)
{
afs_int32 code;
struct ktc_principal sname;
strcpy(sname.cell, info->name);
sname.instance[0] = 0;
strcpy(sname.name, "afs");
- code = ktc_GetToken(&sname,&ttoken, sizeof(ttoken), (char *)0);
+ code = ktc_GetToken(&sname,&ttoken, sizeof(ttoken), NULL);
if (code) {
fprintf(stderr, "%s: Could not get afs tokens, running unauthenticated.\n", pn);
scIndex = 0;
else scIndex = 0; /* don't authenticate */
switch (scIndex) {
case 0:
- sc = (struct rx_securityClass *) rxnull_NewClientSecurityObject();
+ sc = rxnull_NewClientSecurityObject();
break;
case 1:
pn, info->numServers, VLDB_MAXSERVERS);
exit(1);
}
- bzero(serverconns, sizeof(serverconns));
+ memset(serverconns, 0, sizeof(serverconns));
for (i = 0;i<info->numServers;i++)
serverconns[i] = rx_NewConnection(info->hostAddr[i].sin_addr.s_addr,
info->hostAddr[i].sin_port, USER_SERVICE_ID,
* 0 on success,
* errno value if error and no error message printed
*/
-static pokeServers()
+static int pokeServers(void)
{
int code;
* 0 on success,
* errno value if error and no error message printed
*/
-static addServer(name, rank)
- char *name;
- afs_int32 rank;
+static int addServer(char *name, afs_int32 rank)
{
int t,code;
struct setspref *ssp;
}
sp = (struct spref *) (gblob.in + gblob.in_size);
- bcopy (thostent->h_addr_list[t], &(sp->server.s_addr), sizeof(afs_uint32));
+ memcpy(&(sp->server.s_addr), thostent->h_addr_list[t], sizeof(afs_uint32));
sp->rank = (rank > MAXUSHORT ? MAXUSHORT : rank);
gblob.in_size += sizeof(struct spref);
ssp->num_servers++;
}
-static SetPrefCmd(as)
- struct cmd_syndesc *as;
+static int SetPrefCmd(struct cmd_syndesc *as)
{
FILE *infd;
afs_int32 code;
-static GetPrefCmd(as)
- struct cmd_syndesc *as;
+static int GetPrefCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct cmd_item *ti;
return 0;
}
-static StoreBehindCmd(as)
- struct cmd_syndesc *as;
+static int StoreBehindCmd(struct cmd_syndesc *as)
{
afs_int32 code=0;
struct ViceIoctl blob;
blob.in = (char *)&tsb;
blob.out = (char *)&tsb2;
blob.in_size = blob.out_size = sizeof(struct sbstruct);
- bzero (&tsb2, sizeof(tsb2));
+ memset(&tsb2, 0, sizeof(tsb2));
/* once per -file */
for (ti=as->parms[1].items; ti; ti=ti->next) {
}
-static afs_int32 SetCryptCmd(as)
- struct cmd_syndesc *as;
+static afs_int32 SetCryptCmd(struct cmd_syndesc *as)
{
afs_int32 code = 0, flag;
struct ViceIoctl blob;
blob.out_size = 0;
code = pioctl(0, VIOC_SETRXKCRYPT, &blob, 1);
if (code)
- Die(code, (char *) 0);
+ Die(errno, NULL);
return 0;
}
-static afs_int32 GetCryptCmd(as)
- struct cmd_syndesc *as;
+static afs_int32 GetCryptCmd(struct cmd_syndesc *as)
{
afs_int32 code = 0, flag;
struct ViceIoctl blob;
char *tp;
- blob.in = (char *) 0;
+ blob.in = NULL;
blob.in_size = 0;
blob.out_size = sizeof(flag);
blob.out = space;
code = pioctl(0, VIOC_GETRXKCRYPT, &blob, 1);
- if (code) Die(code, (char *) 0);
+ if (code) Die(errno, NULL);
else {
tp = space;
- bcopy(tp, &flag, sizeof(afs_int32));
+ memcpy(&flag, tp, sizeof(afs_int32));
printf("Security level is currently ");
if (flag == 1)
printf("crypt (data security).\n");
#include "AFS_component_version_number.c"
-main(argc, argv)
- int argc;
- char **argv;
+int main(int argc, char **argv)
{
afs_int32 code;
struct cmd_syndesc *ts;
ts = cmd_CreateSyntax("listcells", ListCellsCmd, 0, "list configured cells");
cmd_AddParm(ts, "-numeric", CMD_FLAG, CMD_OPTIONAL, "addresses only");
+ ts = cmd_CreateSyntax("listaliases", ListAliasesCmd, 0, "list configured cell aliases");
+
ts = cmd_CreateSyntax("setquota", SetQuotaCmd, 0, "set volume quota");
cmd_AddParm(ts, "-path", CMD_SINGLE, CMD_OPTIONAL, "dir/file path");
cmd_AddParm(ts, "-max", CMD_SINGLE, 0, "max quota in kbytes");
cmd_AddParm(ts, "-servers", CMD_LIST, CMD_REQUIRED, "primary servers");
cmd_AddParm(ts, "-linkedcell", CMD_SINGLE, CMD_OPTIONAL, "linked cell name");
+ ts = cmd_CreateSyntax("newalias", NewAliasCmd, 0, "configure new cell alias");
+ cmd_AddParm(ts, "-alias", CMD_SINGLE, 0, "alias name");
+ cmd_AddParm(ts, "-name", CMD_SINGLE, 0, "real name of cell");
+
#ifdef FS_ENABLE_SERVER_DEBUG_PORTS
/*
* Turn this on only if you wish to be able to talk to a server which is listening
cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
ts = cmd_CreateSyntax("sysname", SysNameCmd, 0, "get/set sysname (i.e. @sys) value");
- cmd_AddParm(ts, "-newsys", CMD_SINGLE, CMD_OPTIONAL, "new sysname");
+ cmd_AddParm(ts, "-newsys", CMD_LIST, CMD_OPTIONAL, "new sysname");
ts = cmd_CreateSyntax("exportafs", ExportAfsCmd, 0, "enable/disable translators to AFS");
cmd_AddParm(ts, "-type", CMD_SINGLE, 0, "exporter name");
ts = cmd_CreateSyntax("setcrypt", SetCryptCmd, 0, "set cache manager encryption flag");
cmd_AddParm(ts, "-crypt", CMD_SINGLE, 0, "on or off");
+ ts = cmd_CreateSyntax("getcrypt", GetCryptCmd, 0, "set cache manager encryption flag");
+
ts = cmd_CreateSyntax("rxstatproc", RxStatProcCmd, 0,
"Manage per process RX statistics");
cmd_AddParm(ts, "-enable", CMD_FLAG, CMD_OPTIONAL,
return code;
}
-static void Die(errnum, filename)
- int errnum;
- char *filename;
+static void Die(int errnum, char *filename)
{
switch (errnum) {
case EINVAL:
}
/* get clients interface addresses */
-static int
-GetClientAddrsCmd(as)
- struct cmd_syndesc *as;
+static int GetClientAddrsCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct cmd_item *ti;
return 0;
}
-static int
-SetClientAddrsCmd(as)
- struct cmd_syndesc *as;
+static int SetClientAddrsCmd(struct cmd_syndesc *as)
{
afs_int32 code, addr;
struct cmd_item *ti;
return error;
}
-static int
-FlushMountCmd(as)
- struct cmd_syndesc *as;
+static int FlushMountCmd(struct cmd_syndesc *as)
{
afs_int32 code;
struct ViceIoctl blob;
* name (we know there is one) and splice in the symlink value.
*/
if (true_name[0] != '/') {
- last_component = (char *) rindex(orig_name, '/');
+ last_component = (char *) strrchr(orig_name, '/');
strcpy(++last_component, true_name);
strcpy(true_name, orig_name);
}
/*
* Find rightmost slash, if any.
*/
- last_component = (char *) rindex(true_name, '/');
+ last_component = (char *) strrchr(true_name, '/');
if (last_component) {
/*
* Found it. Designate everything before it as the parent directory,
blob.in = last_component;
blob.in_size = strlen(last_component)+1;
blob.out_size = 0;
- bzero(space, MAXSIZE);
+ memset(space, 0, MAXSIZE);
code = pioctl(parent_dir, VIOC_AFS_FLUSHMOUNT, &blob, 1);
return error;
}
-static int
-RxStatProcCmd(as)
- struct cmd_syndesc *as;
+static int RxStatProcCmd(struct cmd_syndesc *as)
{
afs_int32 code;
afs_int32 flags = 0;
return 0;
}
-static int
-RxStatPeerCmd(as)
- struct cmd_syndesc *as;
+static int RxStatPeerCmd(struct cmd_syndesc *as)
{
afs_int32 code;
afs_int32 flags = 0;