linux/drivers/nvdimm/label.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
 */
#include <linux/device.h>
#include <linux/ndctl.h>
#include <linux/uuid.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/nd.h>
#include "nd-core.h"
#include "label.h"
#include "nd.h"

static guid_t nvdimm_btt_guid;
static guid_t nvdimm_btt2_guid;
static guid_t nvdimm_pfn_guid;
static guid_t nvdimm_dax_guid;

static uuid_t nvdimm_btt_uuid;
static uuid_t nvdimm_btt2_uuid;
static uuid_t nvdimm_pfn_uuid;
static uuid_t nvdimm_dax_uuid;

static uuid_t cxl_region_uuid;
static uuid_t cxl_namespace_uuid;

static const char NSINDEX_SIGNATURE[] =;

static u32 best_seq(u32 a, u32 b)
{}

unsigned sizeof_namespace_label(struct nvdimm_drvdata *ndd)
{}

static size_t __sizeof_namespace_index(u32 nslot)
{}

static int __nvdimm_num_label_slots(struct nvdimm_drvdata *ndd,
		size_t index_size)
{}

int nvdimm_num_label_slots(struct nvdimm_drvdata *ndd)
{}

size_t sizeof_namespace_index(struct nvdimm_drvdata *ndd)
{}

static int __nd_label_validate(struct nvdimm_drvdata *ndd)
{}

static int nd_label_validate(struct nvdimm_drvdata *ndd)
{}

static void nd_label_copy(struct nvdimm_drvdata *ndd,
			  struct nd_namespace_index *dst,
			  struct nd_namespace_index *src)
{}

static struct nd_namespace_label *nd_label_base(struct nvdimm_drvdata *ndd)
{}

static int to_slot(struct nvdimm_drvdata *ndd,
		struct nd_namespace_label *nd_label)
{}

static struct nd_namespace_label *to_label(struct nvdimm_drvdata *ndd, int slot)
{}

#define for_each_clear_bit_le(bit, addr, size)

/**
 * preamble_index - common variable initialization for nd_label_* routines
 * @ndd: dimm container for the relevant label set
 * @idx: namespace_index index
 * @nsindex_out: on return set to the currently active namespace index
 * @free: on return set to the free label bitmap in the index
 * @nslot: on return set to the number of slots in the label space
 */
static bool preamble_index(struct nvdimm_drvdata *ndd, int idx,
		struct nd_namespace_index **nsindex_out,
		unsigned long **free, u32 *nslot)
{}

char *nd_label_gen_id(struct nd_label_id *label_id, const uuid_t *uuid,
		      u32 flags)
{}

static bool preamble_current(struct nvdimm_drvdata *ndd,
		struct nd_namespace_index **nsindex,
		unsigned long **free, u32 *nslot)
{}

static bool preamble_next(struct nvdimm_drvdata *ndd,
		struct nd_namespace_index **nsindex,
		unsigned long **free, u32 *nslot)
{}

static bool nsl_validate_checksum(struct nvdimm_drvdata *ndd,
				  struct nd_namespace_label *nd_label)
{}

static void nsl_calculate_checksum(struct nvdimm_drvdata *ndd,
				   struct nd_namespace_label *nd_label)
{}

static bool slot_valid(struct nvdimm_drvdata *ndd,
		struct nd_namespace_label *nd_label, u32 slot)
{}

int nd_label_reserve_dpa(struct nvdimm_drvdata *ndd)
{}

int nd_label_data_init(struct nvdimm_drvdata *ndd)
{}

int nd_label_active_count(struct nvdimm_drvdata *ndd)
{}

struct nd_namespace_label *nd_label_active(struct nvdimm_drvdata *ndd, int n)
{}

u32 nd_label_alloc_slot(struct nvdimm_drvdata *ndd)
{}

bool nd_label_free_slot(struct nvdimm_drvdata *ndd, u32 slot)
{}

u32 nd_label_nfree(struct nvdimm_drvdata *ndd)
{}

static int nd_label_write_index(struct nvdimm_drvdata *ndd, int index, u32 seq,
		unsigned long flags)
{}

static unsigned long nd_label_offset(struct nvdimm_drvdata *ndd,
		struct nd_namespace_label *nd_label)
{}

static enum nvdimm_claim_class guid_to_nvdimm_cclass(guid_t *guid)
{}

/* CXL labels store UUIDs instead of GUIDs for the same data */
static enum nvdimm_claim_class uuid_to_nvdimm_cclass(uuid_t *uuid)
{}

static const guid_t *to_abstraction_guid(enum nvdimm_claim_class claim_class,
	guid_t *target)
{}

/* CXL labels store UUIDs instead of GUIDs for the same data */
static const uuid_t *to_abstraction_uuid(enum nvdimm_claim_class claim_class,
					 uuid_t *target)
{}

static void reap_victim(struct nd_mapping *nd_mapping,
		struct nd_label_ent *victim)
{}

static void nsl_set_type_guid(struct nvdimm_drvdata *ndd,
			      struct nd_namespace_label *nd_label, guid_t *guid)
{}

bool nsl_validate_type_guid(struct nvdimm_drvdata *ndd,
			    struct nd_namespace_label *nd_label, guid_t *guid)
{}

static void nsl_set_claim_class(struct nvdimm_drvdata *ndd,
				struct nd_namespace_label *nd_label,
				enum nvdimm_claim_class claim_class)
{}

enum nvdimm_claim_class nsl_get_claim_class(struct nvdimm_drvdata *ndd,
					    struct nd_namespace_label *nd_label)
{}

static int __pmem_label_update(struct nd_region *nd_region,
		struct nd_mapping *nd_mapping, struct nd_namespace_pmem *nspm,
		int pos, unsigned long flags)
{}

static int init_labels(struct nd_mapping *nd_mapping, int num_labels)
{}

static int del_labels(struct nd_mapping *nd_mapping, uuid_t *uuid)
{}

int nd_pmem_namespace_label_update(struct nd_region *nd_region,
		struct nd_namespace_pmem *nspm, resource_size_t size)
{}

int __init nd_label_init(void)
{}