1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
Index: genext2fs/genext2fs.c
===================================================================
--- genext2fs.orig/genext2fs.c 2005-03-10 21:18:08.000000000 -0500
+++ genext2fs/genext2fs.c 2005-03-13 11:41:55.182746832 -0500
@@ -2284,6 +2284,7 @@
" -d, --root <directory>\n"
" -D, --devtable <file>\n"
" -b, --size-in-blocks <blocks>\n"
+ " -I, --bytes-per-inode <bytes per inode>\n"
" -i, --number-of-inodes <number of inodes>\n"
" -r, --reserved-blocks <number of reserved blocks>\n"
" -g, --block-map <path> Generate a block map file for this path.\n"
@@ -2314,6 +2315,7 @@
int nbresrvd = -1;
int tmp_nbblocks = -1;
int tmp_nbinodes = -1;
+ int bytes_per_inode = BYTES_PER_INODE;
uint32 fs_timestamp = -1;
char * fsout = "-";
char * fsin = 0;
@@ -2345,6 +2347,7 @@
{ "root", required_argument, NULL, 'd' },
{ "devtable", required_argument, NULL, 'D' },
{ "size-in-blocks", required_argument, NULL, 'b' },
+ { "bytes-per-inode", required_argument, NULL, 'I' },
{ "number-of-inodes", required_argument, NULL, 'i' },
{ "reserved-blocks", required_argument, NULL, 'r' },
{ "block-map", required_argument, NULL, 'g' },
@@ -2359,7 +2362,7 @@
{ 0, 0, 0, 0}
} ;
- while((c = getopt_long(argc, argv, "x:d:D:b:i:r:g:e:zfqUPhv", longopts, NULL)) != EOF) {
+ while((c = getopt_long(argc, argv, "x:d:D:b:I:i:r:g:e:zfqUPhv", longopts, NULL)) != EOF) {
switch(c)
{
case 'x':
@@ -2372,6 +2375,9 @@
case 'b':
nbblocks = atoi(optarg);
break;
+ case 'I':
+ bytes_per_inode = atoi(optarg);
+ break;
case 'i':
nbinodes = atoi(optarg);
break;
@@ -2468,24 +2474,22 @@
if(pdest)
*pdest = ':';
}
-
+
tmp_nbinodes = stats.ninodes + EXT2_FIRST_INO + 1;
tmp_nbblocks = stats.nblocks; // FIXME: should add space taken by inodes too
-
+
if(tmp_nbblocks > nbblocks)
{
fprintf(stderr, "number of blocks too low, increasing to %d\n",tmp_nbblocks);
nbblocks = tmp_nbblocks;
}
+ if(nbinodes == -1)
+ nbinodes = nbblocks * BLOCKSIZE / rndup(bytes_per_inode, BLOCKSIZE);
if(tmp_nbinodes > nbinodes)
{
fprintf(stderr, "number of inodes too low, increasing to %d\n",tmp_nbinodes);
nbinodes = tmp_nbinodes;
}
- if(nbblocks == -1)
- error_msg_and_die("filesystem size unspecified");
- if(nbinodes == -1)
- nbinodes = nbblocks * BLOCKSIZE / rndup(BYTES_PER_INODE, BLOCKSIZE);
if(nbresrvd == -1)
nbresrvd = nbblocks * RESERVED_BLOCKS;
if(fs_timestamp == -1)
|