changeset 51:fadfd62d6b14

define filesystem DataGeas and ommit stdlib.h
author anatofuz
date Tue, 28 May 2019 22:27:01 +0900
parents 3931ac87d850
children 214d21c891c7
files src/context.h src/use_context_numbers.h
diffstat 2 files changed, 49 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/context.h	Tue May 28 22:26:00 2019 +0900
+++ b/src/context.h	Tue May 28 22:27:01 2019 +0900
@@ -1,12 +1,8 @@
 /* Context definition for llrb example */
-#ifndef CONTEXT_H
+#ifdef CONTEXT_H
 #define CONTEXT_H
-#ifdef CBCXV6
-
-#else
 #include <stdlib.h>
 #include <pthread.h>
-#endif
 #ifdef USE_CUDAWorker
 #include <cuda.h>
 #include <driver_types.h>
@@ -14,6 +10,8 @@
 #include "helper_cuda.h"
 #endif
 
+#include "use_context_numbers.h"
+
 #define ALLOCATE_SIZE 20000000
 #define NEW(type) (type*)(calloc(1, sizeof(type)))
 #define NEWN(n, type) (type*)(calloc(n, sizeof(type)))
@@ -93,6 +91,7 @@
 };
 
 #include "c/enumData.h"
+#define NDIRECT 12 //fs.h
 
 struct Context {
     enum Code next;
@@ -440,7 +439,51 @@
         struct Atomic* atomic;
         struct Context* lockContext;
     } SpinLock;
+    /* CbCxv6 context*/
+    struct Inode {
+      uint    dev;        // Device number
+      uint    inum;       // Inode number
+      int     ref;        // Reference count
+      int     flags;      // I_BUSY, I_VALID
+
+      short   type;       // copy of disk inode
+      short   major;
+      short   minor;
+      short   nlink;
+      uint    size;
+      uint    addrs[NDIRECT+1];       
+    } Inode;
+    struct Uinteger {
+        uint value;
+    } Uinteger;
+    struct Short {
+       short value;
+    } Short;
+    struct String {
+      char* string;
+    } String;
+    // fs.h ---
+    struct SuperBlock {
+      uint    size;           // Size of file system image (blocks)
+      uint    nblocks;        // Number of data blocks
+      uint    ninodes;        // Number of inodes.
+      uint    nlog;           // Number of log blocks
+    } SuperBlock;
+    struct Dinode {
+      short   type;       // copy of disk inode
+      short   major;
+      short   minor;
+      short   nlink;
+      uint    size;
+      uint    addrs[NDIRECT+1];       
+    } Dinode;
+    struct Dirent {
+      ushort inum;
+      char   name[DIRSIZ];
+    } Dirent;
+    // --- fs.h
 }; // union Data end       this is necessary for context generator
+
 typedef union Data Data;
 
 #include "c/typedefData.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/use_context_numbers.h	Tue May 28 22:27:01 2019 +0900
@@ -0,0 +1,1 @@
+#define NDIRECT 12