mkfsquieter
Change-Id: I54ac01505aa97c1cbe40456c04a35aed5a7ee953
This commit is contained in:
parent
d12d57dcd8
commit
aa0726a089
|
|
@ -143,27 +143,11 @@ main(int argc, char *argv[])
|
||||||
int nread, mode, usrid, grpid, ch, extra_space_percent;
|
int nread, mode, usrid, grpid, ch, extra_space_percent;
|
||||||
block_t blocks, maxblocks;
|
block_t blocks, maxblocks;
|
||||||
ino_t inodes, root_inum;
|
ino_t inodes, root_inum;
|
||||||
time_t bin_time;
|
|
||||||
char *token[MAX_TOKENS], line[LINE_LEN], *sfx;
|
char *token[MAX_TOKENS], line[LINE_LEN], *sfx;
|
||||||
struct stat statbuf;
|
|
||||||
struct fs_size fssize;
|
struct fs_size fssize;
|
||||||
|
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
|
|
||||||
/* Get two times, the current time and the mod time of the binary of
|
|
||||||
* mkfs itself. When the -d flag is used, the later time is put into
|
|
||||||
* the i_mtimes of all the files. This feature is useful when
|
|
||||||
* producing a set of file systems, and one wants all the times to be
|
|
||||||
* identical. First you set the time of the mkfs binary to what you
|
|
||||||
* want, then go.
|
|
||||||
*/
|
|
||||||
current_time = time((time_t *) 0); /* time mkfs is being run */
|
|
||||||
if (stat(progname, &statbuf)) {
|
|
||||||
perror("stat of itself");
|
|
||||||
bin_time = current_time; /* provide some default value */
|
|
||||||
} else
|
|
||||||
bin_time = statbuf.st_mtime; /* time when mkfs binary was last modified */
|
|
||||||
|
|
||||||
/* Process switches. */
|
/* Process switches. */
|
||||||
blocks = 0;
|
blocks = 0;
|
||||||
inodes = 0;
|
inodes = 0;
|
||||||
|
|
@ -199,7 +183,6 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
dflag = 1;
|
dflag = 1;
|
||||||
current_time = bin_time;
|
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
inodes = strtoul(optarg, (char **) NULL, 0);
|
inodes = strtoul(optarg, (char **) NULL, 0);
|
||||||
|
|
@ -214,6 +197,21 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
if (argc == optind) usage();
|
if (argc == optind) usage();
|
||||||
|
|
||||||
|
/* Get two times, the current time and the mod time of the binary of
|
||||||
|
* mkfs itself. When the -d flag is used, the later time is put into
|
||||||
|
* the i_mtimes of all the files. This feature is useful when
|
||||||
|
* producing a set of file systems, and one wants all the times to be
|
||||||
|
* identical. First you set the time of the mkfs binary to what you
|
||||||
|
* want, then go.
|
||||||
|
*/
|
||||||
|
current_time = time((time_t *) 0); /* time mkfs is being run */
|
||||||
|
if(dflag) {
|
||||||
|
struct stat statbuf;
|
||||||
|
if (stat(progname, &statbuf)) {
|
||||||
|
perror("stat of itself");
|
||||||
|
} else current_time = statbuf.st_mtime;
|
||||||
|
}
|
||||||
|
|
||||||
/* Percentage of extra size must be nonnegative.
|
/* Percentage of extra size must be nonnegative.
|
||||||
* It can legitimately be bigger than 100 but has to make some sort of sense.
|
* It can legitimately be bigger than 100 but has to make some sort of sense.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user