mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-05-29 02:28:35 +08:00
style: format code with clang-format [skip ci]
This commit is contained in:
@@ -46,30 +46,30 @@ static struct rt_spinlock _protocol_lock = { 0 };
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define P9_OF_OPS_GET(width, dir) \
|
#define P9_OF_OPS_GET(width, dir) \
|
||||||
rt_inline rt_uint##width##_t get_##dir##_##value##width##_of( \
|
rt_inline rt_uint##width##_t get_##dir##_##value##width##_of( \
|
||||||
struct p9_connection *conn, unsigned idx) \
|
struct p9_connection *conn, unsigned idx) \
|
||||||
{ \
|
{ \
|
||||||
rt_uint##width##_t *vp = (void *)&conn->dir##_buffer[idx]; \
|
rt_uint##width##_t *vp = (void *)&conn->dir##_buffer[idx]; \
|
||||||
return rt_le##width##_to_cpu(*vp); \
|
return rt_le##width##_to_cpu(*vp); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define P9_OF_OPS_PUT(width, dir) \
|
#define P9_OF_OPS_PUT(width, dir) \
|
||||||
rt_inline void put_##dir##_##value##width##_of( \
|
rt_inline void put_##dir##_##value##width##_of( \
|
||||||
struct p9_connection *conn, unsigned idx, \
|
struct p9_connection *conn, unsigned idx, \
|
||||||
rt_uint##width##_t value) \
|
rt_uint##width##_t value) \
|
||||||
{ \
|
{ \
|
||||||
rt_uint##width##_t *vp = (void *)&conn->dir##_buffer[idx]; \
|
rt_uint##width##_t *vp = (void *)&conn->dir##_buffer[idx]; \
|
||||||
*vp = rt_cpu_to_le##width(value); \
|
*vp = rt_cpu_to_le##width(value); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define P9_OPS_PUT(width) \
|
#define P9_OPS_PUT(width) \
|
||||||
rt_inline rt_off_t put_value##width(struct p9_connection *conn, \
|
rt_inline rt_off_t put_value##width(struct p9_connection *conn, \
|
||||||
rt_off_t off, rt_uint##width##_t value) \
|
rt_off_t off, rt_uint##width##_t value) \
|
||||||
{ \
|
{ \
|
||||||
((rt_uint##width##_t *)(conn->tx_buffer + off))[0] = \
|
((rt_uint##width##_t *)(conn->tx_buffer + off))[0] = \
|
||||||
rt_cpu_to_le##width(value); \
|
rt_cpu_to_le##width(value); \
|
||||||
return off + sizeof(value); \
|
return off + sizeof(value); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define P9_OPS_GROUP(width) \
|
#define P9_OPS_GROUP(width) \
|
||||||
P9_OF_OPS_GET(width, rx) \
|
P9_OF_OPS_GET(width, rx) \
|
||||||
@@ -367,8 +367,7 @@ rt_err_t dfs_9pfs_del_tag(struct p9_protocol *p9p)
|
|||||||
|
|
||||||
static int p9_to_fs_err(int rc)
|
static int p9_to_fs_err(int rc)
|
||||||
{
|
{
|
||||||
const int p9_err[] =
|
const int p9_err[] = {
|
||||||
{
|
|
||||||
[0] = RT_EOK,
|
[0] = RT_EOK,
|
||||||
[-P9_ERROR] = -EIO,
|
[-P9_ERROR] = -EIO,
|
||||||
[-P9_UNKNOWN_VERSION] = -ENOSYS,
|
[-P9_UNKNOWN_VERSION] = -ENOSYS,
|
||||||
@@ -428,10 +427,18 @@ static rt_uint8_t fs_to_p9_flags(rt_uint32_t raw_flags)
|
|||||||
|
|
||||||
switch (raw_flags & 3)
|
switch (raw_flags & 3)
|
||||||
{
|
{
|
||||||
case O_RDONLY: flags = OREAD; break;
|
case O_RDONLY:
|
||||||
case O_WRONLY: flags = OWRITE; break;
|
flags = OREAD;
|
||||||
case O_RDWR: flags = ORDWR; break;
|
break;
|
||||||
default: RT_ASSERT(0); break;
|
case O_WRONLY:
|
||||||
|
flags = OWRITE;
|
||||||
|
break;
|
||||||
|
case O_RDWR:
|
||||||
|
flags = ORDWR;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
RT_ASSERT(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (raw_flags & O_TRUNC)
|
if (raw_flags & O_TRUNC)
|
||||||
@@ -490,7 +497,8 @@ static int p9_walk_path_raw(struct p9_connection *conn, const char *path,
|
|||||||
size = put_value32(conn, size, new_fid);
|
size = put_value32(conn, size, new_fid);
|
||||||
size = put_value16(conn, size, 0); /* Fill later */
|
size = put_value16(conn, size, 0); /* Fill later */
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
split = strchrnul(path, '/');
|
split = strchrnul(path, '/');
|
||||||
|
|
||||||
len = split - path;
|
len = split - path;
|
||||||
@@ -908,8 +916,7 @@ static int dfs_9pfs_getdents(struct dfs_file *fd, struct dirent *dirp, uint32_t
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dfs_file_ops _9pfs_fops =
|
static const struct dfs_file_ops _9pfs_fops = {
|
||||||
{
|
|
||||||
.open = dfs_9pfs_open,
|
.open = dfs_9pfs_open,
|
||||||
.close = dfs_9pfs_close,
|
.close = dfs_9pfs_close,
|
||||||
.read = dfs_9pfs_read,
|
.read = dfs_9pfs_read,
|
||||||
@@ -1162,8 +1169,7 @@ static int dfs_9pfs_rename(struct dfs_filesystem *fs,
|
|||||||
return p9_to_fs_err(rc);
|
return p9_to_fs_err(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dfs_filesystem_ops _9pfs =
|
static const struct dfs_filesystem_ops _9pfs = {
|
||||||
{
|
|
||||||
.name = "9p",
|
.name = "9p",
|
||||||
.flags = DFS_FS_FLAG_DEFAULT,
|
.flags = DFS_FS_FLAG_DEFAULT,
|
||||||
.fops = &_9pfs_fops,
|
.fops = &_9pfs_fops,
|
||||||
|
|||||||
Reference in New Issue
Block a user