* \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)
/**
* \}
*/
// === 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 ===
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;
}
// 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;
}
{{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 = {
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;
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;
}
// 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;
}