From: nikita Date: Wed, 31 May 2006 11:08:51 +0000 (+0000) Subject: req-layout: separate req_capsule_has_field() and req_capsule_field_present() X-Git-Tag: v1_8_0_110~486^2~1723 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=add070b545dc67eddceae8cab51d130be302eed0;p=fs%2Flustre-release.git req-layout: separate req_capsule_has_field() and req_capsule_field_present() --- diff --git a/lustre/include/lustre_req_layout.h b/lustre/include/lustre_req_layout.h index 9772e24..c256955 100644 --- a/lustre/include/lustre_req_layout.h +++ b/lustre/include/lustre_req_layout.h @@ -73,6 +73,8 @@ void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt); int req_capsule_has_field(const struct req_capsule *pill, const struct req_msg_field *field); +int req_capsule_field_present(const struct req_capsule *pill, + const struct req_msg_field *field); int req_layout_init(void); void req_layout_fini(void); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index b899e65..7ba9fbb 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -683,10 +683,8 @@ static int mdt_body_unpack(struct mdt_thread_info *info, __u32 flags) CERROR("Invalid fid: "DFID3"\n", PFID3(&body->fid1)); result = -EINVAL; } - } else { - CERROR("Can't unpack body\n"); + } else result = -EFAULT; - } return result; } diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 4163e62..330e47f 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -632,20 +632,20 @@ EXPORT_SYMBOL(req_capsule_extend); int req_capsule_has_field(const struct req_capsule *pill, const struct req_msg_field *field) { - int result; + return field->rmf_offset[pill->rc_fmt->rf_idx][pill->rc_loc ^ 1]; +} +EXPORT_SYMBOL(req_capsule_has_field); + +int req_capsule_field_present(const struct req_capsule *pill, + const struct req_msg_field *field) +{ int loc; + int offset; - loc = pill->rc_loc ^ 1; - if (field->rmf_offset[pill->rc_fmt->rf_idx][loc]) { - int offset; + LASSERT(req_capsule_has_field(pill, field)); - offset = __req_capsule_offset(pill, field, loc); - result = __req_msg(pill, loc)->bufcount > offset; - } else - /* - * Field doesn't exist in this format. - */ - result = 0; - return result; + loc = pill->rc_loc ^ 1; + offset = __req_capsule_offset(pill, field, loc); + return __req_msg(pill, loc)->bufcount > offset; } -EXPORT_SYMBOL(req_capsule_has_field); +EXPORT_SYMBOL(req_capsule_field_present);