From: John Hodge (sonata) Date: Sun, 9 Mar 2014 12:14:20 +0000 (+0800) Subject: Kernel - Rename _EXECUTE to _EXEC (VFS perm flag) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=93ef045b729d13a41beaa503ebeeaaec4a978daf;p=tpg%2Facess2.git Kernel - Rename _EXECUTE to _EXEC (VFS perm flag) --- diff --git a/KernelLand/Kernel/include/vfs_ext.h b/KernelLand/Kernel/include/vfs_ext.h index d18009d4..65a81624 100644 --- a/KernelLand/Kernel/include/vfs_ext.h +++ b/KernelLand/Kernel/include/vfs_ext.h @@ -60,31 +60,12 @@ enum eVFS_SeekDirs * \name ACL Permissions * \{ */ -/** - * \brief Readable - */ -#define VFS_PERM_READ 0x00000001 -/** - * \brief Writeable - */ -#define VFS_PERM_WRITE 0x00000002 -/** - * \brief Append allowed - */ -#define VFS_PERM_APPEND 0x00000004 -/** - * \brief Executable - */ -#define VFS_PERM_EXECUTE 0x00000008 -/** - * \brief All permissions granted - */ -#define VFS_PERM_ALL 0x7FFFFFFF // Mask for permissions -/** - * \brief Denies instead of granting permissions - * \note Denials take precedence - */ -#define VFS_PERM_DENY 0x80000000 // Inverts permissions +#define VFS_PERM_READ 0x00000001 //!< Readable +#define VFS_PERM_WRITE 0x00000002 //!< Writable +#define VFS_PERM_APPEND 0x00000004 //!< Appendable (/create file) +#define VFS_PERM_EXEC 0x00000008 //!< Executable (/Traversable) +#define VFS_PERM_ALL 0x7FFFFFFF //!< All permission bits +#define VFS_PERM_DENY 0x80000000 //!< Flag for denying a permission set (higher precedence) /** * \} */ diff --git a/KernelLand/Kernel/vfs/acls.c b/KernelLand/Kernel/vfs/acls.c index d5deb165..7ae50c2f 100644 --- a/KernelLand/Kernel/vfs/acls.c +++ b/KernelLand/Kernel/vfs/acls.c @@ -10,8 +10,8 @@ Uint VFS_int_CheckACLs(tVFS_ACL *ACLs, int Num, int bDeny, Uint Perms, tUID UID, // === GLOBALS === tVFS_ACL gVFS_ACL_EveryoneRWX = { {1,-1}, {0,VFS_PERM_ALL} }; -tVFS_ACL gVFS_ACL_EveryoneRW = { {1,-1}, {0,VFS_PERM_ALL^VFS_PERM_EXECUTE} }; -tVFS_ACL gVFS_ACL_EveryoneRX = { {1,-1}, {0,VFS_PERM_READ|VFS_PERM_EXECUTE} }; +tVFS_ACL gVFS_ACL_EveryoneRW = { {1,-1}, {0,VFS_PERM_ALL^VFS_PERM_EXEC} }; +tVFS_ACL gVFS_ACL_EveryoneRX = { {1,-1}, {0,VFS_PERM_READ|VFS_PERM_EXEC} }; tVFS_ACL gVFS_ACL_EveryoneRO = { {1,-1}, {0,VFS_PERM_READ} }; // === CODE === @@ -139,21 +139,21 @@ tVFS_ACL *VFS_UnixToAcessACL(Uint Mode, Uint Owner, Uint Group) ret[0].Perm.Inv = 0; ret[0].Perm.Perms = 0; if(Mode & 0400) ret[0].Perm.Perms |= VFS_PERM_READ; if(Mode & 0200) ret[0].Perm.Perms |= VFS_PERM_WRITE; - if(Mode & 0100) ret[0].Perm.Perms |= VFS_PERM_EXECUTE; + if(Mode & 0100) ret[0].Perm.Perms |= VFS_PERM_EXEC; // Group ret[1].Ent.Group = 1; ret[1].Ent.ID = Group; ret[1].Perm.Inv = 0; ret[1].Perm.Perms = 0; if(Mode & 0040) ret[1].Perm.Perms |= VFS_PERM_READ; if(Mode & 0020) ret[1].Perm.Perms |= VFS_PERM_WRITE; - if(Mode & 0010) ret[1].Perm.Perms |= VFS_PERM_EXECUTE; + if(Mode & 0010) ret[1].Perm.Perms |= VFS_PERM_EXEC; // Global ret[2].Ent.Group = 1; ret[2].Ent.ID = -1; ret[2].Perm.Inv = 0; ret[2].Perm.Perms = 0; if(Mode & 0004) ret[2].Perm.Perms |= VFS_PERM_READ; if(Mode & 0002) ret[2].Perm.Perms |= VFS_PERM_WRITE; - if(Mode & 0001) ret[2].Perm.Perms |= VFS_PERM_EXECUTE; + if(Mode & 0001) ret[2].Perm.Perms |= VFS_PERM_EXEC; // Return buffer return ret; diff --git a/KernelLand/Kernel/vfs/dir.c b/KernelLand/Kernel/vfs/dir.c index add48b0c..911eff6f 100644 --- a/KernelLand/Kernel/vfs/dir.c +++ b/KernelLand/Kernel/vfs/dir.c @@ -74,7 +74,7 @@ int VFS_MkNod(const char *Path, Uint Flags) } // Permissions Check - if( !VFS_CheckACL(parent, VFS_PERM_EXECUTE|VFS_PERM_WRITE) ) { + if( !VFS_CheckACL(parent, VFS_PERM_EXEC|VFS_PERM_WRITE) ) { errno = EACCES; goto _error; } diff --git a/KernelLand/Kernel/vfs/fs/root.c b/KernelLand/Kernel/vfs/fs/root.c index fd667b9b..b8202977 100644 --- a/KernelLand/Kernel/vfs/fs/root.c +++ b/KernelLand/Kernel/vfs/fs/root.c @@ -39,8 +39,8 @@ tVFS_ACL RootFS_DirACLs[3] = { {{0,-1}, {0,VFS_PERM_ALL^VFS_PERM_WRITE}} // World (Nobody) }; tVFS_ACL RootFS_FileACLs[3] = { - {{0,0}, {0,VFS_PERM_ALL^VFS_PERM_EXECUTE}}, // Owner (Root) - {{1,0}, {0,VFS_PERM_ALL^VFS_PERM_EXECUTE}}, // Group (Root) + {{0,0}, {0,VFS_PERM_ALL^VFS_PERM_EXEC}}, // Owner (Root) + {{1,0}, {0,VFS_PERM_ALL^VFS_PERM_EXEC}}, // Group (Root) {{0,-1}, {0,VFS_PERM_READ}} // World (Nobody) }; tVFS_NodeType gRootFS_DirType = { diff --git a/KernelLand/Kernel/vfs/open.c b/KernelLand/Kernel/vfs/open.c index f1a16f3f..f0b5734a 100644 --- a/KernelLand/Kernel/vfs/open.c +++ b/KernelLand/Kernel/vfs/open.c @@ -296,7 +296,7 @@ restart_parse: pathEle[nextSlash] = 0; // Check permissions on root of filesystem - if( !VFS_CheckACL(curNode, VFS_PERM_EXECUTE) ) { + if( !VFS_CheckACL(curNode, VFS_PERM_EXEC) ) { LOG("Permissions failure on '%s'", Path); errno = EPERM; goto _error; @@ -474,7 +474,7 @@ int VFS_int_CreateHandle( tVFS_Node *Node, tVFS_Mount *Mount, int Mode ) ENTER("pNode pMount xMode", Node, Mount, Mode); i = 0; - i |= (Mode & VFS_OPENFLAG_EXEC) ? VFS_PERM_EXECUTE : 0; + i |= (Mode & VFS_OPENFLAG_EXEC) ? VFS_PERM_EXEC : 0; i |= (Mode & VFS_OPENFLAG_READ) ? VFS_PERM_READ : 0; i |= (Mode & VFS_OPENFLAG_WRITE) ? VFS_PERM_WRITE : 0; @@ -557,7 +557,7 @@ int VFS_OpenEx(const char *Path, Uint Flags, Uint Mode) } // Check ACLs on the parent - if( !VFS_CheckACL(pnode, VFS_PERM_EXECUTE|VFS_PERM_WRITE) ) { + if( !VFS_CheckACL(pnode, VFS_PERM_EXEC|VFS_PERM_WRITE) ) { errno = EACCES; goto _pnode_err; }