diff options
author | JP Abgrall <jpa@google.com> | 2014-06-11 21:55:38 -0700 |
---|---|---|
committer | JP Abgrall <jpa@google.com> | 2014-06-12 17:42:39 -0700 |
commit | 94f92855ceae3de54cbbfef146b14fdedac49654 (patch) | |
tree | 26652be02ebb794ee6c03e55b5e1cbf51be353d9 /lib | |
parent | 4b32bd42bc5bef74c4d8d8d3c7a503289dc676bc (diff) | |
download | android_external_f2fs-tools-94f92855ceae3de54cbbfef146b14fdedac49654.tar.gz android_external_f2fs-tools-94f92855ceae3de54cbbfef146b14fdedac49654.tar.bz2 android_external_f2fs-tools-94f92855ceae3de54cbbfef146b14fdedac49654.zip |
mkfs: support passing in the number of sectors to use
Adds the optional sectors count:
mkfs.f2fs [options] device [sectors]
Change-Id: I3ac83121576574bda074140ffa60195a2bc9947b
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libf2fs.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libf2fs.c b/lib/libf2fs.c index 358bfb8..6168c5c 100644 --- a/lib/libf2fs.c +++ b/lib/libf2fs.c @@ -354,6 +354,7 @@ int f2fs_crc_valid(u_int32_t blk_crc, void *buf, int len) */ void f2fs_init_configuration(struct f2fs_configuration *c) { + c->total_sectors = 0; c->sector_size = DEFAULT_SECTOR_SIZE; c->sectors_per_blk = DEFAULT_SECTORS_PER_BLOCK; c->blks_per_seg = DEFAULT_BLOCKS_PER_SEGMENT; @@ -430,6 +431,7 @@ int f2fs_get_device_info(struct f2fs_configuration *c) uint32_t sector_size; struct stat stat_buf; struct hd_geometry geom; + u_int64_t wanted_total_sectors = c->total_sectors; fd = open(c->device_name, O_RDWR); if (fd < 0) { @@ -472,7 +474,12 @@ int f2fs_get_device_info(struct f2fs_configuration *c) MSG(0, "\tError: Volume type is not supported!!!\n"); return -1; } + if (wanted_total_sectors && wanted_total_sectors < c->total_sectors) { + MSG(0, "Info: total device sectors = %"PRIu64" (in 512bytes)\n", + c->total_sectors); + c->total_sectors = wanted_total_sectors; + } MSG(0, "Info: sector size = %u\n", c->sector_size); MSG(0, "Info: total sectors = %"PRIu64" (in 512bytes)\n", c->total_sectors); |