[Midnightbsd-cvs] src [11217] trunk/sbin/fsdb: sync fsdb with freebsd
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Jul 1 16:52:02 EDT 2018
Revision: 11217
http://svnweb.midnightbsd.org/src/?rev=11217
Author: laffer1
Date: 2018-07-01 16:52:01 -0400 (Sun, 01 Jul 2018)
Log Message:
-----------
sync fsdb with freebsd
Modified Paths:
--------------
trunk/sbin/fsdb/Makefile
trunk/sbin/fsdb/fsdb.8
trunk/sbin/fsdb/fsdb.c
trunk/sbin/fsdb/fsdb.h
trunk/sbin/fsdb/fsdbutil.c
Property Changed:
----------------
trunk/sbin/fsdb/fsdb.8
Modified: trunk/sbin/fsdb/Makefile
===================================================================
--- trunk/sbin/fsdb/Makefile 2018-07-01 20:51:37 UTC (rev 11216)
+++ trunk/sbin/fsdb/Makefile 2018-07-01 20:52:01 UTC (rev 11217)
@@ -1,12 +1,13 @@
+# $MidnightBSD$
# $NetBSD: Makefile,v 1.1.1.1 1995/10/08 23:08:36 thorpej Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/sbin/fsdb/Makefile 260178 2014-01-02 01:44:14Z scottl $
PROG= fsdb
MAN= fsdb.8
SRCS= fsdb.c fsdbutil.c \
dir.c ea.c fsutil.c inode.c pass1.c pass1b.c pass2.c pass3.c pass4.c \
- pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c
+ pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c globs.c
CFLAGS+= -I${.CURDIR}/../fsck_ffs
WARNS?= 2
LDADD= -ledit -ltermcap
Modified: trunk/sbin/fsdb/fsdb.8
===================================================================
--- trunk/sbin/fsdb/fsdb.8 2018-07-01 20:51:37 UTC (rev 11216)
+++ trunk/sbin/fsdb/fsdb.8 2018-07-01 20:52:01 UTC (rev 11217)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" $NetBSD: fsdb.8,v 1.2 1995/10/08 23:18:08 thorpej Exp $
.\"
.\" Copyright (c) 1995 John T. Kohl
@@ -26,9 +27,9 @@
.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/sbin/fsdb/fsdb.8 306987 2016-10-10 16:25:05Z sevan $
.\"
-.Dd August 24, 2006
+.Dd October 3, 2016
.Dt FSDB 8
.Os
.Sh NAME
@@ -239,19 +240,20 @@
.Sh HISTORY
The
.Nm
-utility uses the source code for
+utility appeared in
+.Bx 4.3 Tahoe .
+It used the source code for
.Xr fsck 8
to implement most of the file system manipulation code.
The remainder of
.Nm
-first appeared in
-.Nx ,
+appeared in
+.Nx 1.1
written by
.An John T. Kohl .
-.Pp
-.An Peter Wemm
-ported it to
-.Fx .
+It first appeared in
+.Fx 2.1.5
+ported by Peter Wemm.
.Sh BUGS
Manipulation of ``short'' symlinks has no effect.
In particular, one should not
Property changes on: trunk/sbin/fsdb/fsdb.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sbin/fsdb/fsdb.c
===================================================================
--- trunk/sbin/fsdb/fsdb.c 2018-07-01 20:51:37 UTC (rev 11216)
+++ trunk/sbin/fsdb/fsdb.c 2018-07-01 20:52:01 UTC (rev 11217)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $NetBSD: fsdb.c,v 1.2 1995/10/08 23:18:10 thorpej Exp $ */
/*
@@ -30,7 +31,7 @@
#ifndef lint
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/sbin/fsdb/fsdb.c 248658 2013-03-23 20:00:02Z mckusick $";
#endif /* not lint */
#include <sys/param.h>
@@ -39,6 +40,7 @@
#include <grp.h>
#include <histedit.h>
#include <pwd.h>
+#include <stdint.h>
#include <string.h>
#include <time.h>
#include <timeconv.h>
@@ -211,7 +213,8 @@
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 +301,8 @@
#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 +367,8 @@
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 +378,8 @@
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;
}
@@ -494,11 +499,11 @@
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;
@@ -594,8 +599,8 @@
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;
@@ -754,7 +759,7 @@
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);
Modified: trunk/sbin/fsdb/fsdb.h
===================================================================
--- trunk/sbin/fsdb/fsdb.h 2018-07-01 20:51:37 UTC (rev 11216)
+++ trunk/sbin/fsdb/fsdb.h 2018-07-01 20:52:01 UTC (rev 11217)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $NetBSD: fsdb.h,v 1.2 1995/10/08 23:18:11 thorpej Exp $ */
/*
@@ -27,7 +28,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sbin/fsdb/fsdb.h 163846 2006-10-31 22:07:29Z pjd $
*/
extern int blread(int fd, char *buf, ufs2_daddr_t blk, long size);
Modified: trunk/sbin/fsdb/fsdbutil.c
===================================================================
--- trunk/sbin/fsdb/fsdbutil.c 2018-07-01 20:51:37 UTC (rev 11216)
+++ trunk/sbin/fsdb/fsdbutil.c 2018-07-01 20:52:01 UTC (rev 11217)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $NetBSD: fsdbutil.c,v 1.2 1995/10/08 23:18:12 thorpej Exp $ */
/*
@@ -30,7 +31,7 @@
#ifndef lint
static const char rcsid[] =
- "$MidnightBSD$";
+ "$FreeBSD: stable/10/sbin/fsdb/fsdbutil.c 247234 2013-02-24 19:32:43Z pluknet $";
#endif /* not lint */
#include <sys/param.h>
@@ -126,12 +127,10 @@
puts("regular file");
break;
case IFBLK:
- printf("block special (%d,%d)",
- major(DIP(dp, di_rdev)), minor(DIP(dp, di_rdev)));
+ printf("block special (%#jx)", (uintmax_t)DIP(dp, di_rdev));
break;
case IFCHR:
- printf("character special (%d,%d)",
- major(DIP(dp, di_rdev)), minor(DIP(dp, di_rdev)));
+ printf("character special (%#jx)", DIP(dp, di_rdev));
break;
case IFLNK:
fputs("symlink",stdout);
@@ -154,7 +153,7 @@
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);
@@ -291,7 +290,7 @@
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++) {
@@ -339,7 +338,7 @@
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;
@@ -364,11 +363,12 @@
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;
More information about the Midnightbsd-cvs
mailing list