1PMEM2_SOURCE_DEVICE_USC(3) PMDK Programmer's Manual PMEM2_SOURCE_DEVICE_USC(3)
2
3
4
6 pmem2_source_device_usc() - returns the unsafe shutdown counter value
7 of a device
8
10 #include <libpmem2.h>
11
12 struct pmem2_source;
13 int pmem2_source_device_usc(const struct pmem2_source *source, uint64_t *usc);
14
16 The pmem2_source_device_usc() function retrieves the sum of the unsafe
17 shutdown count(USC) values of all hardware devices backing the data
18 source and stores it in *usc.
19
20 Please refer to libpmem2_unsafe_shutdown(7) for detailed description on
21 how to properly consume this information.
22
24 The pmem2_source_device_usc() function returns 0 on success. If the
25 function fails, the *usc variable content is left unmodified and a neg‐
26 ative error code is returned.
27
29 The pmem2_source_device_usc() can fail with the following errors:
30
31 On all systems:
32
33 • PMEM2_E_NOSUPP - the underlying platform does not expose unsafe shut‐
34 down count information.
35
36 On Windows:
37
38 • -errno equivalent of return code set by failing GetFinalPathNameBy‐
39 HandleW(), while trying to resolve volume path from the file handle.
40
41 • -errno set by failing malloc(3), while trying to allocate a buffer
42 for storing volume path.
43
44 • -errno equivalent of return code set by failing CreateFileW(), while
45 trying to obtain a handle to the volume.
46
47 • -errno equivalent of return code set by failing DeviceIoControl(),
48 while trying to obtain volume USC value.
49
50 On Linux:
51
52 • -errno set by failing fstat(2), while trying to validate the file de‐
53 scriptor.
54
55 • -errno set by failing ndctl_new(), while trying to initiate a new ND‐
56 CTL library context.
57
58 • -errno set by failing ndctl_dimm_get_dirty_shutdown(), while trying
59 to obtain DIMM USC value.
60
62 fstat(2), errno(3), malloc(3), libpmem2_unsafe_shutdown(7), and
63 <https://pmem.io>
64
65
66
67PMDK - pmem2 API version 1.0 2021-09-24 PMEM2_SOURCE_DEVICE_USC(3)