X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Fio.c;h=8ff15f56c6a7ec33895605ff2326e843c1dbbf4c;hb=fbb51904de075386178cc6bb14717132d3b2153d;hp=689121e714a366b51c59b045a9baa64de6e1747d;hpb=414fb447e4ab5d4f8f456a8de2a16b77eeb1df90;p=tpg%2Facess2.git diff --git a/Kernel/vfs/io.c b/Kernel/vfs/io.c index 689121e7..8ff15f56 100644 --- a/Kernel/vfs/io.c +++ b/Kernel/vfs/io.c @@ -2,7 +2,7 @@ * AcessMicro VFS * - File IO Passthru's */ -#include +#include #include "vfs.h" #include "vfs_int.h" @@ -137,13 +137,13 @@ Uint64 VFS_Tell(int FD) } /** - * \fn int VFS_Seek(int FD, Sint64 Distance, int Whence) + * \fn int VFS_Seek(int FD, Sint64 Offset, int Whence) * \brief Seek to a new location * \param FD File descriptor - * \param Distance Where to go + * \param Offset Where to go * \param Whence From where */ -int VFS_Seek(int FD, Sint64 Distance, int Whence) +int VFS_Seek(int FD, Sint64 Offset, int Whence) { tVFS_Handle *h; @@ -152,23 +152,24 @@ int VFS_Seek(int FD, Sint64 Distance, int Whence) // Set relative to current position if(Whence == 0) { - h->Position += Distance; + h->Position += Offset; return 0; } // Set relative to end of file if(Whence < 0) { - h->Position = h->Node->Size - Distance; + h->Position = h->Node->Size - Offset; return 0; } // Set relative to start of file - h->Position = Distance; + h->Position = Offset; return 0; } /** * \fn int VFS_IOCtl(int FD, int ID, void *Buffer) + * \brief Call an IO Control on a file */ int VFS_IOCtl(int FD, int ID, void *Buffer) { @@ -180,3 +181,43 @@ int VFS_IOCtl(int FD, int ID, void *Buffer) if(!h->Node->IOCtl) return -1; return h->Node->IOCtl(h->Node, ID, Buffer); } + +/** + * \fn int VFS_FInfo(int FD, tFInfo *Dest, int MaxACLs) + * \brief Retrieve file information + * \return Number of ACLs stored + */ +int VFS_FInfo(int FD, tFInfo *Dest, int MaxACLs) +{ + tVFS_Handle *h; + int max; + + h = VFS_GetHandle(FD); + if(!h) return -1; + + Dest->uid = h->Node->UID; + Dest->gid = h->Node->GID; + Dest->size = h->Node->Size; + Dest->atime = h->Node->ATime; + Dest->ctime = h->Node->MTime; + Dest->mtime = h->Node->CTime; + Dest->numacls = h->Node->NumACLs; + + Dest->flags = 0; + if(h->Node->Flags & VFS_FFLAG_DIRECTORY) Dest->flags |= 0x10; + if(h->Node->Flags & VFS_FFLAG_SYMLINK) Dest->flags |= 0x20; + + max = (MaxACLs < h->Node->NumACLs) ? MaxACLs : h->Node->NumACLs; + memcpy(&Dest->acls, h->Node->ACLs, max*sizeof(tVFS_ACL)); + + return max; +} + +// === EXPORTS === +EXPORT(VFS_Read); +EXPORT(VFS_Write); +EXPORT(VFS_ReadAt); +EXPORT(VFS_WriteAt); +EXPORT(VFS_IOCtl); +EXPORT(VFS_Seek); +EXPORT(VFS_Tell);