diff options
author | Marvin Borner | 2021-02-25 17:42:46 +0100 |
---|---|---|
committer | Marvin Borner | 2021-02-25 17:42:46 +0100 |
commit | 34885f1c73824a0fe47aa095e9d55a57021239d2 (patch) | |
tree | b59dfe47069d1f42bd8123e647fadf74bff835a6 /kernel/features | |
parent | b85ba196c47920b9d1b6622718a34f8f6f23bef3 (diff) |
Added *many* static keywords
Diffstat (limited to 'kernel/features')
-rw-r--r-- | kernel/features/fs.c | 34 | ||||
-rw-r--r-- | kernel/features/proc.c | 16 | ||||
-rw-r--r-- | kernel/features/syscall.c | 3 |
3 files changed, 27 insertions, 26 deletions
diff --git a/kernel/features/fs.c b/kernel/features/fs.c index 1744b51..9ea5458 100644 --- a/kernel/features/fs.c +++ b/kernel/features/fs.c @@ -15,7 +15,7 @@ static struct list *mount_points = NULL; -char *vfs_normalize_path(const char *path) +static char *vfs_normalize_path(const char *path) { char *fixed = strdup(path); int len = strlen(fixed); @@ -36,7 +36,7 @@ u8 vfs_mounted(struct device *dev, const char *path) return 0; } -struct mount_info *vfs_recursive_find(char *path) +static struct mount_info *vfs_recursive_find(char *path) { struct node *iterator = mount_points->head; char *fixed = vfs_normalize_path(path); @@ -60,7 +60,7 @@ struct mount_info *vfs_recursive_find(char *path) return vfs_recursive_find(fixed); } -struct mount_info *vfs_find_mount_info(const char *path) +static struct mount_info *vfs_find_mount_info(const char *path) { assert(path[0] == '/'); return vfs_recursive_find(strdup(path)); @@ -75,7 +75,7 @@ struct device *vfs_find_dev(const char *path) return m && m->dev ? m->dev : NULL; } -const char *vfs_resolve_type(enum vfs_type type) +/*static const char *vfs_resolve_type(enum vfs_type type) { switch (type) { case VFS_DEVFS: @@ -91,7 +91,7 @@ const char *vfs_resolve_type(enum vfs_type type) } } -void vfs_list_mounts() +static void vfs_list_mounts() { struct node *iterator = mount_points->head; while (iterator) { @@ -100,7 +100,7 @@ void vfs_list_mounts() vfs_resolve_type(m->dev->vfs->type)); iterator = iterator->next; } -} +}*/ s32 vfs_mount(struct device *dev, const char *path) { @@ -276,7 +276,7 @@ struct device *device_get_by_name(const char *name) return NULL; } -s32 devfs_read(const char *path, void *buf, u32 offset, u32 count, struct device *dev) +static s32 devfs_read(const char *path, void *buf, u32 offset, u32 count, struct device *dev) { struct device *target = device_get_by_name(path + 1); if (!target || !target->read) @@ -284,7 +284,7 @@ s32 devfs_read(const char *path, void *buf, u32 offset, u32 count, struct device return target->read(buf, offset, count, dev); } -u8 devfs_perm(const char *path, enum vfs_perm perm, struct device *dev) +static u8 devfs_perm(const char *path, enum vfs_perm perm, struct device *dev) { (void)path; (void)perm; @@ -292,7 +292,7 @@ u8 devfs_perm(const char *path, enum vfs_perm perm, struct device *dev) return 1; } -u8 devfs_ready(const char *path, struct device *dev) +static u8 devfs_ready(const char *path, struct device *dev) { (void)dev; @@ -326,14 +326,14 @@ void device_install(void) */ // TODO: Remove malloc from buffer_read (attempt in #56cd63f199) -void *buffer_read(u32 block, struct device *dev) +static void *buffer_read(u32 block, struct device *dev) { void *buf = malloc(BLOCK_SIZE); dev->read(buf, block * SECTOR_COUNT, SECTOR_COUNT, dev); return buf; } -struct ext2_superblock *get_superblock(struct device *dev) +static struct ext2_superblock *get_superblock(struct device *dev) { struct ext2_superblock *sb = buffer_read(EXT2_SUPER, dev); @@ -341,12 +341,12 @@ struct ext2_superblock *get_superblock(struct device *dev) return sb; } -struct ext2_bgd *get_bgd(struct device *dev) +static struct ext2_bgd *get_bgd(struct device *dev) { return buffer_read(EXT2_SUPER + 1, dev); } -struct ext2_inode *get_inode(u32 i, struct device *dev) +static struct ext2_inode *get_inode(u32 i, struct device *dev) { struct ext2_superblock *s = get_superblock(dev); assert(s); @@ -370,7 +370,7 @@ struct ext2_inode *get_inode(u32 i, struct device *dev) return in; } -u32 read_indirect(u32 indirect, u32 block_num, struct device *dev) +static u32 read_indirect(u32 indirect, u32 block_num, struct device *dev) { char *data = buffer_read(indirect, dev); u32 ind = *(u32 *)((u32)data + block_num * sizeof(u32)); @@ -378,7 +378,7 @@ u32 read_indirect(u32 indirect, u32 block_num, struct device *dev) return ind; } -s32 read_inode(struct ext2_inode *in, void *buf, u32 offset, u32 count, struct device *dev) +static s32 read_inode(struct ext2_inode *in, void *buf, u32 offset, u32 count, struct device *dev) { // TODO: Support read offset (void)offset; @@ -422,7 +422,7 @@ s32 read_inode(struct ext2_inode *in, void *buf, u32 offset, u32 count, struct d return count; } -u32 find_inode(const char *name, u32 dir_inode, struct device *dev) +static u32 find_inode(const char *name, u32 dir_inode, struct device *dev) { if (!dir_inode) return (unsigned)-1; @@ -456,7 +456,7 @@ u32 find_inode(const char *name, u32 dir_inode, struct device *dev) return (unsigned)-1; } -struct ext2_inode *find_inode_by_path(const char *path, struct device *dev) +static struct ext2_inode *find_inode_by_path(const char *path, struct device *dev) { if (path[0] != '/') return 0; diff --git a/kernel/features/proc.c b/kernel/features/proc.c index d5cc82c..c21ffcc 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -74,7 +74,7 @@ void scheduler(struct regs *regs) /* printf("{%d}", ((struct proc *)current->data)->pid); */ } -void kernel_idle() +static void kernel_idle() { while (1) ; @@ -250,7 +250,7 @@ struct proc *proc_make(void) // TODO: Procfs needs a simpler interface structure (memcmp and everything sucks) -const char *procfs_parse_path(const char **path, u32 *pid) +static const char *procfs_parse_path(const char **path, u32 *pid) { while (**path == '/') (*path)++; @@ -268,7 +268,7 @@ const char *procfs_parse_path(const char **path, u32 *pid) return *path; } -enum stream_defaults procfs_stream(const char *path) +static enum stream_defaults procfs_stream(const char *path) { if (!memcmp(path, "in", 3)) { return STREAM_IN; @@ -283,7 +283,7 @@ enum stream_defaults procfs_stream(const char *path) } } -s32 procfs_write(const char *path, void *buf, u32 offset, u32 count, struct device *dev) +static s32 procfs_write(const char *path, void *buf, u32 offset, u32 count, struct device *dev) { u32 pid = 0; procfs_parse_path(&path, &pid); @@ -321,7 +321,7 @@ s32 procfs_write(const char *path, void *buf, u32 offset, u32 count, struct devi return -1; } -s32 procfs_read(const char *path, void *buf, u32 offset, u32 count, struct device *dev) +static s32 procfs_read(const char *path, void *buf, u32 offset, u32 count, struct device *dev) { (void)dev; u32 pid = 0; @@ -369,7 +369,7 @@ s32 procfs_read(const char *path, void *buf, u32 offset, u32 count, struct devic return -1; } -s32 procfs_wait(const char *path, s32 (*func)(), struct device *dev) +static s32 procfs_wait(const char *path, s32 (*func)(), struct device *dev) { u32 pid = 0; procfs_parse_path(&path, &pid); @@ -392,7 +392,7 @@ s32 procfs_wait(const char *path, s32 (*func)(), struct device *dev) return -1; } -u8 procfs_perm(const char *path, enum vfs_perm perm, struct device *dev) +static u8 procfs_perm(const char *path, enum vfs_perm perm, struct device *dev) { (void)path; (void)dev; @@ -403,7 +403,7 @@ u8 procfs_perm(const char *path, enum vfs_perm perm, struct device *dev) return 1; } -u8 procfs_ready(const char *path, struct device *dev) +static u8 procfs_ready(const char *path, struct device *dev) { (void)dev; diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index 9f05471..538fd59 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -10,9 +10,10 @@ #include <proc.h> #include <str.h> #include <sys.h> +#include <syscall.h> #include <timer.h> -void syscall_handler(struct regs *r) +static void syscall_handler(struct regs *r) { enum sys num = r->eax; r->eax = 0; |