Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
xdr.c File Reference
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/pagemap.h>
#include <linux/errno.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/msg_prot.h>

Go to the source code of this file.

Functions

__be32xdr_encode_netobj (__be32 *p, const struct xdr_netobj *obj)
 
 EXPORT_SYMBOL_GPL (xdr_encode_netobj)
 
__be32xdr_decode_netobj (__be32 *p, struct xdr_netobj *obj)
 
 EXPORT_SYMBOL_GPL (xdr_decode_netobj)
 
__be32xdr_encode_opaque_fixed (__be32 *p, const void *ptr, unsigned int nbytes)
 
 EXPORT_SYMBOL_GPL (xdr_encode_opaque_fixed)
 
__be32xdr_encode_opaque (__be32 *p, const void *ptr, unsigned int nbytes)
 
 EXPORT_SYMBOL_GPL (xdr_encode_opaque)
 
__be32xdr_encode_string (__be32 *p, const char *string)
 
 EXPORT_SYMBOL_GPL (xdr_encode_string)
 
__be32xdr_decode_string_inplace (__be32 *p, char **sp, unsigned int *lenp, unsigned int maxlen)
 
 EXPORT_SYMBOL_GPL (xdr_decode_string_inplace)
 
void xdr_terminate_string (struct xdr_buf *buf, const u32 len)
 
 EXPORT_SYMBOL_GPL (xdr_terminate_string)
 
void xdr_inline_pages (struct xdr_buf *xdr, unsigned int offset, struct page **pages, unsigned int base, unsigned int len)
 
 EXPORT_SYMBOL_GPL (xdr_inline_pages)
 
void _copy_from_pages (char *p, struct page **pages, size_t pgbase, size_t len)
 
 EXPORT_SYMBOL_GPL (_copy_from_pages)
 
void xdr_shift_buf (struct xdr_buf *buf, size_t len)
 
 EXPORT_SYMBOL_GPL (xdr_shift_buf)
 
unsigned int xdr_stream_pos (const struct xdr_stream *xdr)
 
 EXPORT_SYMBOL_GPL (xdr_stream_pos)
 
void xdr_init_encode (struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p)
 
 EXPORT_SYMBOL_GPL (xdr_init_encode)
 
__be32xdr_reserve_space (struct xdr_stream *xdr, size_t nbytes)
 
 EXPORT_SYMBOL_GPL (xdr_reserve_space)
 
void xdr_write_pages (struct xdr_stream *xdr, struct page **pages, unsigned int base, unsigned int len)
 
 EXPORT_SYMBOL_GPL (xdr_write_pages)
 
void xdr_init_decode (struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p)
 
 EXPORT_SYMBOL_GPL (xdr_init_decode)
 
void xdr_init_decode_pages (struct xdr_stream *xdr, struct xdr_buf *buf, struct page **pages, unsigned int len)
 
 EXPORT_SYMBOL_GPL (xdr_init_decode_pages)
 
void xdr_set_scratch_buffer (struct xdr_stream *xdr, void *buf, size_t buflen)
 
 EXPORT_SYMBOL_GPL (xdr_set_scratch_buffer)
 
__be32xdr_inline_decode (struct xdr_stream *xdr, size_t nbytes)
 
 EXPORT_SYMBOL_GPL (xdr_inline_decode)
 
unsigned int xdr_read_pages (struct xdr_stream *xdr, unsigned int len)
 
 EXPORT_SYMBOL_GPL (xdr_read_pages)
 
void xdr_enter_page (struct xdr_stream *xdr, unsigned int len)
 
 EXPORT_SYMBOL_GPL (xdr_enter_page)
 
void xdr_buf_from_iov (struct kvec *iov, struct xdr_buf *buf)
 
 EXPORT_SYMBOL_GPL (xdr_buf_from_iov)
 
int xdr_buf_subsegment (struct xdr_buf *buf, struct xdr_buf *subbuf, unsigned int base, unsigned int len)
 
 EXPORT_SYMBOL_GPL (xdr_buf_subsegment)
 
