Classes | |
class | boost::afio::utils::secded_ecc< blocksize > |
Calculates the single error correcting double error detecting (SECDED) Hamming Error Correcting Code for a blocksize block of bytes. For example, a secdec_ecc<8> would be the very common 72,64 Hamming code used in ECC RAM, or secdec_ecc<4096> would be for a 32784,32768 Hamming code. More... | |
class | boost::afio::utils::page_allocator< T > |
An STL allocator which allocates large TLB page memory.If the operating system is configured to allow it, this type of memory is particularly efficient for doing large scale file i/o. This is because the kernel must normally convert the scatter gather buffers you pass into extended scatter gather buffers as the memory you see as contiguous may not, and probably isn't, actually be contiguous in physical memory. Regions returned by this allocator may be allocated contiguously in physical memory and therefore the kernel can pass through your scatter gather buffers unmodified. More... | |
Functions | |
BOOST_AFIO_DECL std::vector < size_t > | boost::afio::utils::page_sizes (bool only_actually_available=true) noexcept |
Returns the page sizes of this architecture which is useful for calculating direct i/o multiples. | |
size_t | boost::afio::utils::file_buffer_default_size () noexcept |
Returns a reasonable default size for page_allocator, typically the closest page size from page_sizes() to 1Mb. | |
BOOST_AFIO_DECL void | boost::afio::utils::random_fill (char *buffer, size_t bytes) |
Fills the buffer supplied with cryptographically strong randomness. Uses the OS kernel API. | |
size_t | boost::afio::utils::to_hex_string (char *out, size_t outlen, const char *_in, size_t inlen) |
Converts a number to a hex string. Out buffer can be same as in buffer. | |
size_t | boost::afio::utils::from_hex_string (char *out, size_t outlen, const char *in, size_t inlen) |
Converts a hex string to a number. Out buffer can be same as in buffer. | |
std::string | boost::afio::utils::random_string (size_t randomlen) |
Returns a cryptographically random string capable of being used as a filename. Essentially random_fill() + to_hex_string(). |
BOOST_AFIO_DECL std::vector<size_t> boost::afio::utils::page_sizes | ( | bool | only_actually_available = true | ) |
Returns the page sizes of this architecture which is useful for calculating direct i/o multiples.
only_actually_available | Only return page sizes actually available to the user running this process |
{Whatever the system API takes (one would hope constant time).} {Any error from the operating system or std::bad_alloc.}
size_t boost::afio::utils::file_buffer_default_size | ( | ) |
Returns a reasonable default size for page_allocator, typically the closest page size from page_sizes() to 1Mb.
{Whatever the system API takes (one would hope constant time).} {Any error from the operating system or std::bad_alloc.}
BOOST_AFIO_DECL void boost::afio::utils::random_fill | ( | char * | buffer, |
size_t | bytes | ||
) |
Fills the buffer supplied with cryptographically strong randomness. Uses the OS kernel API.
buffer | A buffer to fill |
bytes | How many bytes to fill |
{Whatever the system API takes.} {Any error from the operating system.}
size_t boost::afio::utils::to_hex_string | ( | char * | out, |
size_t | outlen, | ||
const char * | _in, | ||
size_t | inlen | ||
) |
Converts a number to a hex string. Out buffer can be same as in buffer.
Note that the character range used is a 16 item table of:
0123456789abcdef
This lets one pack one byte of input into two bytes of output.
{O(N) where N is the length of the number.} {Throws exception if output buffer is too small for input.}
size_t boost::afio::utils::from_hex_string | ( | char * | out, |
size_t | outlen, | ||
const char * | in, | ||
size_t | inlen | ||
) |
Converts a hex string to a number. Out buffer can be same as in buffer.
Note that this routine is about 43% slower than to_hex_string(), half of which is due to input validation.
{O(N) where N is the length of the string.} {Throws exception if output buffer is too small for input or input size is not multiple of two.}
std::string boost::afio::utils::random_string | ( | size_t | randomlen | ) |
Returns a cryptographically random string capable of being used as a filename. Essentially random_fill() + to_hex_string().
randomlen | The number of bytes of randomness to use for the string. |
{Whatever the system API takes.} {Any error from the operating system.}
January, 2014 |
Copyright © 2013-2014 Niall Douglas, Cork, Ireland Copyright © 2013 Paul Kirth, California |