From 66e04e9f88452b4afef19fb8dbba431018ec1bbb Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Sun, 18 Apr 2004 07:09:49 +0000 Subject: [PATCH] add-fs-exa-file-support-20040417 Make "fs exa filename" print out the FID for the filename, not just the status for the volume containing that file. --- src/venus/fs.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/venus/fs.c b/src/venus/fs.c index 240b303..b309c23 100644 --- a/src/venus/fs.c +++ b/src/venus/fs.c @@ -1302,6 +1302,15 @@ SetVolCmd(struct cmd_syndesc *as) return error; } +/* + * Why is VenusFid declared in the kernel-only section of afs.h, + * if it's the exported interface of the cache manager? + */ +struct VenusFid { + afs_int32 Cell; + AFSFid Fid; +}; + static int ExamineCmd(struct cmd_syndesc *as) { @@ -1314,6 +1323,8 @@ ExamineCmd(struct cmd_syndesc *as) SetDotDefault(&as->parms[0].items); for (ti = as->parms[0].items; ti; ti = ti->next) { + struct VenusFid vfid; + /* once per file */ blob.out_size = MAXSIZE; blob.in_size = 0; @@ -1327,6 +1338,15 @@ ExamineCmd(struct cmd_syndesc *as) status = (VolumeStatus *) space; name = (char *)status + sizeof(*status); offmsg = name + strlen(name) + 1; + + blob.out_size = sizeof(struct VenusFid); + blob.out = (char *) &vfid; + 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); + } + PrintStatus(status, name, offmsg); } return error; @@ -3216,7 +3236,7 @@ main(int argc, char **argv) cmd_AddParm(ts, "-show", CMD_SINGLE, CMD_OPTIONAL, "[user|console|all|none]"); - ts = cmd_CreateSyntax("examine", ExamineCmd, 0, "display volume status"); + ts = cmd_CreateSyntax("examine", ExamineCmd, 0, "display file/volume status"); cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path"); cmd_CreateAlias(ts, "lv"); cmd_CreateAlias(ts, "listvol"); -- 1.9.4