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

Re: [Minios-devel] [UNIKRAFT PATCH v4 10/22] lib/vfscore: add utility funcs&defs to support imported



Hello Yuri,

This patch seems fine.

Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>

There are some of checkpatch warning/error. Please find them inline. We can fix them while upstreaming

Thanks & Regards
Sharan

On 2/18/19 3:54 PM, Yuri Volchkov wrote:
Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
  lib/vfscore/include/vfscore/file.h  |  2 ++
  lib/vfscore/include/vfscore/fs.h    | 28 ++++++++++++++++++++++++
  lib/vfscore/include/vfscore/vnode.h | 21 ++++++++++++++++++
  lib/vfscore/main.c                  | 33 +++++++++++++++++++++++++++++
  lib/vfscore/mount.c                 | 14 ++++++++++++
  lib/vfscore/vfs.h                   |  9 ++++++++
  lib/vfscore/vnode.c                 |  2 ++
  7 files changed, 109 insertions(+)
  create mode 100644 lib/vfscore/include/vfscore/fs.h

diff --git a/lib/vfscore/include/vfscore/file.h 
b/lib/vfscore/include/vfscore/file.h
index 9985706f..3d8d667f 100644
--- a/lib/vfscore/include/vfscore/file.h
+++ b/lib/vfscore/include/vfscore/file.h
@@ -61,6 +61,8 @@ void vfscore_put_fd(int fd);
  void vfscore_install_fd(int fd, struct vfscore_file *file);
  struct vfscore_file *vfscore_get_file(int fd);
+#define FOF_OFFSET 0x0800 /* Use the offset in uio argument */
+
  #ifdef __cplusplus
  }
  #endif
diff --git a/lib/vfscore/include/vfscore/fs.h b/lib/vfscore/include/vfscore/fs.h
new file mode 100644
index 00000000..1bb4e24d
--- /dev/null
+++ b/lib/vfscore/include/vfscore/fs.h
@@ -0,0 +1,28 @@
+#ifndef _VFSCORE_FS_H_
+#define _VFSCORE_FS_H_
+
+#include <fcntl.h>
+/*
+ * Kernel encoding of open mode; separate read and write bits that are
+ * independently testable: 1 greater than the above.
+ */
+#define FREAD           0x00000001
+#define FWRITE          0x00000002
+
+#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
+


WARNING: please, no spaces at the start of a line
#43: FILE: lib/vfscore/include/vfscore/fs.h:16:
+    int rw = oflags & O_ACCMODE;$
+static inline int vfscore_fflags(int oflags)
+{
+    int rw = oflags & O_ACCMODE;
+    oflags &= ~O_ACCMODE;
+    return (rw + 1) | oflags;
+}
+
+static inline int vfscore_oflags(int fflags)
+{
+    int rw = fflags & (FREAD|FWRITE);
+    fflags &= ~(FREAD|FWRITE);
+    return (rw - 1) | fflags;
+}
+
+#endif /* _VFSCORE_FS_H_ */
diff --git a/lib/vfscore/include/vfscore/vnode.h 
b/lib/vfscore/include/vfscore/vnode.h
index a4db9c13..4155a7db 100644
--- a/lib/vfscore/include/vfscore/vnode.h
+++ b/lib/vfscore/include/vfscore/vnode.h
@@ -108,6 +108,27 @@ struct vattr {
        off_t           va_size;
  };
+/* struct vattr is used to consolidate multiple types of file
+ * attributes for passing them as function parameters. Macros bellow
+ * are selectors, of what types of attributes are valid in particular
+ * struct vattr*/
+#define        AT_TYPE         0x00001
+#define        AT_MODE         0x00002
+#define        AT_UID          0x00004
+#define        AT_GID          0x00008
+#define        AT_FSID         0x00010
+#define        AT_NODEID       0x00020
+#define        AT_NLINK        0x00040
+#define        AT_SIZE         0x00080
+#define        AT_ATIME        0x00100
+#define        AT_MTIME        0x00200
+#define        AT_CTIME        0x00400
+#define        AT_RDEV         0x00800
+#define        AT_BLKSIZE      0x01000
+#define        AT_NBLOCKS      0x02000
+#define        AT_SEQ          0x08000
+#define        AT_XVATTR       0x10000
+
  /*
   *  Modes.
   */
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 82e45917..1164b30b 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -52,8 +52,41 @@
  int   vfs_debug = VFSDB_FLAGS;
  #endif
