mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 00:10:15 +00:00
fixed-and-improved-afscp-20031118
Fix afscp to make it build and fix the -u option. Add support for explicitly specifying a file by host/fid.
This commit is contained in:
parent
63ba8d77fb
commit
b737d56f29
@ -9,6 +9,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/stat.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <afs/param.h>
|
||||
#include <afs/afsint.h>
|
||||
@ -37,6 +38,58 @@ statfile(char *path, char *cellname, afs_uint32 * server, struct AFSFid *f)
|
||||
afs_int32 srvbuf[MAXHOSTS];
|
||||
int code;
|
||||
|
||||
if (!strncmp(path, "@afs:", 5)) {
|
||||
char *pdup, *p, *host, *id;
|
||||
struct hostent *he;
|
||||
|
||||
pdup = strdup(path);
|
||||
strtok(pdup, ":");
|
||||
|
||||
if (!(p = strtok(NULL, ":"))) {
|
||||
free(pdup);
|
||||
return -1;
|
||||
}
|
||||
strncpy(cellname, p, MAXCELLCHARS);
|
||||
|
||||
if (!(p = strtok(NULL, ":"))) {
|
||||
free(pdup);
|
||||
return -1;
|
||||
}
|
||||
he = gethostbyname(p);
|
||||
if (!he) {
|
||||
printf("Unknown host %s\n", p);
|
||||
free(pdup);
|
||||
return -1;
|
||||
}
|
||||
memcpy(server, he->h_addr, he->h_length);
|
||||
|
||||
if (!(p = strtok(NULL, ":"))) {
|
||||
free(pdup);
|
||||
return -1;
|
||||
}
|
||||
f->Volume = atoi(p);
|
||||
|
||||
if (!(p = strtok(NULL, ":"))) {
|
||||
free(pdup);
|
||||
return -1;
|
||||
}
|
||||
f->Vnode = atoi(p);
|
||||
|
||||
if (!(p = strtok(NULL, ":"))) {
|
||||
free(pdup);
|
||||
return -1;
|
||||
}
|
||||
f->Unique = atoi(p);
|
||||
|
||||
if (strtok(NULL, ":")) {
|
||||
printf("Too much extra stuff after @afs:...\n");
|
||||
free(pdup);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
v.in = 0;
|
||||
v.in_size = 0;
|
||||
v.out = cellname;
|
||||
@ -177,10 +230,11 @@ main(int argc, char **argv)
|
||||
case 'o':
|
||||
dlcl = 1;
|
||||
break;
|
||||
case 'a':
|
||||
case 'u':
|
||||
unauth = 1;
|
||||
break;
|
||||
default:
|
||||
printf("Unknown option '%c'\n", ch);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -193,6 +247,8 @@ main(int argc, char **argv)
|
||||
fprintf(stderr, " -i Source is local (copy into AFS)\n");
|
||||
fprintf(stderr, " -o Dest is local (copy out of AFS)\n");
|
||||
fprintf(stderr, " -u Run unauthenticated\n");
|
||||
fprintf(stderr, "source and dest can be paths or specified as:\n");
|
||||
fprintf(stderr, " @afs:cellname:servername:volume:vnode:uniq\n");
|
||||
exit(1);
|
||||
}
|
||||
srcf = argv[optind++];
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <afs/param.h>
|
||||
#include <fsint/afscbint.h> /*Callback interface defs */
|
||||
#include <afs/afscbint.h> /*Callback interface defs */
|
||||
int afs_cb_inited = 0;
|
||||
struct interfaceAddr afs_cb_interface;
|
||||
static int
|
||||
@ -49,45 +49,52 @@ SRXAFSCB_Probe(rxcall)
|
||||
|
||||
|
||||
afs_int32
|
||||
SRXAFSCB_GetCE(rxcall)
|
||||
SRXAFSCB_GetCE(rxcall, index, ce)
|
||||
struct rx_call *rxcall;
|
||||
|
||||
afs_int32 index;
|
||||
AFSDBCacheEntry * ce;
|
||||
{ /*SRXAFSCB_GetCE */
|
||||
return (0);
|
||||
} /*SRXAFSCB_GetCE */
|
||||
|
||||
|
||||
afs_int32
|
||||
SRXAFSCB_GetCE64(rxcall)
|
||||
SRXAFSCB_GetCE64(rxcall, index, ce)
|
||||
struct rx_call *rxcall;
|
||||
|
||||
afs_int32 index;
|
||||
AFSDBCacheEntry64 *ce;
|
||||
{ /*SRXAFSCB_GetCE64 */
|
||||
return (0);
|
||||
} /*SRXAFSCB_GetCE64 */
|
||||
|
||||
|
||||
afs_int32
|
||||
SRXAFSCB_GetLock(rxcall)
|
||||
SRXAFSCB_GetLock(rxcall, index, lock)
|
||||
struct rx_call *rxcall;
|
||||
|
||||
afs_int32 index;
|
||||
AFSDBLock *lock;
|
||||
{ /*SRXAFSCB_GetLock */
|
||||
return (0);
|
||||
|
||||
} /*SRXAFSCB_GetLock */
|
||||
|
||||
afs_int32
|
||||
SRXAFSCB_XStatsVersion(rxcall)
|
||||
SRXAFSCB_XStatsVersion(rxcall, v)
|
||||
struct rx_call *rxcall;
|
||||
|
||||
afs_int32 *v;
|
||||
{ /*SRXAFSCB_XStatsVersion */
|
||||
return (0);
|
||||
|
||||
} /*SRXAFSCB_XStatsVersion */
|
||||
|
||||
afs_int32
|
||||
SRXAFSCB_GetXStats(rxcall)
|
||||
SRXAFSCB_GetXStats(rxcall, clientVersionNumber, collectionNumber, srvVersionNumberP, timeP, dataP)
|
||||
struct rx_call *rxcall;
|
||||
|
||||
afs_int32 clientVersionNumber;
|
||||
afs_int32 collectionNumber;
|
||||
afs_int32 * srvVersionNumberP;
|
||||
afs_int32 * timeP;
|
||||
AFSCB_CollData * dataP;
|
||||
{ /*SRXAFSCB_GetXStats */
|
||||
return (0);
|
||||
} /*SRXAFSCB_GetXStats */
|
||||
@ -149,8 +156,8 @@ afs_int32
|
||||
SRXAFSCB_GetCellServDB(rxcall, cellIndex, cellName, cellHosts)
|
||||
struct rx_call *rxcall;
|
||||
afs_int32 cellIndex;
|
||||
char *cellName;
|
||||
afs_int32 *cellHosts;
|
||||
char **cellName;
|
||||
serverList *cellHosts;
|
||||
{
|
||||
return RXGEN_OPCODE;
|
||||
}
|
||||
@ -159,7 +166,7 @@ SRXAFSCB_GetCellServDB(rxcall, cellIndex, cellName, cellHosts)
|
||||
afs_int32
|
||||
SRXAFSCB_GetLocalCell(rxcall, cellName)
|
||||
struct rx_call *rxcall;
|
||||
char *cellName;
|
||||
char **cellName;
|
||||
{
|
||||
return RXGEN_OPCODE;
|
||||
}
|
||||
@ -176,3 +183,22 @@ SRXAFSCB_GetCacheConfig(rxcall, callerVersion, serverVersion, configCount,
|
||||
{
|
||||
return RXGEN_OPCODE;
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SRXAFSCB_GetCellByNum(rxcall, cellnum, cellname, cellhosts)
|
||||
struct rx_call *rxcall;
|
||||
afs_int32 cellnum;
|
||||
char **cellname;
|
||||
serverList *cellhosts;
|
||||
{
|
||||
return RXGEN_OPCODE;
|
||||
}
|
||||
|
||||
afs_int32
|
||||
SRXAFSCB_TellMeAboutYourself(rxcall, addr, cap)
|
||||
struct rx_call *rxcall;
|
||||
struct interfaceAddr *addr;
|
||||
Capabilities *cap;
|
||||
{
|
||||
return RXGEN_OPCODE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user