未验证 提交 38931765 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #3931 from enkiller/0926

[add] DFS file system supports device types
......@@ -186,6 +186,7 @@ int dfs_device_fs_open(struct dfs_fd *file)
result = file->fops->open(file);
if (result == RT_EOK || result == -RT_ENOSYS)
{
file->type = FT_DEVICE;
return 0;
}
}
......@@ -197,6 +198,7 @@ int dfs_device_fs_open(struct dfs_fd *file)
if (result == RT_EOK || result == -RT_ENOSYS)
{
file->data = device;
file->type = FT_DEVICE;
return RT_EOK;
}
}
......
......@@ -55,6 +55,7 @@
#define FT_SOCKET 1 /* socket file */
#define FT_DIRECTORY 2 /* directory */
#define FT_USER 3 /* user defined */
#define FT_DEVICE 4 /* device */
/* File flags */
#define DFS_F_OPEN 0x01000000
......
......@@ -542,6 +542,7 @@ int list_fd(void)
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 if (fd->type == FT_DEVICE) rt_kprintf("%-7.7s ", "device");
else rt_kprintf("%-8.8s ", "unknown");
rt_kprintf("%3d ", fd->ref_count);
rt_kprintf("%04x ", fd->magic);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册