if (seed == dev || ndns || dev->driver) returnfalse; returntrue;
}
struct nd_pfn *to_nd_pfn_safe(struct device *dev)
{ /* * pfn device attributes are re-used by dax device instances, so we * need to be careful to correct device-to-nd_pfn conversion.
*/ if (is_nd_pfn(dev)) return to_nd_pfn(dev);
if (is_nd_dax(dev)) { struct nd_dax *nd_dax = to_nd_dax(dev);
return &nd_dax->nd_pfn;
}
WARN_ON(1); return NULL;
}
staticvoid nd_detach_and_reset(struct device *dev, struct nd_namespace_common **_ndns)
{ /* detach the namespace and destroy / reset the device */
__nd_detach_ndns(dev, _ndns); if (is_idle(dev, *_ndns)) {
nd_device_unregister(dev, ND_ASYNC);
} elseif (is_nd_btt(dev)) { struct nd_btt *nd_btt = to_nd_btt(dev);
ndns = *_ndns; if (strcmp(name, "") == 0) {
nd_detach_and_reset(dev, _ndns); goto out;
} elseif (ndns) {
dev_dbg(dev, "namespace already set to: %s\n",
dev_name(&ndns->dev));
len = -EBUSY; goto out;
}
found = device_find_child_by_name(dev->parent, name); if (!found) {
dev_dbg(dev, "'%s' not found under %s\n", name,
dev_name(dev->parent));
len = -ENODEV; goto out;
}
ndns = to_ndns(found);
switch (ndns->claim_class) { case NVDIMM_CCLASS_NONE: break; case NVDIMM_CCLASS_BTT: case NVDIMM_CCLASS_BTT2: if (!is_nd_btt(dev)) {
len = -EBUSY; goto out_attach;
} break; case NVDIMM_CCLASS_PFN: if (!is_nd_pfn(dev)) {
len = -EBUSY; goto out_attach;
} break; case NVDIMM_CCLASS_DAX: if (!is_nd_dax(dev)) {
len = -EBUSY; goto out_attach;
} break; default:
len = -EBUSY; goto out_attach; break;
}
if (__nvdimm_namespace_capacity(ndns) < SZ_16M) {
dev_dbg(dev, "%s too small to host\n", name);
len = -ENXIO; goto out_attach;
}
WARN_ON_ONCE(!is_nvdimm_bus_locked(dev)); if (!__nd_attach_ndns(dev, ndns, _ndns)) {
dev_dbg(dev, "%s already claimed\n",
dev_name(&ndns->dev));
len = -EBUSY;
}
/* * nd_sb_checksum: compute checksum for a generic info block * * Returns a fletcher64 checksum of everything in the given info block * except the last field (since that's where the checksum lives).
*/
u64 nd_sb_checksum(struct nd_gen_sb *nd_gen_sb)
{
u64 sum;
__le64 sum_save;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.