diff options
author | Marvin Borner | 2021-02-07 14:23:32 +0100 |
---|---|---|
committer | Marvin Borner | 2021-02-07 14:23:32 +0100 |
commit | eca4dfd49216f6158df69143994a18a0b3edd4fe (patch) | |
tree | 831e2ffe1724d4761d734fe753df0d0ea6958dd2 /kernel/inc | |
parent | 03b8f1d1976e0f74c80556315105734354fc06fc (diff) |
Added filesystem and proc permissions
Diffstat (limited to 'kernel/inc')
-rw-r--r-- | kernel/inc/fs.h | 14 | ||||
-rw-r--r-- | kernel/inc/proc.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/kernel/inc/fs.h b/kernel/inc/fs.h index 64f3970..1069597 100644 --- a/kernel/inc/fs.h +++ b/kernel/inc/fs.h @@ -32,6 +32,7 @@ void device_add(struct device *dev); */ enum vfs_type { VFS_DEVFS, VFS_TMPFS, VFS_PROCFS, VFS_EXT2 }; +enum vfs_perm { VFS_EXEC, VFS_WRITE, VFS_READ }; struct vfs { enum vfs_type type; @@ -40,6 +41,7 @@ struct vfs { s32 (*read)(const char *path, void *buf, u32 offset, u32 count, struct device *dev); s32 (*write)(const char *path, void *buf, u32 offset, u32 count, struct device *dev); s32 (*stat)(const char *path, struct stat *buf, struct device *dev); + u8 (*perm)(const char *path, enum vfs_perm perm, struct device *dev); u8 (*ready)(const char *path, struct device *dev); }; @@ -71,6 +73,17 @@ struct device *device_get_by_name(const char *name); #define EXT2_ROOT 2 #define EXT2_MAGIC 0x0000EF53 +// TODO: Support other and group permissions? +#define EXT2_PERM_OEXEC 0x001 +#define EXT2_PERM_OWRITE 0x002 +#define EXT2_PERM_OREAD 0x004 +#define EXT2_PERM_GEXEC 0x008 +#define EXT2_PERM_GWRITE 0x010 +#define EXT2_PERM_GREAD 0x020 +#define EXT2_PERM_UEXEC 0x040 +#define EXT2_PERM_UWRITE 0x080 +#define EXT2_PERM_UREAD 0x100 + struct ext2_superblock { u32 total_inodes; u32 total_blocks; @@ -155,6 +168,7 @@ struct ext2_file { s32 ext2_read(const char *path, void *buf, u32 offset, u32 count, struct device *dev); s32 ext2_stat(const char *path, struct stat *buf, struct device *dev); +u8 ext2_perm(const char *path, enum vfs_perm perm, struct device *dev); u8 ext2_ready(const char *path, struct device *dev); #endif diff --git a/kernel/inc/proc.h b/kernel/inc/proc.h index 6be7da3..4a75638 100644 --- a/kernel/inc/proc.h +++ b/kernel/inc/proc.h @@ -26,6 +26,7 @@ struct proc_wait { struct proc { u32 pid; + u8 super; char name[32]; struct regs regs; struct proc_wait wait; // dev_id @@ -37,6 +38,7 @@ void scheduler(struct regs *regs); void proc_init(void); void proc_print(void); struct proc *proc_current(void); +u8 proc_super(void); struct proc *proc_from_pid(u32 pid); void proc_exit(struct proc *proc, int status); void proc_yield(struct regs *r); |