dir.c (549177863bac22f23663ee9f70c4e3b9fb269f2c) dir.c (b84e06c58fdefdc42931f771dc295e63f4b27365)
1/*
2 * linux/fs/nfs/dir.c
3 *
4 * Copyright (C) 1992 Rick Sladkey
5 *
6 * nfs directory handling functions
7 *
8 * 10 Apr 1996 Added silly rename for unlink --okir

--- 589 unchanged lines hidden (view full) ---

598 dfprintk(VFS, "NFS: readdir(%s/%s) returns %ld\n",
599 dentry->d_parent->d_name.name, dentry->d_name.name,
600 res);
601 return res;
602}
603
604static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
605{
1/*
2 * linux/fs/nfs/dir.c
3 *
4 * Copyright (C) 1992 Rick Sladkey
5 *
6 * nfs directory handling functions
7 *
8 * 10 Apr 1996 Added silly rename for unlink --okir

--- 589 unchanged lines hidden (view full) ---

598 dfprintk(VFS, "NFS: readdir(%s/%s) returns %ld\n",
599 dentry->d_parent->d_name.name, dentry->d_name.name,
600 res);
601 return res;
602}
603
604static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
605{
606 mutex_lock(&filp->f_path.dentry->d_inode->i_mutex);
606 struct dentry *dentry = filp->f_path.dentry;
607 struct inode *inode = dentry->d_inode;
608
609 dfprintk(VFS, "NFS: llseek dir(%s/%s, %lld, %d)\n",
610 dentry->d_parent->d_name.name,
611 dentry->d_name.name,
612 offset, origin);
613
614 mutex_lock(&inode->i_mutex);
607 switch (origin) {
608 case 1:
609 offset += filp->f_pos;
610 case 0:
611 if (offset >= 0)
612 break;
613 default:
614 offset = -EINVAL;
615 goto out;
616 }
617 if (offset != filp->f_pos) {
618 filp->f_pos = offset;
619 nfs_file_open_context(filp)->dir_cookie = 0;
620 }
621out:
615 switch (origin) {
616 case 1:
617 offset += filp->f_pos;
618 case 0:
619 if (offset >= 0)
620 break;
621 default:
622 offset = -EINVAL;
623 goto out;
624 }
625 if (offset != filp->f_pos) {
626 filp->f_pos = offset;
627 nfs_file_open_context(filp)->dir_cookie = 0;
628 }
629out:
622 mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex);
630 mutex_unlock(&inode->i_mutex);
623 return offset;
624}
625
626/*
627 * All directory operations under NFS are synchronous, so fsync()
628 * is a dummy operation.
629 */
630static int nfs_fsync_dir(struct file *filp, struct dentry *dentry, int datasync)

--- 1365 unchanged lines hidden ---
631 return offset;
632}
633
634/*
635 * All directory operations under NFS are synchronous, so fsync()
636 * is a dummy operation.
637 */
638static int nfs_fsync_dir(struct file *filp, struct dentry *dentry, int datasync)

--- 1365 unchanged lines hidden ---