Hey, > > + if (optind < argc) { > > + > > + if (ret_next) { > > + cmd = XFS_IOC_FSBULKSTAT; > > + } else { > > + if (argc > 2) > > + return command_usage(&inode_cmd); > > FYI, this means one can't do the following: > > xfs_io -c "inode -v 123" <mnt> > > Otherwise it looks good to me: > > Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> > Thanks, I'm not sure how I didn't notice this, I thought I had tested all options with verbose mode. I believe I can fix this with this: - if (argc > 2) + if (argc > 2 && !verbose) I must check the amount of arguments, so nobody can pass 2 inode numbers. Bu I believe with this change I can fix it. I'm testing it right now, and will send a patch with this change after I test all the remaining options. Cheers > > + else > > + cmd = XFS_IOC_FSBULKSTAT_SINGLE; > > + } > > + > > + userino = strtoull(argv[optind], &p, 10); > > + if ((*p != '\0')) { > > + printf(_("[num] must be a numeric value\n")); > > + exitcode = 1; > > + return 0; > > + } > > + > > + bulkreq.lastip = &userino; > > + bulkreq.icount = 1; > > + bulkreq.ubuffer = &bstat; > > + bulkreq.ocount = &count; > > + > > + if (xfsctl(file->name, file->fd, cmd, &bulkreq)) { > > + if (errno == EINVAL) { > > + if (!ret_next) > > + printf("0\n"); > > + } else { > > + perror("xfsctl"); > > + } > > + exitcode = 1; > > + return 0; > > + } > > + > > + if (ret_next) > > + userino = bstat.bs_ino; > > + > > + if (verbose) > > + printf("%llu:%d\n", > > + userino, > > + userino > XFS_MAXINUMBER_32 ? 64 : 32); > > + else > > + /* Inode in use */ > > + printf("%llu\n", userino); > > + return 0; > > + > > + /* -n option must not be used stand alone */ > > + } else if (ret_next) { > > + return command_usage(&inode_cmd); > > + } > > + > > + bulkreq.lastip = &last; > > + bulkreq.icount = 1024; /* User-defined maybe!? */ > > + bulkreq.ubuffer = &igroup; > > + bulkreq.ocount = &count; > > + > > + for (;;) { > > + if (xfsctl(file->name, file->fd, XFS_IOC_FSINUMBERS, > > + &bulkreq)) { > > + perror("XFS_IOC_FSINUMBERS"); > > + exitcode = 1; > > + return 0; > > + } > > + > > + if (count == 0) > > + break; > > + > > + lastgrp = count; > > + } > > + > > + lastgrp--; > > + lastino = igroup[lastgrp].xi_startino + > > + xfs_highbit64(igroup[lastgrp].xi_allocmask); > > + > > + if (verbose) > > + printf("%llu:%d\n", lastino, > > + lastino > XFS_MAXINUMBER_32 ? 64 : 32); > > + else > > + printf("%d\n", lastino > XFS_MAXINUMBER_32 ? 1 : 0); > > + > > + return 0; > > +} > > + > > void > > open_init(void) > > { > > @@ -815,6 +954,16 @@ open_init(void) > > _("get/set preferred extent size (in bytes) for the open file"); > > extsize_cmd.help = extsize_help; > > > > + inode_cmd.name = "inode"; > > + inode_cmd.cfunc = inode_f; > > + inode_cmd.args = _("[-n | -v] [num]"); > > + inode_cmd.argmin = 0; > > + inode_cmd.argmax = 2; > > + inode_cmd.flags = CMD_NOMAP_OK; > > + inode_cmd.oneline = > > + _("Query inode number usage in the filesystem"); > > + inode_cmd.help = inode_help; > > + > > add_command(&open_cmd); > > add_command(&stat_cmd); > > add_command(&close_cmd); > > @@ -822,4 +971,5 @@ open_init(void) > > add_command(&chproj_cmd); > > add_command(&lsproj_cmd); > > add_command(&extsize_cmd); > > + add_command(&inode_cmd); > > } > > -- > > 2.4.3 > > > > _______________________________________________ > > xfs mailing list > > xfs@xxxxxxxxxxx > > http://oss.sgi.com/mailman/listinfo/xfs -- Carlos _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs