Changeset 853

Show
Ignore:
Timestamp:
08/21/08 21:46:06 (3 years ago)
Author:
mwhitworth
Message:

Add info.h, icfs.h and kfs.h for infofs/configfs layer.

Location:
Whitix/trunk/include/fs
Files:
3 added
4 modified
1 copied

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/include/fs/bcache.h

    r670 r853  
    2525#define VFS_BCACHE_H 
    2626 
     27#include <sdevice.h> 
     28#include <wait.h> 
     29 
    2730/* Buffer flags. Bit index into buffer->flags. */ 
    2831#define BUFFER_DIRTY    0x0 
    2932#define BUFFER_LOCKED   0x1 
     33#define BUFFER_JOURNAL  0x2 
    3034 
    3135/* Defines for dealing with flags. */ 
    3236#define BufferLocked(buffer) ((buffer)->flags & (1 << BUFFER_LOCKED)) 
    3337#define BufferDirty(buffer) ((buffer)->flags & (1 << BUFFER_DIRTY)) 
     38#define BufferJournal(buffer) ((buffer)->flags & (1 << BUFFER_JOURNAL)) 
    3439 
    3540/* Reference counting. Blocks are only freed if there are no references 
     
    5358        BYTE* data; 
    5459        WaitQueue waitQueue; 
     60        void* privData; 
    5561}; 
    5662 
     
    5864 
    5965int BlockInit(); 
     66struct Buffer* BlockBufferAlloc(struct StorageDevice* device, DWORD blockNum); 
    6067struct Buffer* BlockRead(struct StorageDevice* device,DWORD blockNum); 
    6168int BlockWrite(struct StorageDevice* device,struct Buffer* buffer); 
     
    6471int BlockFree(struct Buffer* buffer); 
    6572int BlockSetSize(struct StorageDevice* device,int blockSize); 
     73int BlockCreateHashTable(struct StorageDevice* dev); 
    6674 
    6775/* Buffer locking */ 
  • Whitix/trunk/include/fs/devfs.h

    r670 r853  
    2020#define DEVFS_H 
    2121 
     22#include <fs/kfs.h> 
    2223#include <fs/vfs.h> 
    2324#include <llist.h> 
     
    3536}; 
    3637 
    37 /* Structures */ 
    38 struct DevFsDir 
    39 { 
    40         struct ListHead entries; /* All DevFsEntrys */ 
    41         struct DevFsDir* parent; 
    42 }; 
    43  
    44 struct DevFsEntry 
    45 { 
    46         struct ListHead next; 
    47         int type; 
    48         union { 
    49                 struct DevFsDir dir; 
    50                 struct DevFsDevice device; 
    51         }; 
    52         char name[1]; 
    53 }; 
    54  
    5538struct StorageDevice; 
    5639 
     
    6043static inline void* DeviceGetOps(struct VNode* devNode) 
    6144{ 
    62         struct DevFsEntry* entry=(struct DevFsEntry*)(devNode->extraInfo); 
     45        struct KeFsEntry* entry=(struct KeFsEntry*)(devNode->id); 
     46        struct DevFsDevice* device; 
    6347 
    6448        /* DevFs directories don't have specific operations. */  
     
    6650                return NULL; 
    6751         
    68         return (void*)(entry->device.ops); 
     52        device=(struct DevFsDevice*)entry->file; 
     53         
     54        return device->ops; 
    6955} 
    7056 
  • Whitix/trunk/include/fs/super.h

    r670 r853  
    2828#include <typedefs.h> 
    2929 
    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 }; 
     30struct VNode; 
    4231 
    4332struct VfsSuperBlock 
     
    5241        struct ListHead vNodeList,sbList; 
    5342        Spinlock nodeListLock; 
     43}; 
     44 
     45struct 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); 
    5458}; 
    5559 
  • Whitix/trunk/include/fs/vfs.h

    r670 r853  
    3131#include <wait.h> 
    3232 
     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> 
    3336#include <fs/exports.h> 
    3437 
     
    149152}; 
    150153 
    151 #define SetVNodeDirty(vNode) (((vNode)->flags) |= VNODE_DIRTY) 
     154static 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} 
    152160 
    153161/* FILE 
     
    183191int FillDir(void* dirEntry,char* name,int nameLen,DWORD vNodeNum);  
    184192 
     193/* Flags to pass to block map */ 
     194#define VFS_MAP_CREATE          0x1 
     195 
    185196struct VNodeOps 
    186197{ 
     
    191202        int (*rmDir)(struct VNode* dir,char* name,int nameLength); 
    192203        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); 
    194205        int (*truncate)(struct VNode* vNode, int size); 
    195206}; 
     
    236247int PollAddWait(struct PollQueue* pollQueue, WaitQueue* waitQueue); 
    237248 
    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  
    242249#endif