comparison src/context.h @ 94:d876c9a65239 default tip

impl mac os target
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Wed, 23 Oct 2019 14:31:38 +0900
parents bc5bcfd2f6d6
children
comparison
equal deleted inserted replaced
93:7d0ec88cdd22 94:d876c9a65239
8 #include <driver_types.h> 8 #include <driver_types.h>
9 #include <cuda_runtime.h> 9 #include <cuda_runtime.h>
10 #include "helper_cuda.h" 10 #include "helper_cuda.h"
11 #endif 11 #endif
12 12
13 #include "types.h" 13 #ifndef NULL
14 #include "use_context_numbers.h" 14 # if defined __GNUG__ && \
15 #include "fs.h" 15 (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
16 #include "defs.h" 16 # define NULL (__null)
17 # else
18 # if !defined(__cplusplus)
19 # define NULL ((void*)0)
20 # else
21 # define NULL (0)
22 # endif
23 # endif
24 #endif
17 25
18 #ifdef XV6KERNEL 26 #ifdef XV6KERNEL
19 #define calloc(a,b) kmalloc((a)*(b)) 27 #define calloc(a,b) kmalloc((a)*(b))
20 #define free(a) kfree(a) 28 #define free(a) kfree(a)
21 #else 29 #else
461 volatile Int* lock; 469 volatile Int* lock;
462 struct Atomic* atomic; 470 struct Atomic* atomic;
463 struct Context* lockContext; 471 struct Context* lockContext;
464 } SpinLock; 472 } SpinLock;
465 /* CbCxv6 cbc_context*/ 473 /* CbCxv6 cbc_context*/
466 struct Inode {
467 uint dev; // Device number
468 uint inum; // Inode number
469 int ref; // Reference count
470 int flags; // I_BUSY, I_VALID
471
472 short type; // copy of disk inode
473 short major;
474 short minor;
475 short nlink;
476 uint size;
477 uint addrs[NDIRECT+1];
478 } Inode;
479 struct Uinteger { 474 struct Uinteger {
480 uint value; 475 unsigned int value;
481 } Uinteger; 476 } Uinteger;
482 struct Short { 477 struct Short {
483 short value; 478 short value;
484 } Short; 479 } Short;
485 struct String { 480 struct String {
486 char* string; 481 char* string;
487 } String; 482 } String;
488 // fs.h ---
489 struct SuperBlock {
490 uint size; // Size of file system image (blocks)
491 uint nblocks; // Number of data blocks
492 uint ninodes; // Number of inodes.
493 uint nlog; // Number of log blocks
494 } SuperBlock;
495 struct Dinode {
496 short type; // copy of disk inode
497 short major;
498 short minor;
499 short nlink;
500 uint size;
501 uint addrs[NDIRECT+1];
502 } Dinode;
503 struct Dirent {
504 ushort inum;
505 char name[DIRSIZ];
506 } Dirent;
507 // --- fs.h
508 }; // union Data end this is necessary for cbc_context generator 483 }; // union Data end this is necessary for cbc_context generator
509 484
510 typedef union Data Data; 485 typedef union Data Data;
511 486
512 #include "c/typedefData.h" 487 #include "c/typedefData.h"