Changeset 853
- Timestamp:
- 08/21/08 21:46:06 (3 years ago)
- Location:
- Whitix/trunk/include/fs
- Files:
-
- 3 added
- 4 modified
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
Whitix/trunk/include/fs/bcache.h
r670 r853 25 25 #define VFS_BCACHE_H 26 26 27 #include <sdevice.h> 28 #include <wait.h> 29 27 30 /* Buffer flags. Bit index into buffer->flags. */ 28 31 #define BUFFER_DIRTY 0x0 29 32 #define BUFFER_LOCKED 0x1 33 #define BUFFER_JOURNAL 0x2 30 34 31 35 /* Defines for dealing with flags. */ 32 36 #define BufferLocked(buffer) ((buffer)->flags & (1 << BUFFER_LOCKED)) 33 37 #define BufferDirty(buffer) ((buffer)->flags & (1 << BUFFER_DIRTY)) 38 #define BufferJournal(buffer) ((buffer)->flags & (1 << BUFFER_JOURNAL)) 34 39 35 40 /* Reference counting. Blocks are only freed if there are no references … … 53 58 BYTE* data; 54 59 WaitQueue waitQueue; 60 void* privData; 55 61 }; 56 62 … … 58 64 59 65 int BlockInit(); 66 struct Buffer* BlockBufferAlloc(struct StorageDevice* device, DWORD blockNum); 60 67 struct Buffer* BlockRead(struct StorageDevice* device,DWORD blockNum); 61 68 int BlockWrite(struct StorageDevice* device,struct Buffer* buffer); … … 64 71 int BlockFree(struct Buffer* buffer); 65 72 int BlockSetSize(struct StorageDevice* device,int blockSize); 73 int BlockCreateHashTable(struct StorageDevice* dev); 66 74 67 75 /* Buffer locking */ -
Whitix/trunk/include/fs/devfs.h
r670 r853 20 20 #define DEVFS_H 21 21 22 #include <fs/kfs.h> 22 23 #include <fs/vfs.h> 23 24 #include <llist.h> … … 35 36 }; 36 37 37 /* Structures */38 struct DevFsDir39 {40 struct ListHead entries; /* All DevFsEntrys */41 struct DevFsDir* parent;42 };43 44 struct DevFsEntry45 {46 struct ListHead next;47 int type;48 union {49 struct DevFsDir dir;50 struct DevFsDevice device;51 };52 char name[1];53 };54 55 38 struct StorageDevice; 56 39 … … 60 43 static inline void* DeviceGetOps(struct VNode* devNode) 61 44 { 62 struct DevFsEntry* entry=(struct DevFsEntry*)(devNode->extraInfo); 45 struct KeFsEntry* entry=(struct KeFsEntry*)(devNode->id); 46 struct DevFsDevice* device; 63 47 64 48 /* DevFs directories don't have specific operations. */ … … 66 50 return NULL; 67 51 68 return (void*)(entry->device.ops); 52 device=(struct DevFsDevice*)entry->file; 53 54 return device->ops; 69 55 } 70 56 -
Whitix/trunk/include/fs/super.h
r670 r853 28 28 #include <typedefs.h> 29 29 30 struct SuperBlockOps 31 { 32 /* General vNode functions */ 33 int (*allocVNode)(struct VNode* vNode); 34 int (*freeVNode)(struct VNode* vNode); 35 int (*readVNode)(struct VNode* vNode); 36 int (*readVNodeWithData)(struct VNode* vNode, void* data); 37 int (*writeVNode)(struct VNode* vNode); 38 39 /* General superblock functions */ 40 int (*writeSuper)(struct VfsSuperBlock* superBlock); 41 }; 30 struct VNode; 42 31 43 32 struct VfsSuperBlock … … 52 41 struct ListHead vNodeList,sbList; 53 42 Spinlock nodeListLock; 43 }; 44 45 struct SuperBlockOps 46 { 47 /* General vNode functions */ 48 int (*allocVNode)(struct VNode* vNode); 49 int (*freeVNode)(struct VNode* vNode); 50 int (*readVNode)(struct VNode* vNode); 51 int (*readVNodeWithData)(struct VNode* vNode, void* data); 52 int (*writeVNode)(struct VNode* vNode); 53 int (*dirtyVNode)(struct VNode* vNode); 54 55 /* General superblock functions */ 56 int (*writeSuper)(struct VfsSuperBlock* superBlock); 57 int (*freeSuper)(struct VfsSuperBlock* superBlock); 54 58 }; 55 59 -
Whitix/trunk/include/fs/vfs.h
r670 r853 31 31 #include <wait.h> 32 32 33 /* Include all virtual filesystem headers, so we don't repeat ourselves in source files. */ 34 #include <fs/super.h> 35 #include <fs/bcache.h> 33 36 #include <fs/exports.h> 34 37 … … 149 152 }; 150 153 151 #define SetVNodeDirty(vNode) (((vNode)->flags) |= VNODE_DIRTY) 154 static inline void SetVNodeDirty(struct VNode* vNode) 155 { 156 vNode->flags |= VNODE_DIRTY; 157 if (vNode->superBlock && vNode->superBlock->sbOps->dirtyVNode) 158 vNode->superBlock->sbOps->dirtyVNode(vNode); 159 } 152 160 153 161 /* FILE … … 183 191 int FillDir(void* dirEntry,char* name,int nameLen,DWORD vNodeNum); 184 192 193 /* Flags to pass to block map */ 194 #define VFS_MAP_CREATE 0x1 195 185 196 struct VNodeOps 186 197 { … … 191 202 int (*rmDir)(struct VNode* dir,char* name,int nameLength); 192 203 int (*permission)(struct VNode* vNode,int access); 193 int (*blockMap)(struct VNode* vNode, DWORD offset );204 int (*blockMap)(struct VNode* vNode, DWORD offset, int flags); 194 205 int (*truncate)(struct VNode* vNode, int size); 195 206 }; … … 236 247 int PollAddWait(struct PollQueue* pollQueue, WaitQueue* waitQueue); 237 248 238 /* Include all virtual filesystem headers, so we don't repeat ourselves in source files. */239 #include <fs/super.h>240 #include <fs/bcache.h>241 242 249 #endif
