4 * Copyright (C) 1991, 1992 Linus Torvalds
7 #include <linux/string.h>
9 #include <linux/utime.h>
10 #include <linux/file.h>
11 #include <linux/smp_lock.h>
12 #include <linux/quotaops.h>
13 #include <linux/fsnotify.h>
14 #include <linux/module.h>
15 #include <linux/slab.h>
16 #include <linux/tty.h>
17 #include <linux/namei.h>
18 #include <linux/backing-dev.h>
19 #include <linux/security.h>
20 #include <linux/mount.h>
21 #include <linux/vfs.h>
22 #include <asm/uaccess.h>
24 #include <linux/personality.h>
25 #include <linux/pagemap.h>
26 #include <linux/syscalls.h>
27 #include <linux/rcupdate.h>
29 #include <asm/unistd.h>
31 int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
37 if (sb->s_op->statfs) {
38 memset(buf, 0, sizeof(*buf));
39 retval = security_sb_statfs(sb);
42 retval = sb->s_op->statfs(sb, buf);
43 if (retval == 0 && buf->f_frsize == 0)
44 buf->f_frsize = buf->f_bsize;
50 EXPORT_SYMBOL(vfs_statfs);
52 static int vfs_statfs_native(struct super_block *sb, struct statfs *buf)
57 retval = vfs_statfs(sb, &st);
61 if (sizeof(*buf) == sizeof(st))
62 memcpy(buf, &st, sizeof(st));
64 if (sizeof buf->f_blocks == 4) {
65 if ((st.f_blocks | st.f_bfree | st.f_bavail) &
66 0xffffffff00000000ULL)
69 * f_files and f_ffree may be -1; it's okay to stuff
72 if (st.f_files != -1 &&
73 (st.f_files & 0xffffffff00000000ULL))
75 if (st.f_ffree != -1 &&
76 (st.f_ffree & 0xffffffff00000000ULL))
80 buf->f_type = st.f_type;
81 buf->f_bsize = st.f_bsize;
82 buf->f_blocks = st.f_blocks;
83 buf->f_bfree = st.f_bfree;
84 buf->f_bavail = st.f_bavail;
85 buf->f_files = st.f_files;
86 buf->f_ffree = st.f_ffree;
87 buf->f_fsid = st.f_fsid;
88 buf->f_namelen = st.f_namelen;
89 buf->f_frsize = st.f_frsize;
90 memset(buf->f_spare, 0, sizeof(buf->f_spare));
95 static int vfs_statfs64(struct super_block *sb, struct statfs64 *buf)
100 retval = vfs_statfs(sb, &st);
104 if (sizeof(*buf) == sizeof(st))
105 memcpy(buf, &st, sizeof(st));
107 buf->f_type = st.f_type;
108 buf->f_bsize = st.f_bsize;
109 buf->f_blocks = st.f_blocks;
110 buf->f_bfree = st.f_bfree;
111 buf->f_bavail = st.f_bavail;
112 buf->f_files = st.f_files;
113 buf->f_ffree = st.f_ffree;
114 buf->f_fsid = st.f_fsid;
115 buf->f_namelen = st.f_namelen;
116 buf->f_frsize = st.f_frsize;
117 memset(buf->f_spare, 0, sizeof(buf->f_spare));
122 asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf)
127 error = user_path_walk(path, &nd);
130 error = vfs_statfs_native(nd.dentry->d_inode->i_sb, &tmp);
131 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
139 asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64 __user *buf)
144 if (sz != sizeof(*buf))
146 error = user_path_walk(path, &nd);
149 error = vfs_statfs64(nd.dentry->d_inode->i_sb, &tmp);
150 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
158 asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
168 error = vfs_statfs_native(file->f_dentry->d_inode->i_sb, &tmp);
169 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
176 asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf)
182 if (sz != sizeof(*buf))
189 error = vfs_statfs64(file->f_dentry->d_inode->i_sb, &tmp);
190 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
197 int do_truncate(struct dentry *dentry, loff_t length, struct file *filp)
200 struct iattr newattrs;
202 /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
206 newattrs.ia_size = length;
207 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
209 newattrs.ia_file = filp;
210 newattrs.ia_valid |= ATTR_FILE;
213 down(&dentry->d_inode->i_sem);
214 err = notify_change(dentry, &newattrs);
215 up(&dentry->d_inode->i_sem);
219 static inline long do_sys_truncate(const char __user * path, loff_t length)
222 struct inode * inode;
226 if (length < 0) /* sorry, but loff_t says... */
229 error = user_path_walk(path, &nd);
232 inode = nd.dentry->d_inode;
234 /* For directories it's -EISDIR, for other non-regulars - -EINVAL */
236 if (S_ISDIR(inode->i_mode))
240 if (!S_ISREG(inode->i_mode))
243 error = permission(inode,MAY_WRITE,&nd);
248 if (IS_RDONLY(inode))
252 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
256 * Make sure that there are no leases.
258 error = break_lease(inode, FMODE_WRITE);
262 error = get_write_access(inode);
266 error = locks_verify_truncate(inode, NULL, length);
269 error = do_truncate(nd.dentry, length, NULL);
271 put_write_access(inode);
279 asmlinkage long sys_truncate(const char __user * path, unsigned long length)
281 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */
282 return do_sys_truncate(path, (long)length);
285 static inline long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
287 struct inode * inode;
288 struct dentry *dentry;
300 /* explicitly opened as large or we are on 64-bit box */
301 if (file->f_flags & O_LARGEFILE)
304 dentry = file->f_dentry;
305 inode = dentry->d_inode;
307 if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
311 /* Cannot ftruncate over 2^31 bytes without large file support */
312 if (small && length > MAX_NON_LFS)
316 if (IS_APPEND(inode))
319 error = locks_verify_truncate(inode, file, length);
321 error = do_truncate(dentry, length, file);
328 asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
330 return do_sys_ftruncate(fd, length, 1);
333 /* LFS versions of truncate are only needed on 32 bit machines */
334 #if BITS_PER_LONG == 32
335 asmlinkage long sys_truncate64(const char __user * path, loff_t length)
337 return do_sys_truncate(path, length);
340 asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
342 return do_sys_ftruncate(fd, length, 0);
346 #ifdef __ARCH_WANT_SYS_UTIME
349 * sys_utime() can be implemented in user-level using sys_utimes().
350 * Is this for backwards compatibility? If so, why not move it
351 * into the appropriate arch directory (for those architectures that
355 /* If times==NULL, set access and modification to current time,
356 * must be owner or have write permission.
357 * Else, update from *times, must be owner or super user.
359 asmlinkage long sys_utime(char __user * filename, struct utimbuf __user * times)
363 struct inode * inode;
364 struct iattr newattrs;
366 error = user_path_walk(filename, &nd);
369 inode = nd.dentry->d_inode;
372 if (IS_RDONLY(inode))
375 /* Don't worry, the checks are done in inode_change_ok() */
376 newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME;
379 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
382 error = get_user(newattrs.ia_atime.tv_sec, ×->actime);
383 newattrs.ia_atime.tv_nsec = 0;
385 error = get_user(newattrs.ia_mtime.tv_sec, ×->modtime);
386 newattrs.ia_mtime.tv_nsec = 0;
390 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
393 if (IS_IMMUTABLE(inode))
396 if (current->fsuid != inode->i_uid &&
397 (error = permission(inode,MAY_WRITE,&nd)) != 0)
401 error = notify_change(nd.dentry, &newattrs);
411 /* If times==NULL, set access and modification to current time,
412 * must be owner or have write permission.
413 * Else, update from *times, must be owner or super user.
415 long do_utimes(char __user * filename, struct timeval * times)
419 struct inode * inode;
420 struct iattr newattrs;
422 error = user_path_walk(filename, &nd);
426 inode = nd.dentry->d_inode;
429 if (IS_RDONLY(inode))
432 /* Don't worry, the checks are done in inode_change_ok() */
433 newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME;
436 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
439 newattrs.ia_atime.tv_sec = times[0].tv_sec;
440 newattrs.ia_atime.tv_nsec = times[0].tv_usec * 1000;
441 newattrs.ia_mtime.tv_sec = times[1].tv_sec;
442 newattrs.ia_mtime.tv_nsec = times[1].tv_usec * 1000;
443 newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET;
446 if (IS_IMMUTABLE(inode))
449 if (current->fsuid != inode->i_uid &&
450 (error = permission(inode,MAY_WRITE,&nd)) != 0)
454 error = notify_change(nd.dentry, &newattrs);
462 asmlinkage long sys_utimes(char __user * filename, struct timeval __user * utimes)
464 struct timeval times[2];
466 if (utimes && copy_from_user(×, utimes, sizeof(times)))
468 return do_utimes(filename, utimes ? times : NULL);
473 * access() needs to use the real uid/gid, not the effective uid/gid.
474 * We do this by temporarily clearing all FS-related capabilities and
475 * switching the fsuid/fsgid around to the real ones.
477 asmlinkage long sys_access(const char __user * filename, int mode)
480 int old_fsuid, old_fsgid;
481 kernel_cap_t old_cap;
484 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
487 old_fsuid = current->fsuid;
488 old_fsgid = current->fsgid;
489 old_cap = current->cap_effective;
491 current->fsuid = current->uid;
492 current->fsgid = current->gid;
495 * Clear the capabilities if we switch to a non-root user
497 * FIXME: There is a race here against sys_capset. The
498 * capabilities can change yet we will restore the old
499 * value below. We should hold task_capabilities_lock,
500 * but we cannot because user_path_walk can sleep.
503 cap_clear(current->cap_effective);
505 current->cap_effective = current->cap_permitted;
507 res = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
509 res = permission(nd.dentry->d_inode, mode, &nd);
510 /* SuS v2 requires we report a read only fs too */
511 if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
512 && !special_file(nd.dentry->d_inode->i_mode))
517 current->fsuid = old_fsuid;
518 current->fsgid = old_fsgid;
519 current->cap_effective = old_cap;
524 asmlinkage long sys_chdir(const char __user * filename)
529 error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
533 error = permission(nd.dentry->d_inode,MAY_EXEC,&nd);
537 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
545 asmlinkage long sys_fchdir(unsigned int fd)
548 struct dentry *dentry;
550 struct vfsmount *mnt;
558 dentry = file->f_dentry;
559 mnt = file->f_vfsmnt;
560 inode = dentry->d_inode;
563 if (!S_ISDIR(inode->i_mode))
566 error = permission(inode, MAY_EXEC, NULL);
568 set_fs_pwd(current->fs, mnt, dentry);
575 asmlinkage long sys_chroot(const char __user * filename)
580 error = __user_walk(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
584 error = permission(nd.dentry->d_inode,MAY_EXEC,&nd);
589 if (!capable(CAP_SYS_CHROOT))
592 set_fs_root(current->fs, nd.mnt, nd.dentry);
601 asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
603 struct inode * inode;
604 struct dentry * dentry;
607 struct iattr newattrs;
613 dentry = file->f_dentry;
614 inode = dentry->d_inode;
617 if (IS_RDONLY(inode))
620 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
623 if (mode == (mode_t) -1)
624 mode = inode->i_mode;
625 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
626 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
627 err = notify_change(dentry, &newattrs);
636 asmlinkage long sys_chmod(const char __user * filename, mode_t mode)
639 struct inode * inode;
641 struct iattr newattrs;
643 error = user_path_walk(filename, &nd);
646 inode = nd.dentry->d_inode;
649 if (IS_RDONLY(inode))
653 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
657 if (mode == (mode_t) -1)
658 mode = inode->i_mode;
659 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
660 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
661 error = notify_change(nd.dentry, &newattrs);
670 static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
672 struct inode * inode;
674 struct iattr newattrs;
677 if (!(inode = dentry->d_inode)) {
678 printk(KERN_ERR "chown_common: NULL inode\n");
682 if (IS_RDONLY(inode))
685 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
687 newattrs.ia_valid = ATTR_CTIME;
688 if (user != (uid_t) -1) {
689 newattrs.ia_valid |= ATTR_UID;
690 newattrs.ia_uid = user;
692 if (group != (gid_t) -1) {
693 newattrs.ia_valid |= ATTR_GID;
694 newattrs.ia_gid = group;
696 if (!S_ISDIR(inode->i_mode))
697 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
699 error = notify_change(dentry, &newattrs);
705 asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
710 error = user_path_walk(filename, &nd);
712 error = chown_common(nd.dentry, user, group);
718 asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group)
723 error = user_path_walk_link(filename, &nd);
725 error = chown_common(nd.dentry, user, group);
732 asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
739 error = chown_common(file->f_dentry, user, group);
745 static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
746 int flags, struct file *f,
747 int (*open)(struct inode *, struct file *))
753 f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK |
754 FMODE_PREAD | FMODE_PWRITE;
755 inode = dentry->d_inode;
756 if (f->f_mode & FMODE_WRITE) {
757 error = get_write_access(inode);
762 f->f_mapping = inode->i_mapping;
763 f->f_dentry = dentry;
766 f->f_op = fops_get(inode->i_fop);
767 file_move(f, &inode->i_sb->s_files);
769 if (!open && f->f_op)
770 open = f->f_op->open;
772 error = open(inode, f);
777 f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
779 file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping);
781 /* NB: we're sure to have correct a_ops only after f_op->open */
782 if (f->f_flags & O_DIRECT) {
783 if (!f->f_mapping->a_ops ||
784 ((!f->f_mapping->a_ops->direct_IO) &&
785 (!f->f_mapping->a_ops->get_xip_page))) {
787 f = ERR_PTR(-EINVAL);
795 if (f->f_mode & FMODE_WRITE)
796 put_write_access(inode);
804 return ERR_PTR(error);
808 * Note that while the flag value (low two bits) for sys_open means:
814 * 00 - no permissions needed
815 * 01 - read-permission
816 * 10 - write-permission
818 * for the internal routines (ie open_namei()/follow_link() etc). 00 is
821 struct file *filp_open(const char * filename, int flags, int mode)
823 int namei_flags, error;
827 if ((namei_flags+1) & O_ACCMODE)
830 error = open_namei(filename, namei_flags, mode, &nd);
832 return nameidata_to_filp(&nd, flags);
834 return ERR_PTR(error);
836 EXPORT_SYMBOL(filp_open);
839 * lookup_instantiate_filp - instantiates the open intent filp
840 * @nd: pointer to nameidata
841 * @dentry: pointer to dentry
842 * @open: open callback
844 * Helper for filesystems that want to use lookup open intents and pass back
845 * a fully instantiated struct file to the caller.
846 * This function is meant to be called from within a filesystem's
848 * Note that in case of error, nd->intent.open.file is destroyed, but the
849 * path information remains valid.
850 * If the open callback is set to NULL, then the standard f_op->open()
851 * filesystem callback is substituted.
853 struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
854 int (*open)(struct inode *, struct file *))
856 if (IS_ERR(nd->intent.open.file))
860 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->mnt),
861 nd->intent.open.flags - 1,
862 nd->intent.open.file,
865 return nd->intent.open.file;
867 release_open_intent(nd);
868 nd->intent.open.file = (struct file *)dentry;
871 EXPORT_SYMBOL_GPL(lookup_instantiate_filp);
874 * nameidata_to_filp - convert a nameidata to an open filp.
875 * @nd: pointer to nameidata
878 * Note that this function destroys the original nameidata
880 struct file *nameidata_to_filp(struct nameidata *nd, int flags)
884 /* Pick up the filp from the open intent */
885 filp = nd->intent.open.file;
886 /* Has the filesystem initialised the file for us? */
887 if (filp->f_dentry == NULL)
888 filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL);
895 * dentry_open() will have done dput(dentry) and mntput(mnt) if it returns an
898 struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
904 f = get_empty_filp();
908 return ERR_PTR(error);
911 return __dentry_open(dentry, mnt, flags, f, NULL);
913 EXPORT_SYMBOL(dentry_open);
916 * Find an empty file descriptor entry, and mark it busy.
918 int get_unused_fd(void)
920 struct files_struct * files = current->files;
925 spin_lock(&files->file_lock);
928 fdt = files_fdtable(files);
929 fd = find_next_zero_bit(fdt->open_fds->fds_bits,
934 * N.B. For clone tasks sharing a files structure, this test
935 * will limit the total number of files that can be opened.
937 if (fd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
940 /* Do we need to expand the fd array or fd set? */
941 error = expand_files(files, fd);
947 * If we needed to expand the fs array we
948 * might have blocked - try again.
954 FD_SET(fd, fdt->open_fds);
955 FD_CLR(fd, fdt->close_on_exec);
956 fdt->next_fd = fd + 1;
959 if (fdt->fd[fd] != NULL) {
960 printk(KERN_WARNING "get_unused_fd: slot %d not NULL!\n", fd);
967 spin_unlock(&files->file_lock);
971 EXPORT_SYMBOL(get_unused_fd);
973 static inline void __put_unused_fd(struct files_struct *files, unsigned int fd)
975 struct fdtable *fdt = files_fdtable(files);
976 __FD_CLR(fd, fdt->open_fds);
977 if (fd < fdt->next_fd)
981 void fastcall put_unused_fd(unsigned int fd)
983 struct files_struct *files = current->files;
984 spin_lock(&files->file_lock);
985 __put_unused_fd(files, fd);
986 spin_unlock(&files->file_lock);
989 EXPORT_SYMBOL(put_unused_fd);
992 * Install a file pointer in the fd array.
994 * The VFS is full of places where we drop the files lock between
995 * setting the open_fds bitmap and installing the file in the file
996 * array. At any such point, we are vulnerable to a dup2() race
997 * installing a file in the array before us. We need to detect this and
998 * fput() the struct file we are about to overwrite in this case.
1000 * It should never happen - if we allow dup2() do it, _really_ bad things
1004 void fastcall fd_install(unsigned int fd, struct file * file)
1006 struct files_struct *files = current->files;
1007 struct fdtable *fdt;
1008 spin_lock(&files->file_lock);
1009 fdt = files_fdtable(files);
1010 BUG_ON(fdt->fd[fd] != NULL);
1011 rcu_assign_pointer(fdt->fd[fd], file);
1012 spin_unlock(&files->file_lock);
1015 EXPORT_SYMBOL(fd_install);
1017 long do_sys_open(const char __user *filename, int flags, int mode)
1019 char *tmp = getname(filename);
1020 int fd = PTR_ERR(tmp);
1023 fd = get_unused_fd();
1025 struct file *f = filp_open(tmp, flags, mode);
1030 fsnotify_open(f->f_dentry);
1039 asmlinkage long sys_open(const char __user *filename, int flags, int mode)
1041 if (force_o_largefile())
1042 flags |= O_LARGEFILE;
1044 return do_sys_open(filename, flags, mode);
1046 EXPORT_SYMBOL_GPL(sys_open);
1051 * For backward compatibility? Maybe this should be moved
1052 * into arch/i386 instead?
1054 asmlinkage long sys_creat(const char __user * pathname, int mode)
1056 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
1062 * "id" is the POSIX thread ID. We use the
1063 * files pointer for this..
1065 int filp_close(struct file *filp, fl_owner_t id)
1069 if (!file_count(filp)) {
1070 printk(KERN_ERR "VFS: Close: file count is 0\n");
1074 if (filp->f_op && filp->f_op->flush)
1075 retval = filp->f_op->flush(filp);
1077 dnotify_flush(filp, id);
1078 locks_remove_posix(filp, id);
1083 EXPORT_SYMBOL(filp_close);
1086 * Careful here! We test whether the file pointer is NULL before
1087 * releasing the fd. This ensures that one clone task can't release
1088 * an fd while another clone is opening it.
1090 asmlinkage long sys_close(unsigned int fd)
1093 struct files_struct *files = current->files;
1094 struct fdtable *fdt;
1096 spin_lock(&files->file_lock);
1097 fdt = files_fdtable(files);
1098 if (fd >= fdt->max_fds)
1103 rcu_assign_pointer(fdt->fd[fd], NULL);
1104 FD_CLR(fd, fdt->close_on_exec);
1105 __put_unused_fd(files, fd);
1106 spin_unlock(&files->file_lock);
1107 return filp_close(filp, files);
1110 spin_unlock(&files->file_lock);
1114 EXPORT_SYMBOL(sys_close);
1117 * This routine simulates a hangup on the tty, to arrange that users
1118 * are given clean terminals at login time.
1120 asmlinkage long sys_vhangup(void)
1122 if (capable(CAP_SYS_TTY_CONFIG)) {
1123 tty_vhangup(current->signal->tty);
1130 * Called when an inode is about to be open.
1131 * We use this to disallow opening large files on 32bit systems if
1132 * the caller didn't specify O_LARGEFILE. On 64bit systems we force
1133 * on this flag in sys_open.
1135 int generic_file_open(struct inode * inode, struct file * filp)
1137 if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
1142 EXPORT_SYMBOL(generic_file_open);
1145 * This is used by subsystems that don't want seekable
1148 int nonseekable_open(struct inode *inode, struct file *filp)
1150 filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
1154 EXPORT_SYMBOL(nonseekable_open);