int read_bytes_from_xdr_buf (struct xdr_buf *buf, unsigned int base, void *obj, unsigned int len)
 
 EXPORT_SYMBOL_GPL (read_bytes_from_xdr_buf)
 
int write_bytes_to_xdr_buf (struct xdr_buf *buf, unsigned int base, void *obj, unsigned int len)
 
 EXPORT_SYMBOL_GPL (write_bytes_to_xdr_buf)
 
int xdr_decode_word (struct xdr_buf *buf, unsigned int base, u32 *obj)
 
 EXPORT_SYMBOL_GPL (xdr_decode_word)
 
int xdr_encode_word (struct xdr_buf *buf, unsigned int base, u32 obj)
 
 EXPORT_SYMBOL_GPL (xdr_encode_word)
 
int xdr_buf_read_netobj (struct xdr_buf *buf, struct xdr_netobj *obj, unsigned int offset)
 
 EXPORT_SYMBOL_GPL (xdr_buf_read_netobj)
 
int xdr_decode_array2 (struct xdr_buf *buf, unsigned int base, struct xdr_array2_desc *desc)
 
 EXPORT_SYMBOL_GPL (xdr_decode_array2)
 
int xdr_encode_array2 (struct xdr_buf *buf, unsigned int base, struct xdr_array2_desc *desc)
 
 EXPORT_SYMBOL_GPL (xdr_encode_array2)
 
int xdr_process_buf (struct xdr_buf *buf, unsigned int offset, unsigned int len, int(*actor)(struct scatterlist *, void *), void *data)
 
 EXPORT_SYMBOL_GPL (xdr_process_buf)
 

Function Documentation

void _copy_from_pages ( char p,
struct page **  pages,
size_t  pgbase,
size_t  len 
)

_copy_from_pages : pointer to destination : array of pages : offset of source data : length

Copies data into an arbitrary memory location from an array of pages The copy is assumed to be non-overlapping.

Definition at line 274 of file xdr.c.

EXPORT_SYMBOL_GPL ( xdr_encode_netobj  )
EXPORT_SYMBOL_GPL ( xdr_decode_netobj  )
EXPORT_SYMBOL_GPL ( xdr_encode_opaque_fixed  )
EXPORT_SYMBOL_GPL ( xdr_encode_opaque  )
EXPORT_SYMBOL_GPL ( xdr_encode_string  )
EXPORT_SYMBOL_GPL ( xdr_decode_string_inplace  )
EXPORT_SYMBOL_GPL ( xdr_terminate_string  )
EXPORT_SYMBOL_GPL ( xdr_inline_pages  )
EXPORT_SYMBOL_GPL ( _copy_from_pages  )
EXPORT_SYMBOL_GPL ( xdr_shift_buf  )
EXPORT_SYMBOL_GPL ( xdr_stream_pos  )
EXPORT_SYMBOL_GPL ( xdr_init_encode  )
EXPORT_SYMBOL_GPL ( xdr_reserve_space  )
EXPORT_SYMBOL_GPL ( xdr_write_pages  )
EXPORT_SYMBOL_GPL ( xdr_init_decode  )
EXPORT_SYMBOL_GPL ( xdr_init_decode_pages  )
EXPORT_SYMBOL_GPL ( xdr_set_scratch_buffer  )
EXPORT_SYMBOL_GPL ( xdr_inline_decode  )
EXPORT_SYMBOL_GPL ( xdr_read_pages  )
EXPORT_SYMBOL_GPL ( xdr_enter_page  )
EXPORT_SYMBOL_GPL ( xdr_buf_from_iov  )
EXPORT_SYMBOL_GPL ( xdr_buf_subsegment  )
EXPORT_SYMBOL_GPL ( read_bytes_from_xdr_buf  )
EXPORT_SYMBOL_GPL ( write_bytes_to_xdr_buf  )
EXPORT_SYMBOL_GPL ( xdr_decode_word  )
EXPORT_SYMBOL_GPL ( xdr_encode_word  )
EXPORT_SYMBOL_GPL ( xdr_buf_read_netobj  )
EXPORT_SYMBOL_GPL ( xdr_decode_array2  )
EXPORT_SYMBOL_GPL ( xdr_encode_array2  )
EXPORT_SYMBOL_GPL ( xdr_process_buf  )
int read_bytes_from_xdr_buf ( struct xdr_buf *  buf,
unsigned int  base,
void obj,
unsigned int  len 
)

