This source file includes following definitions.
- nd_label_next_nsindex
1
2
3
4
5 #ifndef __LABEL_H__
6 #define __LABEL_H__
7
8 #include <linux/ndctl.h>
9 #include <linux/sizes.h>
10 #include <linux/uuid.h>
11 #include <linux/io.h>
12
13 enum {
14 NSINDEX_SIG_LEN = 16,
15 NSINDEX_ALIGN = 256,
16 NSINDEX_SEQ_MASK = 0x3,
17 NSLABEL_UUID_LEN = 16,
18 NSLABEL_NAME_LEN = 64,
19 NSLABEL_FLAG_ROLABEL = 0x1,
20 NSLABEL_FLAG_LOCAL = 0x2,
21 NSLABEL_FLAG_BTT = 0x4,
22 NSLABEL_FLAG_UPDATING = 0x8,
23 BTT_ALIGN = 4096,
24 BTTINFO_SIG_LEN = 16,
25 BTTINFO_UUID_LEN = 16,
26 BTTINFO_FLAG_ERROR = 0x1,
27 BTTINFO_MAJOR_VERSION = 1,
28 ND_LABEL_MIN_SIZE = 256 * 4,
29 ND_LABEL_ID_SIZE = 50,
30 ND_NSINDEX_INIT = 0x1,
31 };
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 struct nd_namespace_index {
53 u8 sig[NSINDEX_SIG_LEN];
54 u8 flags[3];
55 u8 labelsize;
56 __le32 seq;
57 __le64 myoff;
58 __le64 mysize;
59 __le64 otheroff;
60 __le64 labeloff;
61 __le32 nslot;
62 __le16 major;
63 __le16 minor;
64 __le64 checksum;
65 u8 free[0];
66 };
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 struct nd_namespace_label {
83 u8 uuid[NSLABEL_UUID_LEN];
84 u8 name[NSLABEL_NAME_LEN];
85 __le32 flags;
86 __le16 nlabel;
87 __le16 position;
88 __le64 isetcookie;
89 __le64 lbasize;
90 __le64 dpa;
91 __le64 rawsize;
92 __le32 slot;
93
94
95
96
97 u8 align;
98 u8 reserved[3];
99 guid_t type_guid;
100 guid_t abstraction_guid;
101 u8 reserved2[88];
102 __le64 checksum;
103 };
104
105 #define NVDIMM_BTT_GUID "8aed63a2-29a2-4c66-8b12-f05d15d3922a"
106 #define NVDIMM_BTT2_GUID "18633bfc-1735-4217-8ac9-17239282d3f8"
107 #define NVDIMM_PFN_GUID "266400ba-fb9f-4677-bcb0-968f11d0d225"
108 #define NVDIMM_DAX_GUID "97a86d9c-3cdd-4eda-986f-5068b4f80088"
109
110
111
112
113
114 struct nd_label_id {
115 char id[ND_LABEL_ID_SIZE];
116 };
117
118
119
120
121
122 static inline int nd_label_next_nsindex(int index)
123 {
124 if (index < 0)
125 return -1;
126
127 return (index + 1) % 2;
128 }
129
130 struct nvdimm_drvdata;
131 int nd_label_data_init(struct nvdimm_drvdata *ndd);
132 size_t sizeof_namespace_index(struct nvdimm_drvdata *ndd);
133 int nd_label_active_count(struct nvdimm_drvdata *ndd);
134 struct nd_namespace_label *nd_label_active(struct nvdimm_drvdata *ndd, int n);
135 u32 nd_label_alloc_slot(struct nvdimm_drvdata *ndd);
136 bool nd_label_free_slot(struct nvdimm_drvdata *ndd, u32 slot);
137 u32 nd_label_nfree(struct nvdimm_drvdata *ndd);
138 enum nvdimm_claim_class to_nvdimm_cclass(guid_t *guid);
139 struct nd_region;
140 struct nd_namespace_pmem;
141 struct nd_namespace_blk;
142 int nd_pmem_namespace_label_update(struct nd_region *nd_region,
143 struct nd_namespace_pmem *nspm, resource_size_t size);
144 int nd_blk_namespace_label_update(struct nd_region *nd_region,
145 struct nd_namespace_blk *nsblk, resource_size_t size);
146 #endif