int mdd_procfs_init(struct mdd_device *mdd, const char *name) { struct obd_device *obd = mdd2obd_dev(mdd); struct obd_type *type; int rc; ENTRY; /* at the moment there is no linkage between lu_type * and obd_type, so we lookup obd_type this way */ type = class_search_type(LUSTRE_MDD_NAME); LASSERT(name != NULL); LASSERT(type != NULL); LASSERT(obd != NULL); /* Find the type procroot and add the proc entry for this device */ obd->obd_vars = lprocfs_mdd_obd_vars; mdd->mdd_proc_entry = lprocfs_register(name, type->typ_procroot, obd->obd_vars, mdd); if (IS_ERR(mdd->mdd_proc_entry)) { rc = PTR_ERR(mdd->mdd_proc_entry); CERROR("Error %d setting up lprocfs for %s\n", rc, name); mdd->mdd_proc_entry = NULL; GOTO(out, rc); } rc = 0; EXIT; out: if (rc) mdd_procfs_fini(mdd); return rc; }
static struct lu_device *mdd_device_fini(const struct lu_env *env, struct lu_device *d) { struct mdd_device *mdd = lu2mdd_dev(d); if (d->ld_site) lu_dev_del_linkage(d->ld_site, d); mdd_procfs_fini(mdd); return NULL; }