*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#define DEBUG_SUBSYSTEM S_LOG
#include <obd_class.h>
+#include <lustre_ioctl.h>
#include <lustre_log.h>
#include "llog_internal.h"
struct llog_rec_hdr *rec, void *data)
{
struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
- static int l, remains, from, to;
+ static int l, remains;
+ static long from, to;
static char *out;
char *endp;
int cur_index, rc = 0;
struct llog_rec_hdr *rec, void *data)
{
struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
- static int l, remains, from, to;
+ static int l, remains;
+ static long from, to;
static char *out;
char *endp;
int cur_index;
} 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;
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);
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);