* Lawyers can sort out the copyrights and whatnot with these interfaces and
* structures. */
-#ifndef ROS_KERN_VFS_H
-#define ROS_KERN_VFS_H
+#pragma once
#include <ros/common.h>
+#include <ros/limits.h>
#include <sys/queue.h>
#include <sys/uio.h>
#include <bitmask.h>
#include <hashtable.h>
#include <pagemap.h>
#include <blockdev.h>
+#include <fdtap.h>
/* ghetto preprocessor hacks (since proc includes vfs) */
struct page;
#include <ros/fs.h>
+/* Create flags are those used only during creation, and not saved for later
+ * lookup or use. Everything other than them is viewable via getfl */
+#define O_CREAT_FLAGS (O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC)
+/* These flags are those you can attempt to set via setfl for the VFS. */
+#define O_FCNTL_SET_FLAGS (O_APPEND | O_ASYNC | O_DIRECT | O_NOATIME | \
+ O_NONBLOCK)
+
struct super_block;
struct super_operations;
struct dentry;
TAILQ_HEAD(io_wb_tailq, io_writeback);
TAILQ_HEAD(event_poll_tailq, event_poll);
TAILQ_HEAD(vfsmount_tailq, vfsmount);
-TAILQ_HEAD(fs_type_tailq, fs_type);
+TAILQ_HEAD(fs_type_tailq, fs_type);
/* Linux's quickstring - saves recomputing the hash and length. Note the length
* is the non-null-terminated length, as you'd get from strlen(). (for now) */
void *d_fs_info;
};
+/* Checks is a struct dentry pointer if the root.
+ */
+#define DENTRY_IS_ROOT(d) ((d) == (d)->d_parent)
+
/* not sure yet if we want to call delete when refcnt == 0 (move it to LRU) or
* when its time to remove it from the dcache. */
struct dentry_operations {
/* Per-process structs */
#define NR_OPEN_FILES_DEFAULT 32
#define NR_FILE_DESC_DEFAULT 32
-/* this is not in sync with glibc, sysdeps/ros/bits/typesizes.h */
-#define NR_FILE_DESC_MAX (512 * 1024)
/* Bitmask for file descriptors, big for when we exceed the initial small. We
* could just use the fd_array to check for openness instead of the bitmask,
struct file *fd_file;
struct chan *fd_chan;
unsigned int fd_flags;
+ struct fd_tap *fd_tap;
};
/* All open files for a process */
bool closed;
int max_files; /* max files ptd to by fd */
int max_fdset; /* max of the current fd_set */
- int next_fd; /* next number available */
+ int hint_min_fd; /* <= min available fd */
struct file_desc *fd; /* initially pts to fd_array */
struct fd_set *open_fds; /* init, pts to open_fds_init */
struct small_fd_set open_fds_init;
void vfs_init(void);
void qstr_builder(struct dentry *dentry, char *l_name);
char *file_name(struct file *file);
+char *dentry_path(struct dentry *dentry, char *path, size_t max_size);
int path_lookup(char *path, int flags, struct nameidata *nd);
void path_release(struct nameidata *nd);
int mount_fs(struct fs_type *fs, char *dev_name, char *path, int flags);
+static inline char *file_abs_path(struct file *f, char *path, size_t max_size)
+{
+ return dentry_path(f->f_dentry, path, max_size);
+}
+
/* Superblock functions */
struct super_block *get_sb(void);
void init_sb(struct super_block *sb, struct vfsmount *vmnt,
int ls_dash_r(char *path);
extern struct inode_operations dummy_i_op;
extern struct dentry_operations dummy_d_op;
-
-#endif /* ROS_KERN_VFS_H */