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>
19 #include <afs/com_err.h>
21 #include <afs/venus.h>
22 #include "afs/prs_fs.h"
23 #include <afs/afsint.h>
24 #include <afs/cellconfig.h>
37 #include "AFS_component_version_number.c"
39 int WhatFidCmd_FileParm
;
40 int WhatFidCmd_FollowLinkParm
;
42 WhatFidCmd(struct cmd_syndesc
*as
, void *arock
)
45 struct ViceIoctl blob
;
48 struct VolumeStatus
*status
;
52 if (as
->parms
[1].items
)
54 for (ti
= as
->parms
[0].items
; ti
; ti
= ti
->next
) {
56 blob
.out_size
= sizeof(struct VenusFid
);
58 blob
.out
= (char *)&vFid
;
59 code
= pioctl(ti
->data
, VIOCGETFID
, &blob
, follow
);
61 PioctlError(code
, ti
->data
);
64 printf("%s: %x:%d.%d.%d\n", ti
->data
, vFid
.Cell
, vFid
.Fid
.Volume
,
65 vFid
.Fid
.Vnode
, vFid
.Fid
.Unique
);
77 struct cmd_syndesc
*ts
;
81 * The following signal action for AIX is necessary so that in case of a
82 * crash (i.e. core is generated) we can include the user's data section
83 * in the core dump. Unfortunately, by default, only a partial core is
84 * generated which, in many cases, isn't too useful.
88 sigemptyset(&nsa
.sa_mask
);
89 nsa
.sa_handler
= SIG_DFL
;
90 nsa
.sa_flags
= SA_FULLDUMP
;
91 sigaction(SIGSEGV
, &nsa
, NULL
);
96 ts
= cmd_CreateSyntax("initcmd", WhatFidCmd
, NULL
, 0, "list fid for file(s)");
97 WhatFidCmd_FileParm
= cmd_AddParm(ts
, "-path", CMD_LIST
, 0, "pathnames");
98 WhatFidCmd_FollowLinkParm
=
99 cmd_AddParm(ts
, "-link", CMD_FLAG
, CMD_OPTIONAL
,
100 "do not follow symlinks");
102 exit(cmd_Dispatch(argc
, argv
));
106 PioctlError(code
, filename
)
111 if (errno
== EINVAL
) {
114 "%s: Invalid argument; it is possible that %s is not in AFS.\n",
117 fprintf(stderr
, "%s: Invalid argument.\n", pn
);
118 } else if (errno
== ENOENT
) {
120 fprintf(stderr
, "%s: File '%s' doesn't exist\n", pn
, filename
);
122 fprintf(stderr
, "%s: no such file returned\n", pn
);
123 } else if (errno
== EROFS
)
125 "%s: You can not change a backup or readonly volume\n", pn
);
126 else if (errno
== EACCES
|| errno
== EPERM
) {
129 "%s: You don't have the required access rights on '%s'\n",
133 "%s: You do not have the required rights to do this operation\n",
137 fprintf(stderr
, "%s:'%s'", pn
, filename
);
139 fprintf(stderr
, "%s", pn
);
140 fprintf(stderr
, ": %s\n", afs_error_message(errno
));