aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsdb
diff options
context:
space:
mode:
authorMatthew D Fleming <mdf@FreeBSD.org>2012-09-27 23:31:06 +0000
committerMatthew D Fleming <mdf@FreeBSD.org>2012-09-27 23:31:06 +0000
commite25a029eb2496de2e47cd3a936ad4c24bf0043ba (patch)
tree51028e29caefe265e99cac58ecb1cce380def92e /sbin/fsdb
parent623d7cb6637493a21a89389323d72428f85affcc (diff)
downloadsrc-e25a029eb2496de2e47cd3a936ad4c24bf0043ba.tar.gz
src-e25a029eb2496de2e47cd3a936ad4c24bf0043ba.zip
Fix sbin/ build with a 64-bit ino_t.
Original code by: Gleb Kurtsou
Notes
Notes: svn path=/head/; revision=241013
Diffstat (limited to 'sbin/fsdb')
-rw-r--r--sbin/fsdb/fsdb.c26
-rw-r--r--sbin/fsdb/fsdbutil.c13
2 files changed, 22 insertions, 17 deletions
diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c
index 172265368208..e169061e9f65 100644
--- a/sbin/fsdb/fsdb.c
+++ b/sbin/fsdb/fsdb.c
@@ -39,6 +39,7 @@ static const char rcsid[] =
#include <grp.h>
#include <histedit.h>
#include <pwd.h>
+#include <stdint.h>
#include <string.h>
#include <time.h>
#include <timeconv.h>
@@ -211,7 +212,8 @@ char *
prompt(EditLine *el)
{
static char pstring[64];
- snprintf(pstring, sizeof(pstring), "fsdb (inum: %d)> ", curinum);
+ snprintf(pstring, sizeof(pstring), "fsdb (inum: %ju)> ",
+ (uintmax_t)curinum);
return pstring;
}
@@ -298,8 +300,8 @@ ino_t curinum, ocurrent;
#define GETINUM(ac,inum) inum = strtoul(argv[ac], &cp, 0); \
if (inum < ROOTINO || inum > maxino || cp == argv[ac] || *cp != '\0' ) { \
- printf("inode %d out of range; range is [%d,%d]\n", \
- inum, ROOTINO, maxino); \
+ printf("inode %ju out of range; range is [%ju,%ju]\n", \
+ (uintmax_t)inum, (uintmax_t)ROOTINO, (uintmax_t)maxino); \
return 1; \
}
@@ -364,7 +366,8 @@ CMDFUNCSTART(uplink)
if (!checkactive())
return 1;
DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) + 1);
- printf("inode %d link count now %d\n", curinum, DIP(curinode, di_nlink));
+ printf("inode %ju link count now %d\n",
+ (uintmax_t)curinum, DIP(curinode, di_nlink));
inodirty();
return 0;
}
@@ -374,7 +377,8 @@ CMDFUNCSTART(downlink)
if (!checkactive())
return 1;
DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) - 1);
- printf("inode %d link count now %d\n", curinum, DIP(curinode, di_nlink));
+ printf("inode %ju link count now %d\n",
+ (uintmax_t)curinum, DIP(curinode, di_nlink));
inodirty();
return 0;
}
@@ -493,11 +497,11 @@ CMDFUNCSTART(findblk)
if (is_ufs2 ?
compare_blk64(wantedblk64, ino_to_fsba(&sblock, inum)) :
compare_blk32(wantedblk32, ino_to_fsba(&sblock, inum))) {
- printf("block %llu: inode block (%d-%d)\n",
+ printf("block %llu: inode block (%ju-%ju)\n",
(unsigned long long)fsbtodb(&sblock,
ino_to_fsba(&sblock, inum)),
- (inum / INOPB(&sblock)) * INOPB(&sblock),
- (inum / INOPB(&sblock) + 1) * INOPB(&sblock));
+ (uintmax_t)(inum / INOPB(&sblock)) * INOPB(&sblock),
+ (uintmax_t)(inum / INOPB(&sblock) + 1) * INOPB(&sblock));
findblk_numtofind--;
if (findblk_numtofind == 0)
goto end;
@@ -593,8 +597,8 @@ static int
founddatablk(uint64_t blk)
{
- printf("%llu: data block of inode %d\n",
- (unsigned long long)fsbtodb(&sblock, blk), curinum);
+ printf("%llu: data block of inode %ju\n",
+ (unsigned long long)fsbtodb(&sblock, blk), (uintmax_t)curinum);
findblk_numtofind--;
if (findblk_numtofind == 0)
return 1;
@@ -753,7 +757,7 @@ CMDFUNCSTART(ln)
return 1;
rval = makeentry(curinum, inum, argv[2]);
if (rval)
- printf("Ino %d entered as `%s'\n", inum, argv[2]);
+ printf("Ino %ju entered as `%s'\n", (uintmax_t)inum, argv[2]);
else
printf("could not enter name? weird.\n");
curinode = ginode(curinum);
diff --git a/sbin/fsdb/fsdbutil.c b/sbin/fsdb/fsdbutil.c
index 5d6f16d5d864..eaea3db79fd5 100644
--- a/sbin/fsdb/fsdbutil.c
+++ b/sbin/fsdb/fsdbutil.c
@@ -152,7 +152,7 @@ printstat(const char *cp, ino_t inum, union dinode *dp)
puts("fifo");
break;
}
- printf("I=%lu MODE=%o SIZE=%ju", (u_long)inum, DIP(dp, di_mode),
+ printf("I=%ju MODE=%o SIZE=%ju", (uintmax_t)inum, DIP(dp, di_mode),
(uintmax_t)DIP(dp, di_size));
if (sblock.fs_magic != FS_UFS1_MAGIC) {
t = _time64_to_time(dp->dp2.di_birthtime);
@@ -290,7 +290,7 @@ printblocks(ino_t inum, union dinode *dp)
long ndb, offset;
ufs2_daddr_t blkno;
- printf("Blocks for inode %d:\n", inum);
+ printf("Blocks for inode %ju:\n", (uintmax_t)inum);
printf("Direct blocks:\n");
ndb = howmany(DIP(dp, di_size), sblock.fs_bsize);
for (i = 0; i < NDADDR && i < ndb; i++) {
@@ -338,7 +338,7 @@ checkactivedir(void)
return 0;
}
if ((DIP(curinode, di_mode) & IFMT) != IFDIR) {
- warnx("inode %d not a directory", curinum);
+ warnx("inode %ju not a directory", (uintmax_t)curinum);
return 0;
}
return 1;
@@ -363,11 +363,12 @@ printactive(int doblocks)
printstat("current inode", curinum, curinode);
break;
case 0:
- printf("current inode %d: unallocated inode\n", curinum);
+ printf("current inode %ju: unallocated inode\n", (uintmax_t)curinum);
break;
default:
- printf("current inode %d: screwy itype 0%o (mode 0%o)?\n",
- curinum, DIP(curinode, di_mode) & IFMT, DIP(curinode, di_mode));
+ printf("current inode %ju: screwy itype 0%o (mode 0%o)?\n",
+ (uintmax_t)curinum, DIP(curinode, di_mode) & IFMT,
+ DIP(curinode, di_mode));
break;
}
return 0;