X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Fio.c;h=4a44b40aeff26654dfa423772cb87977fe69bd1f;hb=b97cf32102225af9c393b53aa7f0a6703ccf2fae;hp=689121e714a366b51c59b045a9baa64de6e1747d;hpb=414fb447e4ab5d4f8f456a8de2a16b77eeb1df90;p=tpg%2Facess2.git diff --git a/Kernel/vfs/io.c b/Kernel/vfs/io.c index 689121e7..4a44b40a 100644 --- a/Kernel/vfs/io.c +++ b/Kernel/vfs/io.c @@ -169,6 +169,7 @@ int VFS_Seek(int FD, Sint64 Distance, int Whence) /** * \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,46 @@ int VFS_IOCtl(int FD, int ID, void *Buffer) if(!h->Node->IOCtl) return -1; return h->Node->IOCtl(h->Node, ID, Buffer); } + +// -- System Call Structures --- +struct s_sysFInfo { + Uint uid, gid; + Uint flags; + Uint64 size; + Sint64 atime; + Sint64 mtime; + Sint64 ctime; + int numacls; + tVFS_ACL acls[]; +}; + +/** + * \fn int VFS_FInfo(int FD, struct s_sysFInfo *Dest, int MaxACLs) + * \brief Retrieve file information + * \return Number of ACLs stored + */ +int VFS_FInfo(int FD, struct s_sysFInfo *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; +}