Ejemplo n.º 1
0
static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin)
{
	struct gfs2_inode *ip = GFS2_I(file->f_mapping->host);
	struct gfs2_holder i_gh;
	loff_t error;

	if (origin == 2) {
		error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
					   &i_gh);
		if (!error) {
			error = generic_file_llseek_unlocked(file, offset, origin);
			gfs2_glock_dq_uninit(&i_gh);
		}
	} else
		error = generic_file_llseek_unlocked(file, offset, origin);

	return error;
}
Ejemplo n.º 2
0
/**
 * generic_file_llseek - generic llseek implementation for regular files
 * @file:	file structure to seek on
 * @offset:	file offset to seek to
 * @origin:	type of seek
 *
 * This is a generic implemenation of ->llseek useable for all normal local
 * filesystems.  It just updates the file offset to the value specified by
 * @offset and @origin under i_mutex.
 */
loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
{
	loff_t rval;

	mutex_lock(&file->f_dentry->d_inode->i_mutex);
	rval = generic_file_llseek_unlocked(file, offset, origin);
	mutex_unlock(&file->f_dentry->d_inode->i_mutex);

	return rval;
}
Ejemplo n.º 3
0
Archivo: file.c Proyecto: macan/SVFS
static
loff_t svfs_file_llseek(struct file *file, loff_t offset, int origin)
{
	loff_t n;
    svfs_entry(mdc, "offset %ld, origin %d\n", 
               (unsigned long)offset, origin);
	mutex_lock(&file->f_dentry->d_inode->i_mutex);
	n = generic_file_llseek_unlocked(file, offset, origin);
	mutex_unlock(&file->f_dentry->d_inode->i_mutex);
	return n;
}
Ejemplo n.º 4
0
static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
{
	loff_t loff;

	dprintk("NFS: llseek file(%s/%s, %lld, %d)\n",
			filp->f_path.dentry->d_parent->d_name.name,
			filp->f_path.dentry->d_name.name,
			offset, origin);

	/* origin == SEEK_END => we must revalidate the cached file length */
	if (origin == SEEK_END) {
		struct inode *inode = filp->f_mapping->host;

		int retval = nfs_revalidate_file_size(inode, filp);
		if (retval < 0)
			return (loff_t)retval;

		spin_lock(&inode->i_lock);
		loff = generic_file_llseek_unlocked(filp, offset, origin);
		spin_unlock(&inode->i_lock);
	} else
		loff = generic_file_llseek_unlocked(filp, offset, origin);
	return loff;
}
Ejemplo n.º 5
0
static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{
    /* origin == SEEK_END => we must revalidate the cached file length */
    if (origin == SEEK_END) {
        int retval;

        /* some applications poll for the file length in this strange
           way so we must seek to end on non-oplocked files by
           setting the revalidate time to zero */
        CIFS_I(file->f_path.dentry->d_inode)->time = 0;

        retval = cifs_revalidate_file(file);
        if (retval < 0)
            return (loff_t)retval;
    }
    return generic_file_llseek_unlocked(file, offset, origin);
}