mirror of
https://github.com/apache/nuttx.git
synced 2026-09-28 15:54:57 +08:00
v9fs:socket driver
Summary: 1.Add new api for socket parsing header - v9fs_parse_size 2.Add socket driver for 9pfs Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
@@ -27,5 +27,9 @@ if(CONFIG_FS_V9FS)
|
||||
list(APPEND V9FS virtio_9p.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_V9FS_SOCKET_9P)
|
||||
list(APPEND V9FS socket_9p.c)
|
||||
endif()
|
||||
|
||||
target_sources(fs PRIVATE ${V9FS})
|
||||
endif()
|
||||
|
||||
@@ -21,4 +21,9 @@ config V9FS_VIRTIO_9P
|
||||
depends on DRIVERS_VIRTIO
|
||||
default n
|
||||
|
||||
config V9FS_SOCKET_9P
|
||||
bool "Socket 9P support"
|
||||
depends on NET_TCP
|
||||
default n
|
||||
|
||||
endif
|
||||
|
||||
@@ -25,6 +25,10 @@ ifeq ($(CONFIG_FS_V9FS),y)
|
||||
|
||||
CSRCS += client.c transport.c v9fs.c
|
||||
|
||||
ifeq ($(CONFIG_V9FS_SOCKET_9P),y)
|
||||
CSRCS += socket_9p.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V9FS_VIRTIO_9P),y)
|
||||
CSRCS += virtio_9p.c
|
||||
endif
|
||||
|
||||
@@ -1811,3 +1811,13 @@ int v9fs_fid_get(FAR struct v9fs_client_s *client, uint32_t fid)
|
||||
nxmutex_unlock(&client->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* v9fs_parse_size
|
||||
****************************************************************************/
|
||||
|
||||
ssize_t v9fs_parse_size(FAR const void *buffer)
|
||||
{
|
||||
FAR const struct v9fs_header_s *ptr = buffer;
|
||||
return ptr->size;
|
||||
}
|
||||
|
||||
@@ -127,5 +127,6 @@ void v9fs_transport_destroy(FAR struct v9fs_transport_s *transport);
|
||||
void v9fs_transport_done(FAR struct v9fs_payload_s *cookie, int ret);
|
||||
int v9fs_fid_put(FAR struct v9fs_client_s *client, uint32_t fid);
|
||||
int v9fs_fid_get(FAR struct v9fs_client_s *client, uint32_t fid);
|
||||
ssize_t v9fs_parse_size(FAR const void *buffer);
|
||||
|
||||
#endif /* __FS_V9FS_CLIENT_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -45,11 +45,17 @@ struct v9fs_transport_ops_map_s
|
||||
#ifdef CONFIG_V9FS_VIRTIO_9P
|
||||
extern const struct v9fs_transport_ops_s g_virtio_9p_transport_ops;
|
||||
#endif
|
||||
#ifdef CONFIG_V9FS_SOCKET_9P
|
||||
extern const struct v9fs_transport_ops_s g_socket_9p_transport_ops;
|
||||
#endif
|
||||
|
||||
static const struct v9fs_transport_ops_map_s g_transport_ops_map[] =
|
||||
{
|
||||
#ifdef CONFIG_V9FS_VIRTIO_9P
|
||||
{ "virtio", &g_virtio_9p_transport_ops },
|
||||
#endif
|
||||
#ifdef CONFIG_V9FS_SOCKET_9P
|
||||
{ "socket", &g_socket_9p_transport_ops },
|
||||
#endif
|
||||
{ NULL, NULL},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user