1PMEM2_SOURCE_ALIGNMENT(3)  PMDK Programmer's Manual  PMEM2_SOURCE_ALIGNMENT(3)
2
3
4

NAME

6       pmem2_source_alignment() - returns data source alignment
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

20       The  pmem2_source_alignment()  function  returns  0 on success.  If the
21       function fails, the *alignment variable is left unmodified and a  nega‐
22       tive error code is returned.
23

ERRORS

25       The pmem2_source_alignment() can fail with the following errors:
26
27       On all systems:
28
29PMEM2_E_INVALID_ALIGNMENT_VALUE - operating system returned unexpect‐
30         ed alignment value (eg.  it is not a power of two).
31
32       on Linux:
33
34PMEM2_E_INVALID_FILE_TYPE - file descriptor points to a character de‐
35         vice other than Device DAX.
36
37PMEM2_E_INVALID_ALIGNMENT_FORMAT - kernel query for Device DAX align‐
38         ment returned data in invalid format.
39
40       • -errno set by failing fstat(2), while trying to validate the file de‐
41         scriptor.
42
43       • -errno  set by failing realpath(3), while trying to determine whether
44         fd points to a Device DAX.
45
46       • -errno set by failing read(2), while trying to determine Device DAX's
47         alignment.
48
49       • -errno  set  by failing strtoull(3), while trying to determine Device
50         DAX's alignment.
51
52       On FreeBSD:
53
54PMEM2_E_INVALID_FILE_TYPE - file descriptor points  to  a  directory,
55         block device, pipe, socket, or character device.
56
57       • -errno set by failing fstat(2), while trying to validate the file de‐
58         scriptor.
59

SEE ALSO

61       errno(3),  fstat(2),  realpath(3),  read(2),  strtoull(3),   pmem2_con‐
62       fig_new(3), pmem2_source_from_handle(3), pmem2_source_from_fd(3), libp‐
63       mem2(7) and <https://pmem.io>
64
65
66
67PMDK - pmem2 API version 1.0      2022-05-24         PMEM2_SOURCE_ALIGNMENT(3)
Impressum