pmem2_source_alignment(3)

pmem2_source_alignment3

Returns data source alignment

Usage

#include <libpmem2.h>
struct pmem2_source;
int pmem2_source_alignment(const struct pmem2_source *source, size_t *alignment);

Overview

The pmem2_source_alignment() function retrieves the alignment of offset and length needed for pmem2_map_new(3) to succeed. The alignment is stored in *alignment.

Return value

The pmem2_source_alignment() function returns 0 on success. If the function fails, the *alignment variable is left unmodified and a negative error code is returned.

Errors

The pmem2_source_alignment() can fail with the following errors:

On all systems:

•

PMEM2_E_INVALID_ALIGNMENT_VALUE - operating system returned unexpected alignment value (eg. it is not a power of two).

on Linux:

•

PMEM2_E_INVALID_FILE_TYPE - file descriptor points to a character device other than Device DAX.

•

PMEM2_E_INVALID_ALIGNMENT_FORMAT - kernel query for Device DAX alignment returned data in invalid format.

•

-errno set by failing fstat(2), while trying to validate the file descriptor.

•

-errno set by failing realpath(3), while trying to determine whether fd points to a Device DAX.

•

-errno set by failing read(2), while trying to determine Device DAX’s alignment.

•

-errno set by failing strtoull(3), while trying to determine Device DAX’s alignment.

On FreeBSD:

•

PMEM2_E_INVALID_FILE_TYPE - file descriptor points to a directory, block device, pipe, socket, or character device.

•

-errno set by failing fstat(2), while trying to validate the file descriptor.

Releases

3 releases since Debian 11 (Bullseye); the text changed 2 times.

  1. 11
  2. 12
  3. 13

From libpmem2-dev 1.13.1-1.1+b1 in Debian 13 (Trixie). Parsed by carta from the page's man source.