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

Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH v2 1/2] update newlib glue for use with vfscore



Looking good.

Reviewed-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>

On 3/5/19 7:29 PM, Yuri Volchkov wrote:
Consists of multiple fixes:
   - remove stubs of the functions provided by vfscore
   - import mount.h, statfs.h, uio.h from nolibc (minimal changes)
   - add stub for sigfillset

Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
  file.c               |  37 ---------------
  include/sys/mount.h  | 109 +++++++++++++++++++++++++++++++++++++++++++
  include/sys/statfs.h |  36 ++++++++++++++
  include/sys/uio.h    |  62 ++++++++++++++++++++++++
  plat.c               |   6 +++
  5 files changed, 213 insertions(+), 37 deletions(-)
  create mode 100644 include/sys/mount.h
  create mode 100644 include/sys/statfs.h
  create mode 100644 include/sys/uio.h

diff --git a/file.c b/file.c
index 9fd7809..05d29b5 100644
--- a/file.c
+++ b/file.c
@@ -45,49 +45,17 @@ extern int errno;
  #define STDOUT_FILENO   1       /* standard output file descriptor */
  #define STDERR_FILENO   2       /* standard error file descriptor */
-int open(const char *name __unused, int flags __unused, int mode __unused)
-{
-       return -1;
-}
-
-int fstat(int file __unused, struct stat *st)
-{
-       st->st_mode = S_IFCHR;
-       return 0;
-}
-
-int stat(const char *path __unused, struct stat *buf __unused)
-{
-       return -1;
-}
-
-int mkdir(const char *_path __unused, mode_t __mode __unused)
-{
-       return -1;
-}
-
  int link(char *old __unused, char *new __unused)
  {
        errno = EMLINK;
        return -1;
  }
-int unlink(char *name __unused)
-{
-       errno = ENOENT;
-       return -1;
-}
-
  int lseek(int file __unused, int ptr __unused, int dir __unused)
  {
        return 0;
  }
-int chmod(const char *pathname __unused, mode_t mode __unused)
-{
-       return 0;
-}
-
  int access(const char *path __unused, int amode __unused)
  {
        return 0;
@@ -138,11 +106,6 @@ long pathconf(const char *path __unused, int name __unused)
        return 0;
  }
-int dup2(int oldfd __unused, int newfd __unused)
-{
-       return 0;
-}
-
  #include <sys/mman.h>
  void *mmap(void *addr __unused, size_t len __unused, int prot __unused,
                int flags __unused, int fildes __unused, off_t off __unused)
