Commit 67fcaa73 authored by Nathan Scott's avatar Nathan Scott
Browse files

[XFS] Resolve a namespace collision on vnode/vnodeops for FreeBSD porters.



SGI-PV: 953338
SGI-Modid: xfs-linux-melb:xfs-kern:26107a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent b83bd138
......@@ -76,7 +76,7 @@ xfs_page_trace(
int mask)
{
xfs_inode_t *ip;
vnode_t *vp = vn_from_inode(inode);
bhv_vnode_t *vp = vn_from_inode(inode);
loff_t isize = i_size_read(inode);
loff_t offset = page_offset(page);
int delalloc = -1, unmapped = -1, unwritten = -1;
......@@ -181,13 +181,12 @@ xfs_end_bio_unwritten(
void *data)
{
xfs_ioend_t *ioend = data;
vnode_t *vp = ioend->io_vnode;
bhv_vnode_t *vp = ioend->io_vnode;
xfs_off_t offset = ioend->io_offset;
size_t size = ioend->io_size;
int error;
if (likely(!ioend->io_error))
VOP_BMAP(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL, error);
bhv_vop_bmap(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL);
xfs_destroy_ioend(ioend);
}
......@@ -240,10 +239,10 @@ xfs_map_blocks(
xfs_iomap_t *mapp,
int flags)
{
vnode_t *vp = vn_from_inode(inode);
bhv_vnode_t *vp = vn_from_inode(inode);
int error, nmaps = 1;
VOP_BMAP(vp, offset, count, flags, mapp, &nmaps, error);
error = bhv_vop_bmap(vp, offset, count, flags, mapp, &nmaps);
if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)))
VMODIFY(vp);
return -error;
......@@ -1162,7 +1161,7 @@ xfs_vm_writepages(
struct address_space *mapping,
struct writeback_control *wbc)
{
struct vnode *vp = vn_from_inode(mapping->host);
struct bhv_vnode *vp = vn_from_inode(mapping->host);
if (VN_TRUNC(vp))
VUNTRUNCATE(vp);
......@@ -1242,7 +1241,7 @@ __xfs_get_blocks(
int direct,
bmapi_flags_t flags)
{
vnode_t *vp = vn_from_inode(inode);
bhv_vnode_t *vp = vn_from_inode(inode);
xfs_iomap_t iomap;
xfs_off_t offset;
ssize_t size;
......@@ -1252,8 +1251,8 @@ __xfs_get_blocks(
offset = (xfs_off_t)iblock << inode->i_blkbits;
ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
size = bh_result->b_size;
VOP_BMAP(vp, offset, size,
create ? flags : BMAPI_READ, &iomap, &niomap, error);
error = bhv_vop_bmap(vp, offset, size,
create ? flags : BMAPI_READ, &iomap, &niomap);
if (error)
return -error;
if (niomap == 0)
......@@ -1381,13 +1380,13 @@ xfs_vm_direct_IO(
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
vnode_t *vp = vn_from_inode(inode);
bhv_vnode_t *vp = vn_from_inode(inode);
xfs_iomap_t iomap;
int maps = 1;
int error;
ssize_t ret;
VOP_BMAP(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps, error);
error = bhv_vop_bmap(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps);
if (error)
return -error;
......@@ -1420,14 +1419,12 @@ xfs_vm_bmap(
sector_t block)
{
struct inode *inode = (struct inode *)mapping->host;
vnode_t *vp = vn_from_inode(inode);
int error;
bhv_vnode_t *vp = vn_from_inode(inode);
vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
VOP_RWLOCK(vp, VRWLOCK_READ);
VOP_FLUSH_PAGES(vp, (xfs_off_t)0, -1, 0, FI_REMAPF, error);
VOP_RWUNLOCK(vp, VRWLOCK_READ);
bhv_vop_rwlock(vp, VRWLOCK_READ);
bhv_vop_flush_pages(vp, (xfs_off_t)0, -1, 0, FI_REMAPF);
bhv_vop_rwunlock(vp, VRWLOCK_READ);
return generic_block_bmap(mapping, block, xfs_get_blocks);
}
......
......@@ -32,7 +32,7 @@ typedef struct xfs_ioend {
unsigned int io_type; /* delalloc / unwritten */
int io_error; /* I/O error code */
atomic_t io_remaining; /* hold count */
struct vnode *io_vnode; /* file being written to */
struct bhv_vnode *io_vnode; /* file being written to */
struct buffer_head *io_buffer_head;/* buffer linked list head */
struct buffer_head *io_buffer_tail;/* buffer linked list tail */
size_t io_size; /* size of the extent */
......
......@@ -136,7 +136,7 @@ xfs_fs_get_dentry(
struct super_block *sb,
void *data)
{
vnode_t *vp;
bhv_vnode_t *vp;
struct inode *inode;
struct dentry *result;
bhv_vfs_t *vfsp = vfs_from_sb(sb);
......@@ -160,12 +160,12 @@ xfs_fs_get_parent(
struct dentry *child)
{
int error;
vnode_t *vp, *cvp;
bhv_vnode_t *vp, *cvp;
struct dentry *parent;
cvp = NULL;
vp = vn_from_inode(child->d_inode);
VOP_LOOKUP(vp, &dotdot, &cvp, 0, NULL, NULL, error);
error = bhv_vop_lookup(vp, &dotdot, &cvp, 0, NULL, NULL);
if (unlikely(error))
return ERR_PTR(-error);
......
......@@ -58,15 +58,12 @@ __xfs_file_read(
{
struct iovec iov = {buf, count};
struct file *file = iocb->ki_filp;
vnode_t *vp = vn_from_inode(file->f_dentry->d_inode);
ssize_t rval;
bhv_vnode_t *vp = vn_from_inode(file->f_dentry->d_inode);
BUG_ON(iocb->ki_pos != pos);
if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT;
VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
return rval;
return bhv_vop_read(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL);
}
STATIC ssize_t
......@@ -100,15 +97,12 @@ __xfs_file_write(
struct iovec iov = {(void __user *)buf, count};
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
vnode_t *vp = vn_from_inode(inode);
ssize_t rval;
bhv_vnode_t *vp = vn_from_inode(inode);
BUG_ON(iocb->ki_pos != pos);
if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT;
VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
return rval;
return bhv_vop_write(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL);
}
STATIC ssize_t
......@@ -140,7 +134,7 @@ __xfs_file_readv(
loff_t *ppos)
{
struct inode *inode = file->f_mapping->host;
vnode_t *vp = vn_from_inode(inode);
bhv_vnode_t *vp = vn_from_inode(inode);
struct kiocb kiocb;
ssize_t rval;
......@@ -149,7 +143,8 @@ __xfs_file_readv(
if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT;
VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
rval = bhv_vop_read(vp, &kiocb, iov, nr_segs,
&kiocb.ki_pos, ioflags, NULL);
*ppos = kiocb.ki_pos;
return rval;
......@@ -184,7 +179,7 @@ __xfs_file_writev(
loff_t *ppos)
{
struct inode *inode = file->f_mapping->host;
vnode_t *vp = vn_from_inode(inode);
bhv_vnode_t *vp = vn_from_inode(inode);
struct kiocb kiocb;
ssize_t rval;
......@@ -193,7 +188,8 @@ __xfs_file_writev(
if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT;
VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
rval = bhv_vop_write(vp, &kiocb, iov, nr_segs,
&kiocb.ki_pos, ioflags, NULL);
*ppos = kiocb.ki_pos;
return rval;
......@@ -227,11 +223,8 @@ xfs_file_sendfile(
read_actor_t actor,
void *target)
{
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
ssize_t rval;
VOP_SENDFILE(vp, filp, pos, 0, count, actor, target, NULL, rval);
return rval;
return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode),
filp, pos, 0, count, actor, target, NULL);
}
STATIC ssize_t
......@@ -242,11 +235,8 @@ xfs_file_sendfile_invis(
read_actor_t actor,
void *target)
{
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
ssize_t rval;
VOP_SENDFILE(vp, filp, pos, IO_INVIS, count, actor, target, NULL, rval);
return rval;
return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode),
filp, pos, IO_INVIS, count, actor, target, NULL);
}
STATIC ssize_t
......@@ -257,11 +247,8 @@ xfs_file_splice_read(
size_t len,
unsigned int flags)
{
vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
ssize_t rval;
VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, 0, NULL, rval);
return rval;
return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode),
infilp, ppos, pipe, len, flags, 0, NULL);
}
STATIC ssize_t
......@@ -272,11 +259,9 @@ xfs_file_splice_read_invis(
size_t len,
unsigned int flags)
{
vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
ssize_t rval;
VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, IO_INVIS, NULL, rval);
return rval;
return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode),
infilp, ppos, pipe, len, flags, IO_INVIS,
NULL);
}
STATIC ssize_t
......@@ -287,11 +272,8 @@ xfs_file_splice_write(
size_t len,
unsigned int flags)
{
vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
ssize_t rval;
VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, 0, NULL, rval);
return rval;
return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode),
pipe, outfilp, ppos, len, flags, 0, NULL);
}
STATIC ssize_t
......@@ -302,11 +284,9 @@ xfs_file_splice_write_invis(
size_t len,
unsigned int flags)
{
vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
ssize_t rval;
VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, IO_INVIS, NULL, rval);
return rval;
return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode),
pipe, outfilp, ppos, len, flags, IO_INVIS,
NULL);
}
STATIC int
......@@ -314,24 +294,17 @@ xfs_file_open(
struct inode *inode,
struct file *filp)
{
vnode_t *vp = vn_from_inode(inode);
int error;
if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
return -EFBIG;
VOP_OPEN(vp, NULL, error);
return -error;
return -bhv_vop_open(vn_from_inode(inode), NULL);
}
STATIC int
xfs_file_close(
struct file *filp)
{
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
int error;
VOP_CLOSE(vp, 0, file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL, error);
return -error;
return -bhv_vop_close(vn_from_inode(filp->f_dentry->d_inode), 0,
file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL);
}
STATIC int
......@@ -339,12 +312,11 @@ xfs_file_release(
struct inode *inode,
struct file *filp)
{
vnode_t *vp = vn_from_inode(inode);
int error = 0;
bhv_vnode_t *vp = vn_from_inode(inode);
if (vp)
VOP_RELEASE(vp, error);
return -error;
return -bhv_vop_release(vp);
return 0;
}
STATIC int
......@@ -353,17 +325,14 @@ xfs_file_fsync(
struct dentry *dentry,
int datasync)
{
struct inode *inode = dentry->d_inode;
vnode_t *vp = vn_from_inode(inode);
int error;
bhv_vnode_t *vp = vn_from_inode(dentry->d_inode);
int flags = FSYNC_WAIT;
if (datasync)
flags |= FSYNC_DATA;
if (VN_TRUNC(vp))
VUNTRUNCATE(vp);
VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error);
return -error;
return -bhv_vop_fsync(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1);
}
#ifdef CONFIG_XFS_DMAPI
......@@ -374,7 +343,7 @@ xfs_vm_nopage(
int *type)
{
struct inode *inode = area->vm_file->f_dentry->d_inode;
vnode_t *vp = vn_from_inode(inode);
bhv_vnode_t *vp = vn_from_inode(inode);
ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), area, 0))
......@@ -390,7 +359,7 @@ xfs_file_readdir(
filldir_t filldir)
{
int error = 0;
vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
bhv_vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
uio_t uio;
iovec_t iov;
int eof = 0;
......@@ -425,7 +394,7 @@ xfs_file_readdir(
start_offset = uio.uio_offset;
VOP_READDIR(vp, &uio, NULL, &eof, error);
error = bhv_vop_readdir(vp, &uio, NULL, &eof);
if ((uio.uio_offset == start_offset) || error) {
size = 0;
break;
......@@ -475,18 +444,17 @@ xfs_file_mmap(
return 0;
}
STATIC long
xfs_file_ioctl(
struct file *filp,
unsigned int cmd,
unsigned long arg)
unsigned long p)
{
int error;
struct inode *inode = filp->f_dentry->d_inode;
vnode_t *vp = vn_from_inode(inode);
bhv_vnode_t *vp = vn_from_inode(inode);
VOP_IOCTL(vp, inode, filp, 0, cmd, (void __user *)arg, error);
error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p);
VMODIFY(vp);
/* NOTE: some of the ioctl's return positive #'s as a
......@@ -502,13 +470,13 @@ STATIC long
xfs_file_ioctl_invis(
struct file *filp,
unsigned int cmd,
unsigned long arg)
unsigned long p)
{
struct inode *inode = filp->f_dentry->d_inode;
vnode_t *vp = vn_from_inode(inode);
int error;
struct inode *inode = filp->f_dentry->d_inode;
bhv_vnode_t *vp = vn_from_inode(inode);
VOP_IOCTL(vp, inode, filp, IO_INVIS, cmd, (void __user *)arg, error);
error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p);
VMODIFY(vp);
/* NOTE: some of the ioctl's return positive #'s as a
......@@ -527,7 +495,7 @@ xfs_vm_mprotect(
struct vm_area_struct *vma,
unsigned int newflags)
{
vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode);
bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode);
int error = 0;
if (vp->v_vfsp->vfs_flag & VFS_DMI) {
......@@ -553,7 +521,7 @@ STATIC int
xfs_file_open_exec(
struct inode *inode)
{
vnode_t *vp = vn_from_inode(inode);
bhv_vnode_t *vp = vn_from_inode(inode);
xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
int error = 0;
xfs_inode_t *ip;
......
......@@ -28,7 +28,7 @@ fs_tosspages(
xfs_off_t last,
int fiopt)
{
vnode_t *vp = BHV_TO_VNODE(bdp);
bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
struct inode *ip = vn_to_inode(vp);
if (VN_CACHED(vp))
......@@ -42,7 +42,7 @@ fs_flushinval_pages(
xfs_off_t last,
int fiopt)
{
vnode_t *vp = BHV_TO_VNODE(bdp);
bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
struct inode *ip = vn_to_inode(vp);
if (VN_CACHED(vp)) {
......@@ -61,7 +61,7 @@ fs_flush_pages(
uint64_t flags,
int fiopt)
{
vnode_t *vp = BHV_TO_VNODE(bdp);
bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
struct inode *ip = vn_to_inode(vp);
if (VN_DIRTY(vp)) {
......
......@@ -78,7 +78,7 @@ xfs_find_handle(
xfs_handle_t handle;
xfs_fsop_handlereq_t hreq;
struct inode *inode;
struct vnode *vp;
bhv_vnode_t *vp;
if (copy_from_user(&hreq, arg, sizeof(hreq)))
return -XFS_ERROR(EFAULT);
......@@ -192,7 +192,7 @@ xfs_vget_fsop_handlereq(
xfs_mount_t *mp,
struct inode *parinode, /* parent inode pointer */
xfs_fsop_handlereq_t *hreq,
vnode_t **vp,
bhv_vnode_t **vp,
struct inode **inode)
{
void __user *hanp;
......@@ -202,7 +202,7 @@ xfs_vget_fsop_handlereq(
xfs_handle_t handle;
xfs_inode_t *ip;
struct inode *inodep;
vnode_t *vpp;
bhv_vnode_t *vpp;
xfs_ino_t ino;
__u32 igen;
int error;
......@@ -277,7 +277,7 @@ xfs_open_by_handle(
struct file *filp;
struct inode *inode;
struct dentry *dentry;
vnode_t *vp;
bhv_vnode_t *vp;
xfs_fsop_handlereq_t hreq;
if (!capable(CAP_SYS_ADMIN))
......@@ -362,7 +362,7 @@ xfs_readlink_by_handle(
struct uio auio;
struct inode *inode;
xfs_fsop_handlereq_t hreq;
vnode_t *vp;
bhv_vnode_t *vp;
__u32 olen;
if (!capable(CAP_SYS_ADMIN))
......@@ -393,9 +393,11 @@ xfs_readlink_by_handle(
auio.uio_segflg = UIO_USERSPACE;
auio.uio_resid = olen;
VOP_READLINK(vp, &auio, IO_INVIS, NULL, error);
error = bhv_vop_readlink(vp, &auio, IO_INVIS, NULL);
VN_RELE(vp);
if (error)
return -error;
return (olen - auio.uio_resid);
}
......@@ -411,7 +413,7 @@ xfs_fssetdm_by_handle(
xfs_fsop_setdm_handlereq_t dmhreq;
struct inode *inode;
bhv_desc_t *bdp;
vnode_t *vp;
bhv_vnode_t *vp;
if (!capable(CAP_MKNOD))
return -XFS_ERROR(EPERM);
......@@ -452,7 +454,7 @@ xfs_attrlist_by_handle(
attrlist_cursor_kern_t *cursor;
xfs_fsop_attrlist_handlereq_t al_hreq;
struct inode *inode;
vnode_t *vp;
bhv_vnode_t *vp;
char *kbuf;
if (!capable(CAP_SYS_ADMIN))
......@@ -472,8 +474,8 @@ xfs_attrlist_by_handle(
goto out_vn_rele;
cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
VOP_ATTR_LIST(vp, kbuf, al_hreq.buflen, al_hreq.flags,
cursor, NULL, error);
error = bhv_vop_attr_list(vp, kbuf, al_hreq.buflen, al_hreq.flags,
cursor, NULL);
if (error)
goto out_kfree;
......@@ -490,7 +492,7 @@ xfs_attrlist_by_handle(
STATIC int
xfs_attrmulti_attr_get(
struct vnode *vp,
bhv_vnode_t *vp,
char *name,
char __user *ubuf,
__uint32_t *len,
......@@ -505,7 +507,7 @@ xfs_attrmulti_attr_get(
if (!kbuf)
return ENOMEM;
VOP_ATTR_GET(vp, name, kbuf, len, flags, NULL, error);
error = bhv_vop_attr_get(vp, name, kbuf, len, flags, NULL);
if (error)
goto out_kfree;
......@@ -519,7 +521,7 @@ xfs_attrmulti_attr_get(
STATIC int
xfs_attrmulti_attr_set(
struct vnode *vp,
bhv_vnode_t *vp,
char *name,
const char __user *ubuf,
__uint32_t len,
......@@ -542,7 +544,7 @@ xfs_attrmulti_attr_set(
if (copy_from_user(kbuf, ubuf, len))
goto out_kfree;
VOP_ATTR_SET(vp, name, kbuf, len, flags, NULL, error);
error = bhv_vop_attr_set(vp, name, kbuf, len, flags, NULL);
out_kfree:
kfree(kbuf);
......@@ -551,20 +553,15 @@ xfs_attrmulti_attr_set(
STATIC int
xfs_attrmulti_attr_remove(
struct vnode *vp,
bhv_vnode_t *vp,
char *name,
__uint32_t flags)
{
int error;
if (IS_RDONLY(&vp->v_inode))
return -EROFS;
if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode))
return EPERM;
VOP_ATTR_REMOVE(vp, name, flags, NULL, error);
return error;
return bhv_vop_attr_remove(vp, name, flags, NULL);
}
STATIC int
......@@ -578,7 +575,7 @@ xfs_attrmulti_by_handle(
xfs_attr_multiop_t *ops;
xfs_fsop_attrmulti_handlereq_t am_hreq;
struct inode *inode;
vnode_t *vp;
bhv_vnode_t *vp;
unsigned int i, size;
char *attr_name;
......@@ -658,7 +655,7 @@ xfs_attrmulti_by_handle(
STATIC int
xfs_ioc_space(
bhv_desc_t *bdp,
vnode_t *vp,
bhv_vnode_t *vp,
struct file *filp,
int flags,