static int out_xattr_set(struct tgt_session_info *tsi) { struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env); struct object_update *update = tti->tti_u.update.tti_update; struct dt_object *obj = tti->tti_u.update.tti_dt_object; struct lu_buf *lbuf = &tti->tti_buf; char *name; char *buf; char *tmp; int buf_len = 0; int flag; int rc; ENTRY; name = object_update_param_get(update, 0, NULL); if (name == NULL) { CERROR("%s: empty name for xattr set: rc = %d\n", tgt_name(tsi->tsi_tgt), -EPROTO); RETURN(err_serious(-EPROTO)); } buf = object_update_param_get(update, 1, &buf_len); if (buf == NULL || buf_len == 0) { CERROR("%s: empty buf for xattr set: rc = %d\n", tgt_name(tsi->tsi_tgt), -EPROTO); RETURN(err_serious(-EPROTO)); } lbuf->lb_buf = buf; lbuf->lb_len = buf_len; tmp = (char *)object_update_param_get(update, 2, NULL); if (tmp == NULL) { CERROR("%s: empty flag for xattr set: rc = %d\n", tgt_name(tsi->tsi_tgt), -EPROTO); RETURN(err_serious(-EPROTO)); } if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req)) __swab32s((__u32 *)tmp); flag = *(int *)tmp; rc = out_tx_xattr_set(tsi->tsi_env, obj, lbuf, name, flag, &tti->tti_tea, tti->tti_u.update.tti_update_reply, tti->tti_u.update.tti_update_reply_index); RETURN(rc); }
static int out_xattr_set(struct tgt_session_info *tsi) { struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env); struct object_update *update = tti->tti_u.update.tti_update; struct dt_object *obj = tti->tti_u.update.tti_dt_object; struct lu_buf *lbuf = &tti->tti_buf; char *name; char *buf; __u32 *tmp; size_t buf_len = 0; int flag; size_t size = 0; int rc; ENTRY; name = object_update_param_get(update, 0, NULL); if (IS_ERR(name)) { CERROR("%s: empty name for xattr set: rc = %ld\n", tgt_name(tsi->tsi_tgt), PTR_ERR(name)); RETURN(PTR_ERR(name)); } /* If buffer == NULL (-ENODATA), then it might mean delete xattr */ buf = object_update_param_get(update, 1, &buf_len); if (IS_ERR(buf) && PTR_ERR(buf) != -ENODATA) RETURN(PTR_ERR(buf)); lbuf->lb_buf = buf; lbuf->lb_len = buf_len; tmp = object_update_param_get(update, 2, &size); if (IS_ERR(tmp) || size != sizeof(*tmp)) { CERROR("%s: emptry or wrong size %zu flag: rc = %ld\n", tgt_name(tsi->tsi_tgt), size, PTR_ERR(tmp)); RETURN(PTR_ERR(tmp)); } if (ptlrpc_req_need_swab(tsi->tsi_pill->rc_req)) __swab32s(tmp); flag = *tmp; rc = out_tx_xattr_set(tsi->tsi_env, obj, lbuf, name, flag, &tti->tti_tea, tti->tti_tea.ta_handle, tti->tti_u.update.tti_update_reply, tti->tti_u.update.tti_update_reply_index); RETURN(rc); }
static int out_xattr_set(struct mdt_thread_info *info) { struct update *update = info->mti_u.update.mti_update; struct dt_object *obj = info->mti_u.update.mti_dt_object; struct lu_buf *lbuf = &info->mti_buf; char *name; char *buf; char *tmp; int buf_len = 0; int flag; int rc; ENTRY; name = update_param_buf(update, 0, NULL); if (name == NULL) { CERROR("%s: empty name for xattr set: rc = %d\n", mdt_obd_name(info->mti_mdt), -EPROTO); RETURN(err_serious(-EPROTO)); } buf = (char *)update_param_buf(update, 1, &buf_len); if (buf == NULL || buf_len == 0) { CERROR("%s: empty buf for xattr set: rc = %d\n", mdt_obd_name(info->mti_mdt), -EPROTO); RETURN(err_serious(-EPROTO)); } lbuf->lb_buf = buf; lbuf->lb_len = buf_len; tmp = (char *)update_param_buf(update, 2, NULL); if (tmp == NULL) { CERROR("%s: empty flag for xattr set: rc = %d\n", mdt_obd_name(info->mti_mdt), -EPROTO); RETURN(err_serious(-EPROTO)); } flag = le32_to_cpu(*(int *)tmp); rc = out_tx_xattr_set(info, obj, lbuf, name, flag, &info->mti_handle, info->mti_u.update.mti_update_reply, info->mti_u.update.mti_update_reply_index); RETURN(rc); }