nshlib: losetup/lomtd change "-s <sectsize>" to "-b <sectsize>"

to follow host tool usage:
https://github.com/util-linux/util-linux/blob/master/sys-utils/losetup.c#L473

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-09-23 14:13:01 +08:00 committed by Alan Carvalho de Assis
parent baa23afbd3
commit fe7f217497
2 changed files with 8 additions and 8 deletions

View File

@ -303,7 +303,7 @@ static const struct cmdmap_s g_cmdmap[] =
#ifndef CONFIG_DISABLE_MOUNTPOINT
# if defined(CONFIG_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSETUP)
CMD_MAP("losetup", cmd_losetup, 3, 6,
"[-d <dev-path>] | [[-o <offset>] [-r] [-s <sect-size>] "
"[-d <dev-path>] | [[-o <offset>] [-r] [-b <sect-size>] "
"<dev-path> <file-path>]"),
# endif
#endif
@ -320,7 +320,7 @@ static const struct cmdmap_s g_cmdmap[] =
# if defined(CONFIG_MTD_LOOP) && !defined(CONFIG_NSH_DISABLE_LOMTD)
CMD_MAP("lomtd", cmd_lomtd, 3, 9,
"[-d <dev-path>] | [[-o <offset>] [-e <erase-size>] "
"[-s <sect-size>] <dev-path> <file-path>]]"),
"[-b <sect-size>] <dev-path> <file-path>]]"),
# endif
#endif

View File

@ -798,13 +798,13 @@ int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
/* Get the losetup options: Two forms are supported:
*
* losetup -d <loop-device>
* losetup [-o <offset>] [-r] [-s <sectsize> ] <loop-device> <filename>
* losetup [-o <offset>] [-r] [-b <sectsize> ] <loop-device> <filename>
*
* NOTE that the -o and -r options are accepted with the -d option, but
* will be ignored.
*/
while ((option = getopt(argc, argv, "d:o:rs:")) != ERROR)
while ((option = getopt(argc, argv, "d:o:rb:")) != ERROR)
{
switch (option)
{
@ -821,7 +821,7 @@ int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
readonly = true;
break;
case 's':
case 'b':
sectsize = atoi(optarg);
break;
@ -1131,14 +1131,14 @@ int cmd_lomtd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
/* Get the lomtd options: Two forms are supported:
*
* lomtd -d <loop-device>
* lomtd [-o <offset>] [-e erasesize] [-s sectsize]
* lomtd [-o <offset>] [-e erasesize] [-b sectsize]
* <loop-device> <filename>
*
* NOTE that the -o and -r options are accepted with the -d option, but
* will be ignored.
*/
while ((option = getopt(argc, argv, "d:o:e:s:")) != ERROR)
while ((option = getopt(argc, argv, "d:o:e:b:")) != ERROR)
{
switch (option)
{
@ -1155,7 +1155,7 @@ int cmd_lomtd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
offset = atoi(optarg);
break;
case 's':
case 'b':
sectsize = atoi(optarg);
break;