Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/makefs/ffs.c
Show First 20 Lines • Show All 617 Lines • ▼ Show 20 Lines | #define ADDDIRENT(e) do { \ | ||||
if (this + curdirsize > roundup(curdirsize, DIRBLKSIZ)) \ | if (this + curdirsize > roundup(curdirsize, DIRBLKSIZ)) \ | ||||
curdirsize = roundup(curdirsize, DIRBLKSIZ); \ | curdirsize = roundup(curdirsize, DIRBLKSIZ); \ | ||||
curdirsize += this; \ | curdirsize += this; \ | ||||
if (debug & DEBUG_FS_SIZE_DIR_ADD_DIRENT) \ | if (debug & DEBUG_FS_SIZE_DIR_ADD_DIRENT) \ | ||||
printf("ADDDIRENT: now: %s (%d) this %d cur %d\n", \ | printf("ADDDIRENT: now: %s (%d) this %d cur %d\n", \ | ||||
e, tmpdir.d_namlen, this, curdirsize); \ | e, tmpdir.d_namlen, this, curdirsize); \ | ||||
} while (0); | } while (0); | ||||
/* | |||||
* XXX this needs to take into account extra space consumed | |||||
* by indirect blocks, etc. | |||||
*/ | |||||
#define ADDSIZE(x) do { \ | #define ADDSIZE(x) do { \ | ||||
if ((x) < UFS_NDADDR * ffs_opts->bsize) { \ | |||||
fsopts->size += roundup((x), ffs_opts->fsize); \ | fsopts->size += roundup((x), ffs_opts->fsize); \ | ||||
asomers: One problem: the compiler complains about a signed/unsigned comparison in this line, as called… | |||||
} else { \ | |||||
/* Count space consumed by indirecttion blocks. */ \ | |||||
fsopts->size += ffs_opts->bsize * \ | |||||
(howmany((x), UFS_NDADDR * ffs_opts->bsize) - 1); \ | |||||
/* \ | |||||
* If the file is big enough to use indirect blocks, \ | |||||
* we allocate bsize block for trailing data. \ | |||||
*/ \ | |||||
fsopts->size += roundup((x), ffs_opts->bsize); \ | |||||
} \ | |||||
} while (0); | } while (0); | ||||
curdirsize = 0; | curdirsize = 0; | ||||
for (node = root; node != NULL; node = node->next) { | for (node = root; node != NULL; node = node->next) { | ||||
ADDDIRENT(node->name); | ADDDIRENT(node->name); | ||||
if (node == root) { /* we're at "." */ | if (node == root) { /* we're at "." */ | ||||
assert(strcmp(node->name, ".") == 0); | assert(strcmp(node->name, ".") == 0); | ||||
ADDDIRENT(".."); | ADDDIRENT(".."); | ||||
▲ Show 20 Lines • Show All 559 Lines • Show Last 20 Lines |
One problem: the compiler complains about a signed/unsigned comparison in this line, as called from line 664. Could you please fix that?