aboutsummaryrefslogtreecommitdiff
path: root/tools/diag/prtblknos/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/diag/prtblknos/main.c')
-rw-r--r--tools/diag/prtblknos/main.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/tools/diag/prtblknos/main.c b/tools/diag/prtblknos/main.c
index 25a717760922..bfd28206a555 100644
--- a/tools/diag/prtblknos/main.c
+++ b/tools/diag/prtblknos/main.c
@@ -22,8 +22,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
#include <ufs/ffs/fs.h>
@@ -34,19 +32,12 @@
#include <sys/stat.h>
#include <libufs.h>
-union dinode {
- struct ufs1_dinode *dp1;
- struct ufs2_dinode *dp2;
-};
-
void prtblknos(struct fs *fs, union dinode *dp);
struct uufsd disk;
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
union dinodep dp;
struct fs *fs;
@@ -56,7 +47,6 @@ main(argc, argv)
char ibuf[64];
char *fsname, *filename;
ino_t inonum;
- int error;
filename = NULL;
if (argc == 2) {
@@ -83,9 +73,10 @@ main(argc, argv)
fsname = *++argv;
/* get the superblock. */
- if ((error = ufs_disk_fillout(&disk, fsname)) < 0)
+ if (ufs_disk_fillout_blank(&disk, fsname) == -1 ||
+ sbfind(&disk, 0) == -1)
err(1, "Cannot access file system superblock on %s", fsname);
- fs = (struct fs *)&disk.d_sb;
+ fs = (struct fs *)&disk.d_sbunion.d_sb;
/* remaining arguments are inode numbers. */
while (*++argv) {
@@ -99,7 +90,7 @@ main(argc, argv)
(void)printf("%s (inode #%jd): ", filename,
(intmax_t)inonum);
- if ((error = getinode(&disk, &dp, inonum)) < 0)
+ if (getinode(&disk, &dp, inonum) < 0)
warn("Read of inode %jd on %s failed: %s",
(intmax_t)inonum, fsname, disk.d_error);