Skip to content

Commit d061d3a

Browse files
Refactored mkdir support and enabled plugin building.
- Moved mkdir compatibility into nvme/mkdir.h and added to plugins that used mkdir. - Enabled plugins building on Windows.
1 parent 9e1ff30 commit d061d3a

7 files changed

Lines changed: 27 additions & 14 deletions

File tree

libnvme/src/nvme/mkdir.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2+
/*
3+
* This file is part of libnvme.
4+
* Copyright (c) 2026 Micron Technology, Inc.
5+
*
6+
* Cross-platform compatibility for mkdir (sys/stat.h).
7+
*
8+
* Authors: Broc Going <[email protected]>
9+
*/
10+
#pragma once
11+
12+
#if defined(_WIN32) || defined(_WIN64)
13+
14+
#include <direct.h>
15+
16+
/* Windows mkdir doesn't take the mode parameter */
17+
#define mkdir(path, mode) _mkdir(path)
18+
19+
#endif

libnvme/src/platform/windows.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,4 @@ static inline int sigaction(int signum, const struct sigaction *act,
7272
return 0;
7373
}
7474
return -1;
75-
}
76-
77-
78-
/* sys/stat.h compatibility */
79-
80-
/* Windows _mkdir doesn't take mode parameter */
81-
/* _mkdir is defined in <direct.h> */
82-
#define mkdir(path, mode) _mkdir(path)
75+
}

plugins/meson.build

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ if host_system != 'windows'
3636
endif
3737

3838
# Get the list of plugins to build
39-
if host_system != 'windows'
40-
selected_plugins = get_option('plugins')
41-
else
42-
selected_plugins = []
43-
endif
39+
selected_plugins = get_option('plugins')
4440

4541
# Build the plugin_sources list from simple plugins
4642
plugin_sources = []
@@ -59,7 +55,7 @@ if 'feat' in selected_plugins
5955
subdir('feat')
6056
endif
6157

62-
if 'lm' in selected_plugins
58+
if 'lm' in selected_plugins and host_system != 'windows'
6359
subdir('lm')
6460
endif
6561

plugins/micron/micron-nvme.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <sys/stat.h>
2626
#include <sys/types.h>
2727

28+
#include <nvme/mkdir.h>
29+
2830
#include <libnvme.h>
2931

3032
#include "common.h"

plugins/solidigm/solidigm-internal-logs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <inttypes.h>
1616
#include <time.h>
1717

18+
#include <nvme/mkdir.h>
1819
#include <libnvme.h>
1920

2021
#include "common.h"

plugins/wdc/wdc-nvme.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <fcntl.h>
3232
#include <unistd.h>
3333

34+
#include <nvme/mkdir.h>
3435
#include <libnvme.h>
3536

3637
#include "common.h"

plugins/wdc/wdc-utils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <unistd.h>
2626
#include <time.h>
2727

28+
#include <nvme/mkdir.h>
2829
#include <libnvme.h>
2930

3031
#include "nvme-cmds.h"

0 commit comments

Comments
 (0)