예제 #1
0
파일: zpl_ctldir.c 프로젝트: awein/zfs
static int
zpl_shares_iterate(struct file *filp, struct dir_context *ctx)
{
	fstrans_cookie_t cookie;
	cred_t *cr = CRED();
	zfs_sb_t *zsb = ITOZSB(filp->f_path.dentry->d_inode);
	znode_t *dzp;
	int error = 0;

	ZFS_ENTER(zsb);
	cookie = spl_fstrans_mark();

	if (zsb->z_shares_dir == 0) {
		dir_emit_dots(filp, ctx);
		goto out;
	}

	error = -zfs_zget(zsb, zsb->z_shares_dir, &dzp);
	if (error)
		goto out;

	crhold(cr);
	error = -zfs_readdir(ZTOI(dzp), ctx, cr);
	crfree(cr);

	VN_RELE(ZTOV(dzp));

out:
	spl_fstrans_unmark(cookie);
	ZFS_EXIT(zsb);
	ASSERT3S(error, <=, 0);

	return (error);
}
예제 #2
0
파일: zpl_file.c 프로젝트: shenyan1/zfs
static int
zpl_iterate(struct file *filp, struct dir_context *ctx)
{
	struct dentry *dentry = filp->f_path.dentry;
	cred_t *cr = CRED();
	int error;

	crhold(cr);
	error = -zfs_readdir(dentry->d_inode, ctx, cr);
	crfree(cr);
	ASSERT3S(error, <=, 0);

	return (error);
}
예제 #3
0
파일: zpl_file.c 프로젝트: krichter722/zfs
static int
zpl_iterate(struct file *filp, struct dir_context *ctx)
{
	cred_t *cr = CRED();
	int error;
	fstrans_cookie_t cookie;

	crhold(cr);
	cookie = spl_fstrans_mark();
	error = -zfs_readdir(file_inode(filp), ctx, cr);
	spl_fstrans_unmark(cookie);
	crfree(cr);
	ASSERT3S(error, <=, 0);

	return (error);
}
예제 #4
0
파일: zpl_xattr.c 프로젝트: krauter/zfs-1
static ssize_t
zpl_xattr_list_dir(xattr_filldir_t *xf, cred_t *cr)
{
	struct inode *ip = xf->inode;
	struct inode *dxip = NULL;
	int error;

	/* Lookup the xattr directory */
	error = -zfs_lookup(ip, NULL, &dxip, LOOKUP_XATTR, cr, NULL, NULL);
	if (error) {
		if (error == -ENOENT)
			error = 0;

		return (error);
	}

	/* Fill provided buffer via zpl_zattr_filldir helper */
	error = -zfs_readdir(dxip, (void *)xf, zpl_xattr_filldir, &pos, cr);
	VN_RELE(dxip);

	return (error);
}