aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsdb
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/fsdb')
-rw-r--r--sbin/fsdb/fsdb.88
-rw-r--r--sbin/fsdb/fsdb.c18
-rw-r--r--sbin/fsdb/fsdbutil.c6
3 files changed, 29 insertions, 3 deletions
diff --git a/sbin/fsdb/fsdb.8 b/sbin/fsdb/fsdb.8
index ca837f1a0335..bd1283e04fc3 100644
--- a/sbin/fsdb/fsdb.8
+++ b/sbin/fsdb/fsdb.8
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 2, 2006
+.Dd August 23, 2006
.Dt FSDB 8
.Os
.Sh NAME
@@ -204,11 +204,12 @@ Change the group of the current inode to
Change the generation number of the current inode to
.Ar gen .
.Pp
+.It Cm btime Ar time
.It Cm mtime Ar time
.It Cm ctime Ar time
.It Cm atime Ar time
-Change the modification, change, or access time (respectively) on the
-current inode to
+Change the creation (birth), modification, change, or access
+time (respectively) on the current inode to
.Ar time .
.Ar Time
should be in the format
@@ -217,6 +218,7 @@ where
.Em nsec
is an optional nanosecond specification.
If no nanoseconds are specified, the
+.Va birthnsec ,
.Va mtimensec ,
.Va ctimensec ,
or
diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c
index 58d8471f036e..3853d295c07f 100644
--- a/sbin/fsdb/fsdb.c
+++ b/sbin/fsdb/fsdb.c
@@ -148,6 +148,7 @@ CMDFUNC(chgen); /* change generation */
CMDFUNC(chowner); /* change owner */
CMDFUNC(chgroup); /* Change group */
CMDFUNC(back); /* pop back to last ino */
+CMDFUNC(chbtime); /* Change btime */
CMDFUNC(chmtime); /* Change mtime */
CMDFUNC(chctime); /* Change ctime */
CMDFUNC(chatime); /* Change atime */
@@ -182,6 +183,7 @@ struct cmdtable cmds[] = {
{ "chgrp", "Change group of current inode to GROUP", 2, 2, FL_WR, chgroup },
{ "chflags", "Change flags of current inode to FLAGS", 2, 2, FL_WR, chaflags },
{ "chgen", "Change generation number of current inode to GEN", 2, 2, FL_WR, chgen },
+ { "btime", "Change btime of current inode to BTIME", 2, 2, FL_WR, chbtime },
{ "mtime", "Change mtime of current inode to MTIME", 2, 2, FL_WR, chmtime },
{ "ctime", "Change ctime of current inode to CTIME", 2, 2, FL_WR, chctime },
{ "atime", "Change atime of current inode to ATIME", 2, 2, FL_WR, chatime },
@@ -1132,6 +1134,22 @@ badformat:
return 0;
}
+CMDFUNCSTART(chbtime)
+{
+ time_t secs;
+ int32_t nsecs;
+
+ if (dotime(argv[1], &secs, &nsecs))
+ return 1;
+ if (sblock.fs_magic == FS_UFS1_MAGIC)
+ return 1;
+ curinode->dp2.di_birthtime = _time_to_time64(secs);
+ curinode->dp2.di_birthnsec = nsecs;
+ inodirty();
+ printactive(0);
+ return 0;
+}
+
CMDFUNCSTART(chmtime)
{
time_t secs;
diff --git a/sbin/fsdb/fsdbutil.c b/sbin/fsdb/fsdbutil.c
index 474ac82f1b9a..d50c6c00d331 100644
--- a/sbin/fsdb/fsdbutil.c
+++ b/sbin/fsdb/fsdbutil.c
@@ -156,6 +156,12 @@ printstat(const char *cp, ino_t inum, union dinode *dp)
}
printf("I=%lu MODE=%o SIZE=%ju", (u_long)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);
+ p = ctime(&t);
+ printf("\n\tBTIME=%15.15s %4.4s [%d nsec]", &p[4], &p[20],
+ dp->dp2.di_birthnsec);
+ }
if (sblock.fs_magic == FS_UFS1_MAGIC)
t = _time32_to_time(dp->dp1.di_mtime);
else