1 // SPDX-License-Identifier: BSD-3-Clause
2 /* Copyright 2014-2020, Intel Corporation */
9 #include "pmem2_utils.h"
12 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
13 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
17 pmem2_get_type_from_stat(const os_stat_t
*st
, enum pmem2_file_type
*type
)
19 if (S_ISREG(st
->st_mode
)) {
20 *type
= PMEM2_FTYPE_REG
;
24 if (S_ISDIR(st
->st_mode
)) {
25 *type
= PMEM2_FTYPE_DIR
;
29 ERR("file type 0%o not supported", st
->st_mode
& S_IFMT
);
30 return PMEM2_E_INVALID_FILE_TYPE
;
34 * pmem2_device_dax_size -- checks the size of a given
35 * dax device from given source structure
38 pmem2_device_dax_size(const struct pmem2_source
*src
, size_t *size
)
41 "BUG: pmem2_device_dax_size should never be called on this OS";
44 return PMEM2_E_NOSUPP
;
48 * pmem2_device_dax_alignment -- checks the alignment of a given
49 * dax device from given source
52 pmem2_device_dax_alignment(const struct pmem2_source
*src
, size_t *alignment
)
55 "BUG: pmem2_device_dax_alignment should never be called on this OS";
58 return PMEM2_E_NOSUPP
;