#define ei_res_id ei_cb_gl
-extern struct obd_ops ldlm_obd_ops;
-
extern char *ldlm_lockname[];
extern char *ldlm_typename[];
extern const char *ldlm_it2str(enum ldlm_intent_flags it);
};
struct obd_type {
- struct obd_ops *typ_dt_ops;
- struct md_ops *typ_md_ops;
+ const struct obd_ops *typ_dt_ops;
+ const struct md_ops *typ_md_ops;
struct proc_dir_entry *typ_procroot;
struct dentry *typ_debugfs_entry;
#ifdef HAVE_SERVER_SUPPORT
#ifdef HAVE_SERVER_SUPPORT
struct obd_type *class_add_symlinks(const char *name, bool enable_proc);
#endif
-int class_register_type(struct obd_ops *, struct md_ops *, bool enable_proc,
+int class_register_type(const struct obd_ops *dt_ops,
+ const struct md_ops *md_ops, bool enable_proc,
struct lprocfs_vars *module_vars,
const char *nm, struct lu_device_type *ldt);
int class_unregister_type(const char *nm);
return 0;
}
-struct obd_ops lmv_obd_ops = {
+static const struct obd_ops lmv_obd_ops = {
.o_owner = THIS_MODULE,
.o_setup = lmv_setup,
.o_cleanup = lmv_cleanup,
.o_quotactl = lmv_quotactl
};
-struct md_ops lmv_md_ops = {
+static const struct md_ops lmv_md_ops = {
.m_get_root = lmv_get_root,
.m_null_inode = lmv_null_inode,
.m_close = lmv_close,
RETURN(rc);
}
-static struct obd_ops lod_obd_device_ops = {
+static const struct obd_ops lod_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_connect = lod_obd_connect,
.o_disconnect = lod_obd_disconnect,
RETURN(rc);
}
-static struct obd_ops lov_obd_ops = {
+static const struct obd_ops lov_obd_ops = {
.o_owner = THIS_MODULE,
.o_setup = lov_setup,
.o_cleanup = lov_cleanup,
return osc_cleanup_common(obd);
}
-static struct obd_ops mdc_obd_ops = {
+static const struct obd_ops mdc_obd_ops = {
.o_owner = THIS_MODULE,
.o_setup = mdc_setup,
.o_precleanup = mdc_precleanup,
.o_quotactl = mdc_quotactl,
};
-static struct md_ops mdc_md_ops = {
+static const struct md_ops mdc_md_ops = {
.m_get_root = mdc_get_root,
.m_null_inode = mdc_null_inode,
.m_close = mdc_close,
RETURN(rc);
}
-static struct obd_ops mdd_obd_device_ops = {
+static const struct obd_ops mdd_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_connect = mdd_obd_connect,
.o_disconnect = mdd_obd_disconnect,
return rc;
}
-static struct obd_ops mdt_obd_device_ops = {
+static const struct obd_ops mdt_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_set_info_async = mdt_obd_set_info_async,
.o_connect = mdt_obd_connect,
return rc != 0 ? 1 : 0;
}
-static struct obd_ops mds_obd_device_ops = {
+static const struct obd_ops mds_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_health_check = mds_health_check,
};
RETURN(rc);
}
-static struct obd_ops mgc_obd_ops = {
+static const struct obd_ops mgc_obd_ops = {
.o_owner = THIS_MODULE,
.o_setup = mgc_setup,
.o_precleanup = mgc_precleanup,
}
/* use obd ops to offer management infrastructure */
-static struct obd_ops mgs_obd_device_ops = {
+static const struct obd_ops mgs_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_connect = mgs_obd_connect,
.o_reconnect = mgs_obd_reconnect,
if (type->typ_name && type->typ_procroot)
remove_proc_subtree(type->typ_name, proc_lustre_root);
#endif
- if (type->typ_md_ops)
- OBD_FREE_PTR(type->typ_md_ops);
- if (type->typ_dt_ops)
- OBD_FREE_PTR(type->typ_dt_ops);
-
OBD_FREE(type, sizeof(*type));
}
#define CLASS_MAX_NAME 1024
-int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
+int class_register_type(const struct obd_ops *dt_ops,
+ const struct md_ops *md_ops,
bool enable_proc, struct lprocfs_vars *vars,
const char *name, struct lu_device_type *ldt)
{
#ifdef HAVE_SERVER_SUPPORT
dir_exist:
#endif /* HAVE_SERVER_SUPPORT */
- OBD_ALLOC_PTR(type->typ_dt_ops);
- OBD_ALLOC_PTR(type->typ_md_ops);
-
- if (type->typ_dt_ops == NULL ||
- type->typ_md_ops == NULL)
- GOTO (failed, rc = -ENOMEM);
- *(type->typ_dt_ops) = *dt_ops;
- /* md_ops is optional */
- if (md_ops)
- *(type->typ_md_ops) = *md_ops;
+ type->typ_dt_ops = dt_ops;
+ type->typ_md_ops = md_ops;
#ifdef HAVE_SERVER_SUPPORT
if (type->typ_sym_filter) {
atomic_read(&type->typ_refcnt));
/* This is a bad situation, let's make the best of it */
/* Remove ops, but leave the name for debugging */
- OBD_FREE_PTR(type->typ_dt_ops);
- OBD_FREE_PTR(type->typ_md_ops);
+ type->typ_dt_ops = NULL;
+ type->typ_md_ops = NULL;
GOTO(out_put, rc = -EBUSY);
}
RETURN(rc);
}
-static struct obd_ops llog_obd_ops = {
+static const struct obd_ops llog_obd_ops = {
.o_owner = THIS_MODULE,
.o_setup = llog_test_setup,
.o_cleanup = llog_test_cleanup,
{ NULL }
};
-struct obd_ops echo_obd_ops = {
+const struct obd_ops echo_obd_ops = {
.o_owner = THIS_MODULE,
.o_connect = echo_connect,
.o_disconnect = echo_disconnect,
return rc;
}
-static struct obd_ops echo_client_obd_ops = {
+static const struct obd_ops echo_client_obd_ops = {
.o_owner = THIS_MODULE,
.o_iocontrol = echo_client_iocontrol,
.o_connect = echo_client_connect,
#define OBD_ECHO_BLOCK_SIZE (4<<10)
#ifdef HAVE_SERVER_SUPPORT
-extern struct obd_ops echo_obd_ops;
+extern const struct obd_ops echo_obd_ops;
extern struct lu_device_type echo_srv_type;
int echo_persistent_pages_init(void);
void echo_persistent_pages_fini(void);
struct lu_fid *fid, struct fiemap *fiemap);
/* ofd_obd.c */
-extern struct obd_ops ofd_obd_ops;
+extern const struct obd_ops ofd_obd_ops;
int ofd_destroy_by_fid(const struct lu_env *env, struct ofd_device *ofd,
const struct lu_fid *fid, int orphan);
int ofd_statfs(const struct lu_env *env, struct obd_export *exp,
return !!rc;
}
-struct obd_ops ofd_obd_ops = {
+const struct obd_ops ofd_obd_ops = {
.o_owner = THIS_MODULE,
.o_connect = ofd_obd_connect,
.o_reconnect = ofd_obd_reconnect,
}
EXPORT_SYMBOL(osc_cleanup_common);
-static struct obd_ops osc_obd_ops = {
+static const struct obd_ops osc_obd_ops = {
.o_owner = THIS_MODULE,
.o_setup = osc_setup,
.o_precleanup = osc_precleanup,
/*
* lprocfs legacy support.
*/
-static struct obd_ops osd_obd_device_ops = {
+static const struct obd_ops osd_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_connect = osd_obd_connect,
.o_disconnect = osd_obd_disconnect,
};
-static struct obd_ops osd_obd_device_ops = {
+static const struct obd_ops osd_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_connect = osd_obd_connect,
.o_disconnect = osd_obd_disconnect,
RETURN(-EINVAL);
}
-struct obd_ops lwp_obd_device_ops = {
+const struct obd_ops lwp_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_add_conn = client_import_add_conn,
.o_del_conn = client_import_del_conn,
.ldt_ctx_tags = LCT_MD_THREAD | LCT_DT_THREAD,
};
-static struct obd_ops osp_obd_device_ops = {
+static const struct obd_ops osp_obd_device_ops = {
.o_owner = THIS_MODULE,
.o_add_conn = client_import_add_conn,
.o_del_conn = client_import_del_conn,
struct thandle *th);
/* lwp_dev.c */
-extern struct obd_ops lwp_obd_device_ops;
+extern const struct obd_ops lwp_obd_device_ops;
extern struct lu_device_type lwp_device_type;
static inline struct lu_device *osp2top(const struct osp_device *osp)
}
/* use obd ops to offer management infrastructure */
-static struct obd_ops ost_obd_ops = {
+static const struct obd_ops ost_obd_ops = {
.o_owner = THIS_MODULE,
.o_setup = ost_setup,
.o_cleanup = ost_cleanup,
/*
* obd device operations associated with the master target.
*/
-struct obd_ops qmt_obd_ops = {
+static const struct obd_ops qmt_obd_ops = {
.o_owner = THIS_MODULE,
.o_connect = qmt_device_obd_connect,
.o_disconnect = qmt_device_obd_disconnect,