X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fptlrpc%2Fpack_generic.c;h=e4bacc2f26894ff9b46a821376652e486e7b246e;hp=f7c524be2eadb8cbef5d918b962c67024dbe19d7;hb=771308ada3895c3ccfeb8e63365089086c1d9fdc;hpb=67d17dd590f913643f5adc8aced369221faccf05 diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index f7c524b..e4bacc2 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -50,8 +50,6 @@ #include #include #include -#include - #include "ptlrpc_internal.h" static inline __u32 lustre_msg_hdr_size_v2(__u32 count) @@ -2894,110 +2892,6 @@ void lustre_swab_hsm_request(struct hsm_request *hr) __swab32s(&hr->hr_data_len); } -void lustre_swab_object_update(struct object_update *ou) -{ - struct object_update_param *param; - size_t i; - - __swab16s(&ou->ou_type); - __swab16s(&ou->ou_params_count); - __swab32s(&ou->ou_result_size); - __swab32s(&ou->ou_flags); - __swab32s(&ou->ou_padding1); - __swab64s(&ou->ou_batchid); - lustre_swab_lu_fid(&ou->ou_fid); - param = &ou->ou_params[0]; - for (i = 0; i < ou->ou_params_count; i++) { - __swab16s(¶m->oup_len); - __swab16s(¶m->oup_padding); - __swab32s(¶m->oup_padding2); - param = (struct object_update_param *)((char *)param + - object_update_param_size(param)); - } -} - -int lustre_swab_object_update_request(struct object_update_request *our, - __u32 len) -{ - __u32 i, size = 0; - struct object_update *ou; - - __swab32s(&our->ourq_magic); - __swab16s(&our->ourq_count); - __swab16s(&our->ourq_padding); - - /* Don't need to calculate request size if len is 0. */ - if (len > 0) { - size = sizeof(struct object_update_request); - for (i = 0; i < our->ourq_count; i++) { - ou = object_update_request_get(our, i, NULL); - if (ou == NULL) - return -EPROTO; - size += sizeof(struct object_update) + - ou->ou_params_count * - sizeof(struct object_update_param); - } - if (unlikely(size > len)) - return -EOVERFLOW; - } - - for (i = 0; i < our->ourq_count; i++) { - ou = object_update_request_get(our, i, NULL); - lustre_swab_object_update(ou); - } - - return size; -} - -void lustre_swab_object_update_result(struct object_update_result *our) -{ - __swab32s(&our->our_rc); - __swab16s(&our->our_datalen); - __swab16s(&our->our_padding); -} - -int lustre_swab_object_update_reply(struct object_update_reply *our, __u32 len) -{ - __u32 i, size; - - __swab32s(&our->ourp_magic); - __swab16s(&our->ourp_count); - __swab16s(&our->ourp_padding); - - size = sizeof(struct object_update_reply) + our->ourp_count * - (sizeof(__u16) + sizeof(struct object_update_result)); - if (unlikely(size > len)) - return -EOVERFLOW; - - for (i = 0; i < our->ourp_count; i++) { - struct object_update_result *ourp; - - __swab16s(&our->ourp_lens[i]); - ourp = object_update_result_get(our, i, NULL); - if (ourp == NULL) - return -EPROTO; - lustre_swab_object_update_result(ourp); - } - - return size; -} - -void lustre_swab_out_update_header(struct out_update_header *ouh) -{ - __swab32s(&ouh->ouh_magic); - __swab32s(&ouh->ouh_count); - __swab32s(&ouh->ouh_inline_length); - __swab32s(&ouh->ouh_reply_size); -} -EXPORT_SYMBOL(lustre_swab_out_update_header); - -void lustre_swab_out_update_buffer(struct out_update_buffer *oub) -{ - __swab32s(&oub->oub_size); - __swab32s(&oub->oub_padding); -} -EXPORT_SYMBOL(lustre_swab_out_update_buffer); - void lustre_swab_swap_layouts(struct mdc_swap_layouts *msl) { __swab64s(&msl->msl_flags);