示例#1
0
int
xfs_getinode(struct vfs *vfsp, dev_t dev, ino_t inode, struct xfs_inode **ipp)
{
    struct xfs_inode *ip;
    int error;

    if (!vfsp) {
	vfsp = vfs_devsearch(dev, xfs_fstype);
	if (!vfsp) {
	    SET_XFS_ERROR(1, dev, inode);
	    return ENXIO;
	}
    }

    if (error = xfs_iget((((struct mount *)
			   ((vfsp)->vfs_bh.bh_first)->bd_pdata)), (void *)0,
			 (xfs_ino_t) inode, XFS_ILOCK_SHARED, &ip,
			 (daddr_t) 0)) {
	SET_XFS_ERROR(3, vfsp->vfs_dev, inode);
	return error;
    }

    *ipp = ip;
    return 0;
}
示例#2
0
/*
 * xfs_get_block_size()
 *	This routine determines the block size of the given
 *	file system copies it to the user memory pointed at by fs_size.
 *
 * RETURNS:
 *	0 on success
 *	non zero on failure
 */
int
xfs_get_block_size(
	sysarg_t sysarg_fs_dev, 
	sysarg_t sysarg_fs_size)
{
	int 		error = 0;
	dev_t		fs_dev;
	xfs_caddr_t		fs_size;
	struct vfs	*vfsp;

	fs_dev 		= (dev_t)sysarg_fs_dev;
	fs_size		= (xfs_caddr_t)SYSARG_TO_PTR(sysarg_fs_size);

	if ( vfsp = vfs_devsearch( fs_dev, xfs_fstype ) ) {
		if (copy_to_user((xfs_caddr_t)fs_size, &(vfsp->vfs_bsize), 
				sizeof(u_int)) ) {

			error = -XFS_ERROR(EFAULT);
		}
	} else {
		error = -XFS_ERROR( EIO );
	}
	return( error );
}