fs lsmount subcommand for listing VFS mountpoint info
This commit is contained in:
18
user/fs/lsmount.c
Normal file
18
user/fs/lsmount.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <ulib.h>
|
||||
|
||||
static const char *fstypes[] = { "Little FS" };
|
||||
|
||||
void fs_lsmount(void) {
|
||||
VfsAvailMounts availmounts; ZERO(&availmounts);
|
||||
vfsavailmounts(&availmounts);
|
||||
|
||||
for (size_t i = 0; i < ARRLEN(availmounts.fieldavail); i++) {
|
||||
if (availmounts.fieldavail[i]) {
|
||||
VfsMountStat stat; ZERO(&stat);
|
||||
vfsmountstat(&stat, (char *)availmounts.labels[i]);
|
||||
uprintf("%-30s %-10s %-30s\n", stat.label, fstypes[stat.fstype], stat.devname);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,7 @@
|
||||
#define CMDS(X) \
|
||||
X(fetch) X(mkf) X(mkd) \
|
||||
X(tree) X(mount) X(del) \
|
||||
X(fmt) X(unmount)
|
||||
X(fmt) X(unmount) X(lsmount) \
|
||||
|
||||
void main(void) {
|
||||
if (argslen() == 0) {
|
||||
|
||||
Reference in New Issue
Block a user