diff --git a/include/sys/mount.h b/include/sys/mount.h
new file mode 100644
index 0000000..d7a95b3
--- /dev/null
+++ b/include/sys/mount.h
@@ -0,0 +1,109 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright (C) 2013 Cloudius Systems, Ltd.
+ * Copyright (c) 2019, NEC Europe Ltd., NEC Corporation.
+ *
+ * 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 _SYS_MOUNT_H
+#define _SYS_MOUNT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define BLKROSET      _IO(0x12,  93)
+#define BLKROGET      _IO(0x12,  94)
+#define BLKRRPART     _IO(0x12,  95)
+#define BLKGETSIZE    _IO(0x12,  96)
+#define BLKFLSBUF     _IO(0x12,  97)
+#define BLKRASET      _IO(0x12,  98)
+#define BLKRAGET      _IO(0x12,  99)
+#define BLKFRASET     _IO(0x12, 100)
+#define BLKFRAGET     _IO(0x12, 101)
+#define BLKSECTSET    _IO(0x12, 102)
+#define BLKSECTGET    _IO(0x12, 103)
+#define BLKSSZGET     _IO(0x12, 104)
+#define BLKBSZGET    _IOR(0x12, 112, size_t)
+#define BLKBSZSET    _IOW(0x12, 113, size_t)
+#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
+
+#define MS_RDONLY      1
+#define MS_NOSUID      2
+#define MS_NODEV       4
+#define MS_NOEXEC      8
+#define MS_SYNCHRONOUS 16
+#define MS_REMOUNT     32
+#define MS_MANDLOCK    64
+#define MS_DIRSYNC     128
+#define MS_NOATIME     1024
+#define MS_NODIRATIME  2048
+#define MS_BIND        4096
+#define MS_MOVE        8192
+#define MS_REC         16384
+#define MS_SILENT      32768
+#define MS_POSIXACL    (1<<16)
+#define MS_UNBINDABLE  (1<<17)
+#define MS_PRIVATE     (1<<18)
+#define MS_SLAVE       (1<<19)
+#define MS_SHARED      (1<<20)
+#define MS_RELATIME    (1<<21)
+#define MS_KERNMOUNT   (1<<22)
+#define MS_I_VERSION   (1<<23)
+#define MS_STRICTATIME (1<<24)
+#define MS_LAZYTIME    (1<<25)
+#define MS_NOREMOTELOCK (1<<27)
+#define MS_NOSEC       (1<<28)
+#define MS_BORN        (1<<29)
+#define MS_ACTIVE      (1<<30)
+#define MS_NOUSER      (1U<<31)
+
+#define MS_RMT_MASK 
(MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME)
+
+#define MS_MGC_VAL 0xc0ed0000
+#define MS_MGC_MSK 0xffff0000
+
+#define MNT_FORCE       1
+#define MNT_DETACH      2
+#define MNT_EXPIRE      4
+#define UMOUNT_NOFOLLOW 8
+
+int mount(const char *dev, const char *dir, const char *fsname,
+         unsigned long flags, const void *data);
+int umount(const char *path);
+int umount2(const char *path, int flags);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
new file mode 100644
index 0000000..59de629
--- /dev/null
+++ b/include/sys/statfs.h
@@ -0,0 +1,36 @@
+#ifndef        _SYS_STATFS_H
+#define        _SYS_STATFS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/statvfs.h>
+
+typedef struct __fsid_t {
+       int __val[2];
+} fsid_t;
+
+struct statfs {
+       unsigned long f_type, f_bsize;
+       fsblkcnt_t f_blocks, f_bfree, f_bavail;
+       fsfilcnt_t f_files, f_ffree;
+       fsid_t f_fsid;
+       unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
+};
+
+int statfs(const char *path, struct statfs *buf);
+int fstatfs(int fd, struct statfs *buf);
+
+#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
+#define statfs64 statfs
+#define fstatfs64 fstatfs
+#define fsblkcnt64_t fsblkcnt_t
+#define fsfilcnt64_t fsfilcnt_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/sys/uio.h b/include/sys/uio.h
new file mode 100644
index 0000000..b83642e
--- /dev/null
+++ b/include/sys/uio.h
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Copyright (C) 2013 Cloudius Systems, Ltd.
+ * Copyright (c) 2019, NEC Europe Ltd., NEC Corporation.
+ *
+ * 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 _SYS_UIO_H
+#define _SYS_UIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UIO_MAXIOV 1024
+
+ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
+ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset);
+ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset);
+#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
+#define preadv64 preadv
+#define pwritev64 pwritev
+#define off64_t off_t
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/plat.c b/plat.c
index df07dce..f678694 100644
--- a/plat.c
+++ b/plat.c
@@ -55,6 +55,12 @@ int sigprocmask(int how __unused, const sigset_t *set 
__unused,
        return -1;
  }
+int sigfillset(sigset_t *set __unused)
+{
+       errno = ENOTSUP;
+       return -1;
+}
+
  #include <uk/plat/bootstrap.h>
void abort(void)


--
Dr. Florian Schmidt
フローリアン・シュミット
Research Scientist,
Systems and Machine Learning Group
NEC Laboratories Europe
Kurfürsten-Anlage 36, D-69115 Heidelberg
Tel.     +49 (0)6221 4342-265
Fax:     +49 (0)6221 4342-155
e-mail:  florian.schmidt@xxxxxxxxx
============================================================
Registered at Amtsgericht Mannheim, Germany, HRB728558

_______________________________________________
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®.