crafcat7 commented on code in PR #15597:
URL: https://github.com/apache/nuttx/pull/15597#discussion_r1921103487


##########
fs/v9fs/socket_9p.c:
##########
@@ -0,0 +1,228 @@
+/****************************************************************************
+ * fs/v9fs/socket_9p.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/param.h>
+#include <nuttx/kmalloc.h>
+#include <arpa/inet.h>
+#include <nuttx/net/net.h>
+#include <nuttx/fs/fs.h>
+
+#include "client.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define V9FS_HEADER_OFFSET 7
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct socket_9p_priv_s
+{
+  struct v9fs_transport_s transport;
+  struct socket psock;
+  mutex_t lock;
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int socket_9p_create(FAR struct v9fs_transport_s **transport,
+                            FAR const char *args);
+static int socket_9p_request(FAR struct v9fs_transport_s *transport,
+                             FAR struct v9fs_payload_s *payload);
+static void socket_9p_destroy(FAR struct v9fs_transport_s *transport);
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+const struct v9fs_transport_ops_s g_socket_9p_transport_ops =
+{
+  socket_9p_create,  /* create */
+  socket_9p_request, /* request */
+  socket_9p_destroy, /* close */
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: socket_9p_create
+ ****************************************************************************/
+
+static int socket_9p_create(FAR struct v9fs_transport_s **transport,
+                            FAR const char *args)
+{
+  FAR struct socket_9p_priv_s *priv;
+  struct sockaddr_in sin;
+  FAR const char *port;
+  FAR const char *addr;
+  int ret;
+
+  /* Parse IP and port */
+
+  addr = strstr(args, "tag=");
+  if (addr == NULL)
+    {
+      return -EINVAL;
+    }
+
+  addr += 4;
+  port = strchr(addr, ':');
+  if (port == NULL)
+    {
+      /* set default port */
+
+      port = ":563";

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to