#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/sort.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/nd.h>
#include "nd-core.h"
#include "pmem.h"
#include "pfn.h"
#include "nd.h"
static void namespace_io_release(struct device *dev)
{ … }
static void namespace_pmem_release(struct device *dev)
{ … }
static bool is_namespace_pmem(const struct device *dev);
static bool is_namespace_io(const struct device *dev);
static int is_uuid_busy(struct device *dev, void *data)
{ … }
static int is_namespace_uuid_busy(struct device *dev, void *data)
{ … }
bool nd_is_uuid_unique(struct device *dev, uuid_t *uuid)
{ … }
bool pmem_should_map_pages(struct device *dev)
{ … }
EXPORT_SYMBOL(…);
unsigned int pmem_sector_size(struct nd_namespace_common *ndns)
{ … }
EXPORT_SYMBOL(…);
const char *nvdimm_namespace_disk_name(struct nd_namespace_common *ndns,
char *name)
{ … }
EXPORT_SYMBOL(…);
const uuid_t *nd_dev_to_uuid(struct device *dev)
{ … }
EXPORT_SYMBOL(…);
static ssize_t nstype_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(nstype);
static ssize_t __alt_name_store(struct device *dev, const char *buf,
const size_t len)
{ … }
static int nd_namespace_label_update(struct nd_region *nd_region,
struct device *dev)
{ … }
static ssize_t alt_name_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{ … }
static ssize_t alt_name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RW(alt_name);
static int scan_free(struct nd_region *nd_region,
struct nd_mapping *nd_mapping, struct nd_label_id *label_id,
resource_size_t n)
{ … }
static int shrink_dpa_allocation(struct nd_region *nd_region,
struct nd_label_id *label_id, resource_size_t n)
{ … }
static resource_size_t init_dpa_allocation(struct nd_label_id *label_id,
struct nd_region *nd_region, struct nd_mapping *nd_mapping,
resource_size_t n)
{ … }
static void space_valid(struct nd_region *nd_region, struct nvdimm_drvdata *ndd,
struct nd_label_id *label_id, struct resource *prev,
struct resource *next, struct resource *exist,
resource_size_t n, struct resource *valid)
{ … }
enum alloc_loc { … };
static resource_size_t scan_allocate(struct nd_region *nd_region,
struct nd_mapping *nd_mapping, struct nd_label_id *label_id,
resource_size_t n)
{ … }
static int merge_dpa(struct nd_region *nd_region,
struct nd_mapping *nd_mapping, struct nd_label_id *label_id)
{ … }
int __reserve_free_pmem(struct device *dev, void *data)
{ … }
void release_free_pmem(struct nvdimm_bus *nvdimm_bus,
struct nd_mapping *nd_mapping)
{ … }
static int grow_dpa_allocation(struct nd_region *nd_region,
struct nd_label_id *label_id, resource_size_t n)
{ … }
static void nd_namespace_pmem_set_resource(struct nd_region *nd_region,
struct nd_namespace_pmem *nspm, resource_size_t size)
{ … }
static bool uuid_not_set(const uuid_t *uuid, struct device *dev,
const char *where)
{ … }
static ssize_t __size_store(struct device *dev, unsigned long long val)
{ … }
static ssize_t size_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{ … }
resource_size_t __nvdimm_namespace_capacity(struct nd_namespace_common *ndns)
{ … }
resource_size_t nvdimm_namespace_capacity(struct nd_namespace_common *ndns)
{ … }
EXPORT_SYMBOL(…);
bool nvdimm_namespace_locked(struct nd_namespace_common *ndns)
{ … }
EXPORT_SYMBOL(…);
static ssize_t size_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(size, 0444, size_show, size_store);
static uuid_t *namespace_to_uuid(struct device *dev)
{ … }
static ssize_t uuid_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static int namespace_update_uuid(struct nd_region *nd_region,
struct device *dev, uuid_t *new_uuid,
uuid_t **old_uuid)
{ … }
static ssize_t uuid_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{ … }
static DEVICE_ATTR_RW(uuid);
static ssize_t resource_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_ADMIN_RO(resource);
static const unsigned long pmem_lbasize_supported[] = …;
static ssize_t sector_size_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t sector_size_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{ … }
static DEVICE_ATTR_RW(sector_size);
static ssize_t dpa_extents_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(dpa_extents);
static int btt_claim_class(struct device *dev)
{ … }
static ssize_t holder_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(holder);
static int __holder_class_store(struct device *dev, const char *buf)
{ … }
static ssize_t holder_class_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{ … }
static ssize_t holder_class_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RW(holder_class);
static ssize_t mode_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(mode);
static ssize_t force_raw_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{ … }
static ssize_t force_raw_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RW(force_raw);
static struct attribute *nd_namespace_attributes[] = …;
static umode_t namespace_visible(struct kobject *kobj,
struct attribute *a, int n)
{ … }
static struct attribute_group nd_namespace_attribute_group = …;
static const struct attribute_group *nd_namespace_attribute_groups[] = …;
static const struct device_type namespace_io_device_type = …;
static const struct device_type namespace_pmem_device_type = …;
static bool is_namespace_pmem(const struct device *dev)
{ … }
static bool is_namespace_io(const struct device *dev)
{ … }
struct nd_namespace_common *nvdimm_namespace_common_probe(struct device *dev)
{ … }
EXPORT_SYMBOL(…);
int devm_namespace_enable(struct device *dev, struct nd_namespace_common *ndns,
resource_size_t size)
{ … }
EXPORT_SYMBOL_GPL(…);
void devm_namespace_disable(struct device *dev, struct nd_namespace_common *ndns)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct device **create_namespace_io(struct nd_region *nd_region)
{ … }
static bool has_uuid_at_pos(struct nd_region *nd_region, const uuid_t *uuid,
u64 cookie, u16 pos)
{ … }
static int select_pmem_id(struct nd_region *nd_region, const uuid_t *pmem_id)
{ … }
static struct device *create_namespace_pmem(struct nd_region *nd_region,
struct nd_mapping *nd_mapping,
struct nd_namespace_label *nd_label)
{ … }
static struct device *nd_namespace_pmem_create(struct nd_region *nd_region)
{ … }
static struct lock_class_key nvdimm_namespace_key;
void nd_region_create_ns_seed(struct nd_region *nd_region)
{ … }
void nd_region_create_dax_seed(struct nd_region *nd_region)
{ … }
void nd_region_create_pfn_seed(struct nd_region *nd_region)
{ … }
void nd_region_create_btt_seed(struct nd_region *nd_region)
{ … }
static int add_namespace_resource(struct nd_region *nd_region,
struct nd_namespace_label *nd_label, struct device **devs,
int count)
{ … }
static int cmp_dpa(const void *a, const void *b)
{ … }
static struct device **scan_labels(struct nd_region *nd_region)
{ … }
static struct device **create_namespaces(struct nd_region *nd_region)
{ … }
static void deactivate_labels(void *region)
{ … }
static int init_active_labels(struct nd_region *nd_region)
{ … }
int nd_region_register_namespaces(struct nd_region *nd_region, int *err)
{ … }