- struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
- static int l, remains, from, to;
- static char *out;
- char *endp;
- int cur_index;
-
- ENTRY;
- if (ioc_data != NULL && ioc_data->ioc_inllen1 > 0) {
- l = 0;
- remains = ioc_data->ioc_inllen4 +
- cfs_size_round(ioc_data->ioc_inllen1) +
- cfs_size_round(ioc_data->ioc_inllen2) +
- cfs_size_round(ioc_data->ioc_inllen3);
- from = simple_strtol(ioc_data->ioc_inlbuf2, &endp, 0);
- if (*endp != '\0')
- RETURN(-EINVAL);
- to = simple_strtol(ioc_data->ioc_inlbuf3, &endp, 0);
- if (*endp != '\0')
- RETURN(-EINVAL);
- out = ioc_data->ioc_bulk;
- ioc_data->ioc_inllen1 = 0;
- }
-
- cur_index = rec->lrh_index;
- if (cur_index < from)
- RETURN(0);
- if (to > 0 && cur_index > to)
- RETURN(-LLOG_EEMPTY);
-
- if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) {
- struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
-
- if (rec->lrh_type != LLOG_LOGID_MAGIC) {
- CERROR("invalid record in catalog\n");
- RETURN(-EINVAL);
- }
-
- l = snprintf(out, remains,
- "[index]: %05d [logid]: #"LPX64"#"LPX64"#%08x\n",
- cur_index, lir->lid_id.lgl_oid,
- lir->lid_id.lgl_oseq, lir->lid_id.lgl_ogen);
+ struct obd_ioctl_data *ioc_data = data;
+ static int l, remains;
+ static long from, to;
+ static char *out;
+ int cur_index;
+ int rc;
+
+ ENTRY;
+ if (ioc_data && ioc_data->ioc_inllen1 > 0) {
+ l = 0;
+ remains = ioc_data->ioc_inllen4 +
+ round_up(ioc_data->ioc_inllen1, 8) +
+ round_up(ioc_data->ioc_inllen2, 8) +
+ round_up(ioc_data->ioc_inllen3, 8);
+
+ rc = kstrtol(ioc_data->ioc_inlbuf2, 0, &from);
+ if (rc)
+ RETURN(rc);
+
+ rc = kstrtol(ioc_data->ioc_inlbuf3, 0, &to);
+ if (rc)
+ RETURN(rc);
+
+ out = ioc_data->ioc_bulk;
+ ioc_data->ioc_inllen1 = 0;
+ }
+
+ cur_index = rec->lrh_index;
+ if (cur_index < from)
+ RETURN(0);
+ if (to > 0 && cur_index > to)
+ RETURN(-LLOG_EEMPTY);
+
+ if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) {
+ struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
+
+ if (rec->lrh_type != LLOG_LOGID_MAGIC) {
+ CERROR("invalid record in catalog\n");
+ RETURN(-EINVAL);
+ }
+
+ l = snprintf(out, remains,
+ "[index]: %05d [logid]: "DFID":%x\n",
+ cur_index, PFID(&lir->lid_id.lgl_oi.oi_fid),
+ lir->lid_id.lgl_ogen);