From 6860246cfaac6f540665e79bbc4c3d54c419b092 Mon Sep 17 00:00:00 2001 From: chenjing Date: Wed, 23 Jun 2021 17:10:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9/proc/mounts=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 显示信息内容及格式修改为与posix标准一致,内容包括: 1、挂载设备名 2、挂载点路径 3、文件系统类型 4、挂载选项(此项暂不支持,打印()) 5、dump频率(此项暂不支持,值为0) 6、fsck检查次序(此项暂不支持,值为0) close #I3XGCS Signed-off-by: chenjing Change-Id: I2a8cb093e7c5316feb55fb196bc1b4301d8d0249 --- fs/include/fs/mount.h | 4 +++- fs/proc/os_adapt/mounts_proc.c | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/include/fs/mount.h b/fs/include/fs/mount.h index 11f13a2b..3ac08860 100644 --- a/fs/include/fs/mount.h +++ b/fs/include/fs/mount.h @@ -53,6 +53,7 @@ struct Mount { uint32_t hashseed; /* Random seed for vfshash */ unsigned long mountFlags; /* Flags for mount */ char pathName[PATH_MAX]; /* path name of mount point */ + char devName[PATH_MAX]; /* path name of dev point */ }; struct MountOps { @@ -61,7 +62,8 @@ struct MountOps { int (*Statfs)(struct Mount *mount, struct statfs *sbp); }; -typedef int (*foreach_mountpoint_t)(const char *mountpoint, +typedef int (*foreach_mountpoint_t)(const char *devpoint, + const char *mountpoint, struct statfs *statbuf, void *arg); diff --git a/fs/proc/os_adapt/mounts_proc.c b/fs/proc/os_adapt/mounts_proc.c index 1f3be0e4..c5f39ab2 100644 --- a/fs/proc/os_adapt/mounts_proc.c +++ b/fs/proc/os_adapt/mounts_proc.c @@ -38,7 +38,7 @@ #include "fs/mount.h" #include "internal.h" -static int ShowType(const char *mountPoint, struct statfs *statBuf, void *arg) +static int ShowType(const char *devPoint, const char *mountPoint, struct statfs *statBuf, void *arg) { struct SeqBuf *seqBuf = (struct SeqBuf *)arg; char *type = NULL; @@ -66,14 +66,17 @@ static int ShowType(const char *mountPoint, struct statfs *statBuf, void *arg) return 0; } - (void)LosBufPrintf(seqBuf, "%s\t%s\n", type, mountPoint); + if (strlen(devPoint) == 0) { + (void)LosBufPrintf(seqBuf, "%s %s %s %s %d %d\n", type, mountPoint, type, "()", 0, 0); + } else { + (void)LosBufPrintf(seqBuf, "%s %s %s %s %d %d\n", devPoint, mountPoint, type, "()", 0, 0); + } return 0; } static int MountsProcFill(struct SeqBuf *m, void *v) { - (void)LosBufPrintf(m, "%s\t%s\n", "Type", "MountPoint"); foreach_mountpoint_t handler = ShowType; (void)foreach_mountpoint(handler, (void *)m);