Whamcloud - gitweb
LU-6401 uapi: change lustre_cfg.h into a proper UAPI header
[fs/lustre-release.git] / lustre / utils / llog_reader.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.html
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Use is subject to license terms.
25  *
26  * Copyright (c) 2011, 2016, Intel Corporation.
27  */
28 /*
29  * This file is part of Lustre, http://www.lustre.org/
30  * Lustre is a trademark of Sun Microsystems, Inc.
31  */
32 /** \defgroup llog_reader Lustre Log Reader
33  *
34  * Interpret llogs used for storing configuration and changelog data
35  *
36  * @{
37  */
38
39 #include <errno.h>
40 #include <limits.h>
41 #include <stdbool.h>
42 #include <stdio.h>
43 #include <stdlib.h>
44 #include <string.h>
45 #include <sys/types.h>
46 #include <sys/stat.h>
47 #ifdef HAVE_ENDIAN_H
48 # include <endian.h>
49 #endif
50 #include <unistd.h>
51 #include <fcntl.h>
52 #include <sys/vfs.h>
53 #include <linux/magic.h>
54 #include <errno.h>
55 #include <time.h>
56 #include <lnet/nidstr.h>
57 #include <linux/lustre_fid.h>
58 #include <linux/lustre_ostid.h>
59 #include <lustre/lustreapi.h>
60 #include <lustre_log_user.h>
61 #include <linux/lustre_cfg.h>
62
63 static inline int ext2_test_bit(int nr, const void *addr)
64 {
65 #if __BYTE_ORDER == __BIG_ENDIAN
66         const unsigned char *tmp = addr;
67         return (tmp[nr >> 3] >> (nr & 7)) & 1;
68 #else
69         const unsigned long *tmp = addr;
70         return ((1UL << (nr & (__WORDSIZE - 1))) &
71                 ((tmp)[nr / __WORDSIZE])) != 0;
72 #endif
73 }
74
75 int llog_pack_buffer(int fd, struct llog_log_hdr **llog_buf,
76                      struct llog_rec_hdr ***recs, int *recs_number);
77
78 void print_llog_header(struct llog_log_hdr *llog_buf);
79 static void print_records(struct llog_rec_hdr **recs_buf,
80                           int rec_number, int is_ext);
81 void llog_unpack_buffer(int fd, struct llog_log_hdr *llog_buf,
82                         struct llog_rec_hdr **recs_buf);
83
84 #define CANCELLED 0x678
85
86 #define PTL_CMD_BASE 100
87 char* portals_command[17]=
88 {
89         "REGISTER_PEER_FD",
90         "CLOSE_CONNECTION",
91         "REGISTER_MYNID",
92         "PUSH_CONNECTION",
93         "GET_CONN",
94         "DEL_PEER",
95         "ADD_PEER",
96         "GET_PEER",
97         "GET_TXDESC",
98         "ADD_ROUTE",
99         "DEL_ROUTE",
100         "GET_ROUTE",
101         "NOTIFY_ROUTER",
102         "ADD_INTERFACE",
103         "DEL_INTERFACE",
104         "GET_INTERFACE",
105         ""
106 };
107
108 int is_fstype_ext(int fd)
109 {
110         struct statfs           st;
111         int                     rc;
112
113         rc = fstatfs(fd, &st);
114         if (rc < 0) {
115                 llapi_error(LLAPI_MSG_ERROR, rc, "Got statfs error.");
116                 return -errno;
117         }
118
119         return (st.f_type == EXT4_SUPER_MAGIC);
120 }
121
122
123 /**
124  * Attempt to display a path to the object (file) containing changelog entries,
125  * referred to by this changelog_catalog record.
126  *
127  * This path depends on the implementation of the OSD device; zfs-osd and
128  * ldiskfs-osd are different.
129  *
130  * Assumes that if the file system containing the changelog_catalog is
131  * ext{2,3,4}, the backend is ldiskfs-osd; otherwise it is either zfs-osd or at
132  * least names objects based on FID and the zfs-osd path (which includes the
133  * FID) will be sufficient.
134  *
135  * The Object ID stored in the record is also displayed untranslated.
136  */
137 #define OSD_OI_FID_NR         (1UL << 7)
138 static void print_log_path(struct llog_logid_rec *lid, int is_ext)
139 {
140
141         char                    object_path[255];
142         struct lu_fid           fid_from_logid;
143
144         logid_to_fid(&lid->lid_id, &fid_from_logid);
145
146         if (is_ext)
147                 snprintf(object_path, sizeof(object_path),
148                          "O/%ju/d%u/%u", (uintmax_t)fid_from_logid.f_seq,
149                          fid_from_logid.f_oid % 32,
150                          fid_from_logid.f_oid);
151         else
152                 snprintf(object_path, sizeof(object_path),
153                          "oi.%ju/"DFID_NOBRACE,
154                          (uintmax_t)(fid_from_logid.f_seq & (OSD_OI_FID_NR - 1)),
155                          PFID(&fid_from_logid));
156
157         printf("id="DFID":%x path=%s\n",
158                PFID(&lid->lid_id.lgl_oi.oi_fid), lid->lid_id.lgl_ogen,
159                object_path);
160 }
161
162 int main(int argc, char **argv)
163 {
164         int rc = 0;
165         int is_ext;
166         int fd, rec_number;
167         struct llog_log_hdr *llog_buf = NULL;
168         struct llog_rec_hdr **recs_buf = NULL;
169
170         setlinebuf(stdout);
171
172         if (argc != 2) {
173                 printf("Usage: llog_reader filename\n");
174                 return -1;
175         }
176
177         fd = open(argv[1], O_RDONLY);
178         if (fd < 0) {
179                 rc = -errno;
180                 llapi_error(LLAPI_MSG_ERROR, rc, "Could not open the file %s.",
181                             argv[1]);
182                 goto out;
183         }
184
185         is_ext = is_fstype_ext(fd);
186         if (is_ext < 0) {
187                 rc = is_ext;
188                 printf("Unable to determine type of filesystem containing %s\n",
189                        argv[1]);
190                 goto out_fd;
191         }
192
193         rc = llog_pack_buffer(fd, &llog_buf, &recs_buf, &rec_number);
194         if (rc < 0) {
195                 llapi_error(LLAPI_MSG_ERROR, rc, "Could not pack buffer.");
196                 goto out_fd;
197         }
198
199         print_llog_header(llog_buf);
200         print_records(recs_buf, rec_number, is_ext);
201         llog_unpack_buffer(fd, llog_buf, recs_buf);
202
203 out_fd:
204         close(fd);
205 out:
206         return rc;
207 }
208
209
210
211 int llog_pack_buffer(int fd, struct llog_log_hdr **llog,
212                      struct llog_rec_hdr ***recs,
213                      int *recs_number)
214 {
215         int rc = 0, recs_num, rd = 0;
216         long long file_size;
217         struct stat st;
218         char *file_buf = NULL, *recs_buf = NULL;
219         struct llog_rec_hdr **recs_pr = NULL;
220         char *ptr = NULL;
221         int i;
222
223         rc = fstat(fd, &st);
224         if (rc < 0) {
225                 rc = -errno;
226                 llapi_error(LLAPI_MSG_ERROR, rc, "Got file stat error.");
227                 goto out;
228         }
229
230         file_size = st.st_size;
231         if (file_size < sizeof(**llog)) {
232                 llapi_error(LLAPI_MSG_ERROR, rc,
233                             "File too small for llog header: "
234                             "need %zd, size %lld\n",
235                             sizeof(**llog), file_size);
236                 rc = -EIO;
237                 goto out;
238         }
239
240         file_buf = malloc(file_size);
241         if (file_buf == NULL) {
242                 rc = -ENOMEM;
243                 llapi_error(LLAPI_MSG_ERROR, rc, "Memory Alloc for file_buf.");
244                 goto out;
245         }
246         *llog = (struct llog_log_hdr *)file_buf;
247
248         do {
249                 rc = read(fd, file_buf + rd, file_size - rd);
250                 if (rc > 0)
251                         rd += rc;
252         } while (rc > 0 && rd < file_size);
253
254         if (rd < file_size) {
255                 rc = rc < 0 ? -errno : -EIO;
256                 llapi_error(LLAPI_MSG_ERROR, rc,
257                             "Error reading llog header: need %zd, got %d",
258                             sizeof(**llog), rd);
259                 goto clear_file_buf;
260         }
261
262         /* the llog header not countable here.*/
263         recs_num = __le32_to_cpu((*llog)->llh_count) - 1;
264
265         recs_buf = malloc(recs_num * sizeof(**recs_pr));
266         if (recs_buf == NULL) {
267                 rc = -ENOMEM;
268                 llapi_error(LLAPI_MSG_ERROR, rc,
269                             "Error allocating %zd bytes for recs_buf",
270                             recs_num * sizeof(**recs_pr));
271                 goto clear_file_buf;
272         }
273         recs_pr = (struct llog_rec_hdr **)recs_buf;
274
275         ptr = file_buf + __le32_to_cpu((*llog)->llh_hdr.lrh_len);
276         i = 0;
277
278         while (ptr < (file_buf + file_size)) {
279                 struct llog_rec_hdr *cur_rec;
280                 int idx;
281                 unsigned long offset;
282
283                 if (ptr + sizeof(**recs_pr) > file_buf + file_size) {
284                         rc = -EINVAL;
285                         llapi_error(LLAPI_MSG_ERROR, rc,
286                                     "The log is corrupt (too big at %d)", i);
287                         goto clear_recs_buf;
288                 }
289
290                 cur_rec = (struct llog_rec_hdr *)ptr;
291                 idx = __le32_to_cpu(cur_rec->lrh_index);
292                 recs_pr[i] = cur_rec;
293                 offset = (unsigned long)ptr - (unsigned long)file_buf;
294                 if (cur_rec->lrh_len == 0 ||
295                     cur_rec->lrh_len > (*llog)->llh_hdr.lrh_len) {
296                         cur_rec->lrh_len = (*llog)->llh_hdr.lrh_len -
297                                 offset % (*llog)->llh_hdr.lrh_len;
298                         printf("off %lu skip %u to next chunk.\n", offset,
299                                cur_rec->lrh_len);
300                         i--;
301                 } else if (ext2_test_bit(idx, LLOG_HDR_BITMAP(*llog))) {
302                         printf("rec #%d type=%x len=%u offset %lu\n", idx,
303                                cur_rec->lrh_type, cur_rec->lrh_len, offset);
304                 } else {
305                         printf("Bit %d of %d not set\n", idx, recs_num);
306                         cur_rec->lrh_id = CANCELLED;
307                         /* The header counts only set records */
308                         i--;
309                 }
310
311                 ptr += __le32_to_cpu(cur_rec->lrh_len);
312                 if ((ptr - file_buf) > file_size) {
313                         printf("The log is corrupt (too big at %d)\n", i);
314                         rc = -EINVAL;
315                         goto clear_recs_buf;
316                 }
317                 i++;
318         }
319
320         *recs = recs_pr;
321         *recs_number = recs_num;
322
323 out:
324         return rc;
325
326 clear_recs_buf:
327         free(recs_buf);
328
329 clear_file_buf:
330         free(file_buf);
331
332         *llog = NULL;
333         goto out;
334 }
335
336 void llog_unpack_buffer(int fd, struct llog_log_hdr *llog_buf,
337                         struct llog_rec_hdr **recs_buf)
338 {
339         free(llog_buf);
340         free(recs_buf);
341         return;
342 }
343
344 void print_llog_header(struct llog_log_hdr *llog_buf)
345 {
346         time_t t;
347
348         printf("Header size : %u\n",
349                __le32_to_cpu(llog_buf->llh_hdr.lrh_len));
350
351         t = __le64_to_cpu(llog_buf->llh_timestamp);
352         printf("Time : %s", ctime(&t));
353
354         printf("Number of records: %u\n",
355                __le32_to_cpu(llog_buf->llh_count)-1);
356
357         printf("Target uuid : %s\n",
358                (char *)(&llog_buf->llh_tgtuuid));
359
360         /* Add the other info you want to view here */
361
362         printf("-----------------------\n");
363         return;
364 }
365
366 static void print_1_cfg(struct lustre_cfg *lcfg)
367 {
368         int i;
369
370         if (lcfg->lcfg_nid)
371                 printf("nid=%s(%#jx)  ", libcfs_nid2str(lcfg->lcfg_nid),
372                        (uintmax_t)lcfg->lcfg_nid);
373         if (lcfg->lcfg_nal)
374                 printf("nal=%d ", lcfg->lcfg_nal);
375         for (i = 0; i <  lcfg->lcfg_bufcount; i++)
376                 printf("%d:%.*s  ", i, lcfg->lcfg_buflens[i],
377                        (char*)lustre_cfg_buf(lcfg, i));
378         return;
379 }
380
381 static char *lustre_cfg_string(struct lustre_cfg *lcfg, __u32 index)
382 {
383         char *s;
384
385         if (lcfg->lcfg_buflens[index] == 0)
386                 return NULL;
387
388         s = lustre_cfg_buf(lcfg, index);
389         if (s == NULL)
390                 return NULL;
391
392         /*
393          * make sure it's NULL terminated, even if this kills a char
394          * of data. Try to use the padding first though.
395          */
396         if (s[lcfg->lcfg_buflens[index] - 1] != '\0') {
397                 size_t last = __ALIGN_KERNEL(lcfg->lcfg_buflens[index], 8) - 1;
398                 char lost;
399
400                 /* Use the smaller value */
401                 if (last > lcfg->lcfg_buflens[index])
402                         last = lcfg->lcfg_buflens[index];
403
404                 lost = s[last];
405                 s[last] = '\0';
406                 if (lost != '\0') {
407                         fprintf(stderr, "Truncated buf %d to '%s' (lost '%c'...)\n",
408                                 index, s, lost);
409                 }
410         }
411         return s;
412 }
413
414 static void print_setup_cfg(struct lustre_cfg *lcfg)
415 {
416         struct lov_desc *desc;
417
418         if ((lcfg->lcfg_bufcount == 2) &&
419             (lcfg->lcfg_buflens[1] == sizeof(*desc))) {
420                 printf("lov_setup ");
421                 printf("0:%s  ", lustre_cfg_string(lcfg, 0));
422                 printf("1:(struct lov_desc)\n");
423                 desc = (struct lov_desc*)(lustre_cfg_string(lcfg, 1));
424                 printf("\t\tuuid=%s  ", (char*)desc->ld_uuid.uuid);
425                 printf("stripe:cnt=%u ", desc->ld_default_stripe_count);
426                 printf("size=%ju ", (uintmax_t)desc->ld_default_stripe_size);
427                 printf("offset=%ju ",
428                        (uintmax_t)desc->ld_default_stripe_offset);
429                 printf("pattern=%#x", desc->ld_pattern);
430         } else {
431                 printf("setup     ");
432                 print_1_cfg(lcfg);
433         }
434
435         return;
436 }
437
438 void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip)
439 {
440         enum lcfg_command_type cmd = __le32_to_cpu(lcfg->lcfg_command);
441
442         if (*skip > 0)
443                 printf("SKIP ");
444
445         switch(cmd){
446         case(LCFG_ATTACH):{
447                 printf("attach    ");
448                 print_1_cfg(lcfg);
449                 break;
450         }
451         case(LCFG_SETUP):{
452                 print_setup_cfg(lcfg);
453                 break;
454         }
455         case(LCFG_DETACH):{
456                 printf("detach    ");
457                 print_1_cfg(lcfg);
458                 break;
459         }
460         case(LCFG_CLEANUP):{
461                 printf("cleanup   ");
462                 print_1_cfg(lcfg);
463                 break;
464         }
465         case(LCFG_ADD_UUID):{
466                 printf("add_uuid  ");
467                 print_1_cfg(lcfg);
468                 break;
469         }
470         case(LCFG_DEL_UUID):{
471                 printf("del_uuid  ");
472                 print_1_cfg(lcfg);
473                 break;
474         }
475         case(LCFG_ADD_CONN):{
476                 printf("add_conn  ");
477                 print_1_cfg(lcfg);
478                 break;
479         }
480         case(LCFG_DEL_CONN):{
481                 printf("del_conn  ");
482                 print_1_cfg(lcfg);
483                 break;
484         }
485         case(LCFG_LOV_ADD_OBD):{
486                 printf("lov_modify_tgts add ");
487                 print_1_cfg(lcfg);
488                 break;
489         }
490         case(LCFG_LOV_DEL_OBD):{
491                 printf("lov_modify_tgts del ");
492                 print_1_cfg(lcfg);
493                 break;
494         }
495         case(LCFG_ADD_MDC):{
496                 printf("modify_mdc_tgts add ");
497                 print_1_cfg(lcfg);
498                 break;
499         }
500         case(LCFG_DEL_MDC):{
501                 printf("modify_mdc_tgts del ");
502                 print_1_cfg(lcfg);
503                 break;
504         }
505         case(LCFG_MOUNTOPT):{
506                 printf("mount_option ");
507                 print_1_cfg(lcfg);
508                 break;
509         }
510         case(LCFG_DEL_MOUNTOPT):{
511                 printf("del_mount_option ");
512                 print_1_cfg(lcfg);
513                 break;
514         }
515         case(LCFG_SET_TIMEOUT):{
516                 printf("set_timeout=%d ", lcfg->lcfg_num);
517                 break;
518         }
519         case(LCFG_SET_LDLM_TIMEOUT):{
520                 printf("set_ldlm_timeout=%d ", lcfg->lcfg_num);
521                 break;
522         }
523         case(LCFG_SET_UPCALL):{
524                 printf("set_lustre_upcall ");
525                 print_1_cfg(lcfg);
526                 break;
527         }
528         case(LCFG_PARAM):{
529                 printf("param ");
530                 print_1_cfg(lcfg);
531                 break;
532         }
533         case(LCFG_SET_PARAM):{
534                 printf("set_param ");
535                 print_1_cfg(lcfg);
536                 break;
537         }
538         case(LCFG_SPTLRPC_CONF):{
539                 printf("sptlrpc_conf ");
540                 print_1_cfg(lcfg);
541                 break;
542         }
543         case(LCFG_MARKER):{
544                 struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1);
545                 char createtime[26], canceltime[26] = "";
546                 time_t time_tmp;
547
548                 if (marker->cm_flags & CM_START &&
549                     marker->cm_flags & CM_SKIP) {
550                         printf("SKIP START ");
551                         (*skip)++;
552                 } else if (marker->cm_flags & CM_END) {
553                         printf(     "END   ");
554                         *skip = 0;
555                 }
556
557                 if (marker->cm_flags & CM_EXCLUDE) {
558                         if (marker->cm_flags & CM_START)
559                                 printf("EXCLUDE START ");
560                         else
561                                 printf("EXCLUDE END   ");
562                 }
563
564                 /* Handle overflow of 32-bit time_t gracefully.
565                  * The copy to time_tmp is needed in any case to
566                  * keep the pointer happy, even on 64-bit systems. */
567                 time_tmp = marker->cm_createtime;
568                 if (time_tmp == marker->cm_createtime) {
569                         ctime_r(&time_tmp, createtime);
570                         createtime[strlen(createtime) - 1] = 0;
571                 } else {
572                         strcpy(createtime, "in the distant future");
573                 }
574
575                 if (marker->cm_canceltime) {
576                         /* Like cm_createtime, we try to handle overflow of
577                          * 32-bit time_t gracefully. The copy to time_tmp
578                          * is also needed on 64-bit systems to keep the
579                          * pointer happy, see bug 16771 */
580                         time_tmp = marker->cm_canceltime;
581                         if (time_tmp == marker->cm_canceltime) {
582                                 ctime_r(&time_tmp, canceltime);
583                                 canceltime[strlen(canceltime) - 1] = 0;
584                         } else {
585                                 strcpy(canceltime, "in the distant future");
586                         }
587                 }
588
589                 printf("marker %3d (flags=%#04x, v%d.%d.%d.%d) %-15s '%s' %s-%s",
590                        marker->cm_step, marker->cm_flags,
591                        OBD_OCD_VERSION_MAJOR(marker->cm_vers),
592                        OBD_OCD_VERSION_MINOR(marker->cm_vers),
593                        OBD_OCD_VERSION_PATCH(marker->cm_vers),
594                        OBD_OCD_VERSION_FIX(marker->cm_vers),
595                        marker->cm_tgtname, marker->cm_comment,
596                        createtime, canceltime);
597                 break;
598         }
599         case(LCFG_POOL_NEW):{
600                 printf("pool new ");
601                 print_1_cfg(lcfg);
602                 break;
603         }
604         case(LCFG_POOL_ADD):{
605                 printf("pool add ");
606                 print_1_cfg(lcfg);
607                 break;
608         }
609         case(LCFG_POOL_REM):{
610                 printf("pool remove ");
611                 print_1_cfg(lcfg);
612                 break;
613         }
614         case(LCFG_POOL_DEL):{
615                 printf("pool destroy ");
616                 print_1_cfg(lcfg);
617                 break;
618         }
619         default:
620                 printf("unsupported cmd_code = %x\n",cmd);
621         }
622         printf("\n");
623         return;
624 }
625
626 static void print_hsm_action(struct llog_agent_req_rec *larr)
627 {
628         char    buf[12];
629         int     sz;
630
631         sz = larr->arr_hai.hai_len - sizeof(larr->arr_hai);
632         printf("lrh=[type=%X len=%d idx=%d] fid="DFID
633                " compound/cookie=%#jx/%#jx"
634                " status=%s action=%s archive#=%d flags=%#jx"
635                " create=%ju change=%ju"
636                " extent=%#jx-%#jx gid=%#jx datalen=%d"
637                " data=[%s]\n",
638                larr->arr_hdr.lrh_type,
639                larr->arr_hdr.lrh_len, larr->arr_hdr.lrh_index,
640                PFID(&larr->arr_hai.hai_fid),
641                (uintmax_t)larr->arr_compound_id,
642                (uintmax_t)larr->arr_hai.hai_cookie,
643                agent_req_status2name(larr->arr_status),
644                hsm_copytool_action2name(larr->arr_hai.hai_action),
645                larr->arr_archive_id,
646                (uintmax_t)larr->arr_flags,
647                (uintmax_t)larr->arr_req_create,
648                (uintmax_t)larr->arr_req_change,
649                (uintmax_t)larr->arr_hai.hai_extent.offset,
650                (uintmax_t)larr->arr_hai.hai_extent.length,
651                (uintmax_t)larr->arr_hai.hai_gid, sz,
652                hai_dump_data_field(&larr->arr_hai, buf, sizeof(buf)));
653 }
654
655 void print_changelog_rec(struct llog_changelog_rec *rec)
656 {
657         printf("changelog record id:0x%x cr_flags:0x%x cr_type:%s(0x%x)\n",
658                __le32_to_cpu(rec->cr_hdr.lrh_id),
659                __le32_to_cpu(rec->cr.cr_flags),
660                changelog_type2str(__le32_to_cpu(rec->cr.cr_type)),
661                __le32_to_cpu(rec->cr.cr_type));
662 }
663
664 static void print_records(struct llog_rec_hdr **recs,
665                           int rec_number, int is_ext)
666 {
667         __u32 lopt;
668         int i, skip = 0;
669
670         for (i = 0; i < rec_number; i++) {
671                 printf("#%.2d (%.3d)", __le32_to_cpu(recs[i]->lrh_index),
672                        __le32_to_cpu(recs[i]->lrh_len));
673
674                 lopt = __le32_to_cpu(recs[i]->lrh_type);
675
676                 if (recs[i]->lrh_id == CANCELLED)
677                         printf("NOT SET ");
678
679                 switch (lopt) {
680                 case OBD_CFG_REC:
681                         print_lustre_cfg(
682                                 (struct lustre_cfg *)((char *)(recs[i]) +
683                                 sizeof(struct llog_rec_hdr)), &skip);
684                         break;
685                 case LLOG_PAD_MAGIC:
686                         printf("padding\n");
687                         break;
688                 case LLOG_LOGID_MAGIC:
689                         print_log_path((struct llog_logid_rec *)recs[i],
690                                        is_ext);
691                         break;
692                 case HSM_AGENT_REC:
693                         print_hsm_action((struct llog_agent_req_rec *)recs[i]);
694                         break;
695                 case CHANGELOG_REC:
696                         print_changelog_rec((struct llog_changelog_rec *)
697                                             recs[i]);
698                         break;
699                 case CHANGELOG_USER_REC:
700                         printf("changelog_user record id:0x%x\n",
701                                __le32_to_cpu(recs[i]->lrh_id));
702                         break;
703                 default:
704                         printf("unknown type %x\n", lopt);
705                         break;
706                 }
707         }
708 }
709
710 /** @} llog_reader */