diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-25 16:20:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-25 16:20:34 +0000 |
commit | d970b407fc0f4fba35fc31aab80ea6ea69788a52 (patch) | |
tree | 491e11b95bf9ea1a3fb1e6a886a65b8491cf9841 /mdopen.c | |
parent | Adding debian version 4.2-5. (diff) | |
download | mdadm-d970b407fc0f4fba35fc31aab80ea6ea69788a52.tar.xz mdadm-d970b407fc0f4fba35fc31aab80ea6ea69788a52.zip |
Merging upstream version 4.2+20230223.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mdopen.c')
-rw-r--r-- | mdopen.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -475,6 +475,23 @@ int open_mddev(char *dev, int report_errors) return mdfd; } +/** + * is_mddev() - check that file name passed is an md device. + * @dev: file name that has to be checked. + * Return: 1 if file passed is an md device, 0 if not. + */ +int is_mddev(char *dev) +{ + int fd = open_mddev(dev, 1); + + if (fd >= 0) { + close(fd); + return 1; + } + + return 0; +} + char *find_free_devnm(int use_partitions) { static char devnm[32]; |