X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fllog_ioctl.c;h=bff97f3b9219e37e1d0309390cb8ab8282951bc4;hb=245c6d39387bf85b18ea8c4db161f693739fca26;hp=9de449f2f9c151fbc63cc164a587bc5d5a268c23;hpb=233576b564b713ad765d908629b5b290acdabc1e;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/llog_ioctl.c b/lustre/obdclass/llog_ioctl.c index 9de449f..bff97f3 100644 --- a/lustre/obdclass/llog_ioctl.c +++ b/lustre/obdclass/llog_ioctl.c @@ -37,6 +37,7 @@ #define DEBUG_SUBSYSTEM S_LOG #include +#include #include #include "llog_internal.h" @@ -222,7 +223,7 @@ static int llog_print_cb(const struct lu_env *env, struct llog_handle *handle, } else if (rec->lrh_type == OBD_CFG_REC) { int rc; - rc = class_config_parse_rec(rec, out, remains); + rc = class_config_yaml_output(rec, out, remains); if (rc < 0) RETURN(rc); l = rc; @@ -368,7 +369,7 @@ int llog_ioctl(const struct lu_env *env, struct llog_ctxt *ctxt, int cmd, GOTO(out_close, rc = -EINVAL); if (handle->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN) { - rc = llog_cancel_rec(NULL, handle, cookie.lgc_index); + rc = llog_cancel_rec(env, handle, cookie.lgc_index); GOTO(out_close, rc); } else if (!(handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT)) { GOTO(out_close, rc = -EINVAL); @@ -427,3 +428,51 @@ out_close: RETURN(rc); } EXPORT_SYMBOL(llog_ioctl); + +int llog_catalog_list(const struct lu_env *env, struct dt_device *d, + int count, struct obd_ioctl_data *data, + const struct lu_fid *fid) +{ + int size, i; + struct llog_catid *idarray; + struct llog_logid *id; + char *out; + int l, remains, rc = 0; + + ENTRY; + + if (count == 0) { /* get total number of logs */ + rc = llog_osd_get_cat_list(env, d, 0, 0, NULL, fid); + if (rc < 0) + RETURN(rc); + count = rc; + } + + size = sizeof(*idarray) * count; + + OBD_ALLOC_LARGE(idarray, size); + if (!idarray) + RETURN(-ENOMEM); + + rc = llog_osd_get_cat_list(env, d, 0, count, idarray, fid); + if (rc) + GOTO(out, rc); + + out = data->ioc_bulk; + remains = data->ioc_inllen1; + for (i = 0; i < count; i++) { + id = &idarray[i].lci_logid; + l = snprintf(out, remains, + "catalog log: #"DOSTID"#%08x\n", + POSTID(&id->lgl_oi), + id->lgl_ogen); + out += l; + remains -= l; + if (remains <= 0) + break; + } +out: + OBD_FREE_LARGE(idarray, size); + RETURN(rc); +} +EXPORT_SYMBOL(llog_catalog_list);