STABLE14-fs-getfid-20060123

add a fs subcommand to get a fid


(cherry picked from commit db98b697fe4e1b38ac5e73d60dd101b2506e12a4)
This commit is contained in:
Derrick Brashear 2006-01-23 21:07:42 +00:00
parent 33589811b6
commit 6867198aa1

View File

@ -69,7 +69,7 @@ static char tspace[1024];
static struct ubik_client *uclient;
static int GetClientAddrsCmd(), SetClientAddrsCmd(), FlushMountCmd();
static int RxStatProcCmd(), RxStatPeerCmd();
static int RxStatProcCmd(), RxStatPeerCmd(), GetFidCmd();
extern char *hostutil_GetNameByINet();
extern struct hostent *hostutil_GetHostByName();
@ -3437,6 +3437,11 @@ defect 3069
ts = cmd_CreateSyntax("setcbaddr", CallBackRxConnCmd, 0, "configure callback connection address");
cmd_AddParm(ts, "-addr", CMD_SINGLE, CMD_OPTIONAL, "host name or address");
/* try to find volume location information */
ts = cmd_CreateSyntax("getfid", GetFidCmd, 0,
"get fid for file(s)");
cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
code = cmd_Dispatch(argc, argv);
if (rxInitDone)
rx_Finalize();
@ -3794,3 +3799,25 @@ RxStatPeerCmd(struct cmd_syndesc *as, char *arock)
return 0;
}
static int
GetFidCmd(struct cmd_syndesc *as, char *arock)
{
struct ViceIoctl blob;
struct cmd_item *ti;
for (ti = as->parms[0].items; ti; ti = ti->next) {
struct VenusFid vfid;
blob.out_size = sizeof(struct VenusFid);
blob.out = (char *) &vfid;
blob.in_size = 0;
if (0 == pioctl(ti->data, VIOCGETFID, &blob, 1)) {
printf("File %s (%u.%u.%u) contained in volume %u\n",
ti->data, vfid.Fid.Volume, vfid.Fid.Vnode, vfid.Fid.Unique,
vfid.Fid.Volume);
}
}
return 0;
}