libnvdimm, label: add v1.2 interleave-set-cookie algorithm
[linux-2.6-block.git] / drivers / nvdimm / nd.h
index 77d032192bf7d6c11e97b9afb345272b1f3f50ff..ad4e518940c9dbca5355e357739738650f5dd6b0 100644 (file)
@@ -31,6 +31,7 @@ enum {
        ND_MAX_LANES = 256,
        SECTOR_SHIFT = 9,
        INT_LBASIZE_ALIGNMENT = 64,
+       NVDIMM_IO_ATOMIC = 1,
 };
 
 struct nd_poison {
@@ -41,7 +42,7 @@ struct nd_poison {
 
 struct nvdimm_drvdata {
        struct device *dev;
-       int nsindex_size;
+       int nsindex_size, nslabel_size;
        struct nd_cmd_get_config_size nsarea;
        void *data;
        int ns_current, ns_next;
@@ -95,6 +96,12 @@ static inline struct nd_namespace_index *to_next_namespace_index(
        return to_namespace_index(ndd, ndd->ns_next);
 }
 
+unsigned sizeof_namespace_label(struct nvdimm_drvdata *ndd);
+
+#define namespace_label_has(ndd, field) \
+       (offsetof(struct nd_namespace_label, field) \
+               < sizeof_namespace_label(ndd))
+
 #define nd_dbg_dpa(r, d, res, fmt, arg...) \
        dev_dbg((r) ? &(r)->dev : (d)->dev, "%s: %.13s: %#llx @ %#llx " fmt, \
                (r) ? dev_name((d)->dev) : "", res ? res->name : "null", \
@@ -329,7 +336,8 @@ static inline struct device *nd_dax_create(struct nd_region *nd_region)
 struct nd_region *to_nd_region(struct device *dev);
 int nd_region_to_nstype(struct nd_region *nd_region);
 int nd_region_register_namespaces(struct nd_region *nd_region, int *err);
-u64 nd_region_interleave_set_cookie(struct nd_region *nd_region);
+u64 nd_region_interleave_set_cookie(struct nd_region *nd_region,
+               struct nd_namespace_index *nsindex);
 u64 nd_region_interleave_set_altcookie(struct nd_region *nd_region);
 void nvdimm_bus_lock(struct device *dev);
 void nvdimm_bus_unlock(struct device *dev);