Definition at line 897 of file xdr.c.

int write_bytes_to_xdr_buf ( struct xdr_buf *  buf,
unsigned int  base,
void obj,
unsigned int  len 
)

Definition at line 928 of file xdr.c.

void xdr_buf_from_iov ( struct kvec iov,
struct xdr_buf *  buf 
)

Definition at line 821 of file xdr.c.

int xdr_buf_read_netobj ( struct xdr_buf *  buf,
struct xdr_netobj *  obj,
unsigned int  offset 
)

Definition at line 968 of file xdr.c.

int xdr_buf_subsegment ( struct xdr_buf *  buf,
struct xdr_buf *  subbuf,
unsigned int  base,
unsigned int  len 
)

Definition at line 833 of file xdr.c.

int xdr_decode_array2 ( struct xdr_buf *  buf,
unsigned int  base,
struct xdr_array2_desc *  desc 
)

Definition at line 1198 of file xdr.c.

__be32* xdr_decode_netobj ( __be32 p,
struct xdr_netobj *  obj 
)

Definition at line 35 of file xdr.c.

__be32* xdr_decode_string_inplace ( __be32 p,
char **  sp,
unsigned int lenp,
unsigned int  maxlen 
)

Definition at line 100 of file xdr.c.

int xdr_decode_word ( struct xdr_buf *  buf,
unsigned int  base,
u32 obj 
)

Definition at line 942 of file xdr.c.

int xdr_encode_array2 ( struct xdr_buf *  buf,
unsigned int  base,
struct xdr_array2_desc *  desc 
)

Definition at line 1209 of file xdr.c.

__be32* xdr_encode_netobj ( __be32 p,
const struct xdr_netobj *  obj 
)

Definition at line 23 of file xdr.c.

__be32* xdr_encode_opaque ( __be32 p,
const void ptr,
unsigned int  nbytes 
)

xdr_encode_opaque - Encode variable length opaque data : pointer to current position in XDR buffer. : pointer to data to encode (or NULL) : size of data.

Returns the updated current XDR buffer position

Definition at line 85 of file xdr.c.

__be32* xdr_encode_opaque_fixed ( __be32 p,
const void ptr,
unsigned int  nbytes 
)

xdr_encode_opaque_fixed - Encode fixed length opaque data : pointer to current position in XDR buffer. : pointer to data to encode (or NULL) : size of data.

Copy the array of data of length nbytes at ptr to the XDR buffer at position p, then align to the next 32-bit boundary by padding with zero bytes (see RFC1832). Note: if ptr is NULL, only the padding is performed.

Returns the updated current XDR buffer position

Definition at line 61 of file xdr.c.

__be32* xdr_encode_string ( __be32 p,
const char string 
)

Definition at line 93 of file xdr.c.

int xdr_encode_word ( struct xdr_buf *  buf,
unsigned int  base,
u32  obj 
)

Definition at line 956 of file xdr.c.

void xdr_enter_page ( struct xdr_stream *  xdr,
unsigned int  len 
)

xdr_enter_page - decode data from the XDR page : pointer to xdr_stream struct : number of bytes of page data

Moves data beyond the current pointer position from the XDR head[] buffer into the page list. Any data that lies beyond current position + "len" bytes is moved into the XDR tail[]. The current pointer is then repositioned at the beginning of the first XDR page.

Definition at line 806 of file xdr.c.

void xdr_init_decode ( struct xdr_stream *  xdr,
struct xdr_buf *  buf,
__be32 p 
)

xdr_init_decode - Initialize an xdr_stream for decoding data. : pointer to xdr_stream struct : pointer to XDR buffer from which to decode data : current pointer inside XDR buffer

Definition at line 612 of file xdr.c.

void xdr_init_decode_pages ( struct xdr_stream *  xdr,
struct xdr_buf *  buf,
struct page **  pages,
unsigned int  len 
)

