X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Fio.c;h=4a44b40aeff26654dfa423772cb87977fe69bd1f;hb=b97cf32102225af9c393b53aa7f0a6703ccf2fae;hp=57d3f84a8c0698c27d5b56d57e2549b7538aee1c;hpb=8bc40333b1401d7616b225945fee53d972c2f418;p=tpg%2Facess2.git diff --git a/Kernel/vfs/io.c b/Kernel/vfs/io.c index 57d3f84a..4a44b40a 100644 --- a/Kernel/vfs/io.c +++ b/Kernel/vfs/io.c @@ -166,3 +166,61 @@ int VFS_Seek(int FD, Sint64 Distance, int Whence) h->Position = Distance; 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) +{ + tVFS_Handle *h; + + h = VFS_GetHandle(FD); + if(!h) return -1; + + 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; +}