diff options
Diffstat (limited to 'src/sys/include')
-rw-r--r-- | src/sys/include/os/kalloc.h | 8 | ||||
-rw-r--r-- | src/sys/include/os/vnode.h | 24 | ||||
-rw-r--r-- | src/sys/include/sys/fcntl.h | 1 | ||||
-rw-r--r-- | src/sys/include/sys/mount.h | 5 | ||||
-rw-r--r-- | src/sys/include/sys/namei.h | 2 |
5 files changed, 38 insertions, 2 deletions
diff --git a/src/sys/include/os/kalloc.h b/src/sys/include/os/kalloc.h index 143c4f9..aaaaa74 100644 --- a/src/sys/include/os/kalloc.h +++ b/src/sys/include/os/kalloc.h @@ -48,6 +48,14 @@ void *kalloc(size_t sz); /* + * Reallocates memory pool created by `dynalloc()' + * + * @old_ptr: Pointer to old pool. + * @newsize: Size of new pool. + */ +void *krealloc(void *old_ptr, size_t newsize); + +/* * Free a chunk of memory given to by * `ptr' * diff --git a/src/sys/include/os/vnode.h b/src/sys/include/os/vnode.h index 1bef1e2..628ba68 100644 --- a/src/sys/include/os/vnode.h +++ b/src/sys/include/os/vnode.h @@ -32,6 +32,7 @@ #include <sys/types.h> #include <sys/atomic.h> +#include <sys/namei.h> /* Forward declarations */ struct vnode; @@ -83,12 +84,23 @@ struct vop_rw_data { }; /* + * Arguments to create an entry within a + * filesystem + * + * @ndp: Path component to create + */ +struct vop_create_args { + struct nameidata *ndp; +}; + +/* * Represents operations that can be performed on * a specific vnode. These are implemented as callbacks */ struct vop { int(*lookup)(struct vop_lookup_args *args); int(*reclaim)(struct vnode *vp, int flags); + int(*create)(struct vop_create_args *args); ssize_t(*write)(struct vop_rw_data *data); ssize_t(*read)(struct vop_rw_data *data); }; @@ -176,4 +188,16 @@ ssize_t vop_read(struct vnode *vp, char *data, off_t off, size_t len); */ int vop_reclaim(struct vnode *vp, int flags); +/* + * Create a node within a specific filesystem or + * directory + * + * @vp: Vnode of parent directory + * @ndp: Namei descriptor of path component + * + * Returns zero on success, otherwise a less than zero + * value on failure. + */ +int vop_create(struct vnode *vp, struct nameidata *ndp); + #endif /* !_OS_VNODE_H_ */ diff --git a/src/sys/include/sys/fcntl.h b/src/sys/include/sys/fcntl.h index 30d2ec4..1ab3e71 100644 --- a/src/sys/include/sys/fcntl.h +++ b/src/sys/include/sys/fcntl.h @@ -43,6 +43,7 @@ #define O_RDONLY 0x00 #define O_RDWR BIT(1) #define O_WRONLY BIT(2) +#define O_CREAT BIT(3) /* File access mode flags */ #define O_ACCMODE (O_RDWR | O_WRONLY) diff --git a/src/sys/include/sys/mount.h b/src/sys/include/sys/mount.h index 6d041ee..5f6fa6b 100644 --- a/src/sys/include/sys/mount.h +++ b/src/sys/include/sys/mount.h @@ -42,6 +42,7 @@ */ #define MOUNT_INITRD "initrd" /* Initial ramdisk */ #define MOUNT_DEVFS "devfs" /* Device filesystem */ +#define MOUNT_TMPFS "tmpfs" /* Temporary filesystem */ /* * The mount system call @@ -65,7 +66,8 @@ struct mount; /* Filesystem vfsops */ extern struct vfsops g_omar_vfsops; -extern struct vfsops g_devfs_vfops; +extern struct vfsops g_devfs_vfsops; +extern struct vfsops g_tmpfs_vfsops; /* * Represents a mountpoint @@ -133,7 +135,6 @@ struct fs_info { */ #define FS_ATTR_IMAGE BIT(0) /* Is an image kind e.g., OSMORA OMAR */ - /* * VFS operations vector * diff --git a/src/sys/include/sys/namei.h b/src/sys/include/sys/namei.h index 58307b1..9e78a4c 100644 --- a/src/sys/include/sys/namei.h +++ b/src/sys/include/sys/namei.h @@ -32,6 +32,8 @@ #include <os/vnode.h> +#define NAMEI_CREATE BIT(0) /* Create as we go */ + /* * Represents namei data that can be used for * looking up files |