本文整理汇总了C++中ASSERT_VOP_LOCKED函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_VOP_LOCKED函数的具体用法?C++ ASSERT_VOP_LOCKED怎么用?C++ ASSERT_VOP_LOCKED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ASSERT_VOP_LOCKED函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fuse_vnode_get
int
fuse_vnode_get(struct mount *mp,
uint64_t nodeid,
struct vnode *dvp,
struct vnode **vpp,
struct componentname *cnp,
enum vtype vtyp)
{
struct thread *td = (cnp != NULL ? cnp->cn_thread : curthread);
int err = 0;
debug_printf("dvp=%p\n", dvp);
err = fuse_vnode_alloc(mp, td, nodeid, vtyp, vpp);
if (err) {
return err;
}
if (dvp != NULL) {
MPASS((cnp->cn_flags & ISDOTDOT) == 0);
MPASS(!(cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.'));
fuse_vnode_setparent(*vpp, dvp);
}
if (dvp != NULL && cnp != NULL && (cnp->cn_flags & MAKEENTRY) != 0) {
ASSERT_VOP_LOCKED(*vpp, "fuse_vnode_get");
ASSERT_VOP_LOCKED(dvp, "fuse_vnode_get");
cache_enter(dvp, *vpp, cnp);
}
VTOFUD(*vpp)->nlookup++;
return 0;
}
开发者ID:glk,项目名称:fuse-freebsd,代码行数:32,代码来源:fuse_node.c
示例2: nandfs_node_update
int
nandfs_node_update(struct nandfs_node *node)
{
struct nandfs_alloc_request req;
struct nandfsmount *nmp;
struct nandfs_mdt *mdt;
struct nandfs_node *ifile;
struct nandfs_inode *inode;
uint32_t index;
int error = 0;
nmp = node->nn_nmp;
ifile = nmp->nm_ifile_node;
ASSERT_VOP_LOCKED(NTOV(ifile), __func__);
req.entrynum = node->nn_ino;
mdt = &nmp->nm_nandfsdev->nd_ifile_mdt;
DPRINTF(IFILE, ("%s: node:%p ino:%#jx\n",
__func__, &node->nn_inode, (uintmax_t)node->nn_ino));
error = nandfs_get_entry_block(mdt, ifile, &req, &index, 0);
if (error) {
printf("nandfs_get_entry_block returned with ERROR=%d\n",
error);
return (error);
}
inode = ((struct nandfs_inode *) req.bp_entry->b_data) + index;
memcpy(inode, &node->nn_inode, sizeof(*inode));
error = nandfs_dirty_buf(req.bp_entry, 0);
return (error);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:34,代码来源:nandfs_ifile.c
示例3: audit_arg_vnode
/*
* Function to save the path and vnode attr information into the audit
* record.
*
* It is assumed that the caller will hold any vnode locks necessary to
* perform a VOP_GETATTR() on the passed vnode.
*
* XXX: The attr code is very similar to vfs_vnops.c:vn_stat(), but always
* provides access to the generation number as we need that to construct the
* BSM file ID.
*
* XXX: We should accept the process argument from the caller, since it's
* very likely they already have a reference.
*
* XXX: Error handling in this function is poor.
*
* XXXAUDIT: Possibly KASSERT the path pointer is NULL?
*/
static int
audit_arg_vnode(struct vnode *vp, struct vnode_au_info *vnp)
{
struct vattr vattr;
int error;
/*
* Assume that if the caller is calling audit_arg_vnode() on a
* non-MPSAFE vnode, then it will have acquired Giant.
*/
VFS_ASSERT_GIANT(vp->v_mount);
ASSERT_VOP_LOCKED(vp, "audit_arg_vnode");
error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
if (error) {
/* XXX: How to handle this case? */
return (error);
}
vnp->vn_mode = vattr.va_mode;
vnp->vn_uid = vattr.va_uid;
vnp->vn_gid = vattr.va_gid;
vnp->vn_dev = vattr.va_rdev;
vnp->vn_fsid = vattr.va_fsid;
vnp->vn_fileid = vattr.va_fileid;
vnp->vn_gen = vattr.va_gen;
return (0);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:46,代码来源:audit_arg.c
示例4: nandfs_update_segment
/* Update block count of segment */
int
nandfs_update_segment(struct nandfs_device *fsdev, uint64_t seg, uint32_t nblks)
{
struct nandfs_node *su_node;
struct nandfs_segment_usage *su_usage;
struct buf *bp;
uint64_t blk, offset;
int error;
su_node = fsdev->nd_su_node;
ASSERT_VOP_LOCKED(NTOV(su_node), __func__);
nandfs_seg_usage_blk_offset(fsdev, seg, &blk, &offset);
error = nandfs_bread(su_node, blk, NOCRED, 0, &bp);
if (error) {
nandfs_error("%s: read block:%jx to update\n",
__func__, blk);
brelse(bp);
return (error);
}
su_usage = SU_USAGE_OFF(bp, offset);
su_usage->su_lastmod = fsdev->nd_ts.tv_sec;
su_usage->su_flags = NANDFS_SEGMENT_USAGE_DIRTY;
su_usage->su_nblocks += nblks;
DPRINTF(SEG, ("%s: seg:%#jx inc:%#x cur:%#x\n", __func__,
(uintmax_t)seg, nblks, su_usage->su_nblocks));
nandfs_dirty_buf(bp, 1);
return (0);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:35,代码来源:nandfs_sufile.c
示例5: zfs_dirlook
int
zfs_dirlook(znode_t *dzp, const char *name, znode_t **zpp)
{
zfsvfs_t *zfsvfs = dzp->z_zfsvfs;
znode_t *zp;
int error = 0;
ASSERT_VOP_LOCKED(ZTOV(dzp), __func__);
ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock));
if (dzp->z_unlinked)
return (SET_ERROR(ENOENT));
if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) {
*zpp = dzp;
} else if (name[0] == '.' && name[1] == '.' && name[2] == 0) {
error = zfs_dd_lookup(dzp, zpp);
} else {
error = zfs_dirent_lookup(dzp, name, &zp, ZEXISTS);
if (error == 0) {
dzp->z_zn_prefetch = B_TRUE; /* enable prefetching */
*zpp = zp;
}
}
return (error);
}
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:26,代码来源:zfs_dir.c
示例6: nandfs_bad_segment
static int
nandfs_bad_segment(struct nandfs_device *fsdev, uint64_t seg)
{
struct nandfs_node *su_node;
struct nandfs_segment_usage *su_usage;
struct buf *bp;
uint64_t blk, offset;
int error;
su_node = fsdev->nd_su_node;
ASSERT_VOP_LOCKED(NTOV(su_node), __func__);
nandfs_seg_usage_blk_offset(fsdev, seg, &blk, &offset);
error = nandfs_bread(su_node, blk, NOCRED, 0, &bp);
if (error) {
brelse(bp);
return (error);
}
su_usage = SU_USAGE_OFF(bp, offset);
su_usage->su_lastmod = fsdev->nd_ts.tv_sec;
su_usage->su_flags = NANDFS_SEGMENT_USAGE_ERROR;
DPRINTF(SEG, ("%s: seg:%#jx\n", __func__, (uintmax_t)seg));
nandfs_dirty_buf(bp, 1);
return (0);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:30,代码来源:nandfs_sufile.c
示例7: ufs_extattr_disable
/*
* Disable extended attribute support on an FS.
*/
static int
ufs_extattr_disable(struct ufsmount *ump, int attrnamespace,
const char *attrname, struct thread *td)
{
struct ufs_extattr_list_entry *uele;
int error = 0;
if (!ufs_extattr_valid_attrname(attrnamespace, attrname))
return (EINVAL);
uele = ufs_extattr_find_attr(ump, attrnamespace, attrname);
if (!uele)
return (ENOATTR);
LIST_REMOVE(uele, uele_entries);
vn_lock(uele->uele_backing_vnode, LK_SHARED | LK_RETRY);
ASSERT_VOP_LOCKED(uele->uele_backing_vnode, "ufs_extattr_disable");
VOP_UNLOCK(uele->uele_backing_vnode, 0);
error = vn_close(uele->uele_backing_vnode, FREAD|FWRITE,
td->td_ucred, td);
free(uele, M_UFS_EXTATTR);
return (error);
}
开发者ID:markjdb,项目名称:freebsd-dev,代码行数:29,代码来源:ufs_extattr.c
示例8: mac_assert_vnode_locked
/*
* MAC Framework entry points relating to overall operation of system,
* including global services such as the kernel environment and loadable
* modules.
*
* System checks often align with existing privilege checks, but provide
* additional security context that may be relevant to policies, such as the
* specific object being operated on.
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/vnode.h>
#include <sys/sysctl.h>
#include <security/mac/mac_framework.h>
#include <security/mac/mac_internal.h>
#include <security/mac/mac_policy.h>
#define mac_assert_vnode_locked(VP) \
assert((((VP)->v_flag & VLOCKSWORK) == 0) || VOP_ISLOCKED((VP)))
#if 0 /* XXX PM: We don't have the kenv(2) system call in OpenBSD. */
int
mac_kenv_check_dump(struct ucred *cred)
{
int error;
MAC_CHECK(kenv_check_dump, cred);
return (error);
}
int
mac_kenv_check_get(struct ucred *cred, char *name)
{
int error;
MAC_CHECK(kenv_check_get, cred, name);
return (error);
}
int
mac_kenv_check_set(struct ucred *cred, char *name, char *value)
{
int error;
MAC_CHECK(kenv_check_set, cred, name, value);
return (error);
}
int
mac_kenv_check_unset(struct ucred *cred, char *name)
{
int error;
MAC_CHECK(kenv_check_unset, cred, name);
return (error);
}
#endif
#if 0 /* XXX PM: We won't support kernel modules. */
int
mac_kld_check_load(struct ucred *cred, struct vnode *vp)
{
int error;
ASSERT_VOP_LOCKED(vp, "mac_kld_check_load");
MAC_CHECK(kld_check_load, cred, vp, vp->v_label);
return (error);
}
开发者ID:genua,项目名称:anoubis_os,代码行数:80,代码来源:mac_system.c
示例9: fuse_vnode_get
int
fuse_vnode_get(struct mount *mp,
struct fuse_entry_out *feo,
uint64_t nodeid,
struct vnode *dvp,
struct vnode **vpp,
struct componentname *cnp,
enum vtype vtyp)
{
struct thread *td = (cnp != NULL ? cnp->cn_thread : curthread);
int err = 0;
err = fuse_vnode_alloc(mp, td, nodeid, vtyp, vpp);
if (err) {
return err;
}
if (dvp != NULL) {
MPASS((cnp->cn_flags & ISDOTDOT) == 0);
MPASS(!(cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.'));
fuse_vnode_setparent(*vpp, dvp);
}
if (dvp != NULL && cnp != NULL && (cnp->cn_flags & MAKEENTRY) != 0 &&
feo != NULL &&
(feo->entry_valid != 0 || feo->entry_valid_nsec != 0)) {
ASSERT_VOP_LOCKED(*vpp, "fuse_vnode_get");
ASSERT_VOP_LOCKED(dvp, "fuse_vnode_get");
cache_enter(dvp, *vpp, cnp);
}
/*
* In userland, libfuse uses cached lookups for dot and dotdot entries,
* thus it does not really bump the nlookup counter for forget.
* Follow the same semantic and avoid tu bump it in order to keep
* nlookup counters consistent.
*/
if (cnp == NULL || ((cnp->cn_flags & ISDOTDOT) == 0 &&
(cnp->cn_namelen != 1 || cnp->cn_nameptr[0] != '.')))
VTOFUD(*vpp)->nlookup++;
return 0;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:41,代码来源:fuse_node.c
示例10: mac_system_check_swapoff
int
mac_system_check_swapoff(struct ucred *cred, struct vnode *vp)
{
int error;
ASSERT_VOP_LOCKED(vp, "mac_system_check_swapoff");
MAC_POLICY_CHECK(system_check_swapoff, cred, vp, vp->v_label);
MAC_CHECK_PROBE2(system_check_swapoff, error, cred, vp);
return (error);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:12,代码来源:mac_system.c
示例11: osi_VM_FlushPages
/* Purge VM for a file when its callback is revoked.
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp)
{
struct vnode *vp;
struct vm_object *obj;
vp = AFSTOV(avc);
ASSERT_VOP_LOCKED(vp, __func__);
if (VOP_GETVOBJECT(vp, &obj) == 0) {
VM_OBJECT_LOCK(obj);
vm_object_page_remove(obj, 0, 0, FALSE);
VM_OBJECT_UNLOCK(obj);
}
osi_vinvalbuf(vp, 0, 0, 0);
}
开发者ID:SimonWilkinson,项目名称:openafs,代码行数:19,代码来源:osi_vm.c
示例12: ncl_upgrade_vnlock
int
ncl_upgrade_vnlock(struct vnode *vp)
{
int old_lock;
ASSERT_VOP_LOCKED(vp, "ncl_upgrade_vnlock");
old_lock = NFSVOPISLOCKED(vp);
if (old_lock != LK_EXCLUSIVE) {
KASSERT(old_lock == LK_SHARED,
("ncl_upgrade_vnlock: wrong old_lock %d", old_lock));
/* Upgrade to exclusive lock, this might block */
NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
}
return (old_lock);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:15,代码来源:nfs_clsubs.c
示例13: nfs_supportsnfsv4acls
/*
* Determine if the file system supports NFSv4 ACLs.
* Return 1 if it does, 0 otherwise.
*/
int
nfs_supportsnfsv4acls(struct vnode *vp)
{
int error;
register_t retval;
ASSERT_VOP_LOCKED(vp, "nfs supports nfsv4acls");
if (nfsrv_useacl == 0)
return (0);
error = VOP_PATHCONF(vp, _PC_ACL_NFS4, &retval);
if (error == 0 && retval != 0)
return (1);
return (0);
}
开发者ID:superstarrajini,项目名称:freebsd,代码行数:19,代码来源:nfs_commonport.c
示例14: mac_system_check_acct
int
mac_system_check_acct(struct ucred *cred, struct vnode *vp)
{
int error;
if (vp != NULL) {
ASSERT_VOP_LOCKED(vp, "mac_system_check_acct");
}
MAC_POLICY_CHECK(system_check_acct, cred, vp,
vp != NULL ? vp->v_label : NULL);
MAC_CHECK_PROBE2(system_check_acct, error, cred, vp);
return (error);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:15,代码来源:mac_system.c
示例15: nandfs_bufsync
int
nandfs_bufsync(struct bufobj *bo, int waitfor)
{
struct vnode *vp;
int error = 0;
vp = bo2vnode(bo);
ASSERT_VOP_LOCKED(vp, __func__);
error = nandfs_sync_file(vp);
if (error)
nandfs_warning("%s: cannot flush buffers err:%d\n",
__func__, error);
return (error);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:16,代码来源:nandfs_subr.c
示例16: osi_VM_FlushPages
/* Purge VM for a file when its callback is revoked.
*
* Locking: No lock is held, not even the global lock.
*/
void
osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp)
{
struct vnode *vp;
struct vm_object *obj;
vp = AFSTOV(avc);
ASSERT_VOP_LOCKED(vp, __func__);
obj = vp->v_object;
if (obj != NULL) {
AFS_VM_OBJECT_WLOCK(obj);
vm_object_page_remove(obj, 0, 0, FALSE);
AFS_VM_OBJECT_WUNLOCK(obj);
}
osi_vinvalbuf(vp, 0, 0, 0);
}
开发者ID:hwr,项目名称:openafs,代码行数:20,代码来源:osi_vm.c
示例17: dqopen
/*
* Determine the quota file type.
*
* A 32-bit quota file is simply an array of struct dqblk32.
*
* A 64-bit quota file is a struct dqhdr64 followed by an array of struct
* dqblk64. The header contains various magic bits which allow us to be
* reasonably confident that it is indeeda 64-bit quota file and not just
* a 32-bit quota file that just happens to "look right".
*
*/
static int
dqopen(struct vnode *vp, struct ufsmount *ump, int type)
{
struct dqhdr64 dqh;
struct iovec aiov;
struct uio auio;
int error;
ASSERT_VOP_LOCKED(vp, "dqopen");
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
aiov.iov_base = &dqh;
aiov.iov_len = sizeof(dqh);
auio.uio_resid = sizeof(dqh);
auio.uio_offset = 0;
auio.uio_segflg = UIO_SYSSPACE;
auio.uio_rw = UIO_READ;
auio.uio_td = (struct thread *)0;
error = VOP_READ(vp, &auio, 0, ump->um_cred[type]);
if (error != 0)
return (error);
if (auio.uio_resid > 0) {
/* assume 32 bits */
return (0);
}
UFS_LOCK(ump);
if (strcmp(dqh.dqh_magic, Q_DQHDR64_MAGIC) == 0 &&
be32toh(dqh.dqh_version) == Q_DQHDR64_VERSION &&
be32toh(dqh.dqh_hdrlen) == (uint32_t)sizeof(struct dqhdr64) &&
be32toh(dqh.dqh_reclen) == (uint32_t)sizeof(struct dqblk64)) {
/* XXX: what if the magic matches, but the sizes are wrong? */
ump->um_qflags[type] |= QTF_64BIT;
} else {
ump->um_qflags[type] &= ~QTF_64BIT;
}
UFS_UNLOCK(ump);
return (0);
}
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:52,代码来源:ufs_quota.c
示例18: zfs_dd_lookup
static int
zfs_dd_lookup(znode_t *dzp, znode_t **zpp)
{
zfsvfs_t *zfsvfs = dzp->z_zfsvfs;
znode_t *zp;
uint64_t parent;
int error;
ASSERT_VOP_LOCKED(ZTOV(dzp), __func__);
ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock));
if (dzp->z_unlinked)
return (ENOENT);
if ((error = sa_lookup(dzp->z_sa_hdl,
SA_ZPL_PARENT(zfsvfs), &parent, sizeof (parent))) != 0)
return (error);
error = zfs_zget(zfsvfs, parent, &zp);
if (error == 0)
*zpp = zp;
return (error);
}
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:23,代码来源:zfs_dir.c
示例19: ufs_lookup_upgrade_lock
static int
ufs_lookup_upgrade_lock(struct vnode *vp)
{
int error;
ASSERT_VOP_LOCKED(vp, __FUNCTION__);
if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE)
return (0);
error = 0;
/*
* Upgrade vnode lock, since getinoquota()
* requires exclusive lock to modify inode.
*/
vhold(vp);
vn_lock(vp, LK_UPGRADE | LK_RETRY);
VI_LOCK(vp);
if (vp->v_iflag & VI_DOOMED)
error = ENOENT;
vdropl(vp);
return (error);
}
开发者ID:nomadlogic,项目名称:freebsd-base-graphics,代码行数:23,代码来源:ufs_lookup.c
示例20: smbfs_root
/*
* Return locked root vnode of a filesystem
*/
static int
smbfs_root(struct mount *mp, int flags, struct vnode **vpp)
{
struct smbmount *smp = VFSTOSMBFS(mp);
struct vnode *vp;
struct smbnode *np;
struct smbfattr fattr;
struct thread *td;
struct ucred *cred;
struct smb_cred *scred;
int error;
td = curthread;
cred = td->td_ucred;
if (smp->sm_root) {
*vpp = SMBTOV(smp->sm_root);
return vget(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
}
scred = smbfs_malloc_scred();
smb_makescred(scred, td, cred);
error = smbfs_smb_lookup(NULL, NULL, 0, &fattr, scred);
if (error)
goto out;
error = smbfs_nget(mp, NULL, NULL, 0, &fattr, &vp);
if (error)
goto out;
ASSERT_VOP_LOCKED(vp, "smbfs_root");
vp->v_vflag |= VV_ROOT;
np = VTOSMB(vp);
smp->sm_root = np;
*vpp = vp;
out:
smbfs_free_scred(scred);
return error;
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:39,代码来源:smbfs_vfsops.c
注:本文中的ASSERT_VOP_LOCKED函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论