This patch introduces a new option -V to show the version of mkfs.f2fs
and exit after that.

Signed-off-by: Sheng Yong <shengyo...@huawei.com>
---
 mkfs/f2fs_format_main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index 3c70513..3520882 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -58,6 +58,7 @@ static void mkfs_usage()
        MSG(0, "  -t 0: nodiscard, 1: discard [default:1]\n");
        MSG(0, "  -w wanted sector size\n");
        MSG(0, "  -z # of sections per zone [default:1]\n");
+       MSG(0, "  -V print the version number and exit\n");
        MSG(0, "sectors: number of sectors. [default: determined by device 
size]\n");
        exit(1);
 }
@@ -136,7 +137,7 @@ static void parse_feature(const char *features)
 
 static void f2fs_parse_options(int argc, char *argv[])
 {
-       static const char *option_string = "qa:c:d:e:E:il:mo:O:s:S:z:t:fw:";
+       static const char *option_string = "qa:c:d:e:E:il:mo:O:s:S:z:t:fw:V";
        int32_t option=0;
 
        while ((option = getopt(argc,argv,option_string)) != EOF) {
@@ -209,6 +210,10 @@ static void f2fs_parse_options(int argc, char *argv[])
                case 'w':
                        c.wanted_sector_size = atoi(optarg);
                        break;
+               case 'V':
+                       MSG(0, "mkfs.f2fs %s (%s)\n",
+                                       F2FS_TOOLS_VERSION, F2FS_TOOLS_DATE);
+                       exit(0);
                default:
                        MSG(0, "\tError: Unknown option %c\n",option);
                        mkfs_usage();
-- 
2.14.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to