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

[Minios-devel,v2,1/4] Define struct k_stat in a header file and modify mode_t to k_mode_t as convention



I made a header file stat.h in which I defined the structure k_stat and
include this file in syscall.h.

Signed-off-by: gabrielmocanu <gabi.mocanu98@xxxxxxxxx>
---
 plat/linuxu/include/linuxu/mode.h    |  8 ++++++
 plat/linuxu/include/linuxu/stat.h    | 39 ++++++++++++++++++++++++++++
 plat/linuxu/include/linuxu/syscall.h |  9 +++++--
 3 files changed, 54 insertions(+), 2 deletions(-)
 create mode 100644 plat/linuxu/include/linuxu/mode.h
 create mode 100644 plat/linuxu/include/linuxu/stat.h

diff --git a/plat/linuxu/include/linuxu/mode.h 
b/plat/linuxu/include/linuxu/mode.h
new file mode 100644
index 0000000..ac2f40e
--- /dev/null
+++ b/plat/linuxu/include/linuxu/mode.h
@@ -0,0 +1,8 @@
+#ifndef __LINUXU_MODE_H__
+#define __LINUXU_MODE_H__
+
+#define K_O_RDONLY 0x0000
+
+typedef unsigned k_mode_t;
+
+#endif /* __LINUXU_MODE_H__ */
diff --git a/plat/linuxu/include/linuxu/stat.h 
b/plat/linuxu/include/linuxu/stat.h
new file mode 100644
index 0000000..d500b0a
--- /dev/null
+++ b/plat/linuxu/include/linuxu/stat.h
@@ -0,0 +1,39 @@
+#ifndef __LINUXU_STAT_H__
+#define __LINUXU_STAT_H__
+
+#include <linuxu/time.h>
+#include <linuxu/mode.h>
+
+typedef __u64 k_dev_t;
+typedef __u64 k_ino_t;
+typedef __u32 k_nlink_t;
+typedef unsigned k_uid_t;
+typedef unsigned k_gid_t;
+typedef unsigned k_id_t;
+typedef __off k_off_t;
+typedef long k_blksize_t;
+typedef __s64 k_blkcnt_t;
+
+
+struct k_stat {
+  
+  k_dev_t st_dev;
+  k_ino_t st_ino;
+  k_nlink_t st_nlink;
+
+  k_mode_t st_mode;
+  k_uid_t st_uit;
+  k_gid_t st_gid;
+  unsigned int __pad0;
+  k_dev_t st_rdev;
+  k_off_t st_size;
+  k_blksize_t st_blksize;
+  k_blkcnt_t st_blocks;
+
+  struct k_timespec st_atim;
+  struct k_timespec st_mtim;
+  struct k_timespec st_ctim;
+
+};
+
+#endif /* __LINUXU_STAT_H__ */
diff --git a/plat/linuxu/include/linuxu/syscall.h 
b/plat/linuxu/include/linuxu/syscall.h
index c703b32..1b590b1 100644
--- a/plat/linuxu/include/linuxu/syscall.h
+++ b/plat/linuxu/include/linuxu/syscall.h
@@ -39,6 +39,7 @@
 #include <linuxu/time.h>
 #include <sys/types.h>
 #include <linuxu/signal.h>
+#include <linuxu/stat.h>
 
 #if defined __X86_64__
 #include <linuxu/syscall-x86_64.h>
@@ -71,9 +72,13 @@ static inline ssize_t sys_write(int fd, const char *buf, 
size_t len)
                                  (long) (len));
 }
 
-struct stat;
+static inline ssize_t sys_close(int fd)
+{
+  return (ssize_t) syscall1(__SC_CLOSE,
+          (long) (fd));
+}
 
-static inline int sys_fstat(int fd, struct stat *statbuf)
+static inline int sys_fstat(int fd, struct k_stat *statbuf)
 {
        return (int)syscall2(__SC_FSTAT, (long)(fd), (long)(statbuf));
 }
-- 
2.17.1




 


Rackspace

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