Changeset View
Changeset View
Standalone View
Standalone View
head/sys/fs/ext2fs/ext2_vnops.c
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
static vop_readlink_t ext2_readlink; | static vop_readlink_t ext2_readlink; | ||||
static vop_remove_t ext2_remove; | static vop_remove_t ext2_remove; | ||||
static vop_rename_t ext2_rename; | static vop_rename_t ext2_rename; | ||||
static vop_rmdir_t ext2_rmdir; | static vop_rmdir_t ext2_rmdir; | ||||
static vop_setattr_t ext2_setattr; | static vop_setattr_t ext2_setattr; | ||||
static vop_strategy_t ext2_strategy; | static vop_strategy_t ext2_strategy; | ||||
static vop_symlink_t ext2_symlink; | static vop_symlink_t ext2_symlink; | ||||
static vop_write_t ext2_write; | static vop_write_t ext2_write; | ||||
static vop_deleteextattr_t ext2_deleteextattr; | |||||
static vop_getextattr_t ext2_getextattr; | static vop_getextattr_t ext2_getextattr; | ||||
static vop_listextattr_t ext2_listextattr; | static vop_listextattr_t ext2_listextattr; | ||||
static vop_setextattr_t ext2_setextattr; | |||||
static vop_vptofh_t ext2_vptofh; | static vop_vptofh_t ext2_vptofh; | ||||
static vop_close_t ext2fifo_close; | static vop_close_t ext2fifo_close; | ||||
static vop_kqfilter_t ext2fifo_kqfilter; | static vop_kqfilter_t ext2fifo_kqfilter; | ||||
/* Global vfs data structures for ext2. */ | /* Global vfs data structures for ext2. */ | ||||
struct vop_vector ext2_vnodeops = { | struct vop_vector ext2_vnodeops = { | ||||
.vop_default = &default_vnodeops, | .vop_default = &default_vnodeops, | ||||
.vop_access = ext2_access, | .vop_access = ext2_access, | ||||
Show All 22 Lines | struct vop_vector ext2_vnodeops = { | ||||
.vop_reclaim = ext2_reclaim, | .vop_reclaim = ext2_reclaim, | ||||
.vop_remove = ext2_remove, | .vop_remove = ext2_remove, | ||||
.vop_rename = ext2_rename, | .vop_rename = ext2_rename, | ||||
.vop_rmdir = ext2_rmdir, | .vop_rmdir = ext2_rmdir, | ||||
.vop_setattr = ext2_setattr, | .vop_setattr = ext2_setattr, | ||||
.vop_strategy = ext2_strategy, | .vop_strategy = ext2_strategy, | ||||
.vop_symlink = ext2_symlink, | .vop_symlink = ext2_symlink, | ||||
.vop_write = ext2_write, | .vop_write = ext2_write, | ||||
.vop_deleteextattr = ext2_deleteextattr, | |||||
.vop_getextattr = ext2_getextattr, | .vop_getextattr = ext2_getextattr, | ||||
.vop_listextattr = ext2_listextattr, | .vop_listextattr = ext2_listextattr, | ||||
.vop_setextattr = ext2_setextattr, | |||||
.vop_vptofh = ext2_vptofh, | .vop_vptofh = ext2_vptofh, | ||||
}; | }; | ||||
struct vop_vector ext2_fifoops = { | struct vop_vector ext2_fifoops = { | ||||
.vop_default = &fifo_specops, | .vop_default = &fifo_specops, | ||||
.vop_access = ext2_access, | .vop_access = ext2_access, | ||||
.vop_close = ext2fifo_close, | .vop_close = ext2fifo_close, | ||||
.vop_fsync = ext2_fsync, | .vop_fsync = ext2_fsync, | ||||
▲ Show 20 Lines • Show All 1,311 Lines • ▼ Show 20 Lines | ext2_pathconf(struct vop_pathconf_args *ap) | ||||
default: | default: | ||||
error = EINVAL; | error = EINVAL; | ||||
break; | break; | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Vnode operation to remove a named attribute. | |||||
*/ | |||||
static int | |||||
ext2_deleteextattr(struct vop_deleteextattr_args *ap) | |||||
{ | |||||
struct inode *ip; | |||||
struct m_ext2fs *fs; | |||||
int error; | |||||
ip = VTOI(ap->a_vp); | |||||
fs = ip->i_e2fs; | |||||
if (!EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_EXT_ATTR)) | |||||
return (EOPNOTSUPP); | |||||
if (ap->a_vp->v_type == VCHR || ap->a_vp->v_type == VBLK) | |||||
return (EOPNOTSUPP); | |||||
error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, | |||||
ap->a_cred, ap->a_td, VWRITE); | |||||
if (error) | |||||
return (error); | |||||
if (EXT2_INODE_SIZE(fs) != E2FS_REV0_INODE_SIZE) { | |||||
error = ext2_extattr_inode_delete(ip, ap->a_attrnamespace, ap->a_name); | |||||
if (error != ENOATTR) | |||||
return (error); | |||||
} | |||||
if (ip->i_facl) | |||||
error = ext2_extattr_block_delete(ip, ap->a_attrnamespace, ap->a_name); | |||||
return (error); | |||||
} | |||||
/* | |||||
* Vnode operation to retrieve a named extended attribute. | * Vnode operation to retrieve a named extended attribute. | ||||
*/ | */ | ||||
static int | static int | ||||
ext2_getextattr(struct vop_getextattr_args *ap) | ext2_getextattr(struct vop_getextattr_args *ap) | ||||
{ | { | ||||
struct inode *ip; | struct inode *ip; | ||||
struct m_ext2fs *fs; | struct m_ext2fs *fs; | ||||
int error; | int error; | ||||
Show All 13 Lines | if (error) | ||||
return (error); | return (error); | ||||
if (ap->a_size != NULL) | if (ap->a_size != NULL) | ||||
*ap->a_size = 0; | *ap->a_size = 0; | ||||
if (EXT2_INODE_SIZE(fs) != E2FS_REV0_INODE_SIZE) { | if (EXT2_INODE_SIZE(fs) != E2FS_REV0_INODE_SIZE) { | ||||
error = ext2_extattr_inode_get(ip, ap->a_attrnamespace, | error = ext2_extattr_inode_get(ip, ap->a_attrnamespace, | ||||
ap->a_name, ap->a_uio, ap->a_size); | ap->a_name, ap->a_uio, ap->a_size); | ||||
if (error) | if (error != ENOATTR) | ||||
return (error); | return (error); | ||||
} | } | ||||
if (ip->i_facl) | if (ip->i_facl) | ||||
error = ext2_extattr_block_get(ip, ap->a_attrnamespace, | error = ext2_extattr_block_get(ip, ap->a_attrnamespace, | ||||
ap->a_name, ap->a_uio, ap->a_size); | ap->a_name, ap->a_uio, ap->a_size); | ||||
return (error); | return (error); | ||||
Show All 24 Lines | if (error) | ||||
return (error); | return (error); | ||||
if (ap->a_size != NULL) | if (ap->a_size != NULL) | ||||
*ap->a_size = 0; | *ap->a_size = 0; | ||||
if (EXT2_INODE_SIZE(fs) != E2FS_REV0_INODE_SIZE) { | if (EXT2_INODE_SIZE(fs) != E2FS_REV0_INODE_SIZE) { | ||||
error = ext2_extattr_inode_list(ip, ap->a_attrnamespace, | error = ext2_extattr_inode_list(ip, ap->a_attrnamespace, | ||||
ap->a_uio, ap->a_size); | ap->a_uio, ap->a_size); | ||||
if(error) | if (error) | ||||
return (error); | return (error); | ||||
} | } | ||||
if(ip->i_facl) | if (ip->i_facl) | ||||
error = ext2_extattr_block_list(ip, ap->a_attrnamespace, | error = ext2_extattr_block_list(ip, ap->a_attrnamespace, | ||||
ap->a_uio, ap->a_size); | ap->a_uio, ap->a_size); | ||||
return (error); | |||||
} | |||||
/* | |||||
* Vnode operation to set a named attribute. | |||||
*/ | |||||
static int | |||||
ext2_setextattr(struct vop_setextattr_args *ap) | |||||
{ | |||||
struct inode *ip; | |||||
struct m_ext2fs *fs; | |||||
int error; | |||||
ip = VTOI(ap->a_vp); | |||||
fs = ip->i_e2fs; | |||||
if (!EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_EXT_ATTR)) | |||||
return (EOPNOTSUPP); | |||||
if (ap->a_vp->v_type == VCHR || ap->a_vp->v_type == VBLK) | |||||
return (EOPNOTSUPP); | |||||
error = extattr_check_cred(ap->a_vp, ap->a_attrnamespace, | |||||
ap->a_cred, ap->a_td, VWRITE); | |||||
if (error) | |||||
return (error); | |||||
error = ext2_extattr_valid_attrname(ap->a_attrnamespace, ap->a_name); | |||||
if (error) | |||||
return (error); | |||||
if (EXT2_INODE_SIZE(fs) != E2FS_REV0_INODE_SIZE) { | |||||
error = ext2_extattr_inode_set(ip, ap->a_attrnamespace, | |||||
ap->a_name, ap->a_uio); | |||||
if (error != ENOSPC) | |||||
return (error); | |||||
} | |||||
error = ext2_extattr_block_set(ip, ap->a_attrnamespace, | |||||
ap->a_name, ap->a_uio); | |||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Vnode pointer to File handle | * Vnode pointer to File handle | ||||
*/ | */ | ||||
/* ARGSUSED */ | /* ARGSUSED */ | ||||
▲ Show 20 Lines • Show All 564 Lines • Show Last 20 Lines |