static ssize_t cifs_read_wrapper(struct file * file, char __user *read_data, size_t read_size, loff_t * poffset) { if(file->f_dentry == NULL) return -EIO; else if(file->f_dentry->d_inode == NULL) return -EIO; cFYI(1,("In read_wrapper size %zd at %lld",read_size,*poffset)); if(CIFS_I(file->f_dentry->d_inode)->clientCanCacheRead) { return generic_file_read(file,read_data,read_size,poffset); } else { /* BB do we need to lock inode from here until after invalidate? */ /* if(file->f_dentry->d_inode->i_mapping) { filemap_fdatawrite(file->f_dentry->d_inode->i_mapping); filemap_fdatawait(file->f_dentry->d_inode->i_mapping); }*/ /* cifs_revalidate(file->f_dentry);*/ /* BB fixme */ /* BB we should make timer configurable - perhaps by simply calling cifs_revalidate here */ /* invalidate_remote_inode(file->f_dentry->d_inode);*/ return generic_file_read(file,read_data,read_size,poffset); } }
static ssize_t HgfsRead(struct file *file, // IN: File to read from char __user *buf, // OUT: User buffer to copy data into size_t count, // IN: Number of bytes to read loff_t *offset) // IN: Offset at which to read { int result; ASSERT(file); ASSERT(file->f_dentry); ASSERT(buf); ASSERT(offset); LOG(6, (KERN_DEBUG "VMware hgfs: HgfsRead: read %Zu bytes from fh %u " "at offset %Lu\n", count, FILE_GET_FI_P(file)->handle, *offset)); result = HgfsRevalidate(file->f_dentry); if (result) { LOG(4, (KERN_DEBUG "VMware hgfs: HgfsRead: invalid dentry\n")); goto out; } result = generic_file_read(file, buf, count, offset); out: return result; }
static ssize_t cifs_read_wrapper(struct file * file, char __user *read_data, size_t read_size, loff_t * poffset) { if(file == NULL) return -EIO; else if(file->f_dentry == NULL) return -EIO; else if(file->f_dentry->d_inode == NULL) return -EIO; cFYI(1,("In read_wrapper size %zd at %lld",read_size,*poffset)); #ifdef CONFIG_CIFS_EXPERIMENTAL /* check whether we can cache writes locally */ if(file->f_dentry->d_sb) { struct cifs_sb_info *cifs_sb; cifs_sb = CIFS_SB(file->f_dentry->d_sb); if(cifs_sb != NULL) { if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) return cifs_user_read(file,read_data, read_size,poffset); } } #endif /* CIFS_EXPERIMENTAL */ if(CIFS_I(file->f_dentry->d_inode)->clientCanCacheRead) { return generic_file_read(file,read_data,read_size,poffset); } else { /* BB do we need to lock inode from here until after invalidate? */ /* if(file->f_dentry->d_inode->i_mapping) { filemap_fdatawrite(file->f_dentry->d_inode->i_mapping); filemap_fdatawait(file->f_dentry->d_inode->i_mapping); }*/ /* cifs_revalidate(file->f_dentry);*/ /* BB fixme */ /* BB we should make timer configurable - perhaps by simply calling cifs_revalidate here */ /* invalidate_remote_inode(file->f_dentry->d_inode);*/ return generic_file_read(file,read_data,read_size,poffset); } }
static ssize_t nfs_file_read(struct file * file, char * buf, size_t count, loff_t *ppos) { struct dentry * dentry = file->f_dentry; ssize_t result; dfprintk(VFS, "nfs: read(%s/%s, %lu@%lu)\n", dentry->d_parent->d_name.name, dentry->d_name.name, (unsigned long) count, (unsigned long) *ppos); result = nfs_revalidate_inode(NFS_DSERVER(dentry), dentry); if (!result) result = generic_file_read(file, buf, count, ppos); return result; }
ssize_t xixfs_file_read( struct file *filp, char __user *buf, size_t count, loff_t *ppos ) { #if LINUX_VERSION_25_ABOVE struct address_space *mapping = filp->f_mapping; #else struct address_space *mapping = filp->f_dentry->d_inode->i_mapping; #endif struct inode *inode = mapping->host; PXIXFS_LINUX_FCB pFCB = NULL; ssize_t ret = 0; XIXCORE_ASSERT(inode); pFCB = XIXFS_I(inode); XIXFS_ASSERT_FCB(pFCB); DebugTrace(DEBUG_LEVEL_TRACE, (DEBUG_TARGET_FCB|DEBUG_TARGET_VFSAPIT), ("ENTER xixfs_file_read (%s).\n", filp->f_dentry->d_name.name)); if(XIXCORE_TEST_FLAGS( pFCB->XixcoreFcb.FCBFlags, XIXCORE_FCB_CHANGE_DELETED )){ DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL, ("ERROR DELETED FILE \n")); //printk(KERN_DEBUG "xixfs_file_read ERROR\n"); return -EPERM; } //ret = do_sync_read(filp, buf, count, ppos); #if LINUX_VERSION_2_6_19_REPLACE_INTERFACE ret = do_sync_read(filp, buf, count, ppos); #else ret = generic_file_read(filp, buf, count, ppos); #endif //printk(KERN_DEBUG "xixfs_file_read ret (0x%x)\n", ret); return ret; }
static ssize_t smb_file_read(struct file * file, char * buf, size_t count, loff_t *ppos) { struct dentry * dentry = file->f_dentry; ssize_t status; VERBOSE("file %s/%s, count=%lu@%lu\n", DENTRY_PATH(dentry), (unsigned long) count, (unsigned long) *ppos); status = smb_revalidate_inode(dentry); if (status) { PARANOIA("%s/%s validation failed, error=%Zd\n", DENTRY_PATH(dentry), status); goto out; } VERBOSE("before read, size=%ld, flags=%x, atime=%ld\n", (long)dentry->d_inode->i_size, dentry->d_inode->i_flags, dentry->d_inode->i_atime); status = generic_file_read(file, buf, count, ppos); out: return status; }
ssize_t /* bytes read, or (-) error */ xfs_read( bhv_desc_t *bdp, struct file *file, char *buf, size_t size, loff_t *offset, int ioflags, cred_t *credp) { ssize_t ret; xfs_fsize_t n; xfs_inode_t *ip; xfs_mount_t *mp; ip = XFS_BHVTOI(bdp); mp = ip->i_mount; XFS_STATS_INC(xs_read_calls); if (unlikely(ioflags & IO_ISDIRECT)) { if ((ssize_t)size < 0) return -XFS_ERROR(EINVAL); if (((__psint_t)buf & BBMASK) || (*offset & mp->m_blockmask) || (size & mp->m_blockmask)) { if (*offset >= ip->i_d.di_size) { return (0); } return -XFS_ERROR(EINVAL); } } n = XFS_MAXIOFFSET(mp) - *offset; if ((n <= 0) || (size == 0)) return 0; if (n < size) size = n; if (XFS_FORCED_SHUTDOWN(mp)) { return -EIO; } if (!(ioflags & IO_ISLOCKED)) xfs_ilock(ip, XFS_IOLOCK_SHARED); if (DM_EVENT_ENABLED(BHV_TO_VNODE(bdp)->v_vfsp, ip, DM_EVENT_READ) && !(ioflags & IO_INVIS)) { int error; vrwlock_t locktype = VRWLOCK_READ; int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags); error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), *offset, size, dmflags, &locktype); if (error) { if (!(ioflags & IO_ISLOCKED)) xfs_iunlock(ip, XFS_IOLOCK_SHARED); return -error; } } if (unlikely(ioflags & IO_ISDIRECT)) { xfs_rw_enter_trace(XFS_DIORD_ENTER, &ip->i_iocore, buf, size, *offset, ioflags); ret = (*offset < ip->i_d.di_size) ? do_generic_direct_read(file, buf, size, offset) : 0; UPDATE_ATIME(file->f_dentry->d_inode); } else { xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore, buf, size, *offset, ioflags); ret = generic_file_read(file, buf, size, offset); } if (ret > 0) XFS_STATS_ADD(xs_read_bytes, ret); if (!(ioflags & IO_ISLOCKED)) xfs_iunlock(ip, XFS_IOLOCK_SHARED); if (unlikely(ioflags & IO_INVIS)) { /* generic_file_read updates the atime but we need to * undo that because this I/O was supposed to be invisible. */ struct inode *inode = LINVFS_GET_IP(BHV_TO_VNODE(bdp)); inode->i_atime = ip->i_d.di_atime.t_sec; } else { xfs_ichgtime(ip, XFS_ICHGTIME_ACC); } return ret; }