X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FFilesystems%2FFAT%2Fdir.c;h=c371f1f97ea448e7d9f1033c6fc0b5bbaf31e7a9;hb=015f48988e0ff398409d71dfc692005ab439490a;hp=b74b31ff9efa6937133678c211765db5638b9217;hpb=e4342ad9de52043cb8f820643794dc44076f9bd9;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Filesystems/FAT/dir.c b/KernelLand/Modules/Filesystems/FAT/dir.c index b74b31ff..c371f1f9 100644 --- a/KernelLand/Modules/Filesystems/FAT/dir.c +++ b/KernelLand/Modules/Filesystems/FAT/dir.c @@ -27,7 +27,7 @@ Uint16 *FAT_int_GetLFN(tVFS_Node *Node, int ID); void FAT_int_DelLFN(tVFS_Node *Node, int ID); #endif int FAT_ReadDir(tVFS_Node *Node, int ID, char Dest[FILENAME_MAX]); -tVFS_Node *FAT_FindDir(tVFS_Node *Node, const char *Name); +tVFS_Node *FAT_FindDir(tVFS_Node *Node, const char *Name, Uint Flags); tVFS_Node *FAT_GetNodeFromINode(tVFS_Node *Root, Uint64 Inode); #if SUPPORT_WRITE tVFS_Node *FAT_Mknod(tVFS_Node *Node, const char *Name, Uint Flags); @@ -83,6 +83,7 @@ int FAT_int_CreateName(fat_filetable *ft, const Uint16 *LongFileName, char *Dest { int len = FAT_int_ConvertUTF16_to_UTF8(NULL, LongFileName); if( len > FILENAME_MAX ) { + LEAVE('i', -1); return -1; } FAT_int_ConvertUTF16_to_UTF8((Uint8*)Dest, LongFileName); @@ -94,6 +95,7 @@ int FAT_int_CreateName(fat_filetable *ft, const Uint16 *LongFileName, char *Dest #if USE_LFN } #endif + LEAVE('i', 0); return 0; } @@ -278,7 +280,10 @@ int FAT_int_GetEntryByCluster(tVFS_Node *DirNode, Uint32 Cluster, fat_filetable fat_filetable fileinfo[ents_per_sector]; int i, sector; - Mutex_Acquire(&DirNode->Lock); + if( Mutex_Acquire(&DirNode->Lock) ) { + return -EINTR; + } + sector = 0; for( i = 0; ; i ++ ) { @@ -318,7 +323,7 @@ int FAT_int_GetEntryByCluster(tVFS_Node *DirNode, Uint32 Cluster, fat_filetable } Mutex_Release(&DirNode->Lock); - return -1; + return -ENOENT; } /* @@ -445,7 +450,9 @@ Uint16 *FAT_int_GetLFN(tVFS_Node *Node, int ID) tFAT_LFNCache *cache; int i, firstFree; - Mutex_Acquire( &Node->Lock ); + if( Mutex_Acquire( &Node->Lock ) ) { + return NULL; + } // TODO: Thread Safety (Lock things) cache = Node->Data; @@ -623,7 +630,7 @@ int FAT_ReadDir(tVFS_Node *Node, int ID, char Dest[FILENAME_MAX]) * \fn tVFS_Node *FAT_FindDir(tVFS_Node *node, char *name) * \brief Finds an entry in the current directory */ -tVFS_Node *FAT_FindDir(tVFS_Node *Node, const char *Name) +tVFS_Node *FAT_FindDir(tVFS_Node *Node, const char *Name, Uint Flags) { fat_filetable fileent; @@ -659,6 +666,7 @@ tVFS_Node *FAT_GetNodeFromINode(tVFS_Node *Root, Uint64 Inode) if( ret ) { if( (ret->Inode >> 32) != 0 ) { LOG("Node in cache, quick return"); + LEAVE('p', ret); return ret; } else { @@ -812,7 +820,9 @@ int FAT_Link(tVFS_Node *DirNode, const char *NewName, tVFS_Node *NewNode) const int eps = 512 / sizeof(fat_filetable); fat_filetable fileinfo[eps]; - Mutex_Acquire( &DirNode->Lock ); + if( Mutex_Acquire( &DirNode->Lock ) ) { + return EINTR; + } // -- Ensure duplicates aren't created -- if( FAT_int_GetEntryByName(DirNode, NewName, &ft) >= 0 ) { @@ -1096,7 +1106,9 @@ int FAT_Unlink(tVFS_Node *Node, const char *OldName) tVFS_Node *child; fat_filetable ft; - Mutex_Acquire(&Node->Lock); + if( Mutex_Acquire(&Node->Lock) ) { + return EINTR; + } int id = FAT_int_GetEntryByName(Node, OldName, &ft); if(id == -1) {