#include "include/uuid.h"
#include "include/stringify.h"
#include "blkdev.h"
+#include "numa.h"
#include "json_spirit/json_spirit_reader.h"
[BLKDEV_PROP_ROTATIONAL] = "queue/rotational",
[BLKDEV_PROP_SERIAL] = "device/serial",
[BLKDEV_PROP_VENDOR] = "device/device/vendor",
+ [BLKDEV_PROP_NUMA_NODE] = "device/device/numa_node",
+ [BLKDEV_PROP_NUMA_CPUS] = "device/device/local_cpulist",
};
const char *BlkDev::sysfsdir() const {
return get_int_property(BLKDEV_PROP_ROTATIONAL) > 0;
}
+int BlkDev::get_numa_node(int *node) const
+{
+ int numa = get_int_property(BLKDEV_PROP_NUMA_NODE);
+ if (numa < 0)
+ return -1;
+ *node = numa;
+ return 0;
+}
+
int BlkDev::dev(char *dev, size_t max) const
{
return get_string_property(BLKDEV_PROP_DEV, dev, max);
BLKDEV_PROP_ROTATIONAL,
BLKDEV_PROP_SERIAL,
BLKDEV_PROP_VENDOR,
- BLKDEV_PROP_NUMPROPS
+ BLKDEV_PROP_NUMA_NODE,
+ BLKDEV_PROP_NUMA_CPUS,
+ BLKDEV_PROP_NUMPROPS,
};
extern int get_device_by_path(const char *path, char* partition, char* device, size_t max);
bool support_discard() const;
bool is_nvme() const;
bool is_rotational() const;
+ int get_numa_node(int *node) const;
int dev(char *dev, size_t max) const;
int vendor(char *vendor, size_t max) const;
int model(char *model, size_t max) const;