12 #include <linux/export.h>
13 #include <linux/stat.h>
14 #include <linux/time.h>
16 #include <linux/poll.h>
25 size_t size, loff_t *ppos)
30 static ssize_t bad_file_write(
struct file *filp,
const char __user *
buf,
31 size_t siz, loff_t *ppos)
37 unsigned long nr_segs, loff_t
pos)
43 unsigned long nr_segs, loff_t
pos)
58 static long bad_file_unlocked_ioctl(
struct file *
file,
unsigned cmd,
64 static long bad_file_compat_ioctl(
struct file *
file,
unsigned int cmd,
85 static int bad_file_release(
struct inode *
inode,
struct file *filp)
96 static int bad_file_aio_fsync(
struct kiocb *
iocb,
int datasync)
101 static int bad_file_fasync(
int fd,
struct file *filp,
int on)
112 int off,
size_t len, loff_t *
pos,
int more)
117 static unsigned long bad_file_get_unmapped_area(
struct file *
file,
118 unsigned long addr,
unsigned long len,
119 unsigned long pgoff,
unsigned long flags)
124 static int bad_file_check_flags(
int flags)
135 struct file *
out, loff_t *ppos,
size_t len,
141 static ssize_t bad_file_splice_read(
struct file *
in, loff_t *ppos,
150 .llseek = bad_file_llseek,
151 .read = bad_file_read,
152 .write = bad_file_write,
153 .aio_read = bad_file_aio_read,
154 .aio_write = bad_file_aio_write,
155 .readdir = bad_file_readdir,
156 .poll = bad_file_poll,
157 .unlocked_ioctl = bad_file_unlocked_ioctl,
158 .compat_ioctl = bad_file_compat_ioctl,
159 .mmap = bad_file_mmap,
160 .open = bad_file_open,
161 .flush = bad_file_flush,
162 .release = bad_file_release,
163 .fsync = bad_file_fsync,
164 .aio_fsync = bad_file_aio_fsync,
165 .fasync = bad_file_fasync,
166 .lock = bad_file_lock,
167 .sendpage = bad_file_sendpage,
168 .get_unmapped_area = bad_file_get_unmapped_area,
169 .check_flags = bad_file_check_flags,
170 .flock = bad_file_flock,
171 .splice_write = bad_file_splice_write,
172 .splice_read = bad_file_splice_read,
181 static struct dentry *bad_inode_lookup(
struct inode *dir,
184 return ERR_PTR(-
EIO);
187 static int bad_inode_link (
struct dentry *old_dentry,
struct inode *dir,
221 static int bad_inode_rename (
struct inode *old_dir,
struct dentry *old_dentry,
244 static int bad_inode_setattr(
struct dentry *direntry,
struct iattr *attrs)
274 .create = bad_inode_create,
275 .lookup = bad_inode_lookup,
276 .link = bad_inode_link,
277 .unlink = bad_inode_unlink,
278 .symlink = bad_inode_symlink,
279 .mkdir = bad_inode_mkdir,
280 .rmdir = bad_inode_rmdir,
281 .mknod = bad_inode_mknod,
282 .rename = bad_inode_rename,
283 .readlink = bad_inode_readlink,
288 .permission = bad_inode_permission,
289 .getattr = bad_inode_getattr,
290 .setattr = bad_inode_setattr,
291 .setxattr = bad_inode_setxattr,
292 .getxattr = bad_inode_getxattr,
293 .listxattr = bad_inode_listxattr,
294 .removexattr = bad_inode_removexattr,
318 remove_inode_hash(inode);
323 inode->
i_op = &bad_inode_ops;
324 inode->
i_fop = &bad_file_ops;
343 return (inode->
i_op == &bad_inode_ops);