xdr_init_decode - Initialize an xdr_stream for decoding data. : pointer to xdr_stream struct : pointer to XDR buffer from which to decode data : list of pages to decode into : length in bytes of buffer in pages

Definition at line 636 of file xdr.c.

void xdr_init_encode ( struct xdr_stream *  xdr,
struct xdr_buf *  buf,
__be32 p 
)

xdr_init_encode - Initialize a struct xdr_stream for sending data. : pointer to xdr_stream struct : pointer to XDR buffer in which to encode data : current pointer inside XDR buffer

Note: at the moment the RPC client only passes the length of our scratch buffer in the xdr_buf's header kvec. Previously this meant we needed to call xdr_adjust_iovec() after encoding the data. With the new scheme, the xdr_stream manages the details of the buffer length, and takes care of adjusting the kvec length for us.

Definition at line 454 of file xdr.c.

__be32* xdr_inline_decode ( struct xdr_stream *  xdr,
size_t  nbytes 
)

xdr_inline_decode - Retrieve XDR data to decode : pointer to xdr_stream struct : number of bytes of data to decode

Check if the input buffer is long enough to enable us to decode 'nbytes' more bytes of data starting at the current position. If so return the current pointer, then update the current pointer position.

Definition at line 709 of file xdr.c.

void xdr_inline_pages ( struct xdr_buf *  xdr,
unsigned int  offset,
struct page **  pages,
unsigned int  base,
unsigned int  len 
)

Definition at line 132 of file xdr.c.

int xdr_process_buf ( struct xdr_buf *  buf,
unsigned int  offset,
unsigned int  len,
int(*)(struct scatterlist *, void *)  actor,
void data 
)

Definition at line 1221 of file xdr.c.

unsigned int xdr_read_pages ( struct xdr_stream *  xdr,
unsigned int  len 
)

xdr_read_pages - Ensure page-based XDR data to decode is aligned at current pointer position : pointer to xdr_stream struct : number of bytes of page data

Moves data beyond the current pointer position from the XDR head[] buffer into the page list. Any data that lies beyond current position + "len" bytes is moved into the XDR tail[].

Returns the number of XDR encoded bytes now contained in the pages

Definition at line 765 of file xdr.c.

__be32* xdr_reserve_space ( struct xdr_stream *  xdr,
size_t  nbytes 
)

xdr_reserve_space - Reserve buffer space for sending : pointer to xdr_stream : number of bytes to reserve

Checks that we have enough buffer space to encode 'nbytes' more bytes of data. If so, update the total xdr_buf length, and adjust the length of the current kvec.

Definition at line 487 of file xdr.c.

void xdr_set_scratch_buffer ( struct xdr_stream *  xdr,
void buf,
size_t  buflen 
)

xdr_set_scratch_buffer - Attach a scratch buffer for decoding data. : pointer to xdr_stream struct : pointer to an empty buffer : size of 'buf'

The scratch buffer is used when decoding from an array of pages. If an xdr_inline_decode() call spans across page boundaries, then we copy the data into the scratch buffer in order to allow linear access.

Definition at line 672 of file xdr.c.

void xdr_shift_buf ( struct xdr_buf *  buf,
size_t  len 
)

Definition at line 425 of file xdr.c.

unsigned int xdr_stream_pos ( const struct xdr_stream *  xdr)

xdr_stream_pos - Return the current offset from the start of the xdr_stream : pointer to struct xdr_stream

Definition at line 435 of file xdr.c.

void xdr_terminate_string ( struct xdr_buf *  buf,
const u32  len 
)

xdr_terminate_string - '\0'-terminate a string residing in an xdr_buf : XDR buffer where string resides : length of string, in bytes

Definition at line 121 of file xdr.c.

void xdr_write_pages ( struct xdr_stream *  xdr,
struct page **  pages,
unsigned int  base,
unsigned int  len 
)

xdr_write_pages - Insert a list of pages into an XDR buffer for sending : pointer to xdr_stream : list of pages : offset of first byte : length of data in bytes

Definition at line 513 of file xdr.c.