static struct lu_device *osc_device_alloc(const struct lu_env *env, struct lu_device_type *t, struct lustre_cfg *cfg) { struct lu_device *d; struct osc_device *od; struct obd_device *obd; int rc; od = kzalloc(sizeof(*od), GFP_NOFS); if (!od) return ERR_PTR(-ENOMEM); cl_device_init(&od->od_cl, t); d = osc2lu_dev(od); d->ld_ops = &osc_lu_ops; /* Setup OSC OBD */ obd = class_name2obd(lustre_cfg_string(cfg, 0)); LASSERT(obd); rc = osc_setup(obd, cfg); if (rc) { osc_device_free(env, d); return ERR_PTR(rc); } od->od_exp = obd->obd_self_export; return d; }
static struct lu_device *osc_device_alloc(const struct lu_env *env, struct lu_device_type *t, struct lustre_cfg *cfg) { struct lu_device *d; struct osc_device *od; struct obd_device *obd; int rc; OBD_ALLOC_PTR(od); if (od == NULL) RETURN(ERR_PTR(-ENOMEM)); cl_device_init(&od->od_cl, t); d = osc2lu_dev(od); d->ld_ops = &osc_lu_ops; od->od_cl.cd_ops = &osc_cl_ops; /* Setup OSC OBD */ obd = class_name2obd(lustre_cfg_string(cfg, 0)); LASSERT(obd != NULL); rc = osc_setup(obd, cfg); if (rc) { osc_device_free(env, d); RETURN(ERR_PTR(rc)); } od->od_exp = obd->obd_self_export; RETURN(d); }