1 /* Copyright (c) 2009, 2010 The Regents of the University of California
2 * Barret Rhoden <brho@cs.berkeley.edu>
3 * See LICENSE for details.
5 * KFS (Kernel File System)
7 * This is a cheap FS that is based off of a CPIO archive appended to the end of
8 * the kernel binary image. */
10 #ifndef ROS_KERN_KFS_H
11 #define ROS_KERN_KFS_H
13 #include <ros/common.h>
16 /* Every FS must extern it's type, and be included in vfs_init() */
17 extern struct fs_type kfs_fs_type;
19 /* KFS-specific inode info. Could use a union, but I want to init filestart to
22 struct dentry_tailq children; /* our childrens */
23 void *filestart; /* or our file location */
24 size_t init_size; /* file size on the backing store */
27 /* KFS VFS functions. Exported for use by similar FSs (devices, for now) */
28 struct super_block *kfs_get_sb(struct fs_type *fs, int flags,
29 char *dev_name, struct vfsmount *vmnt);
30 void kfs_kill_sb(struct super_block *sb);
31 /* Page Map Operations */
32 int kfs_readpage(struct page_map *pm, struct page *page);
33 /* Super Operations */
34 struct inode *kfs_alloc_inode(struct super_block *sb);
35 void kfs_dealloc_inode(struct inode *inode);
36 void kfs_read_inode(struct inode *inode);
37 void kfs_dirty_inode(struct inode *inode);
38 void kfs_write_inode(struct inode *inode, bool wait);
39 void kfs_put_inode(struct inode *inode);
40 void kfs_drop_inode(struct inode *inode);
41 void kfs_delete_inode(struct inode *inode);
42 void kfs_put_super(struct super_block *sb);
43 void kfs_write_super(struct super_block *sb);
44 int kfs_sync_fs(struct super_block *sb, bool wait);
45 int kfs_remount_fs(struct super_block *sb, int flags, char *data);
46 void kfs_umount_begin(struct super_block *sb);
47 /* inode_operations */
48 int kfs_create(struct inode *dir, struct dentry *dentry, int mode,
49 struct nameidata *nd);
50 struct dentry *kfs_lookup(struct inode *dir, struct dentry *dentry,
51 struct nameidata *nd);
52 int kfs_link(struct dentry *old_dentry, struct inode *dir,
53 struct dentry *new_dentry);
54 int kfs_unlink(struct inode *dir, struct dentry *dentry);
55 int kfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname);
56 int kfs_mkdir(struct inode *dir, struct dentry *dentry, int mode);
57 int kfs_rmdir(struct inode *dir, struct dentry *dentry);
58 int kfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev);
59 int kfs_rename(struct inode *old_dir, struct dentry *old_dentry,
60 struct inode *new_dir, struct dentry *new_dentry);
61 char *kfs_readlink(struct dentry *dentry);
62 void kfs_truncate(struct inode *inode);
63 int kfs_permission(struct inode *inode, int mode, struct nameidata *nd);
64 /* dentry_operations */
65 int kfs_d_revalidate(struct dentry *dir, struct nameidata *nd);
66 int kfs_d_hash(struct dentry *dentry, struct qstr *name);
67 int kfs_d_compare(struct dentry *dir, struct qstr *name1, struct qstr *name2);
68 int kfs_d_delete(struct dentry *dentry);
69 int kfs_d_release(struct dentry *dentry);
70 void kfs_d_iput(struct dentry *dentry, struct inode *inode);
72 int kfs_llseek(struct file *file, off64_t offset, off64_t *ret, int whence);
73 int kfs_readdir(struct file *dir, struct dirent *dirent);
74 int kfs_mmap(struct file *file, struct vm_region *vmr);
75 int kfs_open(struct inode *inode, struct file *file);
76 int kfs_flush(struct file *file);
77 int kfs_release(struct inode *inode, struct file *file);
78 int kfs_fsync(struct file *file, struct dentry *dentry, int datasync);
79 unsigned int kfs_poll(struct file *file, struct poll_table_struct *poll_table);
80 ssize_t kfs_readv(struct file *file, const struct iovec *vector,
81 unsigned long count, off64_t *offset);
82 ssize_t kfs_writev(struct file *file, const struct iovec *vector,
83 unsigned long count, off64_t *offset);
84 ssize_t kfs_sendpage(struct file *file, struct page *page, int offset,
85 size_t size, off64_t pos, int more);
86 int kfs_check_flags(int flags);
88 #endif /* !ROS_KERN_KFS_H */