#ifndef VPI_H #define VPI_H #include #include "bool.h" #include "vars.h" #include #define MOUNT_NAMESIZE 20 #define DEFAULT_NUM_VPIS 10 #define DEFAULT_VPI_MODE 0x81f8 //file, mode: 770 #define DEFAULT_ROOT_VPI "/mnt/ramdisk" #define DEFAULT_FS_SIZE 100000000 #define DEFAULT_ROOT_MODE 0x41fd //directory, mode: 775 #define DEFAULT_ROOT_SIZE 1024 #define DEFAULT_FSID 256 extern char * default_root; //NFS ACCESS Bits #define ACCESS_READ 0x0001; //Read data from file or read a directory. #define ACCESS_LOOKUP 0x0002; //Look up a name in a directory (no meaning for non-directory objects). #define ACCESS_MODIFY 0x0004; //Rewrite existing file data or modify existing directory entries. #define ACCESS_EXTEND 0x0008; //Write new data or add directory Entries. #define ACCESS_DELETE 0x0010; //Delete an existing directory entry. #define ACCESS_EXECUTE 0x0020; //Execute file (no meaning for a directory). //File STAT constants #define NFS3_ATTR_FOLLOW 1 #define NFS3_REG_FILE 1 #define NFS3_DIRECTORY 2 #define NFS3_FILE_SYNC 2 extern list_head vpis; extern u64 total_vpis; extern u64 total_bytes; extern kmem_cache_t * vcache; typedef struct stat3 { ulong type, mode, nlinks, uid, gid; u64 size, used, rdev, fsid, vpid, atime, mtime, ctime; } stat3; typedef struct VPI { struct list_head list; ulong id, //same as the inode # of the mountpoint readcount, writecount; ulong size; //size of the VPI bool growable; //size of the VPI can change or not (grow) ulong nfs_access; u64 eof; //which offset contains the last block u64 eof_size; //how big is it stat3 attr; char name[MOUNT_NAMESIZE]; int namesize; } VPI; typedef struct handle3 { ulong vpid; } handle3; #define NFS3_HANDLE_SIZE sizeof(handle3) VPI * get_VPI(ulong); void add_VPI(char *, u64, bool, ulong, bool); void reset_VPI(VPI *); #endif