Changes by: antona
Update of /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22273/ntfsprogs
Modified Files:
mkntfs.c mkntfs.8.in
Log Message:
mkntfs: Add new option -T which fakes the time to be 00:00:00 UTC,
Jan 1, 1970 instead of the current system time.
Index: mkntfs.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/mkntfs.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -p -r1.55 -r1.56
--- mkntfs.c 3 Jun 2005 21:53:02 -0000 1.55
+++ mkntfs.c 3 Jun 2005 22:22:12 -0000 1.56
@@ -207,6 +207,8 @@ struct {
char disable_indexing; /* -I, disables indexing of file
contents on the volume by default. */
/* -V, print version and exit. */
+ char use_epoch_time; /* -T, fake the time to be
+ 00:00:00 UTC, Jan 1, 1970. */
} opts;
/**
@@ -315,6 +317,8 @@ static void usage(void)
" -n Do not write to disk\n"
" -F Force execution despite "
"errors\n"
+ " -T Fake the time to be "
+ "00:00:00 UTC, Jan 1, 1970\n"
" -q Quiet execution\n"
" -v Verbose execution\n"
" -vv Very verbose execution\n"
@@ -343,7 +347,7 @@ static void parse_options(int argc, char
if (argc && *argv)
EXEC_NAME = *argv;
fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION);
- while ((c = getopt(argc, argv, "c:fh?np:qs:vz:CFIL:QVl")) != EOF)
+ while ((c = getopt(argc, argv, "c:fh?np:qs:vz:CFTIL:QVl")) != EOF)
switch (c) {
case 'n':
opts.no_action = 1;
@@ -401,6 +405,9 @@ static void parse_options(int argc, char
case 'F':
opts.force = 1;
break;
+ case 'T':
+ opts.use_epoch_time = 1;
+ break;
case 'I':
opts.disable_indexing = 1;
break;
@@ -434,6 +441,16 @@ static void parse_options(int argc, char
}
/**
+ * mkntfs_time
+ */
+static time_t mkntfs_time(void)
+{
+ if (!opts.use_epoch_time)
+ return time(NULL);
+ return 0;
+}
+
+/**
* append_to_bad_blocks
*
* Note: Might not return.
@@ -1652,7 +1669,7 @@ static int add_attr_std_info(MFT_RECORD
STANDARD_INFORMATION si;
int err;
- si.creation_time = utc2ntfs(time(NULL));
+ si.creation_time = utc2ntfs(mkntfs_time());
si.last_data_change_time = si.creation_time;
si.last_mft_change_time = si.creation_time;
si.last_access_time = si.creation_time;
@@ -2426,7 +2443,7 @@ static int create_hardlink(INDEX_BLOCK *
fn->parent_directory = ref_parent;
// FIXME: Is this correct? Or do we have to copy the creation_time
// from the std info?
- fn->creation_time = utc2ntfs(time(NULL));
+ fn->creation_time = utc2ntfs(mkntfs_time());
fn->last_data_change_time = fn->creation_time;
fn->last_mft_change_time = fn->creation_time;
fn->last_access_time = fn->creation_time;
@@ -3672,7 +3689,7 @@ int main(int argc, char **argv)
/* Setup the correct locale for string output and conversion. */
utils_set_locale();
/* Initialize the random number generator with the current time. */
- srandom(time(NULL));
+ srandom(mkntfs_time());
/* Allocate and initialize ntfs_volume structure vol. */
vol = ntfs_volume_alloc();
if (!vol)
Index: mkntfs.8.in
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/mkntfs.8.in,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- mkntfs.8.in 24 Mar 2004 10:36:31 -0000 1.11
+++ mkntfs.8.in 3 Jun 2005 22:22:12 -0000 1.12
@@ -3,7 +3,7 @@
.\" This file may be copied under the terms of the GNU Public License.
.\" Adapted from e2fsprogs-1.19/misc/mke2fs.8.in by Theodore Ts'o.
.\"
-.TH MKNTFS 8 "March 2002" "ntfsprogs version @VERSION@"
+.TH MKNTFS 8 "June 2005" "ntfsprogs version @VERSION@"
.SH NAME
mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system
.SH SYNOPSIS
@@ -60,6 +60,9 @@ mkntfs \- create a NTFS 1.2 (Windows NT/
.B \-F
]
[
+.B \-T
+]
+[
.B \-I
]
[
@@ -213,6 +216,10 @@ to run, even if the specified
.I device
is not a block special device, or appears to be mounted.
.TP
+.B \-T
+Fake the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system
+time. This is only really useful for debugging purposes.
+.TP
.B \-I
Disable content indexing on the volume. (This is only meaningful on
Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do
|