libfs: add support for special files not backed by a filesystem
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
#include "file.h"
|
||||
|
||||
void fs_file_set_ops(struct fs_file *f, const struct fs_file_ops *ops)
|
||||
{
|
||||
f->f_ops = ops;
|
||||
}
|
||||
|
||||
struct fs_inode *fs_file_get_inode(const struct fs_file *f)
|
||||
{
|
||||
return f->f_inode;
|
||||
|
||||
@@ -23,6 +23,7 @@ struct fs_file_ops {
|
||||
*f_readdir)(struct fs_file *, struct xpc_buffer *, off_t *);
|
||||
};
|
||||
|
||||
extern void fs_file_set_ops(struct fs_file *f, const struct fs_file_ops *ops);
|
||||
extern struct fs_inode *fs_file_get_inode(const struct fs_file *f);
|
||||
extern size_t fs_file_get_cursor(const struct fs_file *f);
|
||||
extern enum fs_status fs_file_read(
|
||||
|
||||
@@ -39,7 +39,7 @@ extern kern_status_t fs_msg_seek(
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
if (new_offset > f->f_inode->i_size) {
|
||||
if (f->f_inode && new_offset > f->f_inode->i_size) {
|
||||
*out_err = EINVAL;
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user