mirror of
https://github.com/nilfs-dev/nilfs-utils.git
synced 2026-01-26 13:43:15 +00:00
nilfs-resize: switch singular/plural forms of "segment" in message text
When outputting the number segments in messages, switch between singular and plural forms of string "segment" depending on the count. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
This commit is contained in:
parent
0d15f76541
commit
411036081c
@ -458,15 +458,16 @@ static int nilfs_resize_check_free_space(struct nilfs *nilfs,
|
||||
+ nrsvsegs;
|
||||
nbytes = nilfs_resize_calc_size_of_segments(nsegs);
|
||||
myprintf("Error: the filesystem does not have enough free space.\n"
|
||||
" At least %llu more segments (%llu bytes) are required.\n",
|
||||
nsegs, nbytes);
|
||||
" At least %llu more segment%s (%llu bytes) %s required.\n",
|
||||
nsegs, nsegs != 1 ? "s" : "", nbytes,
|
||||
nsegs != 1 ? "are" : "is");
|
||||
return -1;
|
||||
} else if (verbose) {
|
||||
nsegs = sustat.ss_ncleansegs - (sustat.ss_nsegs - newnsegs)
|
||||
- nrsvsegs;
|
||||
nbytes = nilfs_resize_calc_size_of_segments(nsegs);
|
||||
myprintf("%llu free segments (%llu bytes) will be left after shrinkage.\n",
|
||||
nsegs, nbytes);
|
||||
myprintf("%llu free segment%s (%llu bytes) will be left after shrinkage.\n",
|
||||
nsegs, nsegs != 1 ? "s" : "", nbytes);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1258,8 +1259,10 @@ static int nilfs_shrink_online(struct nilfs *nilfs, const char *device,
|
||||
goto out;
|
||||
|
||||
if (newnsegs < sustat.ss_nsegs) {
|
||||
myprintf("%llu segments will be truncated from segnum %llu.\n",
|
||||
(unsigned long long)sustat.ss_nsegs - newnsegs,
|
||||
uint64_t truncsegs = sustat.ss_nsegs - newnsegs;
|
||||
|
||||
myprintf("%llu segment%s will be truncated from segnum %llu.\n",
|
||||
(unsigned long long)truncsegs, truncsegs != 1 ? "s" : "",
|
||||
(unsigned long long)newnsegs);
|
||||
} else if (newnsegs == sustat.ss_nsegs) {
|
||||
myprintf("No segments will be truncated.\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user