4 * Copyright (C) 1991, 1992 Linus Torvalds
7 #include <linux/string.h>
9 #include <linux/file.h>
10 #include <linux/quotaops.h>
11 #include <linux/fsnotify.h>
12 #include <linux/module.h>
13 #include <linux/slab.h>
14 #include <linux/tty.h>
15 #include <linux/namei.h>
16 #include <linux/backing-dev.h>
17 #include <linux/capability.h>
18 #include <linux/security.h>
19 #include <linux/mount.h>
20 #include <linux/vfs.h>
21 #include <linux/fcntl.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>
28 #include <linux/audit.h>
30 int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)
36 if (dentry->d_sb->s_op->statfs) {
37 memset(buf, 0, sizeof(*buf));
38 retval = security_sb_statfs(dentry);
41 retval = dentry->d_sb->s_op->statfs(dentry, buf);
42 if (retval == 0 && buf->f_frsize == 0)
43 buf->f_frsize = buf->f_bsize;
49 EXPORT_SYMBOL(vfs_statfs);
51 static int vfs_statfs_native(struct dentry *dentry, struct statfs *buf)
56 retval = vfs_statfs(dentry, &st);
60 if (sizeof(*buf) == sizeof(st))
61 memcpy(buf, &st, sizeof(st));
63 if (sizeof buf->f_blocks == 4) {
64 if ((st.f_blocks | st.f_bfree | st.f_bavail) &
65 0xffffffff00000000ULL)
68 * f_files and f_ffree may be -1; it's okay to stuff
71 if (st.f_files != -1 &&
72 (st.f_files & 0xffffffff00000000ULL))
74 if (st.f_ffree != -1 &&
75 (st.f_ffree & 0xffffffff00000000ULL))
79 buf->f_type = st.f_type;
80 buf->f_bsize = st.f_bsize;
81 buf->f_blocks = st.f_blocks;
82 buf->f_bfree = st.f_bfree;
83 buf->f_bavail = st.f_bavail;
84 buf->f_files = st.f_files;
85 buf->f_ffree = st.f_ffree;
86 buf->f_fsid = st.f_fsid;
87 buf->f_namelen = st.f_namelen;
88 buf->f_frsize = st.f_frsize;
89 memset(buf->f_spare, 0, sizeof(buf->f_spare));
94 static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf)
99 retval = vfs_statfs(dentry, &st);
103 if (sizeof(*buf) == sizeof(st))
104 memcpy(buf, &st, sizeof(st));
106 buf->f_type = st.f_type;
107 buf->f_bsize = st.f_bsize;
108 buf->f_blocks = st.f_blocks;
109 buf->f_bfree = st.f_bfree;
110 buf->f_bavail = st.f_bavail;
111 buf->f_files = st.f_files;
112 buf->f_ffree = st.f_ffree;
113 buf->f_fsid = st.f_fsid;
114 buf->f_namelen = st.f_namelen;
115 buf->f_frsize = st.f_frsize;
116 memset(buf->f_spare, 0, sizeof(buf->f_spare));
121 asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf)
126 error = user_path_walk(path, &nd);
129 error = vfs_statfs_native(nd.dentry, &tmp);
130 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
138 asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64 __user *buf)
143 if (sz != sizeof(*buf))
145 error = user_path_walk(path, &nd);
148 error = vfs_statfs64(nd.dentry, &tmp);
149 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
157 asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
167 error = vfs_statfs_native(file->f_path.dentry, &tmp);
168 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
175 asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf)
181 if (sz != sizeof(*buf))
188 error = vfs_statfs64(file->f_path.dentry, &tmp);
189 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
196 int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
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 | time_attrs;
209 newattrs.ia_file = filp;
210 newattrs.ia_valid |= ATTR_FILE;
213 /* Remove suid/sgid on truncate too */
214 newattrs.ia_valid |= should_remove_suid(dentry);
216 mutex_lock(&dentry->d_inode->i_mutex);
217 err = notify_change(dentry, &newattrs);
218 mutex_unlock(&dentry->d_inode->i_mutex);
222 static long do_sys_truncate(const char __user * path, loff_t length)
225 struct inode * inode;
229 if (length < 0) /* sorry, but loff_t says... */
232 error = user_path_walk(path, &nd);
235 inode = nd.dentry->d_inode;
237 /* For directories it's -EISDIR, for other non-regulars - -EINVAL */
239 if (S_ISDIR(inode->i_mode))
243 if (!S_ISREG(inode->i_mode))
246 error = vfs_permission(&nd, MAY_WRITE);
251 if (IS_RDONLY(inode))
255 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
259 * Make sure that there are no leases.
261 error = break_lease(inode, FMODE_WRITE);
265 error = get_write_access(inode);
269 error = locks_verify_truncate(inode, NULL, length);
272 error = do_truncate(nd.dentry, length, 0, NULL);
274 put_write_access(inode);
282 asmlinkage long sys_truncate(const char __user * path, unsigned long length)
284 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */
285 return do_sys_truncate(path, (long)length);
288 static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
290 struct inode * inode;
291 struct dentry *dentry;
303 /* explicitly opened as large or we are on 64-bit box */
304 if (file->f_flags & O_LARGEFILE)
307 dentry = file->f_path.dentry;
308 inode = dentry->d_inode;
310 if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
314 /* Cannot ftruncate over 2^31 bytes without large file support */
315 if (small && length > MAX_NON_LFS)
319 if (IS_APPEND(inode))
322 error = locks_verify_truncate(inode, file, length);
324 error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
331 asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
333 long ret = do_sys_ftruncate(fd, length, 1);
334 /* avoid REGPARM breakage on x86: */
335 prevent_tail_call(ret);
339 /* LFS versions of truncate are only needed on 32 bit machines */
340 #if BITS_PER_LONG == 32
341 asmlinkage long sys_truncate64(const char __user * path, loff_t length)
343 return do_sys_truncate(path, length);
346 asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
348 long ret = do_sys_ftruncate(fd, length, 0);
349 /* avoid REGPARM breakage on x86: */
350 prevent_tail_call(ret);
356 * access() needs to use the real uid/gid, not the effective uid/gid.
357 * We do this by temporarily clearing all FS-related capabilities and
358 * switching the fsuid/fsgid around to the real ones.
360 asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
363 int old_fsuid, old_fsgid;
364 kernel_cap_t old_cap;
367 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */
370 old_fsuid = current->fsuid;
371 old_fsgid = current->fsgid;
372 old_cap = current->cap_effective;
374 current->fsuid = current->uid;
375 current->fsgid = current->gid;
378 * Clear the capabilities if we switch to a non-root user
380 * FIXME: There is a race here against sys_capset. The
381 * capabilities can change yet we will restore the old
382 * value below. We should hold task_capabilities_lock,
383 * but we cannot because user_path_walk can sleep.
386 cap_clear(current->cap_effective);
388 current->cap_effective = current->cap_permitted;
390 res = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
394 res = vfs_permission(&nd, mode);
395 /* SuS v2 requires we report a read only fs too */
396 if(res || !(mode & S_IWOTH) ||
397 special_file(nd.dentry->d_inode->i_mode))
398 goto out_path_release;
400 if(IS_RDONLY(nd.dentry->d_inode))
406 current->fsuid = old_fsuid;
407 current->fsgid = old_fsgid;
408 current->cap_effective = old_cap;
413 asmlinkage long sys_access(const char __user *filename, int mode)
415 return sys_faccessat(AT_FDCWD, filename, mode);
418 asmlinkage long sys_chdir(const char __user * filename)
423 error = __user_walk(filename,
424 LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd);
428 error = vfs_permission(&nd, MAY_EXEC);
432 set_fs_pwd(current->fs, nd.mnt, nd.dentry);
440 asmlinkage long sys_fchdir(unsigned int fd)
443 struct dentry *dentry;
445 struct vfsmount *mnt;
453 dentry = file->f_path.dentry;
454 mnt = file->f_path.mnt;
455 inode = dentry->d_inode;
458 if (!S_ISDIR(inode->i_mode))
461 error = file_permission(file, MAY_EXEC);
463 set_fs_pwd(current->fs, mnt, dentry);
470 asmlinkage long sys_chroot(const char __user * filename)
475 error = __user_walk(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
479 error = vfs_permission(&nd, MAY_EXEC);
484 if (!capable(CAP_SYS_CHROOT))
487 set_fs_root(current->fs, nd.mnt, nd.dentry);
496 asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
498 struct inode * inode;
499 struct dentry * dentry;
502 struct iattr newattrs;
508 dentry = file->f_path.dentry;
509 inode = dentry->d_inode;
511 audit_inode(NULL, inode);
514 if (IS_RDONLY(inode))
517 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
519 mutex_lock(&inode->i_mutex);
520 if (mode == (mode_t) -1)
521 mode = inode->i_mode;
522 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
523 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
524 err = notify_change(dentry, &newattrs);
525 mutex_unlock(&inode->i_mutex);
533 asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
537 struct inode * inode;
539 struct iattr newattrs;
541 error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd);
544 inode = nd.dentry->d_inode;
547 if (IS_RDONLY(inode))
551 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
554 mutex_lock(&inode->i_mutex);
555 if (mode == (mode_t) -1)
556 mode = inode->i_mode;
557 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
558 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
559 error = notify_change(nd.dentry, &newattrs);
560 mutex_unlock(&inode->i_mutex);
568 asmlinkage long sys_chmod(const char __user *filename, mode_t mode)
570 return sys_fchmodat(AT_FDCWD, filename, mode);
573 static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
575 struct inode * inode;
577 struct iattr newattrs;
580 if (!(inode = dentry->d_inode)) {
581 printk(KERN_ERR "chown_common: NULL inode\n");
585 if (IS_RDONLY(inode))
588 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
590 newattrs.ia_valid = ATTR_CTIME;
591 if (user != (uid_t) -1) {
592 newattrs.ia_valid |= ATTR_UID;
593 newattrs.ia_uid = user;
595 if (group != (gid_t) -1) {
596 newattrs.ia_valid |= ATTR_GID;
597 newattrs.ia_gid = group;
599 if (!S_ISDIR(inode->i_mode))
600 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
601 mutex_lock(&inode->i_mutex);
602 error = notify_change(dentry, &newattrs);
603 mutex_unlock(&inode->i_mutex);
608 asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
613 error = user_path_walk(filename, &nd);
616 error = chown_common(nd.dentry, user, group);
622 asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
623 gid_t group, int flag)
629 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
632 follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;
633 error = __user_walk_fd(dfd, filename, follow, &nd);
636 error = chown_common(nd.dentry, user, group);
642 asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group)
647 error = user_path_walk_link(filename, &nd);
650 error = chown_common(nd.dentry, user, group);
657 asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
661 struct dentry * dentry;
667 dentry = file->f_path.dentry;
668 audit_inode(NULL, dentry->d_inode);
669 error = chown_common(dentry, user, group);
675 static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
676 int flags, struct file *f,
677 int (*open)(struct inode *, struct file *))
683 f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK |
684 FMODE_PREAD | FMODE_PWRITE;
685 inode = dentry->d_inode;
686 if (f->f_mode & FMODE_WRITE) {
687 error = get_write_access(inode);
692 f->f_mapping = inode->i_mapping;
693 f->f_path.dentry = dentry;
696 f->f_op = fops_get(inode->i_fop);
697 file_move(f, &inode->i_sb->s_files);
699 if (!open && f->f_op)
700 open = f->f_op->open;
702 error = open(inode, f);
707 f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
709 file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping);
711 /* NB: we're sure to have correct a_ops only after f_op->open */
712 if (f->f_flags & O_DIRECT) {
713 if (!f->f_mapping->a_ops ||
714 ((!f->f_mapping->a_ops->direct_IO) &&
715 (!f->f_mapping->a_ops->get_xip_page))) {
717 f = ERR_PTR(-EINVAL);
725 if (f->f_mode & FMODE_WRITE)
726 put_write_access(inode);
728 f->f_path.dentry = NULL;
729 f->f_path.mnt = NULL;
734 return ERR_PTR(error);
738 * Note that while the flag value (low two bits) for sys_open means:
744 * 00 - no permissions needed
745 * 01 - read-permission
746 * 10 - write-permission
748 * for the internal routines (ie open_namei()/follow_link() etc). 00 is
751 static struct file *do_filp_open(int dfd, const char *filename, int flags,
754 int namei_flags, error;
758 if ((namei_flags+1) & O_ACCMODE)
761 error = open_namei(dfd, filename, namei_flags, mode, &nd);
763 return nameidata_to_filp(&nd, flags);
765 return ERR_PTR(error);
768 struct file *filp_open(const char *filename, int flags, int mode)
770 return do_filp_open(AT_FDCWD, filename, flags, mode);
772 EXPORT_SYMBOL(filp_open);
775 * lookup_instantiate_filp - instantiates the open intent filp
776 * @nd: pointer to nameidata
777 * @dentry: pointer to dentry
778 * @open: open callback
780 * Helper for filesystems that want to use lookup open intents and pass back
781 * a fully instantiated struct file to the caller.
782 * This function is meant to be called from within a filesystem's
784 * Beware of calling it for non-regular files! Those ->open methods might block
785 * (e.g. in fifo_open), leaving you with parent locked (and in case of fifo,
786 * leading to a deadlock, as nobody can open that fifo anymore, because
787 * another process to open fifo will block on locked parent when doing lookup).
788 * Note that in case of error, nd->intent.open.file is destroyed, but the
789 * path information remains valid.
790 * If the open callback is set to NULL, then the standard f_op->open()
791 * filesystem callback is substituted.
793 struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
794 int (*open)(struct inode *, struct file *))
796 if (IS_ERR(nd->intent.open.file))
800 nd->intent.open.file = __dentry_open(dget(dentry), mntget(nd->mnt),
801 nd->intent.open.flags - 1,
802 nd->intent.open.file,
805 return nd->intent.open.file;
807 release_open_intent(nd);
808 nd->intent.open.file = (struct file *)dentry;
811 EXPORT_SYMBOL_GPL(lookup_instantiate_filp);
814 * nameidata_to_filp - convert a nameidata to an open filp.
815 * @nd: pointer to nameidata
818 * Note that this function destroys the original nameidata
820 struct file *nameidata_to_filp(struct nameidata *nd, int flags)
824 /* Pick up the filp from the open intent */
825 filp = nd->intent.open.file;
826 /* Has the filesystem initialised the file for us? */
827 if (filp->f_path.dentry == NULL)
828 filp = __dentry_open(nd->dentry, nd->mnt, flags, filp, NULL);
835 * dentry_open() will have done dput(dentry) and mntput(mnt) if it returns an
838 struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
844 f = get_empty_filp();
848 return ERR_PTR(error);
851 return __dentry_open(dentry, mnt, flags, f, NULL);
853 EXPORT_SYMBOL(dentry_open);
856 * Find an empty file descriptor entry, and mark it busy.
858 int get_unused_fd_flags(int flags)
860 struct files_struct * files = current->files;
865 spin_lock(&files->file_lock);
868 fdt = files_fdtable(files);
869 fd = find_next_zero_bit(fdt->open_fds->fds_bits, fdt->max_fds,
873 * N.B. For clone tasks sharing a files structure, this test
874 * will limit the total number of files that can be opened.
876 if (fd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
879 /* Do we need to expand the fd array or fd set? */
880 error = expand_files(files, fd);
886 * If we needed to expand the fs array we
887 * might have blocked - try again.
893 FD_SET(fd, fdt->open_fds);
894 if (flags & O_CLOEXEC)
895 FD_SET(fd, fdt->close_on_exec);
897 FD_CLR(fd, fdt->close_on_exec);
898 files->next_fd = fd + 1;
901 if (fdt->fd[fd] != NULL) {
902 printk(KERN_WARNING "get_unused_fd: slot %d not NULL!\n", fd);
909 spin_unlock(&files->file_lock);
913 int get_unused_fd(void)
915 return get_unused_fd_flags(0);
918 EXPORT_SYMBOL(get_unused_fd);
920 static void __put_unused_fd(struct files_struct *files, unsigned int fd)
922 struct fdtable *fdt = files_fdtable(files);
923 __FD_CLR(fd, fdt->open_fds);
924 if (fd < files->next_fd)
928 void fastcall put_unused_fd(unsigned int fd)
930 struct files_struct *files = current->files;
931 spin_lock(&files->file_lock);
932 __put_unused_fd(files, fd);
933 spin_unlock(&files->file_lock);
936 EXPORT_SYMBOL(put_unused_fd);
939 * Install a file pointer in the fd array.
941 * The VFS is full of places where we drop the files lock between
942 * setting the open_fds bitmap and installing the file in the file
943 * array. At any such point, we are vulnerable to a dup2() race
944 * installing a file in the array before us. We need to detect this and
945 * fput() the struct file we are about to overwrite in this case.
947 * It should never happen - if we allow dup2() do it, _really_ bad things
951 void fastcall fd_install(unsigned int fd, struct file * file)
953 struct files_struct *files = current->files;
955 spin_lock(&files->file_lock);
956 fdt = files_fdtable(files);
957 BUG_ON(fdt->fd[fd] != NULL);
958 rcu_assign_pointer(fdt->fd[fd], file);
959 spin_unlock(&files->file_lock);
962 EXPORT_SYMBOL(fd_install);
964 long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
966 char *tmp = getname(filename);
967 int fd = PTR_ERR(tmp);
970 fd = get_unused_fd_flags(flags);
972 struct file *f = do_filp_open(dfd, tmp, flags, mode);
977 fsnotify_open(f->f_path.dentry);
986 asmlinkage long sys_open(const char __user *filename, int flags, int mode)
990 if (force_o_largefile())
991 flags |= O_LARGEFILE;
993 ret = do_sys_open(AT_FDCWD, filename, flags, mode);
994 /* avoid REGPARM breakage on x86: */
995 prevent_tail_call(ret);
998 EXPORT_SYMBOL_GPL(sys_open);
1000 asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
1005 if (force_o_largefile())
1006 flags |= O_LARGEFILE;
1008 ret = do_sys_open(dfd, filename, flags, mode);
1009 /* avoid REGPARM breakage on x86: */
1010 prevent_tail_call(ret);
1017 * For backward compatibility? Maybe this should be moved
1018 * into arch/i386 instead?
1020 asmlinkage long sys_creat(const char __user * pathname, int mode)
1022 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
1028 * "id" is the POSIX thread ID. We use the
1029 * files pointer for this..
1031 int filp_close(struct file *filp, fl_owner_t id)
1035 if (!file_count(filp)) {
1036 printk(KERN_ERR "VFS: Close: file count is 0\n");
1040 if (filp->f_op && filp->f_op->flush)
1041 retval = filp->f_op->flush(filp, id);
1043 dnotify_flush(filp, id);
1044 locks_remove_posix(filp, id);
1049 EXPORT_SYMBOL(filp_close);
1052 * Careful here! We test whether the file pointer is NULL before
1053 * releasing the fd. This ensures that one clone task can't release
1054 * an fd while another clone is opening it.
1056 asmlinkage long sys_close(unsigned int fd)
1059 struct files_struct *files = current->files;
1060 struct fdtable *fdt;
1063 spin_lock(&files->file_lock);
1064 fdt = files_fdtable(files);
1065 if (fd >= fdt->max_fds)
1070 rcu_assign_pointer(fdt->fd[fd], NULL);
1071 FD_CLR(fd, fdt->close_on_exec);
1072 __put_unused_fd(files, fd);
1073 spin_unlock(&files->file_lock);
1074 retval = filp_close(filp, files);
1076 /* can't restart close syscall because file table entry was cleared */
1077 if (unlikely(retval == -ERESTARTSYS ||
1078 retval == -ERESTARTNOINTR ||
1079 retval == -ERESTARTNOHAND ||
1080 retval == -ERESTART_RESTARTBLOCK))
1086 spin_unlock(&files->file_lock);
1090 EXPORT_SYMBOL(sys_close);
1093 * This routine simulates a hangup on the tty, to arrange that users
1094 * are given clean terminals at login time.
1096 asmlinkage long sys_vhangup(void)
1098 if (capable(CAP_SYS_TTY_CONFIG)) {
1099 /* XXX: this needs locking */
1100 tty_vhangup(current->signal->tty);
1107 * Called when an inode is about to be open.
1108 * We use this to disallow opening large files on 32bit systems if
1109 * the caller didn't specify O_LARGEFILE. On 64bit systems we force
1110 * on this flag in sys_open.
1112 int generic_file_open(struct inode * inode, struct file * filp)
1114 if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
1119 EXPORT_SYMBOL(generic_file_open);
1122 * This is used by subsystems that don't want seekable
1125 int nonseekable_open(struct inode *inode, struct file *filp)
1127 filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
1131 EXPORT_SYMBOL(nonseekable_open);