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:
chenrun1
2025-01-20 17:12:14 +08:00
committed by Xiang Xiao
parent 5f77da4c51
commit 4d17c353dd
7 changed files with 259 additions and 0 deletions
+4
View File
@@ -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()
+5
View File
@@ -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
+4
View File
@@ -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
+10
View File
@@ -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;
}
+1
View File
@@ -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 */
+229
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -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},
};