mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 08:20:16 +00:00
volinfo: show header filenames even if error
When invoked with -header option, print the header inode number, and namei filename, even if the header file cannot be opened. Change-Id: Id2a2e63f07e12cd817718a9da63d24250718ae06 Reviewed-on: http://gerrit.openafs.org/7190 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Tom Keiser <tkeiser@sinenomine.net> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
2460e132a9
commit
b71f4ffa7c
@ -1172,7 +1172,7 @@ HandleSpecialFile(const char *name, struct DiskPartition64 *dp,
|
|||||||
struct VolumeHeader *header, Inode inode,
|
struct VolumeHeader *header, Inode inode,
|
||||||
afs_sfsize_t * psize)
|
afs_sfsize_t * psize)
|
||||||
{
|
{
|
||||||
afs_sfsize_t size = 0;
|
afs_sfsize_t size = -1;
|
||||||
IHandle_t *ih = NULL;
|
IHandle_t *ih = NULL;
|
||||||
FdHandle_t *fdP = NULL;
|
FdHandle_t *fdP = NULL;
|
||||||
#ifdef AFS_NAMEI_ENV
|
#ifdef AFS_NAMEI_ENV
|
||||||
@ -1183,7 +1183,7 @@ HandleSpecialFile(const char *name, struct DiskPartition64 *dp,
|
|||||||
fdP = IH_OPEN(ih);
|
fdP = IH_OPEN(ih);
|
||||||
if (fdP == NULL) {
|
if (fdP == NULL) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: Error opening header file '%s' for volume %u", progname,
|
"%s: Error opening header file '%s' for volume %u\n", progname,
|
||||||
name, header->id);
|
name, header->id);
|
||||||
perror("open");
|
perror("open");
|
||||||
goto error;
|
goto error;
|
||||||
@ -1191,22 +1191,27 @@ HandleSpecialFile(const char *name, struct DiskPartition64 *dp,
|
|||||||
size = FDH_SIZE(fdP);
|
size = FDH_SIZE(fdP);
|
||||||
if (size == -1) {
|
if (size == -1) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: Error getting size of header file '%s' for volume %u",
|
"%s: Error getting size of header file '%s' for volume %u\n",
|
||||||
progname, name, header->id);
|
progname, name, header->id);
|
||||||
perror("fstat");
|
perror("fstat");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
*psize += size;
|
||||||
|
|
||||||
|
error:
|
||||||
if (DumpInfo) {
|
if (DumpInfo) {
|
||||||
printf("\t%s inode\t= %s (size = %lld)\n",
|
printf("\t%s inode\t= %s (size = ", name, PrintInode(NULL, inode));
|
||||||
name, PrintInode(NULL, inode), size);
|
if (size != -1) {
|
||||||
|
printf("%lld)\n", size);
|
||||||
|
} else {
|
||||||
|
printf("unknown)\n");
|
||||||
|
}
|
||||||
#ifdef AFS_NAMEI_ENV
|
#ifdef AFS_NAMEI_ENV
|
||||||
namei_HandleToName(&filename, ih);
|
namei_HandleToName(&filename, ih);
|
||||||
printf("\t%s namei\t= %s\n", name, filename.n_path);
|
printf("\t%s namei\t= %s\n", name, filename.n_path);
|
||||||
#endif /* AFS_NAMEI_ENV */
|
#endif /* AFS_NAMEI_ENV */
|
||||||
}
|
}
|
||||||
*psize += size;
|
|
||||||
|
|
||||||
error:
|
|
||||||
if (fdP != NULL) {
|
if (fdP != NULL) {
|
||||||
FDH_REALLYCLOSE(fdP);
|
FDH_REALLYCLOSE(fdP);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user