Allow fsdb to manipulate the birthtime entries on UFS2.
Approved by: jhb MFC after: 1 month
This commit is contained in:
parent
dba2c26a5e
commit
ce40746fa9
@ -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
|
||||
|
@ -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 @@ dotime(char *name, time_t *secp, int32_t *nsecp)
|
||||
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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user