MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / cmd_mkfs

Function cmd_mkfs

components/finsh/msh_file.c:510–539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508MSH_CMD_EXPORT_ALIAS(cmd_mkdir, mkdir, Create the DIRECTORY.);
509
510static int cmd_mkfs(int argc, char **argv)
511{
512 int result = 0;
513 char *type = "elm"; /* use the default file system type as 'fatfs' */
514
515 if (argc == 2)
516 {
517 result = dfs_mkfs(type, argv[1]);
518 }
519 else if (argc == 4)
520 {
521 if (strcmp(argv[1], "-t") == 0)
522 {
523 type = argv[2];
524 result = dfs_mkfs(type, argv[3]);
525 }
526 }
527 else
528 {
529 rt_kprintf("Usage: mkfs [-t type] device\n");
530 return 0;
531 }
532
533 if (result != RT_EOK)
534 {
535 rt_kprintf("mkfs failed, result=%d\n", result);
536 }
537
538 return 0;
539}
540MSH_CMD_EXPORT_ALIAS(cmd_mkfs, mkfs, format disk with file system);
541
542/*

Callers

nothing calls this directly

Calls 2

rt_kprintfFunction · 0.85
dfs_mkfsFunction · 0.50

Tested by

no test coverage detected