/**
* Debugging functions and helpers to print request structure into debug log
* @{
- */
+ */
/* Spare the preprocessor, spoil the bugs. */
#define FLAG(field, str) (field ? str : "")
/**
* service thread pid
*/
- pid_t t_pid;
+ pid_t t_pid;
/**
* put watchdog in the structure per thread b=14840
*/
/** @} */
/**
- * ptlrpc msg buffer and swab interface
+ * ptlrpc msg buffer and swab interface
*
* @{
*/
int ptlrpc_buf_need_swab(struct ptlrpc_request *req, const int inout,
- int index);
+ __u32 index);
void ptlrpc_buf_set_swabbed(struct ptlrpc_request *req, const int inout,
- int index);
+ __u32 index);
int ptlrpc_unpack_rep_msg(struct ptlrpc_request *req, int len);
int ptlrpc_unpack_req_msg(struct ptlrpc_request *req, int len);
unsigned int newlen, int move_data);
void lustre_free_reply_state(struct ptlrpc_reply_state *rs);
int __lustre_unpack_msg(struct lustre_msg *m, int len);
-int lustre_msg_hdr_size(__u32 magic, int count);
-int lustre_msg_size(__u32 magic, int count, __u32 *lengths);
-int lustre_msg_size_v2(int count, __u32 *lengths);
-int lustre_packed_msg_size(struct lustre_msg *msg);
-int lustre_msg_early_size(void);
-void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size);
-void *lustre_msg_buf(struct lustre_msg *m, int n, int minlen);
-int lustre_msg_buflen(struct lustre_msg *m, int n);
-void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len);
-int lustre_msg_bufcount(struct lustre_msg *m);
-char *lustre_msg_string(struct lustre_msg *m, int n, int max_len);
+__u32 lustre_msg_hdr_size(__u32 magic, __u32 count);
+__u32 lustre_msg_size(__u32 magic, int count, __u32 *lengths);
+__u32 lustre_msg_size_v2(int count, __u32 *lengths);
+__u32 lustre_packed_msg_size(struct lustre_msg *msg);
+__u32 lustre_msg_early_size(void);
+void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, __u32 n, __u32 min_size);
+void *lustre_msg_buf(struct lustre_msg *m, __u32 n, __u32 minlen);
+__u32 lustre_msg_buflen(struct lustre_msg *m, __u32 n);
+void lustre_msg_set_buflen(struct lustre_msg *m, __u32 n, __u32 len);
+__u32 lustre_msg_bufcount(struct lustre_msg *m);
+char *lustre_msg_string(struct lustre_msg *m, __u32 n, __u32 max_len);
__u32 lustre_msghdr_get_flags(struct lustre_msg *msg);
void lustre_msghdr_set_flags(struct lustre_msg *msg, __u32 flags);
__u32 lustre_msg_get_flags(struct lustre_msg *msg);
-void lustre_msg_add_flags(struct lustre_msg *msg, int flags);
-void lustre_msg_set_flags(struct lustre_msg *msg, int flags);
-void lustre_msg_clear_flags(struct lustre_msg *msg, int flags);
+void lustre_msg_add_flags(struct lustre_msg *msg, __u32 flags);
+void lustre_msg_set_flags(struct lustre_msg *msg, __u32 flags);
+void lustre_msg_clear_flags(struct lustre_msg *msg, __u32 flags);
__u32 lustre_msg_get_op_flags(struct lustre_msg *msg);
-void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags);
-void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags);
+void lustre_msg_add_op_flags(struct lustre_msg *msg, __u32 flags);
+void lustre_msg_set_op_flags(struct lustre_msg *msg, __u32 flags);
struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg);
__u32 lustre_msg_get_type(struct lustre_msg *msg);
__u32 lustre_msg_get_version(struct lustre_msg *msg);
-void lustre_msg_add_version(struct lustre_msg *msg, int version);
+void lustre_msg_add_version(struct lustre_msg *msg, __u32 version);
__u32 lustre_msg_get_opc(struct lustre_msg *msg);
__u64 lustre_msg_get_last_xid(struct lustre_msg *msg);
__u64 lustre_msg_get_last_committed(struct lustre_msg *msg);
}
/**
- * Returns true if request \a req got early reply and hard deadline is not met
+ * Returns true if request \a req got early reply and hard deadline is not met
*/
static inline int
ptlrpc_client_early(struct ptlrpc_request *req)
void req_capsule_client_dump(struct req_capsule *pill);
void req_capsule_server_dump(struct req_capsule *pill);
void req_capsule_init_area(struct req_capsule *pill);
-int req_capsule_filled_sizes(struct req_capsule *pill, enum req_location loc);
+size_t req_capsule_filled_sizes(struct req_capsule *pill,
+ enum req_location loc);
int req_capsule_server_pack(struct req_capsule *pill);
void *req_capsule_client_get(struct req_capsule *pill,
const struct req_msg_field *field,
void *swabber);
void *req_capsule_client_sized_get(struct req_capsule *pill,
- const struct req_msg_field *field,
- int len);
+ const struct req_msg_field *field,
+ __u32 len);
void *req_capsule_server_get(struct req_capsule *pill,
const struct req_msg_field *field);
void *req_capsule_server_sized_get(struct req_capsule *pill,
- const struct req_msg_field *field,
- int len);
+ const struct req_msg_field *field,
+ __u32 len);
void *req_capsule_server_swab_get(struct req_capsule *pill,
const struct req_msg_field *field,
void *swabber);
void *req_capsule_server_sized_swab_get(struct req_capsule *pill,
const struct req_msg_field *field,
- int len, void *swabber);
+ __u32 len, void *swabber);
const void *req_capsule_other_get(struct req_capsule *pill,
const struct req_msg_field *field);
void req_capsule_set_size(struct req_capsule *pill,
- const struct req_msg_field *field,
- enum req_location loc, int size);
-int req_capsule_get_size(const struct req_capsule *pill,
- const struct req_msg_field *field,
- enum req_location loc);
-int req_capsule_msg_size(struct req_capsule *pill, enum req_location loc);
-int req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,
+ const struct req_msg_field *field,
+ enum req_location loc, __u32 size);
+__u32 req_capsule_get_size(const struct req_capsule *pill,
+ const struct req_msg_field *field,
+ enum req_location loc);
+__u32 req_capsule_msg_size(struct req_capsule *pill, enum req_location loc);
+__u32 req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,
enum req_location loc);
void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt);
const struct req_msg_field *field,
enum req_location loc);
void req_capsule_shrink(struct req_capsule *pill,
- const struct req_msg_field *field,
- unsigned int newlen,
- enum req_location loc);
+ const struct req_msg_field *field,
+ __u32 newlen,
+ enum req_location loc);
int req_capsule_server_grow(struct req_capsule *pill,
- const struct req_msg_field *field,
- unsigned int newlen);
+ const struct req_msg_field *field,
+ __u32 newlen);
int req_layout_init(void);
void req_layout_fini(void);
enum req_location loc,
int off)
{
- int size = req_capsule_msg_size(pill, loc);
- return ldlm_req_handles_avail(size, off);
+ __u32 size = req_capsule_msg_size(pill, loc);
+ return ldlm_req_handles_avail(size, off);
}
static inline int ldlm_format_handles_avail(struct obd_import *imp,
const struct req_format *fmt,
enum req_location loc, int off)
{
- int size = req_capsule_fmt_size(imp->imp_msg_magic, fmt, loc);
- return ldlm_req_handles_avail(size, off);
+ __u32 size = req_capsule_fmt_size(imp->imp_msg_magic, fmt, loc);
+ return ldlm_req_handles_avail(size, off);
}
/**
*/
struct req_format {
- const char *rf_name;
- int rf_idx;
- struct {
- int nr;
- const struct req_msg_field **d;
- } rf_fields[RCL_NR];
+ const char *rf_name;
+ size_t rf_idx;
+ struct {
+ size_t nr;
+ const struct req_msg_field **d;
+ } rf_fields[RCL_NR];
};
#define DEFINE_REQ_FMT(name, client, client_nr, server, server_nr) { \
*/
int req_layout_init(void)
{
- int i;
- int j;
- int k;
+ size_t i;
+ size_t j;
+ size_t k;
struct req_format *rf = NULL;
for (i = 0; i < ARRAY_SIZE(req_formats); ++i) {
*/
void req_capsule_init_area(struct req_capsule *pill)
{
- int i;
+ size_t i;
for (i = 0; i < ARRAY_SIZE(pill->rc_area[RCL_CLIENT]); i++) {
pill->rc_area[RCL_CLIENT][i] = -1;
static int __req_format_is_sane(const struct req_format *fmt)
{
- return
- 0 <= fmt->rf_idx && fmt->rf_idx < ARRAY_SIZE(req_formats) &&
- req_formats[fmt->rf_idx] == fmt;
+ return fmt->rf_idx < ARRAY_SIZE(req_formats) &&
+ req_formats[fmt->rf_idx] == fmt;
}
static struct lustre_msg *__req_msg(const struct req_capsule *pill,
* variable-sized fields. The field sizes come from the declared \a rmf_size
* field of a \a pill's \a rc_fmt's RMF's.
*/
-int req_capsule_filled_sizes(struct req_capsule *pill,
- enum req_location loc)
+size_t req_capsule_filled_sizes(struct req_capsule *pill,
+ enum req_location loc)
{
- const struct req_format *fmt = pill->rc_fmt;
- int i;
+ const struct req_format *fmt = pill->rc_fmt;
+ size_t i;
LASSERT(fmt != NULL);
* Returns the PTLRPC request or reply (\a loc) buffer offset of a \a pill
* corresponding to the given RMF (\a field).
*/
-static int __req_capsule_offset(const struct req_capsule *pill,
- const struct req_msg_field *field,
- enum req_location loc)
+static __u32 __req_capsule_offset(const struct req_capsule *pill,
+ const struct req_msg_field *field,
+ enum req_location loc)
{
int offset;
const struct req_format *fmt;
struct lustre_msg *msg;
void *value;
- int len;
- int offset;
+ __u32 len;
+ __u32 offset;
- void *(*getter)(struct lustre_msg *m, int n, int minlen);
+ void *(*getter)(struct lustre_msg *m, __u32 n, __u32 minlen);
static const char *rcl_names[RCL_NR] = {
[RCL_CLIENT] = "client",
len = lustre_msg_buflen(msg, offset);
if ((len % field->rmf_size) != 0) {
CERROR("%s: array field size mismatch "
- "%d modulo %d != 0 (%d)\n",
- field->rmf_name, len, field->rmf_size, loc);
+ "%d modulo %u != 0 (%d)\n",
+ field->rmf_name, len, field->rmf_size, loc);
return NULL;
}
} else if (pill->rc_area[loc][offset] != -1) {
len = pill->rc_area[loc][offset];
} else {
- len = max(field->rmf_size, 0);
+ len = max_t(typeof(field->rmf_size), field->rmf_size, 0);
}
value = getter(msg, offset, len);
if (value == NULL) {
DEBUG_REQ(D_ERROR, pill->rc_req,
- "Wrong buffer for field `%s' (%d of %d) "
- "in format `%s': %d vs. %d (%s)\n",
- field->rmf_name, offset, lustre_msg_bufcount(msg),
- fmt->rf_name, lustre_msg_buflen(msg, offset), len,
- rcl_names[loc]);
+ "Wrong buffer for field `%s' (%u of %u) "
+ "in format `%s': %u vs. %u (%s)\n",
+ field->rmf_name, offset, lustre_msg_bufcount(msg),
+ fmt->rf_name, lustre_msg_buflen(msg, offset), len,
+ rcl_names[loc]);
} else {
swabber_dumper_helper(pill, field, loc, offset, value, len,
dump, swabber);
*/
void __req_capsule_dump(struct req_capsule *pill, enum req_location loc)
{
- const struct req_format *fmt;
- const struct req_msg_field *field;
- int len;
- int i;
+ const struct req_format *fmt;
+ const struct req_msg_field *field;
+ __u32 len;
+ size_t i;
fmt = pill->rc_fmt;
* have a specific dumper
*/
len = req_capsule_get_size(pill, field, loc);
- CDEBUG(D_RPCTRACE, "Field %s has no dumper function;"
- "field size is %d\n", field->rmf_name, len);
+ CDEBUG(D_RPCTRACE, "Field %s has no dumper function;"
+ "field size is %u\n", field->rmf_name, len);
} else {
/* It's the dumping side-effect that we're interested in */
(void) __req_capsule_get(pill, field, loc, NULL, 1);
* returned.
*/
void *req_capsule_client_sized_get(struct req_capsule *pill,
- const struct req_msg_field *field,
- int len)
+ const struct req_msg_field *field,
+ __u32 len)
{
req_capsule_set_size(pill, field, RCL_CLIENT, len);
return __req_capsule_get(pill, field, RCL_CLIENT, NULL, 0);
* returned.
*/
void *req_capsule_server_sized_get(struct req_capsule *pill,
- const struct req_msg_field *field,
- int len)
+ const struct req_msg_field *field,
+ __u32 len)
{
req_capsule_set_size(pill, field, RCL_SERVER, len);
return __req_capsule_get(pill, field, RCL_SERVER, NULL, 0);
void *req_capsule_server_sized_swab_get(struct req_capsule *pill,
const struct req_msg_field *field,
- int len, void *swabber)
+ __u32 len, void *swabber)
{
req_capsule_set_size(pill, field, RCL_SERVER, len);
return __req_capsule_get(pill, field, RCL_SERVER, swabber, 0);
* request or reply.
*/
void req_capsule_set_size(struct req_capsule *pill,
- const struct req_msg_field *field,
- enum req_location loc, int size)
+ const struct req_msg_field *field,
+ enum req_location loc, __u32 size)
{
- LASSERT(loc == RCL_SERVER || loc == RCL_CLIENT);
-
- if ((size != field->rmf_size) &&
- (field->rmf_size != -1) &&
- !(field->rmf_flags & RMF_F_NO_SIZE_CHECK) &&
- (size > 0)) {
- if ((field->rmf_flags & RMF_F_STRUCT_ARRAY) &&
- (size % field->rmf_size != 0)) {
- CERROR("%s: array field size mismatch "
- "%d %% %d != 0 (%d)\n",
- field->rmf_name, size, field->rmf_size, loc);
- LBUG();
- } else if (!(field->rmf_flags & RMF_F_STRUCT_ARRAY) &&
- size < field->rmf_size) {
- CERROR("%s: field size mismatch %d != %d (%d)\n",
- field->rmf_name, size, field->rmf_size, loc);
- LBUG();
- }
- }
-
- pill->rc_area[loc][__req_capsule_offset(pill, field, loc)] = size;
+ LASSERT(loc == RCL_SERVER || loc == RCL_CLIENT);
+
+ if ((size != (__u32)field->rmf_size) &&
+ (field->rmf_size != -1) &&
+ !(field->rmf_flags & RMF_F_NO_SIZE_CHECK) &&
+ (size > 0)) {
+ __u32 rmf_size = (__u32)field->rmf_size;
+ if ((field->rmf_flags & RMF_F_STRUCT_ARRAY) &&
+ (size % rmf_size != 0)) {
+ CERROR("%s: array field size mismatch "
+ "%u %% %u != 0 (%d)\n",
+ field->rmf_name, size, rmf_size, loc);
+ LBUG();
+ } else if (!(field->rmf_flags & RMF_F_STRUCT_ARRAY) &&
+ size < rmf_size) {
+ CERROR("%s: field size mismatch %u != %u (%d)\n",
+ field->rmf_name, size, rmf_size, loc);
+ LBUG();
+ }
+ }
+
+ pill->rc_area[loc][__req_capsule_offset(pill, field, loc)] = size;
}
EXPORT_SYMBOL(req_capsule_set_size);
* actually sets the size in pill.rc_area[loc][offset], but this function
* returns the message buflen[offset], maybe we should use another name.
*/
-int req_capsule_get_size(const struct req_capsule *pill,
+__u32 req_capsule_get_size(const struct req_capsule *pill,
const struct req_msg_field *field,
enum req_location loc)
{
*
* See also req_capsule_set_size().
*/
-int req_capsule_msg_size(struct req_capsule *pill, enum req_location loc)
+__u32 req_capsule_msg_size(struct req_capsule *pill, enum req_location loc)
{
return lustre_msg_size(pill->rc_req->rq_import->imp_msg_magic,
pill->rc_fmt->rf_fields[loc].nr,
* This function should not be used for formats which contain variable size
* fields.
*/
-int req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,
+__u32 req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,
enum req_location loc)
{
- int size, i = 0;
+ __u32 size;
+ size_t i = 0;
/*
* This function should probably LASSERT() that fmt has no fields with
* we do.
*/
size = lustre_msg_hdr_size(magic, fmt->rf_fields[loc].nr);
- if (size < 0)
- return size;
+ if (size == 0)
+ return size;
for (; i < fmt->rf_fields[loc].nr; ++i)
if (fmt->rf_fields[loc].d[i]->rmf_size != -1)
*/
void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt)
{
- int i;
- int j;
+ int i;
+ size_t j;
const struct req_format *old;
const struct req_msg_field *field,
enum req_location loc)
{
- int offset;
+ __u32 offset;
LASSERT(loc == RCL_SERVER || loc == RCL_CLIENT);
LASSERT(req_capsule_has_field(pill, field, loc));
* This is not the opposite of req_capsule_extend().
*/
void req_capsule_shrink(struct req_capsule *pill,
- const struct req_msg_field *field,
- unsigned int newlen,
- enum req_location loc)
+ const struct req_msg_field *field,
+ __u32 newlen,
+ enum req_location loc)
{
const struct req_format *fmt;
struct lustre_msg *msg;
- int len;
+ __u32 len;
int offset;
fmt = pill->rc_fmt;
msg = __req_msg(pill, loc);
len = lustre_msg_buflen(msg, offset);
- LASSERTF(newlen <= len, "%s:%s, oldlen=%d, newlen=%d\n",
+ LASSERTF(newlen <= len, "%s:%s, oldlen=%u, newlen=%u\n",
fmt->rf_name, field->rmf_name, len, newlen);
if (loc == RCL_CLIENT)
EXPORT_SYMBOL(req_capsule_shrink);
int req_capsule_server_grow(struct req_capsule *pill,
- const struct req_msg_field *field,
- unsigned int newlen)
+ const struct req_msg_field *field,
+ __u32 newlen)
{
struct ptlrpc_reply_state *rs = pill->rc_req->rq_reply_state, *nrs;
char *from, *to;
- int offset, len, rc;
+ int rc;
+ __u32 offset, len;
LASSERT(pill->rc_fmt != NULL);
LASSERT(__req_format_is_sane(pill->rc_fmt));
len = req_capsule_get_size(pill, field, RCL_SERVER);
offset = __req_capsule_offset(pill, field, RCL_SERVER);
- if (pill->rc_req->rq_repbuf_len >=
+ if ((__u32)pill->rc_req->rq_repbuf_len >=
lustre_packed_msg_size(pill->rc_req->rq_repmsg) - len + newlen)
CERROR("Inplace repack might be done\n");
#include "ptlrpc_internal.h"
-static inline int lustre_msg_hdr_size_v2(int count)
+static inline __u32 lustre_msg_hdr_size_v2(__u32 count)
{
return cfs_size_round(offsetof(struct lustre_msg_v2,
lm_buflens[count]));
}
-int lustre_msg_hdr_size(__u32 magic, int count)
+__u32 lustre_msg_hdr_size(__u32 magic, __u32 count)
{
switch (magic) {
case LUSTRE_MSG_MAGIC_V2:
return lustre_msg_hdr_size_v2(count);
default:
LASSERTF(0, "incorrect message magic: %08x\n", magic);
- return -EINVAL;
+ return 0;
}
}
EXPORT_SYMBOL(lustre_msg_hdr_size);
void ptlrpc_buf_set_swabbed(struct ptlrpc_request *req, const int inout,
- int index)
+ __u32 index)
{
if (inout)
lustre_set_req_swabbed(req, index);
EXPORT_SYMBOL(ptlrpc_buf_set_swabbed);
int ptlrpc_buf_need_swab(struct ptlrpc_request *req, const int inout,
- int index)
+ __u32 index)
{
if (inout)
return (ptlrpc_req_need_swab(req) &&
EXPORT_SYMBOL(ptlrpc_buf_need_swab);
static inline int lustre_msg_check_version_v2(struct lustre_msg_v2 *msg,
- __u32 version)
+ __u32 version)
{
__u32 ver = lustre_msg_get_version(msg);
return (ver & LUSTRE_VERSION_MASK) != version;
EXPORT_SYMBOL(lustre_msg_check_version);
/* early reply size */
-int lustre_msg_early_size()
+__u32 lustre_msg_early_size()
{
- static int size = 0;
+ static __u32 size;
if (!size) {
/* Always reply old ptlrpc_body_v2 to keep interoprability
* with the old client (< 2.3) which doesn't have pb_jobid
__u32 pblen = sizeof(struct ptlrpc_body_v2);
size = lustre_msg_size(LUSTRE_MSG_MAGIC_V2, 1, &pblen);
}
- return size;
+ return size;
}
EXPORT_SYMBOL(lustre_msg_early_size);
-int lustre_msg_size_v2(int count, __u32 *lengths)
+__u32 lustre_msg_size_v2(int count, __u32 *lengths)
{
- int size;
+ __u32 size;
int i;
size = lustre_msg_hdr_size_v2(count);
* in the form of a v2 request. If this is a connection to a v1
* target then the first buffer will be stripped because the ptlrpc
* data is part of the lustre_msg_v1 header. b=14043 */
-int lustre_msg_size(__u32 magic, int count, __u32 *lens)
+__u32 lustre_msg_size(__u32 magic, int count, __u32 *lens)
{
__u32 size[] = { sizeof(struct ptlrpc_body) };
return lustre_msg_size_v2(count, lens);
default:
LASSERTF(0, "incorrect message magic: %08x\n", magic);
- return -EINVAL;
+ return 0;
}
}
EXPORT_SYMBOL(lustre_msg_size);
/* This is used to determine the size of a buffer that was already packed
* and will correctly handle the different message formats. */
-int lustre_packed_msg_size(struct lustre_msg *msg)
+__u32 lustre_packed_msg_size(struct lustre_msg *msg)
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2:
}
EXPORT_SYMBOL(lustre_pack_reply);
-void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size)
+void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, __u32 n, __u32 min_size)
{
- int i, offset, buflen, bufcount;
+ __u32 i, offset, buflen, bufcount;
LASSERT(m != NULL);
- LASSERT(n >= 0);
bufcount = m->lm_bufcount;
if (unlikely(n >= bufcount)) {
return (char *)m + offset;
}
-void *lustre_msg_buf(struct lustre_msg *m, int n, int min_size)
+void *lustre_msg_buf(struct lustre_msg *m, __u32 n, __u32 min_size)
{
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V2:
}
EXPORT_SYMBOL(lustre_msg_buf);
-static int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment,
+static int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, __u32 segment,
unsigned int newlen, int move_data)
{
char *tail = NULL, *newpos;
}
}
-static inline int lustre_msg_buflen_v2(struct lustre_msg_v2 *m, int n)
+static inline __u32 lustre_msg_buflen_v2(struct lustre_msg_v2 *m, __u32 n)
{
if (n >= m->lm_bufcount)
return 0;
*
* returns zero for non-existent message indices
*/
-int lustre_msg_buflen(struct lustre_msg *m, int n)
+__u32 lustre_msg_buflen(struct lustre_msg *m, __u32 n)
{
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V2:
return lustre_msg_buflen_v2(m, n);
default:
CERROR("incorrect message magic: %08x\n", m->lm_magic);
- return -EINVAL;
+ return 0;
}
}
EXPORT_SYMBOL(lustre_msg_buflen);
static inline void
-lustre_msg_set_buflen_v2(struct lustre_msg_v2 *m, int n, int len)
+lustre_msg_set_buflen_v2(struct lustre_msg_v2 *m, __u32 n, __u32 len)
{
if (n >= m->lm_bufcount)
LBUG();
m->lm_buflens[n] = len;
}
-void lustre_msg_set_buflen(struct lustre_msg *m, int n, int len)
+void lustre_msg_set_buflen(struct lustre_msg *m, __u32 n, __u32 len)
{
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V2:
/* NB return the bufcount for lustre_msg_v2 format, so if message is packed
* in V1 format, the result is one bigger. (add struct ptlrpc_body). */
-int lustre_msg_bufcount(struct lustre_msg *m)
+__u32 lustre_msg_bufcount(struct lustre_msg *m)
{
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V2:
return m->lm_bufcount;
default:
CERROR("incorrect message magic: %08x\n", m->lm_magic);
- return -EINVAL;
+ return 0;
}
}
EXPORT_SYMBOL(lustre_msg_bufcount);
-char *lustre_msg_string(struct lustre_msg *m, int index, int max_len)
+char *lustre_msg_string(struct lustre_msg *m, __u32 index, __u32 max_len)
{
- /* max_len == 0 means the string should fill the buffer */
- char *str;
- int slen, blen;
+ /* max_len == 0 means the string should fill the buffer */
+ char *str;
+ __u32 slen, blen;
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V2:
EXPORT_SYMBOL(lustre_msg_string);
/* Wrap up the normal fixed length cases */
-static inline void *__lustre_swab_buf(struct lustre_msg *msg, int index,
- int min_size, void *swabber)
+static inline void *__lustre_swab_buf(struct lustre_msg *msg, __u32 index,
+ __u32 min_size, void *swabber)
{
void *ptr = NULL;
}
EXPORT_SYMBOL(lustre_msg_get_flags);
-void lustre_msg_add_flags(struct lustre_msg *msg, int flags)
+void lustre_msg_add_flags(struct lustre_msg *msg, __u32 flags)
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
}
EXPORT_SYMBOL(lustre_msg_add_flags);
-void lustre_msg_set_flags(struct lustre_msg *msg, int flags)
+void lustre_msg_set_flags(struct lustre_msg *msg, __u32 flags)
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
}
EXPORT_SYMBOL(lustre_msg_set_flags);
-void lustre_msg_clear_flags(struct lustre_msg *msg, int flags)
+void lustre_msg_clear_flags(struct lustre_msg *msg, __u32 flags)
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
}
EXPORT_SYMBOL(lustre_msg_get_op_flags);
-void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags)
+void lustre_msg_add_op_flags(struct lustre_msg *msg, __u32 flags)
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
}
EXPORT_SYMBOL(lustre_msg_add_op_flags);
-void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags)
+void lustre_msg_set_op_flags(struct lustre_msg *msg, __u32 flags)
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
}
EXPORT_SYMBOL(lustre_msg_get_version);
-void lustre_msg_add_version(struct lustre_msg *msg, int version)
+void lustre_msg_add_version(struct lustre_msg *msg, __u32 version)
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
[RCL_SERVER] = "S"
};
- printf("L %s (%i/%i)\n", rf->rf_name,
+ printf("L %s (%zu/%zu)\n", rf->rf_name,
rf->rf_fields[RCL_CLIENT].nr, rf->rf_fields[RCL_SERVER].nr);
for (j = 0; j < RCL_NR; ++j) {