本文整理汇总了C++中CLASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ CLASSERT函数的具体用法?C++ CLASSERT怎么用?C++ CLASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CLASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lnet_selftest_structure_assertion
void
lnet_selftest_structure_assertion(void)
{
CLASSERT(sizeof(struct srpc_msg) == 160);
CLASSERT(sizeof(struct srpc_test_reqst) == 70);
CLASSERT(offsetof(struct srpc_msg, msg_body.tes_reqst.tsr_concur) == 72);
CLASSERT(offsetof(struct srpc_msg, msg_body.tes_reqst.tsr_ndest) == 78);
CLASSERT(sizeof(struct srpc_stat_reply) == 136);
CLASSERT(sizeof(struct srpc_stat_reqst) == 28);
}
示例2: mdt_setattr_unpack_rec
static int mdt_setattr_unpack_rec(struct mdt_thread_info *info)
{
struct lu_ucred *uc = mdt_ucred(info);
struct md_attr *ma = &info->mti_attr;
struct lu_attr *la = &ma->ma_attr;
struct req_capsule *pill = info->mti_pill;
struct mdt_reint_record *rr = &info->mti_rr;
struct mdt_rec_setattr *rec;
ENTRY;
CLASSERT(sizeof(struct mdt_rec_setattr)== sizeof(struct mdt_rec_reint));
rec = req_capsule_client_get(pill, &RMF_REC_REINT);
if (rec == NULL)
RETURN(-EFAULT);
/* This prior initialization is needed for old_init_ucred_reint() */
uc->uc_fsuid = rec->sa_fsuid;
uc->uc_fsgid = rec->sa_fsgid;
uc->uc_cap = rec->sa_cap;
uc->uc_suppgids[0] = rec->sa_suppgid;
uc->uc_suppgids[1] = -1;
rr->rr_fid1 = &rec->sa_fid;
la->la_valid = mdt_attr_valid_xlate(rec->sa_valid, rr, ma);
/* If MDS_ATTR_xTIME is set without MDS_ATTR_xTIME_SET and
* the client does not have OBD_CONNECT_FULL20, convert it
* to LA_xTIME. LU-3036 */
if (!(exp_connect_flags(info->mti_exp) & OBD_CONNECT_FULL20)) {
if (!(rec->sa_valid & MDS_ATTR_ATIME_SET) &&
(rec->sa_valid & MDS_ATTR_ATIME))
la->la_valid |= LA_ATIME;
if (!(rec->sa_valid & MDS_ATTR_MTIME_SET) &&
(rec->sa_valid & MDS_ATTR_MTIME))
la->la_valid |= LA_MTIME;
if (!(rec->sa_valid & MDS_ATTR_CTIME_SET) &&
(rec->sa_valid & MDS_ATTR_CTIME))
la->la_valid |= LA_CTIME;
}
la->la_mode = rec->sa_mode;
la->la_flags = rec->sa_attr_flags;
la->la_uid = rec->sa_uid;
la->la_gid = rec->sa_gid;
la->la_size = rec->sa_size;
la->la_blocks = rec->sa_blocks;
la->la_ctime = rec->sa_ctime;
la->la_atime = rec->sa_atime;
la->la_mtime = rec->sa_mtime;
ma->ma_valid = MA_INODE;
if (rec->sa_bias & MDS_DATA_MODIFIED)
ma->ma_attr_flags |= MDS_DATA_MODIFIED;
else
ma->ma_attr_flags &= ~MDS_DATA_MODIFIED;
if (req_capsule_get_size(pill, &RMF_CAPA1, RCL_CLIENT))
mdt_set_capainfo(info, 0, rr->rr_fid1,
req_capsule_client_get(pill, &RMF_CAPA1));
RETURN(0);
}
示例3: mdc_unlink_pack
void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
{
struct mdt_rec_unlink *rec;
CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_unlink));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
LASSERT(rec != NULL);
rec->ul_opcode = op_data->op_cli_flags & CLI_RM_ENTRY ?
REINT_RMENTRY : REINT_UNLINK;
rec->ul_fsuid = op_data->op_fsuid;
rec->ul_fsgid = op_data->op_fsgid;
rec->ul_cap = op_data->op_cap;
rec->ul_mode = op_data->op_mode;
rec->ul_suppgid1= op_data->op_suppgids[0];
rec->ul_suppgid2= -1;
rec->ul_fid1 = op_data->op_fid1;
rec->ul_fid2 = op_data->op_fid2;
rec->ul_time = op_data->op_mod_time;
rec->ul_bias = op_data->op_bias;
mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen);
/* pack SELinux policy info if any */
mdc_file_sepol_pack(req);
}
示例4: mdc_unlink_pack
void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
{
struct mdt_rec_unlink *rec;
char *tmp;
CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_unlink));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
LASSERT(rec != NULL);
rec->ul_opcode = op_data->op_cli_flags & CLI_RM_ENTRY ?
REINT_RMENTRY : REINT_UNLINK;
rec->ul_fsuid = op_data->op_fsuid;
rec->ul_fsgid = op_data->op_fsgid;
rec->ul_cap = op_data->op_cap;
rec->ul_mode = op_data->op_mode;
rec->ul_suppgid1= op_data->op_suppgids[0];
rec->ul_suppgid2= -1;
rec->ul_fid1 = op_data->op_fid1;
rec->ul_fid2 = op_data->op_fid2;
rec->ul_time = op_data->op_mod_time;
rec->ul_bias = op_data->op_bias;
mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
LASSERT(tmp != NULL);
LOGL0(op_data->op_name, op_data->op_namelen, tmp);
}
示例5: mdt_rename_unpack
static int mdt_rename_unpack(struct mdt_thread_info *info)
{
struct lu_ucred *uc = mdt_ucred(info);
struct mdt_rec_rename *rec;
struct md_attr *ma = &info->mti_attr;
struct lu_attr *attr = &info->mti_attr.ma_attr;
struct mdt_reint_record *rr = &info->mti_rr;
struct req_capsule *pill = info->mti_pill;
int rc;
ENTRY;
CLASSERT(sizeof(struct mdt_rec_rename) == sizeof(struct mdt_rec_reint));
rec = req_capsule_client_get(pill, &RMF_REC_REINT);
if (rec == NULL)
RETURN(-EFAULT);
/* This prior initialization is needed for old_init_ucred_reint() */
uc->uc_fsuid = rec->rn_fsuid;
uc->uc_fsgid = rec->rn_fsgid;
uc->uc_cap = rec->rn_cap;
uc->uc_suppgids[0] = rec->rn_suppgid1;
uc->uc_suppgids[1] = rec->rn_suppgid2;
attr->la_uid = rec->rn_fsuid;
attr->la_gid = rec->rn_fsgid;
rr->rr_fid1 = &rec->rn_fid1;
rr->rr_fid2 = &rec->rn_fid2;
attr->la_ctime = rec->rn_time;
attr->la_mtime = rec->rn_time;
/* rename_tgt contains the mode already */
attr->la_mode = rec->rn_mode;
attr->la_valid = LA_UID | LA_GID | LA_CTIME | LA_MTIME | LA_MODE;
if (req_capsule_get_size(pill, &RMF_CAPA1, RCL_CLIENT))
mdt_set_capainfo(info, 0, rr->rr_fid1,
req_capsule_client_get(pill, &RMF_CAPA1));
if (req_capsule_get_size(pill, &RMF_CAPA2, RCL_CLIENT))
mdt_set_capainfo(info, 1, rr->rr_fid2,
req_capsule_client_get(pill, &RMF_CAPA2));
rc = mdt_name_unpack(pill, &RMF_NAME, &rr->rr_name, 0);
if (rc < 0)
RETURN(rc);
rc = mdt_name_unpack(pill, &RMF_SYMTGT, &rr->rr_tgt_name, 0);
if (rc < 0)
RETURN(rc);
if (rec->rn_bias & MDS_VTX_BYPASS)
ma->ma_attr_flags |= MDS_VTX_BYPASS;
else
ma->ma_attr_flags &= ~MDS_VTX_BYPASS;
info->mti_spec.no_create = !!req_is_replay(mdt_info_req(info));
rc = mdt_dlmreq_unpack(info);
RETURN(rc);
}
示例6: osd_check_lma
static int osd_check_lma(const struct lu_env *env, struct osd_object *obj)
{
struct osd_thread_info *info = osd_oti_get(env);
struct lu_buf buf;
int rc;
struct lustre_mdt_attrs *lma;
ENTRY;
CLASSERT(sizeof(info->oti_buf) >= sizeof(*lma));
lma = (struct lustre_mdt_attrs *)info->oti_buf;
buf.lb_buf = lma;
buf.lb_len = sizeof(info->oti_buf);
rc = osd_xattr_get(env, &obj->oo_dt, &buf, XATTR_NAME_LMA);
if (rc > 0) {
rc = 0;
lustre_lma_swab(lma);
if (unlikely((lma->lma_incompat & ~LMA_INCOMPAT_SUPP) ||
CFS_FAIL_CHECK(OBD_FAIL_OSD_LMA_INCOMPAT))) {
CWARN("%s: unsupported incompat LMA feature(s) %#x for "
"fid = "DFID"\n", osd_obj2dev(obj)->od_svname,
lma->lma_incompat & ~LMA_INCOMPAT_SUPP,
PFID(lu_object_fid(&obj->oo_dt.do_lu)));
rc = -EOPNOTSUPP;
}
} else if (rc == -ENODATA) {
/* haven't initialize LMA xattr */
rc = 0;
}
RETURN(rc);
}
示例7: mdc_link_pack
void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
{
struct mdt_rec_link *rec;
char *tmp;
CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_link));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
LASSERT (rec != NULL);
rec->lk_opcode = REINT_LINK;
rec->lk_fsuid = op_data->op_fsuid;//current->fsuid;
rec->lk_fsgid = op_data->op_fsgid;//current->fsgid;
rec->lk_cap = op_data->op_cap;//current->cap_effective;
rec->lk_suppgid1 = op_data->op_suppgids[0];
rec->lk_suppgid2 = op_data->op_suppgids[1];
rec->lk_fid1 = op_data->op_fid1;
rec->lk_fid2 = op_data->op_fid2;
rec->lk_time = op_data->op_mod_time;
rec->lk_bias = op_data->op_bias;
mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
mdc_pack_capa(req, &RMF_CAPA2, op_data->op_capa2);
tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
LOGL0(op_data->op_name, op_data->op_namelen, tmp);
}
示例8: ptlrpc_fill_bulk_md
void ptlrpc_fill_bulk_md(lnet_md_t *md, struct ptlrpc_bulk_desc *desc,
int mdidx)
{
int offset = mdidx * LNET_MAX_IOV;
CLASSERT(PTLRPC_MAX_BRW_PAGES < LI_POISON);
LASSERT(mdidx < desc->bd_md_max_brw);
LASSERT(desc->bd_iov_count <= PTLRPC_MAX_BRW_PAGES);
LASSERT(!(md->options & (LNET_MD_IOVEC | LNET_MD_KIOV |
LNET_MD_PHYS)));
md->length = max(0, desc->bd_iov_count - mdidx * LNET_MAX_IOV);
md->length = min_t(unsigned int, LNET_MAX_IOV, md->length);
if (ptlrpc_is_bulk_desc_kiov(desc->bd_type)) {
md->options |= LNET_MD_KIOV;
if (GET_ENC_KIOV(desc))
md->start = &BD_GET_ENC_KIOV(desc, offset);
else
md->start = &BD_GET_KIOV(desc, offset);
} else {
md->options |= LNET_MD_IOVEC;
if (GET_ENC_KVEC(desc))
md->start = &BD_GET_ENC_KVEC(desc, offset);
else
md->start = &BD_GET_KVEC(desc, offset);
}
}
示例9: mdc_setattr_pack
void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
void *ea, size_t ealen)
{
struct mdt_rec_setattr *rec;
struct lov_user_md *lum = NULL;
CLASSERT(sizeof(struct mdt_rec_reint) ==sizeof(struct mdt_rec_setattr));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
mdc_setattr_pack_rec(rec, op_data);
mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
if (ealen == 0)
return;
lum = req_capsule_client_get(&req->rq_pill, &RMF_EADATA);
if (ea == NULL) { /* Remove LOV EA */
lum->lmm_magic = cpu_to_le32(LOV_USER_MAGIC_V1);
lum->lmm_stripe_size = 0;
lum->lmm_stripe_count = 0;
lum->lmm_stripe_offset = (typeof(lum->lmm_stripe_offset))(-1);
} else {
memcpy(lum, ea, ealen);
}
}
示例10: osc_lock_blocking
/**
* Core of osc_dlm_blocking_ast() logic.
*/
static void osc_lock_blocking(const struct lu_env *env,
struct ldlm_lock *dlmlock,
struct osc_lock *olck, int blocking)
{
struct cl_lock *lock = olck->ols_cl.cls_lock;
LASSERT(olck->ols_lock == dlmlock);
CLASSERT(OLS_BLOCKED < OLS_CANCELLED);
LASSERT(!osc_lock_is_lockless(olck));
/*
* Lock might be still addref-ed here, if e.g., blocking ast
* is sent for a failed lock.
*/
osc_lock_unhold(olck);
if (blocking && olck->ols_state < OLS_BLOCKED)
/*
* Move osc_lock into OLS_BLOCKED before canceling the lock,
* because it recursively re-enters osc_lock_blocking(), with
* the state set to OLS_CANCELLED.
*/
olck->ols_state = OLS_BLOCKED;
/*
* cancel and destroy lock at least once no matter how blocking ast is
* entered (see comment above osc_ldlm_blocking_ast() for use
* cases). cl_lock_cancel() and cl_lock_delete() are idempotent.
*/
cl_lock_cancel(env, lock);
cl_lock_delete(env, lock);
}
示例11: osd_dir_it_next
/**
* to load a directory entry at a time and stored it in
* iterator's in-memory data structure.
*
* \param di, struct osd_it_ea, iterator's in memory structure
*
* \retval +ve, iterator reached to end
* \retval 0, iterator not reached to end
* \retval -ve, on error
*/
static int osd_dir_it_next(const struct lu_env *env, struct dt_it *di)
{
struct osd_zap_it *it = (struct osd_zap_it *)di;
zap_attribute_t *za = &osd_oti_get(env)->oti_za;
int rc;
/* temp. storage should be enough for any key supported by ZFS */
CLASSERT(sizeof(za->za_name) <= sizeof(it->ozi_name));
/*
* the first ->next() moves the cursor to .
* the second ->next() moves the cursor to ..
* then we get to the real records and have to verify any exist
*/
if (it->ozi_pos <= 2) {
it->ozi_pos++;
if (it->ozi_pos <=2)
RETURN(0);
}
zap_cursor_advance(it->ozi_zc);
/*
* According to current API we need to return error if its last entry.
* zap_cursor_advance() does not return any value. So we need to call
* retrieve to check if there is any record. We should make
* changes to Iterator API to not return status for this API
*/
rc = osd_index_retrieve_skip_dots(it, za);
if (rc == -ENOENT) /* end of dir */
RETURN(+1);
RETURN(rc);
}
示例12: mdt_rename_unpack
static int mdt_rename_unpack(struct mdt_thread_info *info)
{
struct md_ucred *uc = mdt_ucred(info);
struct mdt_rec_rename *rec;
struct md_attr *ma = &info->mti_attr;
struct lu_attr *attr = &info->mti_attr.ma_attr;
struct mdt_reint_record *rr = &info->mti_rr;
struct req_capsule *pill = info->mti_pill;
int rc;
ENTRY;
CLASSERT(sizeof(struct mdt_rec_rename) == sizeof(struct mdt_rec_reint));
rec = req_capsule_client_get(pill, &RMF_REC_REINT);
if (rec == NULL)
RETURN(-EFAULT);
uc->mu_fsuid = rec->rn_fsuid;
uc->mu_fsgid = rec->rn_fsgid;
uc->mu_cap = rec->rn_cap;
uc->mu_suppgids[0] = rec->rn_suppgid1;
uc->mu_suppgids[1] = rec->rn_suppgid2;
attr->la_uid = rec->rn_fsuid;
attr->la_gid = rec->rn_fsgid;
rr->rr_fid1 = &rec->rn_fid1;
rr->rr_fid2 = &rec->rn_fid2;
attr->la_ctime = rec->rn_time;
attr->la_mtime = rec->rn_time;
/* rename_tgt contains the mode already */
attr->la_mode = rec->rn_mode;
attr->la_valid = LA_UID | LA_GID | LA_CTIME | LA_MTIME | LA_MODE;
if (req_capsule_get_size(pill, &RMF_CAPA1, RCL_CLIENT))
mdt_set_capainfo(info, 0, rr->rr_fid1,
req_capsule_client_get(pill, &RMF_CAPA1));
if (req_capsule_get_size(pill, &RMF_CAPA2, RCL_CLIENT))
mdt_set_capainfo(info, 1, rr->rr_fid2,
req_capsule_client_get(pill, &RMF_CAPA2));
info->mti_spec.sp_ck_split = !!(rec->rn_bias & MDS_CHECK_SPLIT);
info->mti_cross_ref = !!(rec->rn_bias & MDS_CROSS_REF);
rr->rr_name = req_capsule_client_get(pill, &RMF_NAME);
rr->rr_tgt = req_capsule_client_get(pill, &RMF_SYMTGT);
if (rr->rr_name == NULL || rr->rr_tgt == NULL)
RETURN(-EFAULT);
rr->rr_namelen = req_capsule_get_size(pill, &RMF_NAME, RCL_CLIENT) - 1;
rr->rr_tgtlen = req_capsule_get_size(pill, &RMF_SYMTGT, RCL_CLIENT) - 1;
if (!info->mti_cross_ref)
LASSERT(rr->rr_namelen > 0 && rr->rr_tgtlen > 0);
if (rec->rn_bias & MDS_VTX_BYPASS)
ma->ma_attr_flags |= MDS_VTX_BYPASS;
else
ma->ma_attr_flags &= ~MDS_VTX_BYPASS;
info->mti_spec.no_create = !!req_is_replay(mdt_info_req(info));
rc = mdt_dlmreq_unpack(info);
RETURN(rc);
}
示例13: lustre_loa_init
void lustre_loa_init(struct lustre_ost_attrs *loa, const struct lu_fid *fid,
__u32 compat, __u32 incompat)
{
CLASSERT(sizeof(*loa) == LMA_OLD_SIZE);
memset(&loa->loa_parent_fid, 0,
sizeof(*loa) - offsetof(typeof(*loa), loa_parent_fid));
lustre_lma_init(&loa->loa_lma, fid, compat, incompat);
}
示例14: initDemo
void initDemo( DeviceDataBase* deviceData = NULL )
{
m_pDemo = NULL;
m_pDemo = createFuncs[0]( deviceData );
CLASSERT( m_pDemo );
m_pDemo->init();
m_pDemo->reset();
}
示例15: lov_lsm_pack_v1v3
/**
* Pack LOV striping metadata for disk storage format (in little
* endian byte order).
*
* This follows the getxattr() conventions. If \a buf_size is zero
* then return the size needed. If \a buf_size is too small then
* return -ERANGE. Otherwise return the size of the result.
*/
ssize_t lov_lsm_pack_v1v3(const struct lov_stripe_md *lsm, void *buf,
size_t buf_size)
{
struct lov_mds_md_v1 *lmmv1 = buf;
struct lov_mds_md_v3 *lmmv3 = buf;
struct lov_ost_data_v1 *lmm_objects;
size_t lmm_size;
unsigned int i;
ENTRY;
lmm_size = lov_mds_md_size(lsm->lsm_entries[0]->lsme_stripe_count,
lsm->lsm_magic);
if (buf_size == 0)
RETURN(lmm_size);
if (buf_size < lmm_size)
RETURN(-ERANGE);
/* lmmv1 and lmmv3 point to the same struct and have the
* same first fields
*/
lmmv1->lmm_magic = cpu_to_le32(lsm->lsm_magic);
lmm_oi_cpu_to_le(&lmmv1->lmm_oi, &lsm->lsm_oi);
lmmv1->lmm_stripe_size = cpu_to_le32(
lsm->lsm_entries[0]->lsme_stripe_size);
lmmv1->lmm_stripe_count = cpu_to_le16(
lsm->lsm_entries[0]->lsme_stripe_count);
lmmv1->lmm_pattern = cpu_to_le32(lsm->lsm_entries[0]->lsme_pattern);
lmmv1->lmm_layout_gen = cpu_to_le16(lsm->lsm_layout_gen);
if (lsm->lsm_magic == LOV_MAGIC_V3) {
CLASSERT(sizeof(lsm->lsm_entries[0]->lsme_pool_name) ==
sizeof(lmmv3->lmm_pool_name));
strlcpy(lmmv3->lmm_pool_name,
lsm->lsm_entries[0]->lsme_pool_name,
sizeof(lmmv3->lmm_pool_name));
lmm_objects = lmmv3->lmm_objects;
} else {
lmm_objects = lmmv1->lmm_objects;
}
if (lsm->lsm_is_released)
RETURN(lmm_size);
for (i = 0; i < lsm->lsm_entries[0]->lsme_stripe_count; i++) {
struct lov_oinfo *loi = lsm->lsm_entries[0]->lsme_oinfo[i];
ostid_cpu_to_le(&loi->loi_oi, &lmm_objects[i].l_ost_oi);
lmm_objects[i].l_ost_gen = cpu_to_le32(loi->loi_ost_gen);
lmm_objects[i].l_ost_idx = cpu_to_le32(loi->loi_ost_idx);
}
RETURN(lmm_size);
}