X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=KernelLand%2FModules%2FStorage%2FLVM%2Fmain.c;h=501e8a7b8e8df0120c228b9e084c94fc562a7862;hb=13078002b01ee4f63eb2001d2ef479a2a006ea32;hp=8793d68be3cd78eda6539f1307016ef710a129f2;hpb=e4342ad9de52043cb8f820643794dc44076f9bd9;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Storage/LVM/main.c b/KernelLand/Modules/Storage/LVM/main.c index 8793d68b..501e8a7b 100644 --- a/KernelLand/Modules/Storage/LVM/main.c +++ b/KernelLand/Modules/Storage/LVM/main.c @@ -2,8 +2,8 @@ * Acess2 Logical Volume Manager * - By John Hodge (thePowersGang) * - * lvm.h - * - LVM Core definitions + * main.c + * - LVM Core Code */ #define DEBUG 0 #define VERSION VER2(0,1) @@ -18,13 +18,13 @@ int LVM_Cleanup(void); // --- int LVM_Root_ReadDir(tVFS_Node *Node, int ID, char Dest[FILENAME_MAX]); -tVFS_Node *LVM_Root_FindDir(tVFS_Node *Node, const char *Name); +tVFS_Node *LVM_Root_FindDir(tVFS_Node *Node, const char *Name, Uint Flags); int LVM_Vol_ReadDir(tVFS_Node *Node, int ID, char Dest[FILENAME_MAX]); -tVFS_Node *LVM_Vol_FindDir(tVFS_Node *Node, const char *Name); -size_t LVM_Vol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); -size_t LVM_Vol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); -size_t LVM_SubVol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer); -size_t LVM_SubVol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer); +tVFS_Node *LVM_Vol_FindDir(tVFS_Node *Node, const char *Name, Uint Flags); +size_t LVM_Vol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer, Uint Flags); +size_t LVM_Vol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer, Uint Flags); +size_t LVM_SubVol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer, Uint Flags); +size_t LVM_SubVol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer, Uint Flags); void LVM_CloseNode(tVFS_Node *Node); Uint LVM_int_DrvUtil_ReadBlock(Uint64 Address, Uint Count, void *Buffer, void *Argument); @@ -111,6 +111,8 @@ int LVM_Cleanup(void) Mutex_Acquire(&vol->VolNode.Lock); if( vol->Type->Cleanup ) vol->Type->Cleanup( vol->Ptr ); + if( vol->CacheHandle ) + IOCache_Destroy(vol->CacheHandle); LOG("Removed volume %s", vol->Name); free(vol); } @@ -130,6 +132,8 @@ int LVM_Root_ReadDir(tVFS_Node *Node, int ID, char Dest[FILENAME_MAX]) if( ID < 0 ) return -EINVAL; + // TODO: Sub-dirs for 'by-uuid', 'by-label' etc + for( vol = gpLVM_FirstVolume; vol && ID --; vol = vol->Next ); if(vol) { @@ -139,7 +143,7 @@ int LVM_Root_ReadDir(tVFS_Node *Node, int ID, char Dest[FILENAME_MAX]) else return -ENOENT; } -tVFS_Node *LVM_Root_FindDir(tVFS_Node *Node, const char *Name) +tVFS_Node *LVM_Root_FindDir(tVFS_Node *Node, const char *Name, Uint Flags) { tLVM_Vol *vol; for( vol = gpLVM_FirstVolume; vol; vol = vol->Next ) @@ -170,7 +174,7 @@ int LVM_Vol_ReadDir(tVFS_Node *Node, int ID, char Dest[FILENAME_MAX]) strncpy(Dest, src, FILENAME_MAX); return 0; } -tVFS_Node *LVM_Vol_FindDir(tVFS_Node *Node, const char *Name) +tVFS_Node *LVM_Vol_FindDir(tVFS_Node *Node, const char *Name, Uint Flags) { tLVM_Vol *vol = Node->ImplPtr; @@ -189,7 +193,7 @@ tVFS_Node *LVM_Vol_FindDir(tVFS_Node *Node, const char *Name) return NULL; } -size_t LVM_Vol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) +size_t LVM_Vol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer, Uint Flags) { tLVM_Vol *vol = Node->ImplPtr; Uint64 byte_size = vol->BlockCount * vol->BlockSize; @@ -207,12 +211,12 @@ size_t LVM_Vol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) ); } -size_t LVM_Vol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) +size_t LVM_Vol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer, Uint Flags) { return 0; } -size_t LVM_SubVol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) +size_t LVM_SubVol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer, Uint Flags) { tLVM_SubVolume *sv = Node->ImplPtr; Uint64 byte_size = sv->BlockCount * sv->Vol->BlockSize; @@ -236,7 +240,7 @@ size_t LVM_SubVol_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffe LVM_int_DrvUtil_ReadBlock, sv->Vol->BlockSize, sv->Vol ); } -size_t LVM_SubVol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) +size_t LVM_SubVol_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer, Uint Flags) { tLVM_SubVolume *sv = Node->ImplPtr; Uint64 byte_size = sv->BlockCount * sv->Vol->BlockSize;