Lines Matching refs:nd_btt
27 struct nd_btt *nd_btt = to_nd_btt(dev); in nd_btt_release() local
30 nd_detach_ndns(&nd_btt->dev, &nd_btt->ndns); in nd_btt_release()
31 ida_simple_remove(&nd_region->btt_ida, nd_btt->id); in nd_btt_release()
32 kfree(nd_btt->uuid); in nd_btt_release()
33 kfree(nd_btt); in nd_btt_release()
47 struct nd_btt *to_nd_btt(struct device *dev) in to_nd_btt()
49 struct nd_btt *nd_btt = container_of(dev, struct nd_btt, dev); in to_nd_btt() local
52 return nd_btt; in to_nd_btt()
62 struct nd_btt *nd_btt = to_nd_btt(dev); in sector_size_show() local
64 return nd_sector_size_show(nd_btt->lbasize, btt_lbasize_supported, buf); in sector_size_show()
70 struct nd_btt *nd_btt = to_nd_btt(dev); in sector_size_store() local
75 rc = nd_sector_size_store(dev, buf, &nd_btt->lbasize, in sector_size_store()
89 struct nd_btt *nd_btt = to_nd_btt(dev); in uuid_show() local
91 if (nd_btt->uuid) in uuid_show()
92 return sprintf(buf, "%pUb\n", nd_btt->uuid); in uuid_show()
99 struct nd_btt *nd_btt = to_nd_btt(dev); in uuid_store() local
103 rc = nd_uuid_store(dev, &nd_btt->uuid, buf, len); in uuid_store()
115 struct nd_btt *nd_btt = to_nd_btt(dev); in namespace_show() local
119 rc = sprintf(buf, "%s\n", nd_btt->ndns in namespace_show()
120 ? dev_name(&nd_btt->ndns->dev) : ""); in namespace_show()
128 struct nd_btt *nd_btt = to_nd_btt(dev); in namespace_store() local
133 rc = nd_namespace_store(dev, &nd_btt->ndns, buf, len); in namespace_store()
165 struct nd_btt *nd_btt; in __nd_btt_create() local
168 nd_btt = kzalloc(sizeof(*nd_btt), GFP_KERNEL); in __nd_btt_create()
169 if (!nd_btt) in __nd_btt_create()
172 nd_btt->id = ida_simple_get(&nd_region->btt_ida, 0, 0, GFP_KERNEL); in __nd_btt_create()
173 if (nd_btt->id < 0) in __nd_btt_create()
176 nd_btt->lbasize = lbasize; in __nd_btt_create()
182 nd_btt->uuid = uuid; in __nd_btt_create()
183 dev = &nd_btt->dev; in __nd_btt_create()
184 dev_set_name(dev, "btt%d.%d", nd_region->id, nd_btt->id); in __nd_btt_create()
188 device_initialize(&nd_btt->dev); in __nd_btt_create()
189 if (ndns && !__nd_attach_ndns(&nd_btt->dev, ndns, &nd_btt->ndns)) { in __nd_btt_create()
198 ida_simple_remove(&nd_region->btt_ida, nd_btt->id); in __nd_btt_create()
201 kfree(nd_btt); in __nd_btt_create()
233 bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct btt_sb *super) in nd_btt_arena_is_valid() argument
235 const u8 *parent_uuid = nd_dev_to_uuid(&nd_btt->ndns->dev); in nd_btt_arena_is_valid()
253 dev_info(&nd_btt->dev, "Found arena with an error flag\n"); in nd_btt_arena_is_valid()
259 static int __nd_btt_probe(struct nd_btt *nd_btt, in __nd_btt_probe() argument
262 if (!btt_sb || !ndns || !nd_btt) in __nd_btt_probe()
271 if (!nd_btt_arena_is_valid(nd_btt, btt_sb)) in __nd_btt_probe()
274 nd_btt->lbasize = le32_to_cpu(btt_sb->external_lbasize); in __nd_btt_probe()
275 nd_btt->uuid = kmemdup(btt_sb->uuid, 16, GFP_KERNEL); in __nd_btt_probe()
276 if (!nd_btt->uuid) in __nd_btt_probe()
279 __nd_device_register(&nd_btt->dev); in __nd_btt_probe()
306 struct nd_btt *nd_btt = to_nd_btt(dev); in nd_btt_probe() local
308 __nd_detach_ndns(dev, &nd_btt->ndns); in nd_btt_probe()