-class HugePages {
- public:
- HugePages();
-
- /**
- * Get list of supported huge page sizes and their mount points, if
- * hugetlbfs file systems are mounted for those sizes.
- */
- const HugePageSizeVec& sizes() const { return sizes_; }
-
- /**
- * Return the mount point for the requested huge page size.
- * 0 = use smallest available.
- * Throws on error.
- */
- const HugePageSize& getSize(size_t hugePageSize = 0) const;
-
- /**
- * Create a file on a huge page filesystem containing a copy of the data
- * from data. If multiple huge page sizes are allowed, we
- * pick the smallest huge page size available, unless you request one
- * explicitly with the hugePageSize argument.
- *
- * The "path" argument must be rooted under the mount point for the
- * selected huge page size. If relative, it is considered relative to the
- * mount point.
- *
- * We return a struct File structure containing the full path and size
- * (rounded up to a multiple of the huge page size)
- */
- struct File {
- File() : size(0) { }
- fs::path path;
- size_t size;
- };
- File create(
- ByteRange data, const fs::path& path,
- HugePageSize hugePageSize = HugePageSize()) const;
-
- private:
- HugePageSizeVec sizes_;
-};
+const HugePageSizeVec& getHugePageSizes();
+
+/**
+ * Return the mount point for the requested huge page size.
+ * 0 = use smallest available.
+ * Returns nullptr if the requested huge page size is not available.
+ */
+const HugePageSize* getHugePageSize(size_t size = 0);
+
+/**
+ * Return the huge page size for a device.
+ * returns nullptr if device does not refer to a huge page filesystem.
+ */
+const HugePageSize* getHugePageSizeForDevice(dev_t device);