2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
13 #include <afsconfig.h>
14 #include <afs/param.h>
24 #include <sys/ioctl.h>
25 #include <sys/socket.h>
27 #include <netinet/in.h>
30 #include <afs/venus.h>
31 #include "afs/prs_fs.h"
32 #include <afs/afsint.h>
34 #include <afs/cellconfig.h>
48 #include "AFS_component_version_number.c"
50 int WhatFidCmd_FileParm;
51 int WhatFidCmd_FollowLinkParm;
54 register struct cmd_syndesc *as;
56 register afs_int32 code;
57 struct ViceIoctl blob;
59 register struct cmd_item *ti;
60 struct VolumeStatus *status;
64 if (as->parms[1].items)
66 for (ti = as->parms[0].items; ti; ti = ti->next) {
68 blob.out_size = sizeof(struct VenusFid);
70 blob.out = (char *)&vFid;
71 code = pioctl(ti->data, VIOCGETFID, &blob, follow);
73 PioctlError(code, ti->data);
76 printf("%s: %x:%d.%d.%d\n", ti->data, vFid.Cell, vFid.Fid.Volume,
77 vFid.Fid.Vnode, vFid.Fid.Unique);
88 register afs_int32 code;
89 register struct cmd_syndesc *ts;
93 * The following signal action for AIX is necessary so that in case of a
94 * crash (i.e. core is generated) we can include the user's data section
95 * in the core dump. Unfortunately, by default, only a partial core is
96 * generated which, in many cases, isn't too useful.
100 sigemptyset(&nsa.sa_mask);
101 nsa.sa_handler = SIG_DFL;
102 nsa.sa_flags = SA_FULLDUMP;
103 sigaction(SIGSEGV, &nsa, NULL);
108 ts = cmd_CreateSyntax("initcmd", WhatFidCmd, 0, "list fid for file(s)");
109 WhatFidCmd_FileParm = cmd_AddParm(ts, "-path", CMD_LIST, 0, "pathnames");
110 WhatFidCmd_FollowLinkParm =
111 cmd_AddParm(ts, "-link", CMD_FLAG, CMD_OPTIONAL,
112 "do not follow symlinks");
114 exit(cmd_Dispatch(argc, argv));
118 PioctlError(code, filename)
123 if (errno == EINVAL) {
126 "%s: Invalid argument; it is possible that %s is not in AFS.\n",
129 fprintf(stderr, "%s: Invalid argument.\n", pn);
130 } else if (errno == ENOENT) {
132 fprintf(stderr, "%s: File '%s' doesn't exist\n", pn, filename);
134 fprintf(stderr, "%s: no such file returned\n", pn);
135 } else if (errno == EROFS)
137 "%s: You can not change a backup or readonly volume\n", pn);
138 else if (errno == EACCES || errno == EPERM) {
141 "%s: You don't have the required access rights on '%s'\n",
145 "%s: You do not have the required rights to do this operation\n",
149 fprintf(stderr, "%s:'%s'", pn, filename);
151 fprintf(stderr, "%s", pn);
152 fprintf(stderr, ": %s\n", error_message(errno));