From 839254d9769485504e36dd4f70b4e186b94061c3 Mon Sep 17 00:00:00 2001 From: tangyuxin <462747508@qq.com> Date: Tue, 26 Jun 2018 14:01:27 +0800 Subject: [PATCH] =?UTF-8?q?[components][dfs]=20list=5Ffd=20=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E4=BF=A1=E6=81=AF=E6=9B=B4=E5=8A=A0=E5=8F=8B=E5=A5=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/src/dfs.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index f613168a4c..01f5f9ccc3 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -522,23 +522,30 @@ int list_fd(void) if (!fd_table) return -1; rt_enter_critical(); - + + rt_kprintf("fd type ref magic path\n"); + rt_kprintf("-- ------ --- ----- ------\n"); for (index = 0; index < fd_table->maxfd; index ++) { struct dfs_fd *fd = fd_table->fds[index]; if (fd->fops) { - rt_kprintf("--fd: %d--", index); - if (fd->type == FT_DIRECTORY) rt_kprintf("[dir]\n"); - if (fd->type == FT_REGULAR) rt_kprintf("[file]\n"); - if (fd->type == FT_SOCKET) rt_kprintf("[socket]\n"); - if (fd->type == FT_USER) rt_kprintf("[user]\n"); - rt_kprintf("refcount=%d\n", fd->ref_count); - rt_kprintf("magic=0x%04x\n", fd->magic); + rt_kprintf("%2d ", index); + if (fd->type == FT_DIRECTORY) rt_kprintf("%-7.7s ", "dir"); + else if (fd->type == FT_REGULAR) rt_kprintf("%-7.7s ", "file"); + else if (fd->type == FT_SOCKET) rt_kprintf("%-7.7s ", "socket"); + else if (fd->type == FT_USER) rt_kprintf("%-7.7s ", "user"); + else rt_kprintf("%-8.8s ", "unknown"); + rt_kprintf("%3d ", fd->ref_count); + rt_kprintf("%04x ", fd->magic); if (fd->path) { - rt_kprintf("path: %s\n", fd->path); + rt_kprintf("%s\n", fd->path); + } + else + { + rt_kprintf("\n"); } } }