- err = llog_init_handle(NULL, handle, 0, NULL);
- if (err)
- GOTO(out_close, err = -ENOENT);
-
- switch (cmd) {
- case OBD_IOC_LLOG_INFO: {
- int l;
- int remains = data->ioc_inllen2 +
- cfs_size_round(data->ioc_inllen1);
- char *out = data->ioc_bulk;
-
- l = snprintf(out, remains,
- "logid: #"LPX64"#"LPX64"#%08x\n"
- "flags: %x (%s)\n"
- "records count: %d\n"
- "last index: %d\n",
- handle->lgh_id.lgl_oid, handle->lgh_id.lgl_oseq,
- handle->lgh_id.lgl_ogen,
- handle->lgh_hdr->llh_flags,
- handle->lgh_hdr->llh_flags &
- LLOG_F_IS_CAT ? "cat" : "plain",
- handle->lgh_hdr->llh_count,
- handle->lgh_last_idx);
+ if (*data->ioc_inlbuf1 == '#') {
+ rc = str2logid(&logid, data->ioc_inlbuf1, data->ioc_inllen1);
+ if (rc)
+ RETURN(rc);
+ rc = llog_open(env, ctxt, &handle, &logid, NULL,
+ LLOG_OPEN_EXISTS);
+ if (rc)
+ RETURN(rc);
+ } else if (*data->ioc_inlbuf1 == '$') {
+ char *name = data->ioc_inlbuf1 + 1;
+
+ rc = llog_open(env, ctxt, &handle, NULL, name,
+ LLOG_OPEN_EXISTS);
+ if (rc)
+ RETURN(rc);
+ } else {
+ RETURN(-EINVAL);
+ }
+
+ rc = llog_init_handle(env, handle, 0, NULL);
+ if (rc)
+ GOTO(out_close, rc = -ENOENT);
+
+ switch (cmd) {
+ case OBD_IOC_LLOG_INFO: {
+ int l;
+ int remains = data->ioc_inllen2 +
+ cfs_size_round(data->ioc_inllen1);
+ char *out = data->ioc_bulk;
+
+ l = snprintf(out, remains,
+ "logid: #"DOSTID"#%08x\n"
+ "flags: %x (%s)\n"
+ "records count: %d\n"
+ "last index: %d\n",
+ POSTID(&handle->lgh_id.lgl_oi),
+ handle->lgh_id.lgl_ogen,
+ handle->lgh_hdr->llh_flags,
+ handle->lgh_hdr->llh_flags &
+ LLOG_F_IS_CAT ? "cat" : "plain",
+ handle->lgh_hdr->llh_count,
+ handle->lgh_last_idx);