~ubuntu-branches/ubuntu/oneiric/openafs/oneiric-201305130334

« back to all changes in this revision

Viewing changes to src/venus/fs.c

  • Committer: Bazaar Package Importer
  • Author(s): Russ Allbery
  • Date: 2008-09-22 19:07:02 UTC
  • mfrom: (12.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080922190702-59m13d7kn6gkw32d
Tags: 1.4.7.dfsg1-6
* Apply upstream patch to free /proc entries in the correct order.
  Thanks, Marc Dionne.  (Closes: #493914)
* Apply upstream deltas to support 2.6.27 kernels and to stop using
  COMMON_KERN_CFLAGS for all 2.6 kernels uniformly, which fixes
  problems on amd64 with newer kernels.  Thanks, Björn Torkelsson.
  (LP: #267504)
* Translation updates:
  - Swedish, thanks Martin Bagge.  (Closes: #493120)

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#include <afs/param.h>
12
12
 
13
13
RCSID
14
 
    ("$Header: /cvs/openafs/src/venus/fs.c,v 1.24.2.5 2006/07/31 17:07:52 shadow Exp $");
 
14
    ("$Header: /cvs/openafs/src/venus/fs.c,v 1.24.2.12 2008/03/08 01:15:36 shadow Exp $");
15
15
 
16
16
#include <afs/afs_args.h>
17
17
#include <rx/xdr.h>
25
25
#include <afs/stds.h>
26
26
#include <afs/vice.h>
27
27
#include <afs/venus.h>
 
28
#include <afs/com_err.h>
28
29
#ifdef  AFS_AIX32_ENV
29
30
#include <signal.h>
30
31
#endif
31
32
 
32
 
#ifdef HAVE_STRING_H
33
33
#include <string.h>
34
 
#else
35
 
#ifdef HAVE_STRINGS_H
36
 
#include <strings.h>
37
 
#endif
38
 
#endif
39
34
 
40
35
#undef VIRTUE
41
36
#undef VICE
69
64
static struct ubik_client *uclient;
70
65
 
71
66
static int GetClientAddrsCmd(), SetClientAddrsCmd(), FlushMountCmd();
72
 
static int RxStatProcCmd(), RxStatPeerCmd(), GetFidCmd();
 
67
static int RxStatProcCmd(), RxStatPeerCmd(), GetFidCmd(), UuidCmd();
73
68
 
74
69
extern char *hostutil_GetNameByINet();
75
70
extern struct hostent *hostutil_GetHostByName();
76
71
 
77
72
 
78
 
extern struct cmd_syndesc *cmd_CreateSyntax();
79
73
static char pn[] = "fs";
80
74
static int rxInitDone = 0;
81
75
 
82
76
static void ZapList();
83
77
static int PruneList();
84
78
static CleanAcl();
85
 
static SetVolCmd();
 
79
static int SetVolCmd(struct cmd_syndesc *as, void *arock);
86
80
static GetCellName();
87
81
static VLDBInit();
88
82
static void Die();
286
280
        if (arights & DFS_USR7)
287
281
            printf("H");
288
282
    }
 
283
    return 0;
289
284
}
290
285
 
291
286
/* this function returns TRUE (1) if the file is in AFS, otherwise false (0) */
731
726
}
732
727
 
733
728
static int
734
 
SetACLCmd(struct cmd_syndesc *as, char *arock)
 
729
SetACLCmd(struct cmd_syndesc *as, void *arock)
735
730
{
736
731
    afs_int32 code;
737
732
    struct ViceIoctl blob;
865
860
 
866
861
 
867
862
static int
868
 
CopyACLCmd(struct cmd_syndesc *as, char *arock)
 
863
CopyACLCmd(struct cmd_syndesc *as, void *arock)
869
864
{
870
865
    afs_int32 code;
871
866
    struct ViceIoctl blob;
1045
1040
 
1046
1041
/* clean up an acl to not have bogus entries */
1047
1042
static int
1048
 
CleanACLCmd(struct cmd_syndesc *as, char *arock)
 
1043
CleanACLCmd(struct cmd_syndesc *as, void *arock)
1049
1044
{
1050
1045
    afs_int32 code;
1051
1046
    struct Acl *ta = 0;
1132
1127
}
1133
1128
 
1134
1129
static int
1135
 
ListACLCmd(struct cmd_syndesc *as, char *arock)
 
1130
ListACLCmd(struct cmd_syndesc *as, void *arock)
1136
1131
{
1137
1132
    afs_int32 code;
1138
1133
    struct Acl *ta;
1196
1191
}
1197
1192
 
1198
1193
static int
1199
 
GetCallerAccess(struct cmd_syndesc *as, char *arock)
 
1194
GetCallerAccess(struct cmd_syndesc *as, void *arock)
1200
1195
{
1201
1196
    struct cmd_item *ti;
1202
1197
    int error = 0;
1223
1218
}
1224
1219
 
1225
1220
static int
1226
 
FlushVolumeCmd(struct cmd_syndesc *as, char *arock)
 
1221
FlushVolumeCmd(struct cmd_syndesc *as, void *arock)
1227
1222
{
1228
1223
    afs_int32 code;
1229
1224
    struct ViceIoctl blob;
1244
1239
    return error;
1245
1240
}
1246
1241
 
1247
 
static int
1248
 
FlushCmd(struct cmd_syndesc *as, char *arock)
 
1242
/* 
 
1243
 * The Windows version of UuidCmd displays the UUID.
 
1244
 * When the UNIX version is updated to do the same
 
1245
 * be sure to replace the CMD_REQUIRED flag with
 
1246
 * CMD_OPTIONAL in the cmd_AddParam(-generate) call 
 
1247
 */
 
1248
static int
 
1249
UuidCmd(struct cmd_syndesc *as, void *arock)
 
1250
{
 
1251
    afs_int32 code;
 
1252
    struct ViceIoctl blob;
 
1253
 
 
1254
    blob.in_size = 0;
 
1255
    blob.out_size = 0;
 
1256
    
 
1257
    if (as->parms[0].items) {
 
1258
        if (geteuid()) {
 
1259
            fprintf (stderr, "Permission denied: requires root access.\n");
 
1260
            return EACCES;
 
1261
        }
 
1262
 
 
1263
        /* generate new UUID */
 
1264
        code = pioctl(0, VIOC_NEWUUID, &blob, 1);
 
1265
 
 
1266
        if (code) {
 
1267
            Die(errno, 0);
 
1268
            return 1;
 
1269
        }
 
1270
 
 
1271
        printf("New uuid generated.\n");
 
1272
    } else {
 
1273
        /* This will never execute */
 
1274
        printf("Please add the '-generate' option to generate a new UUID.\n");
 
1275
    }
 
1276
    return 0;
 
1277
}
 
1278
 
 
1279
static int
 
1280
FlushCmd(struct cmd_syndesc *as, void *arock)
1249
1281
{
1250
1282
    afs_int32 code;
1251
1283
    struct ViceIoctl blob;
1272
1304
 
1273
1305
/* all this command does is repackage its args and call SetVolCmd */
1274
1306
static int
1275
 
SetQuotaCmd(struct cmd_syndesc *as, char *arock)
 
1307
SetQuotaCmd(struct cmd_syndesc *as, void *arock)
1276
1308
{
1277
1309
    struct cmd_syndesc ts;
1278
1310
 
1279
1311
    /* copy useful stuff from our command slot; we may later have to reorder */
1280
1312
    memcpy(&ts, as, sizeof(ts));        /* copy whole thing */
1281
 
    return SetVolCmd(&ts);
 
1313
    return SetVolCmd(&ts, arock);
1282
1314
}
1283
1315
 
1284
1316
static int
1285
 
SetVolCmd(struct cmd_syndesc *as, char *arock)
 
1317
SetVolCmd(struct cmd_syndesc *as, void *arock)
1286
1318
{
1287
1319
    afs_int32 code;
1288
1320
    struct ViceIoctl blob;
1346
1378
};
1347
1379
 
1348
1380
static int
1349
 
ExamineCmd(struct cmd_syndesc *as, char *arock)
 
1381
ExamineCmd(struct cmd_syndesc *as, void *arock)
1350
1382
{
1351
1383
    afs_int32 code;
1352
1384
    struct ViceIoctl blob;
1387
1419
}
1388
1420
 
1389
1421
static int
1390
 
ListQuotaCmd(struct cmd_syndesc *as, char *arock)
 
1422
ListQuotaCmd(struct cmd_syndesc *as, void *arock)
1391
1423
{
1392
1424
    afs_int32 code;
1393
1425
    struct ViceIoctl blob;
1418
1450
}
1419
1451
 
1420
1452
static int
1421
 
WhereIsCmd(struct cmd_syndesc *as, char *arock)
 
1453
WhereIsCmd(struct cmd_syndesc *as, void *arock)
1422
1454
{
1423
1455
    afs_int32 code;
1424
1456
    struct ViceIoctl blob;
1457
1489
 
1458
1490
 
1459
1491
static int
1460
 
DiskFreeCmd(struct cmd_syndesc *as, char *arock)
 
1492
DiskFreeCmd(struct cmd_syndesc *as, void *arock)
1461
1493
{
1462
1494
    afs_int32 code;
1463
1495
    struct ViceIoctl blob;
1488
1520
}
1489
1521
 
1490
1522
static int
1491
 
QuotaCmd(struct cmd_syndesc *as, char *arock)
 
1523
QuotaCmd(struct cmd_syndesc *as, void *arock)
1492
1524
{
1493
1525
    afs_int32 code;
1494
1526
    struct ViceIoctl blob;
1521
1553
}
1522
1554
 
1523
1555
static int
1524
 
ListMountCmd(struct cmd_syndesc *as, char *arock)
 
1556
ListMountCmd(struct cmd_syndesc *as, void *arock)
1525
1557
{
1526
1558
    afs_int32 code;
1527
1559
    struct ViceIoctl blob;
1641
1673
    return error;
1642
1674
}
1643
1675
 
1644
 
static
1645
 
MakeMountCmd(struct cmd_syndesc *as, char *arock)
 
1676
static int
 
1677
MakeMountCmd(struct cmd_syndesc *as, void *arock)
1646
1678
{
1647
1679
    afs_int32 code;
1648
1680
    char *cellName, *volName, *tmpName;
1750
1782
 *      tp: Set to point to the actual name of the mount point to nuke.
1751
1783
 */
1752
1784
static int
1753
 
RemoveMountCmd(struct cmd_syndesc *as, char *arock)
 
1785
RemoveMountCmd(struct cmd_syndesc *as, void *arock)
1754
1786
{
1755
1787
    afs_int32 code = 0;
1756
1788
    struct ViceIoctl blob;
1802
1834
*/
1803
1835
 
1804
1836
static int
1805
 
CheckServersCmd(struct cmd_syndesc *as, char *arock)
 
1837
CheckServersCmd(struct cmd_syndesc *as, void *arock)
1806
1838
{
1807
1839
    afs_int32 code;
1808
1840
    struct ViceIoctl blob;
1901
1933
}
1902
1934
 
1903
1935
static int
1904
 
MessagesCmd(struct cmd_syndesc *as, char *arock)
 
1936
MessagesCmd(struct cmd_syndesc *as, void *arock)
1905
1937
{
1906
1938
    afs_int32 code = 0;
1907
1939
    struct ViceIoctl blob;
1947
1979
}
1948
1980
 
1949
1981
static int
1950
 
CheckVolumesCmd(struct cmd_syndesc *as, char *arock)
 
1982
CheckVolumesCmd(struct cmd_syndesc *as, void *arock)
1951
1983
{
1952
1984
    afs_int32 code;
1953
1985
    struct ViceIoctl blob;
1965
1997
}
1966
1998
 
1967
1999
static int
1968
 
SetCacheSizeCmd(struct cmd_syndesc *as, char *arock)
 
2000
SetCacheSizeCmd(struct cmd_syndesc *as, void *arock)
1969
2001
{
1970
2002
    afs_int32 code;
1971
2003
    struct ViceIoctl blob;
2004
2036
 
2005
2037
#define MAXGCSIZE       16
2006
2038
static int
2007
 
GetCacheParmsCmd(struct cmd_syndesc *as, char *arock)
 
2039
GetCacheParmsCmd(struct cmd_syndesc *as, void *arock)
2008
2040
{
2009
2041
    afs_int32 code;
2010
2042
    struct ViceIoctl blob;
2029
2061
}
2030
2062
 
2031
2063
static int
2032
 
ListCellsCmd(struct cmd_syndesc *as, char *arock)
 
2064
ListCellsCmd(struct cmd_syndesc *as, void *arock)
2033
2065
{
2034
2066
    afs_int32 code;
2035
2067
    afs_int32 i, j;
2080
2112
}
2081
2113
 
2082
2114
static int
2083
 
ListAliasesCmd(struct cmd_syndesc *as, char *arock)
 
2115
ListAliasesCmd(struct cmd_syndesc *as, void *arock)
2084
2116
{
2085
2117
    afs_int32 code, i;
2086
2118
    char *tp, *aliasName, *realName;
2110
2142
}
2111
2143
 
2112
2144
static int
2113
 
CallBackRxConnCmd(struct cmd_syndesc *as, char *arock)
 
2145
CallBackRxConnCmd(struct cmd_syndesc *as, void *arock)
2114
2146
{
2115
2147
    afs_int32 code;
2116
2148
    struct ViceIoctl blob;
2149
2181
}
2150
2182
 
2151
2183
static int
2152
 
NewCellCmd(struct cmd_syndesc *as, char *arock)
 
2184
NewCellCmd(struct cmd_syndesc *as, void *arock)
2153
2185
{
2154
2186
    afs_int32 code, linkedstate = 0, size = 0, *lp;
2155
2187
    struct ViceIoctl blob;
2261
2293
}
2262
2294
 
2263
2295
static int
2264
 
NewAliasCmd(struct cmd_syndesc *as, char *arock)
 
2296
NewAliasCmd(struct cmd_syndesc *as, void *arock)
2265
2297
{
2266
2298
    afs_int32 code;
2267
2299
    struct ViceIoctl blob;
2296
2328
}
2297
2329
 
2298
2330
static int
2299
 
WhichCellCmd(struct cmd_syndesc *as, char *arock)
 
2331
WhichCellCmd(struct cmd_syndesc *as, void *arock)
2300
2332
{
2301
2333
    afs_int32 code;
2302
2334
    struct cmd_item *ti;
2321
2353
}
2322
2354
 
2323
2355
static int
2324
 
WSCellCmd(struct cmd_syndesc *as, char *arock)
 
2356
WSCellCmd(struct cmd_syndesc *as, void *arock)
2325
2357
{
2326
2358
    afs_int32 code;
2327
2359
    struct ViceIoctl blob;
2351
2383
*/
2352
2384
 
2353
2385
static int
2354
 
MonitorCmd(struct cmd_syndesc *as, char *arock)
 
2386
MonitorCmd(struct cmd_syndesc *as, void *arock)
2355
2387
{
2356
2388
    afs_int32 code;
2357
2389
    struct ViceIoctl blob;
2412
2444
}
2413
2445
 
2414
2446
static int
2415
 
SysNameCmd(struct cmd_syndesc *as, char *arock)
 
2447
SysNameCmd(struct cmd_syndesc *as, void *arock)
2416
2448
{
2417
2449
    afs_int32 code;
2418
2450
    struct ViceIoctl blob;
2466
2498
 
2467
2499
static char *exported_types[] = { "null", "nfs", "" };
2468
2500
static int
2469
 
ExportAfsCmd(struct cmd_syndesc *as, char *arock)
 
2501
ExportAfsCmd(struct cmd_syndesc *as, void *arock)
2470
2502
{
2471
2503
    afs_int32 code;
2472
2504
    struct ViceIoctl blob;
2565
2597
 
2566
2598
 
2567
2599
static int
2568
 
GetCellCmd(struct cmd_syndesc *as, char *arock)
 
2600
GetCellCmd(struct cmd_syndesc *as, void *arock)
2569
2601
{
2570
2602
    afs_int32 code;
2571
2603
    struct ViceIoctl blob;
2616
2648
}
2617
2649
 
2618
2650
static int
2619
 
SetCellCmd(struct cmd_syndesc *as, char *arock)
 
2651
SetCellCmd(struct cmd_syndesc *as, void *arock)
2620
2652
{
2621
2653
    afs_int32 code;
2622
2654
    struct ViceIoctl blob;
2800
2832
 
2801
2833
 
2802
2834
static int
2803
 
SetPrefCmd(struct cmd_syndesc *as, char *arock)
 
2835
SetPrefCmd(struct cmd_syndesc *as, void *arock)
2804
2836
{
2805
2837
    FILE *infd;
2806
2838
    afs_int32 code;
2906
2938
 
2907
2939
 
2908
2940
static int
2909
 
GetPrefCmd(struct cmd_syndesc *as, char *arock)
 
2941
GetPrefCmd(struct cmd_syndesc *as, void *arock)
2910
2942
{
2911
2943
    afs_int32 code;
2912
2944
    struct cmd_item *ti;
2976
3008
}
2977
3009
 
2978
3010
static int
2979
 
StoreBehindCmd(struct cmd_syndesc *as, char *arock)
 
3011
StoreBehindCmd(struct cmd_syndesc *as, void *arock)
2980
3012
{
2981
3013
    afs_int32 code = 0;
2982
3014
    struct ViceIoctl blob;
3076
3108
}
3077
3109
 
3078
3110
 
3079
 
static afs_int32
3080
 
SetCryptCmd(struct cmd_syndesc *as, char *arock)
 
3111
static int
 
3112
SetCryptCmd(struct cmd_syndesc *as, void *arock)
3081
3113
{
3082
3114
    afs_int32 code = 0, flag;
3083
3115
    struct ViceIoctl blob;
3103
3135
}
3104
3136
 
3105
3137
 
3106
 
static afs_int32
3107
 
GetCryptCmd(struct cmd_syndesc *as, char *arock)
 
3138
static int
 
3139
GetCryptCmd(struct cmd_syndesc *as, void *arock)
3108
3140
{
3109
3141
    afs_int32 code = 0, flag;
3110
3142
    struct ViceIoctl blob;
3155
3187
#endif
3156
3188
 
3157
3189
    /* try to find volume location information */
3158
 
    ts = cmd_CreateSyntax("getclientaddrs", GetClientAddrsCmd, 0,
 
3190
    ts = cmd_CreateSyntax("getclientaddrs", GetClientAddrsCmd, NULL,
3159
3191
                          "get client network interface addresses");
3160
3192
    cmd_CreateAlias(ts, "gc");
3161
3193
 
3162
 
    ts = cmd_CreateSyntax("setclientaddrs", SetClientAddrsCmd, 0,
 
3194
    ts = cmd_CreateSyntax("setclientaddrs", SetClientAddrsCmd, NULL,
3163
3195
                          "set client network interface addresses");
3164
3196
    cmd_AddParm(ts, "-address", CMD_LIST, CMD_OPTIONAL | CMD_EXPANDS,
3165
3197
                "client network interfaces");
3166
3198
    cmd_CreateAlias(ts, "sc");
3167
3199
 
3168
 
    ts = cmd_CreateSyntax("setserverprefs", SetPrefCmd, 0,
 
3200
    ts = cmd_CreateSyntax("setserverprefs", SetPrefCmd, NULL,
3169
3201
                          "set server ranks");
3170
3202
    cmd_AddParm(ts, "-servers", CMD_LIST, CMD_OPTIONAL | CMD_EXPANDS,
3171
3203
                "fileserver names and ranks");
3176
3208
    cmd_AddParm(ts, "-stdin", CMD_FLAG, CMD_OPTIONAL, "input from stdin");
3177
3209
    cmd_CreateAlias(ts, "sp");
3178
3210
 
3179
 
    ts = cmd_CreateSyntax("getserverprefs", GetPrefCmd, 0,
 
3211
    ts = cmd_CreateSyntax("getserverprefs", GetPrefCmd, NULL,
3180
3212
                          "get server ranks");
3181
3213
    cmd_AddParm(ts, "-file", CMD_SINGLE, CMD_OPTIONAL,
3182
3214
                "output to named file");
3185
3217
/*    cmd_AddParm(ts, "-cell", CMD_FLAG, CMD_OPTIONAL, "cellname"); */
3186
3218
    cmd_CreateAlias(ts, "gp");
3187
3219
 
3188
 
    ts = cmd_CreateSyntax("setacl", SetACLCmd, 0, "set access control list");
 
3220
    ts = cmd_CreateSyntax("setacl", SetACLCmd, NULL, "set access control list");
3189
3221
    cmd_AddParm(ts, "-dir", CMD_LIST, 0, "directory");
3190
3222
    cmd_AddParm(ts, "-acl", CMD_LIST, 0, "access list entries");
3191
3223
    cmd_AddParm(ts, "-clear", CMD_FLAG, CMD_OPTIONAL, "clear access list");
3198
3230
                "initial file acl (DFS only)");
3199
3231
    cmd_CreateAlias(ts, "sa");
3200
3232
 
3201
 
    ts = cmd_CreateSyntax("listacl", ListACLCmd, 0,
 
3233
    ts = cmd_CreateSyntax("listacl", ListACLCmd, NULL,
3202
3234
                          "list access control list");
3203
3235
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3204
3236
    parm_listacl_id = ts->nParms;
3206
3238
    cmd_AddParm(ts, "-if", CMD_FLAG, CMD_OPTIONAL, "initial file acl");
3207
3239
    cmd_CreateAlias(ts, "la");
3208
3240
 
3209
 
    ts = cmd_CreateSyntax("getcalleraccess", GetCallerAccess, 0,
 
3241
    ts = cmd_CreateSyntax("getcalleraccess", GetCallerAccess, NULL,
3210
3242
            "list callers access");
3211
3243
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3212
3244
    cmd_CreateAlias(ts, "gca");
3213
3245
 
3214
 
    ts = cmd_CreateSyntax("cleanacl", CleanACLCmd, 0,
 
3246
    ts = cmd_CreateSyntax("cleanacl", CleanACLCmd, NULL,
3215
3247
                          "clean up access control list");
3216
3248
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3217
3249
 
3218
 
    ts = cmd_CreateSyntax("copyacl", CopyACLCmd, 0,
 
3250
    ts = cmd_CreateSyntax("copyacl", CopyACLCmd, NULL,
3219
3251
                          "copy access control list");
3220
3252
    cmd_AddParm(ts, "-fromdir", CMD_SINGLE, 0,
3221
3253
                "source directory (or DFS file)");
3229
3261
 
3230
3262
    cmd_CreateAlias(ts, "ca");
3231
3263
 
3232
 
    ts = cmd_CreateSyntax("flush", FlushCmd, 0, "flush file from cache");
 
3264
    ts = cmd_CreateSyntax("flush", FlushCmd, NULL, "flush file from cache");
3233
3265
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3234
 
    ts = cmd_CreateSyntax("flushmount", FlushMountCmd, 0,
 
3266
    ts = cmd_CreateSyntax("flushmount", FlushMountCmd, NULL,
3235
3267
                          "flush mount symlink from cache");
3236
3268
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3237
3269
 
3238
 
    ts = cmd_CreateSyntax("setvol", SetVolCmd, 0, "set volume status");
 
3270
    ts = cmd_CreateSyntax("setvol", SetVolCmd, NULL, "set volume status");
3239
3271
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3240
3272
    cmd_AddParm(ts, "-max", CMD_SINGLE, CMD_OPTIONAL,
3241
3273
                "disk space quota in 1K units");
3248
3280
                "offline message");
3249
3281
    cmd_CreateAlias(ts, "sv");
3250
3282
 
3251
 
    ts = cmd_CreateSyntax("messages", MessagesCmd, 0,
 
3283
    ts = cmd_CreateSyntax("messages", MessagesCmd, NULL,
3252
3284
                          "control Cache Manager messages");
3253
3285
    cmd_AddParm(ts, "-show", CMD_SINGLE, CMD_OPTIONAL,
3254
3286
                "[user|console|all|none]");
3255
3287
 
3256
 
    ts = cmd_CreateSyntax("examine", ExamineCmd, 0, "display file/volume status");
 
3288
    ts = cmd_CreateSyntax("examine", ExamineCmd, NULL, "display file/volume status");
3257
3289
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3258
3290
    cmd_CreateAlias(ts, "lv");
3259
3291
    cmd_CreateAlias(ts, "listvol");
3260
3292
 
3261
 
    ts = cmd_CreateSyntax("listquota", ListQuotaCmd, 0, "list volume quota");
 
3293
    ts = cmd_CreateSyntax("listquota", ListQuotaCmd, NULL, "list volume quota");
3262
3294
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3263
3295
    cmd_CreateAlias(ts, "lq");
3264
3296
 
3265
 
    ts = cmd_CreateSyntax("diskfree", DiskFreeCmd, 0,
 
3297
    ts = cmd_CreateSyntax("diskfree", DiskFreeCmd, NULL,
3266
3298
                          "show server disk space usage");
3267
3299
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3268
3300
    cmd_CreateAlias(ts, "df");
3269
3301
 
3270
 
    ts = cmd_CreateSyntax("quota", QuotaCmd, 0, "show volume quota usage");
 
3302
    ts = cmd_CreateSyntax("quota", QuotaCmd, NULL, "show volume quota usage");
3271
3303
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3272
3304
 
3273
 
    ts = cmd_CreateSyntax("lsmount", ListMountCmd, 0, "list mount point");
 
3305
    ts = cmd_CreateSyntax("lsmount", ListMountCmd, NULL, "list mount point");
3274
3306
    cmd_AddParm(ts, "-dir", CMD_LIST, 0, "directory");
3275
3307
 
3276
 
    ts = cmd_CreateSyntax("mkmount", MakeMountCmd, 0, "make mount point");
 
3308
    ts = cmd_CreateSyntax("mkmount", MakeMountCmd, NULL, "make mount point");
3277
3309
    cmd_AddParm(ts, "-dir", CMD_SINGLE, 0, "directory");
3278
3310
    cmd_AddParm(ts, "-vol", CMD_SINGLE, 0, "volume name");
3279
3311
    cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
3289
3321
*/
3290
3322
 
3291
3323
 
3292
 
    ts = cmd_CreateSyntax("rmmount", RemoveMountCmd, 0, "remove mount point");
 
3324
    ts = cmd_CreateSyntax("rmmount", RemoveMountCmd, NULL, "remove mount point");
3293
3325
    cmd_AddParm(ts, "-dir", CMD_LIST, 0, "directory");
3294
3326
 
3295
 
    ts = cmd_CreateSyntax("checkservers", CheckServersCmd, 0,
 
3327
    ts = cmd_CreateSyntax("checkservers", CheckServersCmd, NULL,
3296
3328
                          "check local cell's servers");
3297
3329
    cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell to check");
3298
3330
    cmd_AddParm(ts, "-all", CMD_FLAG, CMD_OPTIONAL, "check all cells");
3301
3333
    cmd_AddParm(ts, "-interval", CMD_SINGLE, CMD_OPTIONAL,
3302
3334
                "seconds between probes");
3303
3335
 
3304
 
    ts = cmd_CreateSyntax("checkvolumes", CheckVolumesCmd, 0,
 
3336
    ts = cmd_CreateSyntax("checkvolumes", CheckVolumesCmd, NULL,
3305
3337
                          "check volumeID/name mappings");
3306
3338
    cmd_CreateAlias(ts, "checkbackups");
3307
3339
 
3308
3340
 
3309
 
    ts = cmd_CreateSyntax("setcachesize", SetCacheSizeCmd, 0,
 
3341
    ts = cmd_CreateSyntax("setcachesize", SetCacheSizeCmd, NULL,
3310
3342
                          "set cache size");
3311
3343
    cmd_AddParm(ts, "-blocks", CMD_SINGLE, CMD_OPTIONAL,
3312
3344
                "size in 1K byte blocks (0 => reset)");
3333
3365
#endif
3334
3366
    cmd_CreateAlias(ts, "sq");
3335
3367
 
3336
 
    ts = cmd_CreateSyntax("newcell", NewCellCmd, 0, "configure new cell");
 
3368
    ts = cmd_CreateSyntax("newcell", NewCellCmd, NULL, "configure new cell");
3337
3369
    cmd_AddParm(ts, "-name", CMD_SINGLE, 0, "cell name");
3338
3370
    cmd_AddParm(ts, "-servers", CMD_LIST, CMD_REQUIRED, "primary servers");
3339
3371
    cmd_AddParm(ts, "-linkedcell", CMD_SINGLE, CMD_OPTIONAL,
3340
3372
                "linked cell name");
3341
3373
 
3342
 
    ts = cmd_CreateSyntax("newalias", NewAliasCmd, 0,
 
3374
    ts = cmd_CreateSyntax("newalias", NewAliasCmd, NULL,
3343
3375
                          "configure new cell alias");
3344
3376
    cmd_AddParm(ts, "-alias", CMD_SINGLE, 0, "alias name");
3345
3377
    cmd_AddParm(ts, "-name", CMD_SINGLE, 0, "real name of cell");
3357
3389
                "cell's vldb server port");
3358
3390
#endif
3359
3391
 
3360
 
    ts = cmd_CreateSyntax("whichcell", WhichCellCmd, 0, "list file's cell");
3361
 
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3362
 
 
3363
 
    ts = cmd_CreateSyntax("whereis", WhereIsCmd, 0, "list file's location");
3364
 
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3365
 
 
3366
 
    ts = cmd_CreateSyntax("wscell", WSCellCmd, 0, "list workstation's cell");
 
3392
    ts = cmd_CreateSyntax("whichcell", WhichCellCmd, NULL, "list file's cell");
 
3393
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
 
3394
 
 
3395
    ts = cmd_CreateSyntax("whereis", WhereIsCmd, NULL, "list file's location");
 
3396
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
 
3397
 
 
3398
    ts = cmd_CreateSyntax("wscell", WSCellCmd, NULL, "list workstation's cell");
3367
3399
 
3368
3400
/*
3369
 
    ts = cmd_CreateSyntax("primarycell", PrimaryCellCmd, 0, "obsolete (listed primary cell)");
 
3401
    ts = cmd_CreateSyntax("primarycell", PrimaryCellCmd, NULL, "obsolete (listed primary cell)");
3370
3402
*/
3371
3403
 
3372
3404
    /* set cache monitor host address */
3373
 
    ts = cmd_CreateSyntax("monitor", MonitorCmd, 0, (char *)CMD_HIDDEN);
 
3405
    ts = cmd_CreateSyntax("monitor", MonitorCmd, NULL, (char *)CMD_HIDDEN);
3374
3406
    cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_OPTIONAL,
3375
3407
                "host name or 'off'");
3376
3408
    cmd_CreateAlias(ts, "mariner");
3377
3409
 
3378
 
    ts = cmd_CreateSyntax("getcellstatus", GetCellCmd, 0, "get cell status");
 
3410
    ts = cmd_CreateSyntax("getcellstatus", GetCellCmd, NULL, "get cell status");
3379
3411
    cmd_AddParm(ts, "-cell", CMD_LIST, 0, "cell name");
3380
3412
 
3381
 
    ts = cmd_CreateSyntax("setcell", SetCellCmd, 0, "set cell status");
 
3413
    ts = cmd_CreateSyntax("setcell", SetCellCmd, NULL, "set cell status");
3382
3414
    cmd_AddParm(ts, "-cell", CMD_LIST, 0, "cell name");
3383
3415
    cmd_AddParm(ts, "-suid", CMD_FLAG, CMD_OPTIONAL, "allow setuid programs");
3384
3416
    cmd_AddParm(ts, "-nosuid", CMD_FLAG, CMD_OPTIONAL,
3385
3417
                "disallow setuid programs");
3386
3418
 
3387
 
    ts = cmd_CreateSyntax("flushvolume", FlushVolumeCmd, 0,
 
3419
    ts = cmd_CreateSyntax("flushvolume", FlushVolumeCmd, NULL,
3388
3420
                          "flush all data in volume");
3389
3421
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3390
3422
 
3391
 
    ts = cmd_CreateSyntax("sysname", SysNameCmd, 0,
 
3423
    ts = cmd_CreateSyntax("sysname", SysNameCmd, NULL,
3392
3424
                          "get/set sysname (i.e. @sys) value");
3393
3425
    cmd_AddParm(ts, "-newsys", CMD_LIST, CMD_OPTIONAL, "new sysname");
3394
3426
 
3395
 
    ts = cmd_CreateSyntax("exportafs", ExportAfsCmd, 0,
 
3427
    ts = cmd_CreateSyntax("exportafs", ExportAfsCmd, NULL,
3396
3428
                          "enable/disable translators to AFS");
3397
3429
    cmd_AddParm(ts, "-type", CMD_SINGLE, 0, "exporter name");
3398
3430
    cmd_AddParm(ts, "-start", CMD_SINGLE, CMD_OPTIONAL,
3405
3437
                "allow nfs mounts to subdirs of /afs/.. (on  | off)");
3406
3438
 
3407
3439
 
3408
 
    ts = cmd_CreateSyntax("storebehind", StoreBehindCmd, 0,
 
3440
    ts = cmd_CreateSyntax("storebehind", StoreBehindCmd, NULL,
3409
3441
                          "store to server after file close");
3410
3442
    cmd_AddParm(ts, "-kbytes", CMD_SINGLE, CMD_OPTIONAL,
3411
3443
                "asynchrony for specified names");
3442
3474
                          "get fid for file(s)");
3443
3475
    cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
3444
3476
 
 
3477
    ts = cmd_CreateSyntax("uuid", UuidCmd, 0, "manage the UUID for the cache manager");
 
3478
    cmd_AddParm(ts, "-generate", CMD_FLAG, CMD_REQUIRED, "generate a new UUID");
 
3479
 
3445
3480
    code = cmd_Dispatch(argc, argv);
3446
3481
    if (rxInitDone)
3447
3482
        rx_Finalize();
3487
3522
            fprintf(stderr, "%s:'%s'", pn, filename);
3488
3523
        else
3489
3524
            fprintf(stderr, "%s", pn);
3490
 
        fprintf(stderr, ": %s\n", error_message(errnum));
 
3525
        fprintf(stderr, ": %s\n", afs_error_message(errnum));
3491
3526
        break;
3492
3527
    }
3493
3528
}
3494
3529
 
3495
3530
/* get clients interface addresses */
3496
3531
static int
3497
 
GetClientAddrsCmd(struct cmd_syndesc *as, char *arock)
 
3532
GetClientAddrsCmd(struct cmd_syndesc *as, void *arock)
3498
3533
{
3499
3534
    afs_int32 code;
3500
3535
    struct cmd_item *ti;
3540
3575
}
3541
3576
 
3542
3577
static int
3543
 
SetClientAddrsCmd(struct cmd_syndesc *as, char *arock)
 
3578
SetClientAddrsCmd(struct cmd_syndesc *as, void *arock)
3544
3579
{
3545
3580
    afs_int32 code, addr;
3546
3581
    struct cmd_item *ti;
3614
3649
}
3615
3650
 
3616
3651
static int
3617
 
FlushMountCmd(struct cmd_syndesc *as, char *arock)
 
3652
FlushMountCmd(struct cmd_syndesc *as, void *arock)
3618
3653
{
3619
3654
    afs_int32 code;
3620
3655
    struct ViceIoctl blob;
3730
3765
}
3731
3766
 
3732
3767
static int
3733
 
RxStatProcCmd(struct cmd_syndesc *as, char *arock)
 
3768
RxStatProcCmd(struct cmd_syndesc *as, void *arock)
3734
3769
{
3735
3770
    afs_int32 code;
3736
3771
    afs_int32 flags = 0;
3765
3800
}
3766
3801
 
3767
3802
static int
3768
 
RxStatPeerCmd(struct cmd_syndesc *as, char *arock)
 
3803
RxStatPeerCmd(struct cmd_syndesc *as, void *arock)
3769
3804
{
3770
3805
    afs_int32 code;
3771
3806
    afs_int32 flags = 0;
3800
3835
}
3801
3836
 
3802
3837
static int
3803
 
GetFidCmd(struct cmd_syndesc *as, char *arock)
 
3838
GetFidCmd(struct cmd_syndesc *as, void *arock)
3804
3839
{
3805
3840
    struct ViceIoctl blob;
3806
3841
    struct cmd_item *ti;