[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 2/7] lib/9pfs: Add 9pfs header


  • To: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Sat, 7 Sep 2019 09:59:53 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hk9e/P8wTAUJFojTZk+kGbUszgD00CWn0oDLxu/xysM=; b=EvzLh1Q0WlsVH8HAerQcysBvWeR8KhGkzlklLxn5V3dCYPNUn0T7a2gZzT2icuWF9MWSeMMzERlFYgAlehyimlvrl/ksrilC9EhiuzOjT0AwqLK8CjBl5IMt+6wudq3OjAtHaVcx7BL+vaIP8VCCN0CSh086udXRDXCaviUa8wbiqzE0oznMbaK/XLGBTzUJrGVlNqoiZJAYaB1Apenhh2WhPWbJPp8siKGkPv+Dmk254ZWQ4Afc3+/K2eBOACkygihjDayF+XHxp5XnVfySR4FGdga/qiByZ6+7TIoO4BV8iaOl/5vb7yirVDj4vqWCOfGJXqNtso7x2GYRFHujFQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ob/w5qeArIXfqpZFoGrX2D0I6G5LgAUqpQmSYwHlJQdISUSDguAylRTP4lNr3y9pAsx3ZNXrhJ4/8cmsNWStY3bCahgruXMUbz4hiurRFSy5TWJqrPT8OVWwfbf1ABUQd2FDF/8S4AJ3e5G5Srerg+LSGaK0SRUT59RN3BxtHl4TpczBU1AabXXnyMNv5R9clQ9grkXSzG5JhizpmOGSN40K7Php9AFqVZ0W9Ilyk4UjlcfmnxBQOvsG4CGWINUQFr2RJh3CBfUldXaTHeDQuNSTiczANY5Q2qXiDI65bVHI13nkLTrVF1W2FSbDpaPcyZQ7r5+PJK/Y20apwifA1Q==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Cc: "costin.lupu@xxxxxxxxx" <costin.lupu@xxxxxxxxx>, Cristian Banu <cristb@xxxxxxxxx>
  • Delivery-date: Sat, 07 Sep 2019 10:00:07 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVZWL//PnmkZZ/3keYbCvKtXkoHg==
  • Thread-topic: [UNIKRAFT PATCH 2/7] lib/9pfs: Add 9pfs header

From: Cristian Banu <cristb@xxxxxxxxx>

This patch adds the 9pfs header which contains the data structures
used by the file system and helper macros for accessing them from
VFS structures.

Signed-off-by: Cristian Banu <cristb@xxxxxxxxx>
---
 lib/9pfs/9pfs.h | 102 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 lib/9pfs/9pfs.h

diff --git a/lib/9pfs/9pfs.h b/lib/9pfs/9pfs.h
new file mode 100644
index 00000000..3571c857
--- /dev/null
+++ b/lib/9pfs/9pfs.h
@@ -0,0 +1,102 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Cristian Banu <cristb@xxxxxxxxx>
+ *
+ * Copyright (c) 2019, University Politehnica of Bucharest. All rights 
reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#ifndef __UK_9PFS__
+#define __UK_9PFS__
+
+#include <stdbool.h>
+#include <uk/9pdev.h>
+#include <uk/9pfid.h>
+
+#include <vfscore/prex.h>
+
+/*
+ * Currently supports only the 9P2000.u variant of the protocol.
+ */
+enum uk_9pfs_proto {
+       UK_9P_PROTO_2000U,
+       UK_9P_PROTO_MAX
+};
+
+struct uk_9pfs_mount_data {
+       /* 9P device. */
+       struct uk_9pdev         *dev;
+       /* Wanted transport. */
+       struct uk_9pdev_trans   *trans;
+       /* Protocol version used. */
+       enum uk_9pfs_proto      proto;
+       /* Username to attempt to mount as on the remote server. */
+       const char              *uname;
+       /* File tree to access when offered multiple exported filesystems. */
+       const char              *aname;
+};
+
+struct uk_9pfs_file_data {
+       /* Fid associated with the 9pfs file. */
+       struct uk_9pfid        *fid;
+       /*
+        * Buffer for persisting results from a 9P read operation across
+        * readdir() calls.
+        */
+       char                   *readdir_buf;
+       /*
+        * Offset within the buffer where the stat of the next child can
+        * be found.
+        */
+       int                    readdir_off;
+       /* Total size of the data in the readdir buf. */
+       int                    readdir_sz;
+};
+
+struct uk_9pfs_node_data {
+       /* Fid associated with the vfs node. */
+       struct uk_9pfid        *fid;
+       /* Number of files opened from the vfs node. */
+       int                    nb_open_files;
+       /* Is a 9P remove call required when nb_open_files reaches 0? */
+       bool                   removed;
+};
+
+int uk_9pfs_allocate_vnode_data(struct vnode *vp, struct uk_9pfid *fid);
+void uk_9pfs_free_vnode_data(struct vnode *vp);
+
+/* Default readdir buffer size. */
+#define UK_9PFS_READDIR_BUFSZ  8192
+
+#define UK_9PFS_FD(file) ((struct uk_9pfs_file_data *) (file)->f_data)
+#define UK_9PFS_ND(vnode) ((struct uk_9pfs_node_data *) (vnode)->v_data)
+#define UK_9PFS_VFID(vnode) (UK_9PFS_ND(vnode)->fid)
+#define UK_9PFS_MD(mount) ((struct uk_9pfs_mount_data *) (mount)->m_data)
+
+#endif /* __UK_9PFS__ */
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.