extern struct obd_device *class_conn2obd(struct lustre_handle *);
extern struct obd_device *class_exp2obd(struct obd_export *);
+struct lu_device_type;
+
/* genops.c */
struct obd_export *class_conn2export(struct lustre_handle *);
-int class_register_type(struct obd_ops *ops, struct lprocfs_vars *, char *nm);
-int class_unregister_type(char *nm);
+int class_register_type(struct obd_ops *ops, struct lprocfs_vars *,
+ const char *nm, struct lu_device_type *ldt);
+int class_unregister_type(const char *nm);
struct obd_device *class_newdev(struct obd_type *type, char *name);
void class_release_dev(struct obd_device *obd);
-int class_name2dev(char *name);
-struct obd_device *class_name2obd(char *name);
+int class_name2dev(const char *name);
+struct obd_device *class_name2obd(const char *name);
int class_uuid2dev(struct obd_uuid *uuid);
struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
void class_obd_list(void);
struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
- char * typ_name,
+ const char * typ_name,
struct obd_uuid *grp_uuid);
struct obd_device * class_find_client_notype(struct obd_uuid *tgt_uuid,
struct obd_uuid *grp_uuid);
char *obd_export_nid2str(struct obd_export *exp);
-int obd_export_evict_by_nid(struct obd_device *obd, char *nid);
-int obd_export_evict_by_uuid(struct obd_device *obd, char *uuid);
+int obd_export_evict_by_nid(struct obd_device *obd, const char *nid);
+int obd_export_evict_by_uuid(struct obd_device *obd, const char *uuid);
/* config.c */
int class_process_config(struct lustre_cfg *lcfg);
char * lp_mdc;
};
-struct lustre_profile *class_get_profile(char * prof);
-void class_del_profile(char *prof);
+struct lustre_profile *class_get_profile(const char * prof);
+void class_del_profile(const char *prof);
/* genops.c */
#define class_export_get(exp) \
struct obd_import *class_new_import(void);
void class_destroy_import(struct obd_import *exp);
-struct obd_type *class_search_type(char *name);
-struct obd_type *class_get_type(char *name);
+struct obd_type *class_search_type(const char *name);
+struct obd_type *class_get_type(const char *name);
void class_put_type(struct obd_type *type);
int class_connect(struct lustre_handle *conn, struct obd_device *obd,
struct obd_uuid *cluuid);
return(rc);
}
-static inline int obd_pin(struct obd_export *exp, struct lu_fid *fid,
+static inline int obd_pin(struct obd_export *exp, struct lu_fid *fid,
struct obd_client_handle *handle, int flag)
{
int rc;
void class_uuid_unparse(class_uuid_t in, struct obd_uuid *out);
/* lustre_peer.c */
-int lustre_uuid_to_peer(char *uuid, lnet_nid_t *peer_nid, int index);
-int class_add_uuid(char *uuid, __u64 nid);
-int class_del_uuid (char *uuid);
+int lustre_uuid_to_peer(const char *uuid, lnet_nid_t *peer_nid, int index);
+int class_add_uuid(const char *uuid, __u64 nid);
+int class_del_uuid (const char *uuid);
void class_init_uuidlist(void);
void class_exit_uuidlist(void);
return uuid->uuid[0] == '\0';
}
-static inline void obd_str2uuid(struct obd_uuid *uuid, char *tmp)
+static inline void obd_str2uuid(struct obd_uuid *uuid, const char *tmp)
{
strncpy((char *)uuid->uuid, tmp, sizeof(*uuid));
uuid->uuid[sizeof(*uuid) - 1] = '\0';
}
-static inline char *obd_uuid2str(struct obd_uuid *uuid)
+static inline char *obd_uuid2str(struct obd_uuid *uuid)
{
if (uuid->uuid[sizeof(*uuid) - 1] != '\0') {
/* Obviously not safe, but for printfs, no real harm done...*/
#include <linux/obd_ost.h>
#include <linux/obd_class.h>
#include <linux/lprocfs_status.h>
+#include <linux/lu_object.h>
extern struct list_head obd_types;
static spinlock_t obd_types_lock = SPIN_LOCK_UNLOCKED;
* support functions: we could use inter-module communication, but this
* is more portable to other OS's
*/
-struct obd_type *class_search_type(char *name)
+struct obd_type *class_search_type(const char *name)
{
struct list_head *tmp;
struct obd_type *type;
return NULL;
}
-struct obd_type *class_get_type(char *name)
+struct obd_type *class_get_type(const char *name)
{
struct obd_type *type = class_search_type(name);
#ifdef CONFIG_KMOD
if (!type) {
- char *modname = name;
+ const char *modname = name;
if (strcmp(modname, LUSTRE_MDT_NAME) == 0)
modname = LUSTRE_MDS_NAME;
if (!request_module(modname)) {
}
int class_register_type(struct obd_ops *ops, struct lprocfs_vars *vars,
- char *name)
+ const char *name, struct lu_device_type *ldt)
{
struct obd_type *type;
int rc = 0;
GOTO (failed, rc);
}
#endif
+ if (ldt != NULL) {
+ type->typ_lu = ldt;
+ rc = ldt->ldt_ops->ldto_init(ldt);
+ if (rc != 0)
+ GOTO (failed, rc);
+ }
spin_lock(&obd_types_lock);
list_add(&type->typ_chain, &obd_types);
RETURN(rc);
}
-int class_unregister_type(char *name)
+int class_unregister_type(const char *name)
{
struct obd_type *type = class_search_type(name);
ENTRY;
spin_unlock(&obd_dev_lock);
}
-int class_name2dev(char *name)
+int class_name2dev(const char *name)
{
int i;
return -1;
}
-struct obd_device *class_name2obd(char *name)
+struct obd_device *class_name2obd(const char *name)
{
int dev = class_name2dev(name);
if (dev < 0)
specified, then only the client with that uuid is returned,
otherwise any client connected to the tgt is returned. */
struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
- char * typ_name,
+ const char * typ_name,
struct obd_uuid *grp_uuid)
{
int i;
EXPORT_SYMBOL(class_update_export_timer);
#define EVICT_BATCH 32
-int obd_export_evict_by_nid(struct obd_device *obd, char *nid)
+int obd_export_evict_by_nid(struct obd_device *obd, const char *nid)
{
struct obd_export *doomed_exp[EVICT_BATCH] = { NULL };
struct list_head *p;
}
EXPORT_SYMBOL(obd_export_evict_by_nid);
-int obd_export_evict_by_uuid(struct obd_device *obd, char *uuid)
+int obd_export_evict_by_uuid(struct obd_device *obd, const char *uuid)
{
struct obd_export *doomed_exp = NULL;
struct list_head *p;
class_del_uuid(NULL);
}
-int lustre_uuid_to_peer(char *uuid, lnet_nid_t *peer_nid, int index)
+int lustre_uuid_to_peer(const char *uuid, lnet_nid_t *peer_nid, int index)
{
struct list_head *tmp;
return -ENOENT;
}
-/* Add a nid to a niduuid. Multiple nids can be added to a single uuid;
+/* Add a nid to a niduuid. Multiple nids can be added to a single uuid;
LNET will choose the best one. */
-int class_add_uuid(char *uuid, __u64 nid)
+int class_add_uuid(const char *uuid, __u64 nid)
{
struct uuid_nid_data *data;
int nob = strnlen (uuid, PAGE_SIZE) + 1;
}
/* Delete the nids for one uuid if specified, otherwise delete all */
-int class_del_uuid (char *uuid)
+int class_del_uuid(const char *uuid)
{
struct list_head deathrow;
struct list_head *tmp;
static LIST_HEAD(lustre_profile_list);
-struct lustre_profile *class_get_profile(char * prof)
+struct lustre_profile *class_get_profile(const char * prof)
{
struct lustre_profile *lprof;
RETURN(err);
}
-void class_del_profile(char *prof)
+void class_del_profile(const char *prof)
{
struct lustre_profile *lprof;