src/alignedbuf.c File Reference

#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include "rdd.h"
#include "alignedbuf.h"

Include dependency graph for alignedbuf.c:

Go to the source code of this file.

Functions

unsigned rdd_abuf_get_alignment (RDD_ALIGNEDBUF *buf)
 Returns the alignment in bytes of an aligned buffer.
unsigned rdd_abuf_get_size (RDD_ALIGNEDBUF *buf)
 Returns the size in bytes of an aligned buffer.
int rdd_free_alignedbuf (RDD_ALIGNEDBUF *buf)
 Deallocates the data buffer associated with buf and invalidates both pointer fields in buf.
int rdd_new_alignedbuf (RDD_ALIGNEDBUF *buf, unsigned bufsize, unsigned align)
 Allocates a buffer of sz bytes and returns two pointers in buf: a pointer to the buffer and a pointer that has been aligned to align bytes.

Variables

static char copyright []


Function Documentation

unsigned rdd_abuf_get_alignment ( RDD_ALIGNEDBUF buf  ) 

Returns the alignment in bytes of an aligned buffer.

Parameters:
buf pointer to an RDD_ALIGNEDBUF structure that was allocated by the client and initialized by calling rdd_new_aligned_buf().
Returns:
the alignment in bytes of the aligned buffer

Definition at line 104 of file alignedbuf.c.

References RDD_ALIGNEDBUF::align.

unsigned rdd_abuf_get_size ( RDD_ALIGNEDBUF buf  ) 

Returns the size in bytes of an aligned buffer.

Parameters:
buf pointer to an RDD_ALIGNEDBUF structure that was allocated by the client and initialized by calling rdd_new_aligned_buf().
Returns:
The size in bytes of the aligned buffer

Definition at line 98 of file alignedbuf.c.

References RDD_ALIGNEDBUF::asize.

int rdd_free_alignedbuf ( RDD_ALIGNEDBUF buf  ) 

Deallocates the data buffer associated with buf and invalidates both pointer fields in buf.

Parameters:
buf pointer to an RDD_ALIGNEDBUF structure that was allocated by the client and initialized by calling rdd_new_aligned_buf().
Returns:
Always returns RDD_OK.

Definition at line 89 of file alignedbuf.c.

References RDD_OK, and RDD_ALIGNEDBUF::unaligned.

int rdd_new_alignedbuf ( RDD_ALIGNEDBUF buf,
unsigned  sz,
unsigned  align 
)

Allocates a buffer of sz bytes and returns two pointers in buf: a pointer to the buffer and a pointer that has been aligned to align bytes.

Parameters:
buf pointer to an RDD_ALIGNEDBUF structure allocated by the client.
sz size in bytes of the data buffer that will be allocated; there will be at least sz bytes of free space in the aligned buffer.
align alignment in bytes.
Returns:
Returns RDD_OK on success. Returns RDD_NOMEM if there is insufficient memory to allocate the buffer. Returns RDD_BADARG if a bad alignment argument is given.

Definition at line 57 of file alignedbuf.c.

References RDD_ALIGNEDBUF::align, RDD_ALIGNEDBUF::aligned, RDD_ALIGNEDBUF::asize, RDD_BADARG, RDD_NOMEM, RDD_OK, and RDD_ALIGNEDBUF::unaligned.


Variable Documentation

char copyright[] [static]

Initial value:

"@(#) Copyright (c) 2002\n\
    Netherlands Forensic Institute.  All rights reserved.\n"

Definition at line 40 of file alignedbuf.c.


Generated on Sun Feb 6 12:35:59 2011 for rdd by  doxygen 1.5.6