-int lustre_lnet_send_dbg_task(enum lnet_dbg_task dbg_task,
- struct lnet_dbg_task_info *dbg_info,
- struct cYAML **show_rc,
- struct cYAML **err_rc)
-{
- struct lnet_ioctl_dbg *dbg;
- struct lnet_dbg_task_info *info;
- int rc = LUSTRE_CFG_RC_NO_ERR;
- char err_str[LNET_MAX_STR_LEN];
-
- snprintf(err_str, sizeof(err_str), "\"success\"");
-
- dbg = calloc(1, sizeof(*dbg) + sizeof(*info));
- if (!dbg) {
- snprintf(err_str, sizeof(err_str), "\"out of memory\"");
- rc = LUSTRE_CFG_RC_OUT_OF_MEM;
- goto out;
- }
-
- info = (struct lnet_dbg_task_info *)dbg->dbg_bulk;
-
- LIBCFS_IOC_INIT_V2(*dbg, dbg_hdr);
-
- dbg->dbg_task = dbg_task;
- if (dbg_info)
- memcpy(info, dbg_info, sizeof(*info));
-
- rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_DBG, dbg);
- if (rc != 0) {
- rc = -errno;
- snprintf(err_str,
- sizeof(err_str),
- "\"debug task failed %s\"", strerror(errno));
- goto out;
- }
-
-out:
- cYAML_build_error(rc, -1, DBG_CMD,
- "debug", err_str, err_rc);
-
- return rc;
-}
-