Lines Matching defs:obj

23 xdr_encode_netobj(__be32 *p, const struct xdr_netobj *obj)
25 unsigned int quadlen = XDR_QUADLEN(obj->len);
28 *p++ = cpu_to_be32(obj->len);
29 memcpy(p, obj->data, obj->len);
30 return p + XDR_QUADLEN(obj->len);
35 xdr_decode_netobj(__be32 *p, struct xdr_netobj *obj)
41 obj->len = len;
42 obj->data = (u8 *) p;
1107 static void __read_bytes_from_xdr_buf(struct xdr_buf *subbuf, void *obj, unsigned int len)
1112 memcpy(obj, subbuf->head[0].iov_base, this_len);
1114 obj += this_len;
1117 _copy_from_pages(obj, subbuf->pages, subbuf->page_base, this_len);
1119 obj += this_len;
1121 memcpy(obj, subbuf->tail[0].iov_base, this_len);
1124 /* obj is assumed to point to allocated memory of size at least len: */
1125 int read_bytes_from_xdr_buf(struct xdr_buf *buf, unsigned int base, void *obj, unsigned int len)
1133 __read_bytes_from_xdr_buf(&subbuf, obj, len);
1138 static void __write_bytes_to_xdr_buf(struct xdr_buf *subbuf, void *obj, unsigned int len)
1143 memcpy(subbuf->head[0].iov_base, obj, this_len);
1145 obj += this_len;
1148 _copy_to_pages(subbuf->pages, subbuf->page_base, obj, this_len);
1150 obj += this_len;
1152 memcpy(subbuf->tail[0].iov_base, obj, this_len);
1155 /* obj is assumed to point to allocated memory of size at least len: */
1156 int write_bytes_to_xdr_buf(struct xdr_buf *buf, unsigned int base, void *obj, unsigned int len)
1164 __write_bytes_to_xdr_buf(&subbuf, obj, len);
1170 xdr_decode_word(struct xdr_buf *buf, unsigned int base, u32 *obj)
1175 status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj));
1178 *obj = be32_to_cpu(raw);
1184 xdr_encode_word(struct xdr_buf *buf, unsigned int base, u32 obj)
1186 __be32 raw = cpu_to_be32(obj);
1188 return write_bytes_to_xdr_buf(buf, base, &raw, sizeof(obj));
1195 * set obj to point to it. */
1196 int xdr_buf_read_netobj(struct xdr_buf *buf, struct xdr_netobj *obj, unsigned int offset)
1200 if (xdr_decode_word(buf, offset, &obj->len))
1202 if (xdr_buf_subsegment(buf, &subbuf, offset + 4, obj->len))
1205 /* Is the obj contained entirely in the head? */
1206 obj->data = subbuf.head[0].iov_base;
1207 if (subbuf.head[0].iov_len == obj->len)
1209 /* ..or is the obj contained entirely in the tail? */
1210 obj->data = subbuf.tail[0].iov_base;
1211 if (subbuf.tail[0].iov_len == obj->len)
1214 /* use end of tail as storage for obj:
1219 if (obj->len > buf->buflen - buf->len)
1222 obj->data = buf->tail[0].iov_base + buf->tail[0].iov_len;
1224 obj->data = buf->head[0].iov_base + buf->head[0].iov_len;
1225 __read_bytes_from_xdr_buf(&subbuf, obj->data, obj->len);