#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
+#include <afs/afs_consts.h>
#include <afs/afs_args.h>
#include <rx/xdr.h>
#include <sys/ioctl.h>
#include <netdb.h>
#include <errno.h>
#include <stdio.h>
+#include <ctype.h>
#include <netinet/in.h>
#include <sys/stat.h>
#include <afs/stds.h>
#include <afs/vice.h>
#include <afs/venus.h>
#include <afs/com_err.h>
+#include <afs/afs_consts.h>
#ifdef AFS_AIX32_ENV
#include <signal.h>
#endif
#include <afs/vlserver.h>
#include <afs/cmd.h>
#include <afs/afsutil.h>
+#include <afs/com_err.h>
#include <stdlib.h>
#include <assert.h>
#include <afs/ptclient.h>
+#include <afs/ptuser.h>
+#include <afs/afsutil.h>
+#include <afs/sys_prototypes.h>
-
-#define MAXHOSTS 13
-#define OMAXHOSTS 8
-#define MAXCELLHOSTS 8
#define MAXNAME 100
-#define MAXSIZE 2048
#define MAXINSIZE 1300 /* pioctl complains if data is larger than this */
#define VMSGSIZE 128 /* size of msg buf in volume hdr */
-static char space[MAXSIZE];
+static char space[AFS_PIOCTL_MAXSIZE];
static char tspace[1024];
static struct ubik_client *uclient;
-static int GetClientAddrsCmd(), SetClientAddrsCmd(), FlushMountCmd();
-static int RxStatProcCmd(), RxStatPeerCmd(), GetFidCmd(), UuidCmd();
-
-extern char *hostutil_GetNameByINet();
-extern struct hostent *hostutil_GetHostByName();
-
+static int GetClientAddrsCmd(struct cmd_syndesc *, void *);
+static int SetClientAddrsCmd(struct cmd_syndesc *, void *);
+static int FlushMountCmd(struct cmd_syndesc *, void *);
+static int RxStatProcCmd(struct cmd_syndesc *, void *);
+static int RxStatPeerCmd(struct cmd_syndesc *, void *);
+static int GetFidCmd(struct cmd_syndesc *, void *);
+static int UuidCmd(struct cmd_syndesc *, void *);
static char pn[] = "fs";
static int rxInitDone = 0;
-static void ZapList();
-static int PruneList();
-static CleanAcl();
+struct AclEntry;
+struct Acl;
+static void ZapList(struct AclEntry *);
+static int PruneList(struct AclEntry **, int);
+static int CleanAcl(struct Acl *, char *);
static int SetVolCmd(struct cmd_syndesc *as, void *arock);
-static GetCellName();
-static VLDBInit();
-static void Die();
+static int GetCellName(char *, struct afsconf_cell *);
+static int VLDBInit(int, struct afsconf_cell *);
+static void Die(int, char *);
/*
* Character to use between name and rights in printed representation for
};
static void
-ZapAcl(acl)
- struct Acl *acl;
+ZapAcl(struct Acl *acl)
{
if (!acl)
return;
free(acl);
}
-static
-foldcmp(a, b)
- char *a;
- char *b;
+static int
+foldcmp(char *a, char *b)
{
char t, u;
while (1) {
afs_int32 code;
blob.in_size = 0;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.out = space;
code = pioctl(apath, VIOC_FILE_CELL_NAME, &blob, 1);
Parent(char *apath)
{
char *tp;
- strcpy(tspace, apath);
+ strlcpy(tspace, apath, sizeof(tspace));
tp = strrchr(tspace, '/');
- if (tp) {
- *tp = 0;
- } else
- strcpy(tspace, ".");
+ if (tp == (char *)tspace)
+ tp++;
+ else if (tp == (char *)NULL) {
+ tp = (char *)tspace;
+ *(tp++) = '.';
+ }
+ *tp = '\0';
return tspace;
}
printf("%-25.25s", name);
if (status->MaxQuota != 0) {
- printf("%10d%10d", status->MaxQuota, status->BlocksInUse);
+ printf(" %10d %10d", status->MaxQuota, status->BlocksInUse);
QuotaUsed =
((((double)status->BlocksInUse) / status->MaxQuota) * 100.0);
} else {
- printf(" no limit%10d", status->BlocksInUse);
+ printf(" no limit %10d", status->BlocksInUse);
}
if (QuotaUsed > 90.0) {
printf("%5.0f%%<<", QuotaUsed);
static char *
AclToString(struct Acl *acl)
{
- static char mydata[MAXSIZE];
- char tstring[MAXSIZE];
+ static char mydata[AFS_PIOCTL_MAXSIZE];
+ char tstring[AFS_PIOCTL_MAXSIZE];
char dfsstring[30];
struct AclEntry *tp;
clear = 0;
plusp = !(as->parms[3].items);
for (ti = as->parms[0].items; ti; ti = ti->next) {
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = idf;
blob.in = blob.out = space;
code = pioctl(ti->data, VIOCGETAL, &blob, 1);
struct ViceIoctl blob;
struct Acl *fa, *ta = 0;
struct AclEntry *tp;
- struct cmd_item *ti, *ui;
- int plusp;
- afs_int32 rights;
+ struct cmd_item *ti;
int clear;
int idf = getidf(as, parm_copyacl_id);
int error = 0;
clear = 1;
else
clear = 0;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = idf;
blob.in = blob.out = space;
code = pioctl(as->parms[0].items->data, VIOCGETAL, &blob, 1);
fa = ParseAcl(space);
CleanAcl(fa, as->parms[0].items->data);
for (ti = as->parms[1].items; ti; ti = ti->next) {
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = idf;
blob.in = blob.out = space;
code = pioctl(ti->data, VIOCGETAL, &blob, 1);
* negative sign), then it might be bad. We then query the ptserver
* to see.
*/
-static
+static int
BadName(char *aname, char *fname)
{
afs_int32 tc, code, id;
char *nm;
char cell[MAXCELLCHARS];
- for (nm = aname; tc = *nm; nm++) {
+ for (nm = aname; (tc = *nm); nm++) {
/* all must be '-' or digit to be bad */
if (tc != '-' && (tc < '0' || tc > '9'))
return 0;
/* clean up an access control list of its bad entries; return 1 if we made
any changes to the list, and 0 otherwise */
-static
+static int
CleanAcl(struct Acl *aa, char *fname)
{
struct AclEntry *te, **le, *ne;
SetDotDefault(&as->parms[0].items);
for (ti = as->parms[0].items; ti; ti = ti->next) {
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = 0;
blob.out = space;
code = pioctl(ti->data, VIOCGETAL, &blob, 1);
SetDotDefault(&as->parms[0].items);
for (ti = as->parms[0].items; ti; ti = ti->next) {
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = idf;
blob.in = blob.out = space;
code = pioctl(ti->data, VIOCGETAL, &blob, 1);
continue;
}
ta = ParseAcl(space);
- switch (ta->dfs) {
- case 0:
- printf("Access list for %s is\n", ti->data);
- break;
- case 1:
- printf("DFS access list for %s is\n", ti->data);
- break;
- case 2:
- printf("DFS initial directory access list of %s is\n", ti->data);
- break;
- case 3:
- printf("DFS initial file access list of %s is\n", ti->data);
- break;
- }
- if (ta->dfs) {
- printf(" Default cell = %s\n", ta->cell);
- }
- if (ta->nplus > 0) {
- if (!ta->dfs)
- printf("Normal rights:\n");
- for (te = ta->pluslist; te; te = te->next) {
- printf(" %s ", te->name);
- PRights(te->rights, ta->dfs);
- printf("\n");
+ if (as->parms[3].items) { /* -cmd */
+ printf("fs setacl -dir %s -acl ", ti->data);
+ if (ta->nplus > 0) {
+ for (te = ta->pluslist; te; te = te->next) {
+ printf(" %s ", te->name);
+ PRights(te->rights, ta->dfs);
+ }
+ }
+ printf("\n");
+ if (ta->nminus > 0) {
+ printf("fs setacl -dir %s -acl ", ti->data);
+ for (te = ta->minuslist; te; te = te->next) {
+ printf(" %s ", te->name);
+ PRights(te->rights, ta->dfs);
+ }
+ printf(" -negative\n");
+ }
+ } else {
+ switch (ta->dfs) {
+ case 0:
+ printf("Access list for %s is\n", ti->data);
+ break;
+ case 1:
+ printf("DFS access list for %s is\n", ti->data);
+ break;
+ case 2:
+ printf("DFS initial directory access list of %s is\n", ti->data);
+ break;
+ case 3:
+ printf("DFS initial file access list of %s is\n", ti->data);
+ break;
}
- }
- if (ta->nminus > 0) {
- printf("Negative rights:\n");
- for (te = ta->minuslist; te; te = te->next) {
- printf(" %s ", te->name);
- PRights(te->rights, ta->dfs);
- printf("\n");
+ if (ta->dfs) {
+ printf(" Default cell = %s\n", ta->cell);
+ }
+ if (ta->nplus > 0) {
+ if (!ta->dfs)
+ printf("Normal rights:\n");
+ for (te = ta->pluslist; te; te = te->next) {
+ printf(" %s ", te->name);
+ PRights(te->rights, ta->dfs);
+ printf("\n");
+ }
}
+ if (ta->nminus > 0) {
+ printf("Negative rights:\n");
+ for (te = ta->minuslist; te; te = te->next) {
+ printf(" %s ", te->name);
+ PRights(te->rights, ta->dfs);
+ printf("\n");
+ }
+ }
+ if (ti->next)
+ printf("\n");
}
- if (ti->next)
- printf("\n");
ZapAcl(ta);
}
return error;
return 0;
}
+#if defined(AFS_CACHE_BYPASS)
+/*
+ * Set cache-bypass threshold. Files larger than this size will not be cached.
+ * With a threshold of 0, the cache is always bypassed. With a threshold of -1,
+ * cache bypass is disabled.
+ */
+
+static int
+BypassThresholdCmd(struct cmd_syndesc *as, void *arock)
+{
+ afs_int32 code;
+ struct ViceIoctl blob;
+ afs_int32 threshold_i, threshold_o;
+ char *tp;
+
+ /* if new threshold supplied, then set and confirm, else,
+ * get current threshold and print
+ */
+
+ if(as->parms[0].items) {
+ int digit, ix, len;
+
+ tp = as->parms[0].items->data;
+ len = strlen(tp);
+ digit = 1;
+ for(ix = 0; ix < len; ++ix) {
+ if(!isdigit(tp[0])) {
+ digit = 0;
+ break;
+ }
+ }
+ if (digit == 0) {
+ fprintf(stderr, "fs bypassthreshold -size: %s must be an undecorated digit string.\n", tp);
+ return EINVAL;
+ }
+ threshold_i = atoi(tp);
+ if(ix > 9 && threshold_i < 2147483647)
+ threshold_i = 2147483647;
+ blob.in = (char *) &threshold_i;
+ blob.in_size = sizeof(threshold_i);
+ } else {
+ blob.in = NULL;
+ blob.in_size = 0;
+ }
+
+ blob.out = (char *) &threshold_o;
+ blob.out_size = sizeof(threshold_o);
+ code = pioctl(0, VIOC_SETBYPASS_THRESH, &blob, 1);
+ if (code) {
+ Die(errno, NULL);
+ return 1;
+ } else {
+ printf("Cache bypass threshold %d", threshold_o);
+ if(threshold_o == -1)
+ printf(" (disabled)");
+ printf("\n");
+ }
+
+ return 0;
+}
+
+#endif
+
static int
FlushCmd(struct cmd_syndesc *as, void *arock)
{
SetDotDefault(&as->parms[0].items);
for (ti = as->parms[0].items; ti; ti = ti->next) {
/* once per file */
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = sizeof(*status) + 3; /* for the three terminating nulls */
blob.out = space;
blob.in = space;
status->MinQuota = status->MaxQuota = -1;
offmsg = NULL;
if (as->parms[1].items) {
- code = util_GetInt32(as->parms[1].items->data, &status->MaxQuota);
+ code = util_GetHumanInt32(as->parms[1].items->data, &status->MaxQuota);
if (code) {
fprintf(stderr, "%s: bad integer specified for quota.\n", pn);
error = 1;
struct VenusFid vfid;
/* once per file */
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = 0;
blob.out = space;
code = pioctl(ti->data, VIOCGETVOLSTAT, &blob, 1);
char *name;
int error = 0;
- printf("%-25s%-10s%-10s%-7s%-11s\n", "Volume Name", " Quota",
- " Used", " %Used", " Partition");
+ printf("%-25s%-11s%-11s%-7s%-11s\n", "Volume Name", " Quota",
+ " Used", " %Used", " Partition");
SetDotDefault(&as->parms[0].items);
for (ti = as->parms[0].items; ti; ti = ti->next) {
/* once per file */
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = 0;
blob.out = space;
code = pioctl(ti->data, VIOCGETVOLSTAT, &blob, 1);
SetDotDefault(&as->parms[0].items);
for (ti = as->parms[0].items; ti; ti = ti->next) {
/* once per file */
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = 0;
blob.out = space;
memset(space, 0, sizeof(space));
hosts = (afs_int32 *) space;
printf("File %s is on host%s ", ti->data,
(hosts[0] && !hosts[1]) ? "" : "s");
- for (j = 0; j < MAXHOSTS; j++) {
+ for (j = 0; j < AFS_MAXHOSTS; j++) {
if (hosts[j] == 0)
break;
tp = hostutil_GetNameByINet(hosts[j]);
SetDotDefault(&as->parms[0].items);
for (ti = as->parms[0].items; ti; ti = ti->next) {
/* once per file */
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = 0;
blob.out = space;
code = pioctl(ti->data, VIOCGETVOLSTAT, &blob, 1);
SetDotDefault(&as->parms[0].items);
for (ti = as->parms[0].items; ti; ti = ti->next) {
/* once per file */
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = 0;
blob.out = space;
code = pioctl(ti->data, VIOCGETVOLSTAT, &blob, 1);
* Find rightmost slash, if any.
*/
last_component = (char *)strrchr(true_name, '/');
- if (last_component) {
+ if (last_component == (char *)true_name) {
+ strcpy(parent_dir, "/");
+ last_component++;
+ }
+ else if (last_component != (char *)NULL) {
/*
* Found it. Designate everything before it as the parent directory,
* everything after it as the final component.
blob.in = last_component;
blob.in_size = strlen(last_component) + 1;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.out = space;
- memset(space, 0, MAXSIZE);
+ memset(space, 0, AFS_PIOCTL_MAXSIZE);
code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, &blob, 1);
/* Check for a cellname in the volume specification, and complain
* if it doesn't match what was specified with -cell */
- if (tmpName = strchr(volName, ':')) {
+ if ((tmpName = strchr(volName, ':'))) {
*tmpName = '\0';
if (cellName) {
if (strcasecmp(cellName, volName)) {
if (!cellName) {
blob.in_size = 0;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.out = space;
code =
pioctl(Parent(as->parms[0].items->data), VIOC_FILE_CELL_NAME,
afs_int32 j;
afs_int32 temp;
char *tp;
- char tbuffer[128];
- afs_int32 interval;
struct afsconf_cell info;
struct chservinfo checkserv;
blob.in_size = sizeof(struct chservinfo);
blob.in = (caddr_t) & checkserv;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.out = space;
memset(space, 0, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */
{
afs_int32 code = 0;
struct ViceIoctl blob;
- afs_int32 j;
- afs_int32 temp;
struct gaginfo gagflags;
struct cmd_item *show;
memset(&gagflags, 0, sizeof(struct gaginfo));
blob.in_size = sizeof(struct gaginfo);
blob.in = (caddr_t) & gagflags;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.out = space;
memset(space, 0, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */
- if (show = as->parms[0].items) {
+ if ((show = as->parms[0].items)) {
if (!strcasecmp(show->data, "user"))
gagflags.showflags |= GAGUSER;
else if (!strcasecmp(show->data, "console"))
}
static int
-PreCacheCmd(struct cmd_syndesc *as, char *arock)
+PreCacheCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 code;
struct ViceIoctl blob;
return 1;
}
if (as->parms[0].items) {
- code = util_GetInt32(as->parms[0].items->data, &temp);
+ code = util_GetHumanInt32(as->parms[0].items->data, &temp);
if (code) {
fprintf(stderr, "%s: bad integer specified for cache size.\n",
pn);
}
if (percentBlocks > 90)
- printf("[cache size usage over 90%, consider increasing cache size]\n");
+ printf("[cache size usage over 90%%, consider increasing cache size]\n");
if (percentFiles > 90)
- printf("[cache file usage over 90%, consider increasing '-files' argument to afsd]\n");
+ printf("[cache file usage over 90%%, consider increasing '-files' argument to afsd]\n");
return 0;
}
{
afs_int32 code;
afs_int32 i, j;
- char *tcp, *tp;
- afs_int32 clear;
+ char *tp;
struct ViceIoctl blob;
int resolve;
for (i = 0;; i++) {
tp = space;
memcpy(tp, &i, sizeof(afs_int32));
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = sizeof(afs_int32);
blob.in = space;
blob.out = space;
return 1;
}
tp = space;
- printf("Cell %s on hosts", tp + MAXCELLHOSTS * sizeof(afs_int32));
- for (j = 0; j < MAXCELLHOSTS; j++) {
+ printf("Cell %s on hosts", tp + AFS_MAXCELLHOSTS * sizeof(afs_int32));
+ for (j = 0; j < AFS_MAXCELLHOSTS; j++) {
afs_int32 addr;
char *name, tbuffer[20];
for (i = 0;; i++) {
tp = space;
memcpy(tp, &i, sizeof(afs_int32));
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = sizeof(afs_int32);
blob.in = space;
blob.out = space;
struct cmd_item *ti;
afs_int32 hostAddr;
struct hostent *thp;
- char *tp;
int setp;
ti = as->parms[0].items;
char *tp, *cellname = 0;
struct hostent *thp;
afs_int32 fsport = 0, vlport = 0;
- afs_int32 magic, scount; /* Number of servers to pass in pioctl call */
+ afs_int32 scount; /* Number of servers to pass in pioctl call */
/* Yuck!
* With the NEWCELL pioctl call, 3.4 clients take an array of
- * MAXHOSTS (13) servers while 3.5 clients take an array of
- * MAXCELLHOSTS (8) servers. To determine which we are talking to,
+ * AFS_MAXHOSTS (13) servers while 3.5 clients take an array of
+ * AFS_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,
lp = (afs_int32 *) tp;
*lp++ = 0; /* first cell entry */
*lp = 0x12345678; /* magic */
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = sizeof(afs_int32) + sizeof(afs_int32);
blob.in = space;
blob.out = space;
return 1;
}
if (code < 1 && errno == EDOM) {
- scount = MAXHOSTS;
+ scount = AFS_MAXHOSTS;
} else {
tp = space;
- cellname = tp + MAXCELLHOSTS * sizeof(afs_int32);
- scount = ((cellname[0] != '\0') ? MAXCELLHOSTS : MAXHOSTS);
+ cellname = tp + AFS_MAXCELLHOSTS * sizeof(afs_int32);
+ scount = ((cellname[0] != '\0') ? AFS_MAXCELLHOSTS : AFS_MAXHOSTS);
}
/* Now setup and do the NEWCELL pioctl call */
blob.in_size = 0;
blob.in = NULL;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.out = space;
code = pioctl(NULL, VIOC_GET_WS_CELL, &blob, 1);
ti = as->parms[0].items;
blob.in = space;
blob.out = space;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
blob.in_size = sizeof(afs_int32);
input += sizeof(afs_int32);
for (; ti; ti = ti->next) {
setp++;
blob.in_size += strlen(ti->data) + 1;
- if (blob.in_size > MAXSIZE) {
+ if (blob.in_size > AFS_PIOCTL_MAXSIZE) {
fprintf(stderr, "%s: sysname%s too long.\n", pn,
setp > 1 ? "s" : "");
return 1;
}
exp = 1;
}
- if (ti = as->parms[2].items) { /* -noconvert */
+ if ((ti = as->parms[2].items)) { /* -noconvert */
if (strcmp(ti->data, "on") == 0)
mode = 2;
else if (strcmp(ti->data, "off") == 0)
return 1;
}
}
- if (ti = as->parms[3].items) { /* -uidcheck */
+ if ((ti = as->parms[3].items)) { /* -uidcheck */
if (strcmp(ti->data, "on") == 0)
pwsync = 3;
else if (strcmp(ti->data, "off") == 0)
return 1;
}
}
- if (ti = as->parms[4].items) { /* -submounts */
+ if ((ti = as->parms[4].items)) { /* -submounts */
if (strcmp(ti->data, "on") == 0)
smounts = 3;
else if (strcmp(ti->data, "off") == 0)
return 1;
}
}
- if (ti = as->parms[5].items) { /* -clipags */
+ if ((ti = as->parms[5].items)) { /* -clipags */
if (strcmp(ti->data, "on") == 0)
clipags = 3;
else if (strcmp(ti->data, "off") == 0)
return 1;
}
}
- if (ti = as->parms[6].items) { /* -pagcb */
+ if ((ti = as->parms[6].items)) { /* -pagcb */
if (strcmp(ti->data, "on") == 0)
pagcb = 3;
else if (strcmp(ti->data, "off") == 0)
{
afs_int32 code;
- code = ugen_ClientInit(noAuthFlag, AFSDIR_CLIENT_ETC_DIRPATH,
+ code = ugen_ClientInit(noAuthFlag, (char *) AFSDIR_CLIENT_ETC_DIRPATH,
info->name, 0, &uclient,
NULL, pn, rxkad_clear,
VLDB_MAXSERVERS, AFSCONF_VLDBSERVICE, 50,
struct setspref *ssp;
struct spref *sp;
struct hostent *thostent;
- afs_uint32 addr;
int error = 0;
#ifndef MAXUSHORT
if (debug)
fprintf(stderr, "adding server %s, rank %d, ip addr 0x%lx\n",
- name, sp->rank, sp->server.s_addr);
+ name, sp->rank, (long unsigned int) sp->server.s_addr);
}
return error;
gblob.in_size = ((char *)&(ssp->servers[0])) - (char *)ssp;
gblob.in = space;
gblob.out = space;
- gblob.out_size = MAXSIZE;
+ gblob.out_size = AFS_PIOCTL_MAXSIZE;
if (geteuid()) {
perror(ti->data);
error = -1;
} else {
- while (fscanf(infd, "%79s%ld", name, &rank) != EOF) {
+ while (fscanf(infd, "%79s%ld", name, (long int *)&rank) != EOF) {
code = addServer(name, (unsigned short)rank);
if (code)
error = code;
ti = as->parms[3].items; /* -stdin */
if (ti) {
- while (scanf("%79s%ld", name, &rank) != EOF) {
+ while (scanf("%79s%ld", name, (long int *)&rank) != EOF) {
code = addServer(name, (unsigned short)rank);
if (code)
error = code;
afs_int32 code;
struct cmd_item *ti;
char *name, tbuffer[20];
- afs_int32 rank, addr;
+ afs_int32 addr;
FILE *outfd;
int resolve;
int vlservers = 0;
blob.in_size = sizeof(struct sprefrequest);
blob.in = (char *)in;
blob.out = space;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
in->num_servers =
- (MAXSIZE - 2 * sizeof(short)) / sizeof(struct spref);
+ (AFS_PIOCTL_MAXSIZE - 2 * sizeof(short)) / sizeof(struct spref);
in->flags = vlservers;
code = pioctl(0, VIOC_GETSPREFS, &blob, 1);
verbose = 1;
blob.in = (char *)&tsb;
- blob.out = (char *)&tsb2;
- blob.in_size = blob.out_size = sizeof(struct sbstruct);
- memset(&tsb2, 0, sizeof(tsb2));
+ blob.in_size = sizeof(struct sbstruct);
/* once per -file */
for (ti = as->parms[1].items; ti; ti = ti->next) {
/* Do this solely to see if the file is there */
+
+ blob.out = space;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
code = pioctl(ti->data, VIOCWHEREIS, &blob, 1);
if (code) {
Die(errno, ti->data);
continue;
}
+ memset(&tsb2, 0, sizeof(tsb2));
+ blob.out = (char *)&tsb2;
+ blob.out_size = sizeof(struct sbstruct);
code = pioctl(ti->data, VIOC_STORBEHIND, &blob, 1);
if (code) {
Die(errno, ti->data);
*/
if (!as->parms[1].items || (allfiles != -1)) {
tsb.sb_default = allfiles;
+ memset(&tsb2, 0, sizeof(tsb2));
+ blob.out = (char *)&tsb2;
+ blob.out_size = sizeof(struct sbstruct);
code = pioctl(0, VIOC_STORBEHIND, &blob, 1);
if (code) {
Die(errno, ((allfiles == -1) ? 0 : "-allfiles"));
parm_listacl_id = ts->nParms;
cmd_AddParm(ts, "-id", CMD_FLAG, CMD_OPTIONAL, "initial directory acl");
cmd_AddParm(ts, "-if", CMD_FLAG, CMD_OPTIONAL, "initial file acl");
+ cmd_AddParm(ts, "-cmd", CMD_FLAG, CMD_OPTIONAL, "output as 'fs setacl' command");
cmd_CreateAlias(ts, "la");
ts = cmd_CreateSyntax("getcalleraccess", GetCallerAccess, NULL,
cmd_AddParm(ts, "-fast", CMD_FLAG, CMD_OPTIONAL,
"don't check name with VLDB");
+#if defined(AFS_CACHE_BYPASS)
+ ts = cmd_CreateSyntax("bypassthreshold", BypassThresholdCmd, 0,
+ "get/set cache bypass file size threshold");
+ cmd_AddParm(ts, "-size", CMD_SINGLE, CMD_OPTIONAL, "file size");
+#endif
+
/*
defect 3069
GetClientAddrsCmd(struct cmd_syndesc *as, void *arock)
{
afs_int32 code;
- struct cmd_item *ti;
- char *name;
struct ViceIoctl blob;
struct sprefrequest *in;
struct sprefinfo *out;
blob.in_size = sizeof(struct sprefrequest);
blob.in = (char *)in;
blob.out = space;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
in->num_servers =
- (MAXSIZE - 2 * sizeof(short)) / sizeof(struct spref);
+ (AFS_PIOCTL_MAXSIZE - 2 * sizeof(short)) / sizeof(struct spref);
/* returns addr in network byte order */
code = pioctl(0, VIOC_GETCPREFS, &blob, 1);
if (code) {
{
afs_int32 code, addr;
struct cmd_item *ti;
- char name[80];
struct ViceIoctl blob;
struct setspref *ssp;
int sizeUsed = 0, i, flag;
- afs_int32 existingAddr[1024]; /* existing addresses on this host */
+ afs_uint32 existingAddr[1024]; /* existing addresses on this host */
int existNu;
int error = 0;
ssp->num_servers = 0;
blob.in = space;
blob.out = space;
- blob.out_size = MAXSIZE;
+ blob.out_size = AFS_PIOCTL_MAXSIZE;
if (geteuid()) {
fprintf(stderr, "Permission denied: requires root access.\n");
* Find rightmost slash, if any.
*/
last_component = (char *)strrchr(true_name, '/');
- if (last_component) {
+ if (last_component == (char *)true_name) {
+ strcpy(parent_dir, "/");
+ last_component++;
+ }
+ else if (last_component != (char *)NULL) {
/*
* Found it. Designate everything before it as the parent directory,
* everything after it as the final component.
blob.in = last_component;
blob.in_size = strlen(last_component) + 1;
blob.out_size = 0;
- memset(space, 0, MAXSIZE);
+ memset(space, 0, AFS_PIOCTL_MAXSIZE);
code = pioctl(parent_dir, VIOC_AFS_FLUSHMOUNT, &blob, 1);
afs_int32 code;
afs_int32 flags = 0;
struct ViceIoctl blob;
- struct cmd_item *ti;
if (as->parms[0].items) { /* -enable */
flags |= AFSCALL_RXSTATS_ENABLE;
afs_int32 code;
afs_int32 flags = 0;
struct ViceIoctl blob;
- struct cmd_item *ti;
if (as->parms[0].items) { /* -enable */
flags |= AFSCALL_RXSTATS_ENABLE;