changeset 149:654f2dadd744

add inode.h
author menikon
date Mon, 16 Dec 2019 15:45:51 +0900
parents 86cd551e5b38
children 124c59d99fc9
files src/CMakeLists.txt src/file.h src/fs.c src/gearsTools/lib/Gears/Context/Template/XV6.pm src/inode.h src/proc.h
diffstat 6 files changed, 35 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/CMakeLists.txt	Mon Dec 16 14:18:28 2019 +0900
+++ b/src/CMakeLists.txt	Mon Dec 16 15:45:51 2019 +0900
@@ -126,6 +126,8 @@
   SOURCES
 	string.c arm.c asm.S bio.c buddy.c console.cbc exec.c file.cbc fs.c log.c main.c memide.c pipe.cbc proc.cbc spinlock.cbc 
 	start.c swtch.S syscall.cbc sysfile.cbc sysproc.c trap_asm.S trap.c vm.c device/picirq.c device/timer.c device/uart.c 
-  SingleLinkedStack.cbc sys_read_impl.cbc
+  SingleLinkedStack.cbc sys_open_impl.cbc
          entry.S 
 )
+
+# sys_read_impl.cbc
\ No newline at end of file
--- a/src/file.h	Mon Dec 16 14:18:28 2019 +0900
+++ b/src/file.h	Mon Dec 16 15:45:51 2019 +0900
@@ -10,6 +10,8 @@
 } file;
 */
 // in-memory copy of an inode
+
+/*
 struct inode {
     uint    dev;        // Device number
     uint    inum;       // Inode number
@@ -23,9 +25,13 @@
     uint    size;
     uint    addrs[NDIRECT+1];
 };
+*/
+
 #define I_BUSY 0x1
 #define I_VALID 0x2
 
+
+
 // table mapping major device number to
 // device functions
 struct devsw {
--- a/src/fs.c	Mon Dec 16 14:18:28 2019 +0900
+++ b/src/fs.c	Mon Dec 16 15:45:51 2019 +0900
@@ -19,6 +19,7 @@
 #include "buf.h"
 #include "fs.h"
 #include "file.h"
+#include "context.h"
 
 #define min(a, b) ((a) < (b) ? (a) : (b))
 static void itrunc (struct inode*);
--- a/src/gearsTools/lib/Gears/Context/Template/XV6.pm	Mon Dec 16 14:18:28 2019 +0900
+++ b/src/gearsTools/lib/Gears/Context/Template/XV6.pm	Mon Dec 16 15:45:51 2019 +0900
@@ -109,8 +109,13 @@
 
 #define GearImpl(cbc_context, intf, name) (Gearef(cbc_context, intf)->name->intf.name)
 
+#ifndef CBC_XV6_CONTEXT
+
+
 #include "c/enumCode.h"
 
+#include "types.h"
+
 enum Relational {
     EQ,
     GT,
@@ -120,6 +125,7 @@
 #include "c/enumData.h"
 #define NDIRECT 12 //fs.h
 
+
 struct Context {
     enum Code next;
     struct Worker* worker;
@@ -169,6 +175,8 @@
     struct Context Context;
 }; // union Data end       this is necessary for context generator
 typedef union Data Data;
+#define CBC_XV6_CONTEXT
+#endif
 EOF
 }
 
@@ -176,6 +184,9 @@
 sub emit_last_header {
   my($class, $out) = @_;
   print $out <<'EOF';
+
+
+
 #include "c/typedefData.h"
 
 #include "c/extern.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/inode.h	Mon Dec 16 15:45:51 2019 +0900
@@ -0,0 +1,13 @@
+typedef struct inode <Impl> {
+    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;
--- a/src/proc.h	Mon Dec 16 14:18:28 2019 +0900
+++ b/src/proc.h	Mon Dec 16 15:45:51 2019 +0900
@@ -3,6 +3,7 @@
 #define PROC_INCLUDE_
 #include "context.h"
 
+
 // Per-CPU state, now we only support one CPU
 struct cpu {
     uchar           id;             // index into cpus[] below
@@ -20,7 +21,6 @@
 extern struct cpu cpus[NCPU];
 extern int ncpu;
 
-
 extern struct cpu* cpu;
 extern struct proc* proc;