+/* This macro is for defining an alias of the 64bit version of a
+ * syscall to the regular one. It seams we can make the logic which is
+ * choosing the right call simpler then in common libc.
+ *
+ * Let's keep LFS64 calls just in case in future we will find out that
+ * these aliases are need.
+ */
+#define LFS64(x)
+
  static mode_t global_umask = S_IWGRP | S_IWOTH;
+/* TODO: these macro does not belong here
+ * NOTE: borrowed from OSv
+ */
+#define DO_ONCE(thing) do {                            \
+       static int _x;                                  \
+       if (!_x) {                                      \
+           _x = 1;                                     \
+           thing ;                                     \
+       }                                               \
+} while (0)
+#define WARN_STUBBED() DO_ONCE(uk_pr_warn("%s() stubbed\n", __func__))
+

WARNING: please, no spaces at the start of a line
#121: FILE: lib/vfscore/main.c:80:
+#define NO_SYS(decl) decl {                            \
+    DO_ONCE(uk_pr_warn("%s not implemented\n", __func__));   \
+    errno = ENOSYS;                                    \
+    return -1;                                         \
+}
+
+static inline int libc_error(int err)
+{
+    errno = err;
+    return -1;
+}
+
  static inline mode_t apply_umask(mode_t mode)
  {
        return mode & ~ukarch_load_n(&global_umask);
diff --git a/lib/vfscore/mount.c b/lib/vfscore/mount.c
index fad47026..71c876d2 100644
--- a/lib/vfscore/mount.c
+++ b/lib/vfscore/mount.c
@@ -79,6 +79,20 @@ fs_getfs(const char *name)
        return fs;
  }
+int device_open(const char *name __unused, int mode __unused,
+               struct device **devp __unused)
+{
+       UK_CRASH("%s is not implemented (%s)\n", __func__, name);
+       return 0;
+}
+
+int device_close(struct device *dev)
+{
+       (void) dev;
+       UK_CRASH("%s not implemented", __func__);
+       return 0;
+}
+
  int
  sys_mount(const char *dev, const char *dir, const char *fsname, int flags, 
const void *data)
  {
diff --git a/lib/vfscore/vfs.h b/lib/vfscore/vfs.h
index 19f8ac87..609dc1f5 100644
--- a/lib/vfscore/vfs.h
+++ b/lib/vfscore/vfs.h
@@ -151,4 +151,13 @@ void        vnode_dump(void);
  void   mount_dump(void);
  #endif
+static void __attribute__((unused)) uk_vfscore_trace(int foo __unused, ...)
+{
+}
+

ERROR: space prohibited before that close parenthesis ')'
#172: FILE: lib/vfscore/vfs.h:159:
+ static void trace_name(__VA_ARGS__ ) __attribute__((unused, alias("uk_vfscore_trace")))
+#define TRACEPOINT(trace_name, fmt, ...)                       \
+       static void trace_name(__VA_ARGS__ ) __attribute__((unused, 
alias("uk_vfscore_trace")))
+
+
+
  #endif /* !_VFS_H */
diff --git a/lib/vfscore/vnode.c b/lib/vfscore/vnode.c
index a2f45596..86e6d9c7 100644
--- a/lib/vfscore/vnode.c
+++ b/lib/vfscore/vnode.c
@@ -48,6 +48,8 @@
  #include <vfscore/vnode.h>
  #include "vfs.h"
+#define S_BLKSIZE 512
+
  enum vtype iftovt_tab[16] = {
        VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
        VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VBAD,


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