* GPL HEADER END
*/
/*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2014, Intel Corporation.
* Use is subject to license terms.
*
* Author: Johann Lombardi <johann.lombardi@intel.com>
struct lu_device *ld = qmt2lu_dev(qmt);
struct obd_device *obd, *mdt_obd;
struct obd_type *type;
+ char *svname = lustre_cfg_string(cfg, 0);
int rc;
ENTRY;
+ if (svname == NULL)
+ RETURN(-EINVAL);
+
/* record who i am, it might be useful ... */
- strncpy(qmt->qmt_svname, lustre_cfg_string(cfg, 0),
- sizeof(qmt->qmt_svname) - 1);
+ rc = strlcpy(qmt->qmt_svname, svname, sizeof(qmt->qmt_svname));
+ if (rc >= sizeof(qmt->qmt_svname))
+ RETURN(-E2BIG);
/* look-up the obd_device associated with the qmt */
obd = class_name2obd(qmt->qmt_svname);
/* set up and start rebalance thread */
thread_set_flags(&qmt->qmt_reba_thread, SVC_STOPPED);
- cfs_waitq_init(&qmt->qmt_reba_thread.t_ctl_waitq);
- CFS_INIT_LIST_HEAD(&qmt->qmt_reba_list);
+ init_waitqueue_head(&qmt->qmt_reba_thread.t_ctl_waitq);
+ INIT_LIST_HEAD(&qmt->qmt_reba_list);
spin_lock_init(&qmt->qmt_reba_lock);
rc = qmt_start_reba_thread(qmt);
if (rc) {
int rc;
ENTRY;
- rc = class_register_type(&qmt_obd_ops, NULL, NULL, LUSTRE_QMT_NAME,
- &qmt_device_type);
+ rc = class_register_type(&qmt_obd_ops, NULL, true, NULL,
+ LUSTRE_QMT_NAME, &qmt_device_type);
RETURN(rc);
}