- struct ptlrpc_request *req = NULL;
- char *buf = NULL;
- char *str;
- int len = 0;
-
- rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
- if (rc)
- RETURN(rc);
- data = (void *)buf;
-
- if (!data->ioc_inlbuf1) {
- obd_ioctl_freedata(buf, len);
- RETURN(-EINVAL);
- }
-
- req = ptlrpc_request_alloc(sbi2mdc(sbi)->cl_import,
- &RQF_LLOG_CATINFO);
- if (req == NULL)
- GOTO(out_catinfo, rc = -ENOMEM);
-
- req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
- data->ioc_inllen1);
- req_capsule_set_size(&req->rq_pill, &RMF_STRING, RCL_CLIENT,
- data->ioc_inllen2);
-
- rc = ptlrpc_request_pack(req, LUSTRE_LOG_VERSION, LLOG_CATINFO);
- if (rc) {
- ptlrpc_request_free(req);
- GOTO(out_catinfo, rc);
- }
-
- str = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
- memcpy(str, data->ioc_inlbuf1, data->ioc_inllen1);
- if (data->ioc_inllen2) {
- str = req_capsule_client_get(&req->rq_pill,
- &RMF_STRING);
- memcpy(str, data->ioc_inlbuf2, data->ioc_inllen2);
- }
-
- req_capsule_set_size(&req->rq_pill, &RMF_STRING, RCL_SERVER,
- data->ioc_plen1);
- ptlrpc_request_set_replen(req);
-
- rc = ptlrpc_queue_wait(req);
- if (!rc) {
- str = req_capsule_server_get(&req->rq_pill,
- &RMF_STRING);
- if (cfs_copy_to_user(data->ioc_pbuf1, str,
- data->ioc_plen1))
- rc = -EFAULT;
- }
- ptlrpc_req_finished(req);
- out_catinfo:
- obd_ioctl_freedata(buf, len);
- RETURN(rc);