David Teigland | b3b94fa | 2006-01-16 16:50:04 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
| 3 | * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. |
| 4 | * |
| 5 | * This copyrighted material is made available to anyone wishing to use, |
| 6 | * modify, copy, or redistribute it subject to the terms and conditions |
| 7 | * of the GNU General Public License v.2. |
| 8 | */ |
| 9 | |
| 10 | #include <linux/sched.h> |
| 11 | #include <linux/slab.h> |
| 12 | #include <linux/spinlock.h> |
| 13 | #include <linux/completion.h> |
| 14 | #include <linux/buffer_head.h> |
| 15 | #include <asm/semaphore.h> |
| 16 | |
| 17 | #include "gfs2.h" |
| 18 | #include <linux/gfs2_ondisk.h> |
| 19 | |
| 20 | #define pv(struct, member, fmt) printk(" "#member" = "fmt"\n", struct->member); |
| 21 | #define pa(struct, member, count) print_array(#member, struct->member, count); |
| 22 | |
| 23 | /** |
| 24 | * print_array - Print out an array of bytes |
| 25 | * @title: what to print before the array |
| 26 | * @buf: the array |
| 27 | * @count: the number of bytes |
| 28 | * |
| 29 | */ |
| 30 | |
| 31 | static void print_array(char *title, char *buf, int count) |
| 32 | { |
| 33 | int x; |
| 34 | |
| 35 | printk(" %s =\n", title); |
| 36 | for (x = 0; x < count; x++) { |
| 37 | printk("%.2X ", (unsigned char)buf[x]); |
| 38 | if (x % 16 == 15) |
| 39 | printk("\n"); |
| 40 | } |
| 41 | if (x % 16) |
| 42 | printk("\n"); |
| 43 | } |
| 44 | |
| 45 | /* |
| 46 | * gfs2_xxx_in - read in an xxx struct |
| 47 | * first arg: the cpu-order structure |
| 48 | * buf: the disk-order buffer |
| 49 | * |
| 50 | * gfs2_xxx_out - write out an xxx struct |
| 51 | * first arg: the cpu-order structure |
| 52 | * buf: the disk-order buffer |
| 53 | * |
| 54 | * gfs2_xxx_print - print out an xxx struct |
| 55 | * first arg: the cpu-order structure |
| 56 | */ |
| 57 | |
| 58 | void gfs2_inum_in(struct gfs2_inum *no, char *buf) |
| 59 | { |
| 60 | struct gfs2_inum *str = (struct gfs2_inum *)buf; |
| 61 | |
| 62 | no->no_formal_ino = be64_to_cpu(str->no_formal_ino); |
| 63 | no->no_addr = be64_to_cpu(str->no_addr); |
| 64 | } |
| 65 | |
| 66 | void gfs2_inum_out(struct gfs2_inum *no, char *buf) |
| 67 | { |
| 68 | struct gfs2_inum *str = (struct gfs2_inum *)buf; |
| 69 | |
| 70 | str->no_formal_ino = cpu_to_be64(no->no_formal_ino); |
| 71 | str->no_addr = cpu_to_be64(no->no_addr); |
| 72 | } |
| 73 | |
| 74 | void gfs2_inum_print(struct gfs2_inum *no) |
| 75 | { |
| 76 | pv(no, no_formal_ino, "%llu"); |
| 77 | pv(no, no_addr, "%llu"); |
| 78 | } |
| 79 | |
| 80 | void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf) |
| 81 | { |
| 82 | struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf; |
| 83 | |
| 84 | mh->mh_magic = be32_to_cpu(str->mh_magic); |
| 85 | mh->mh_type = be16_to_cpu(str->mh_type); |
| 86 | mh->mh_format = be16_to_cpu(str->mh_format); |
| 87 | } |
| 88 | |
| 89 | void gfs2_meta_header_out(struct gfs2_meta_header *mh, char *buf) |
| 90 | { |
| 91 | struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf; |
| 92 | |
| 93 | str->mh_magic = cpu_to_be32(mh->mh_magic); |
| 94 | str->mh_type = cpu_to_be16(mh->mh_type); |
| 95 | str->mh_format = cpu_to_be16(mh->mh_format); |
| 96 | } |
| 97 | |
| 98 | void gfs2_meta_header_print(struct gfs2_meta_header *mh) |
| 99 | { |
| 100 | pv(mh, mh_magic, "0x%.8X"); |
| 101 | pv(mh, mh_type, "%u"); |
| 102 | pv(mh, mh_format, "%u"); |
| 103 | } |
| 104 | |
| 105 | void gfs2_sb_in(struct gfs2_sb *sb, char *buf) |
| 106 | { |
| 107 | struct gfs2_sb *str = (struct gfs2_sb *)buf; |
| 108 | |
| 109 | gfs2_meta_header_in(&sb->sb_header, buf); |
| 110 | |
| 111 | sb->sb_fs_format = be32_to_cpu(str->sb_fs_format); |
| 112 | sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format); |
| 113 | sb->sb_bsize = be32_to_cpu(str->sb_bsize); |
| 114 | sb->sb_bsize_shift = be32_to_cpu(str->sb_bsize_shift); |
| 115 | |
| 116 | gfs2_inum_in(&sb->sb_master_dir, (char *)&str->sb_master_dir); |
| 117 | gfs2_inum_in(&sb->sb_root_dir, (char *)&str->sb_root_dir); |
| 118 | |
| 119 | memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN); |
| 120 | memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); |
| 121 | } |
| 122 | |
| 123 | void gfs2_sb_out(struct gfs2_sb *sb, char *buf) |
| 124 | { |
| 125 | struct gfs2_sb *str = (struct gfs2_sb *)buf; |
| 126 | |
| 127 | gfs2_meta_header_out(&sb->sb_header, buf); |
| 128 | |
| 129 | str->sb_fs_format = cpu_to_be32(sb->sb_fs_format); |
| 130 | str->sb_multihost_format = cpu_to_be32(sb->sb_multihost_format); |
| 131 | str->sb_bsize = cpu_to_be32(sb->sb_bsize); |
| 132 | str->sb_bsize_shift = cpu_to_be32(sb->sb_bsize_shift); |
| 133 | |
| 134 | gfs2_inum_out(&sb->sb_master_dir, (char *)&str->sb_master_dir); |
| 135 | gfs2_inum_out(&sb->sb_root_dir, (char *)&str->sb_root_dir); |
| 136 | |
| 137 | memcpy(str->sb_lockproto, sb->sb_lockproto, GFS2_LOCKNAME_LEN); |
| 138 | memcpy(str->sb_locktable, sb->sb_locktable, GFS2_LOCKNAME_LEN); |
| 139 | } |
| 140 | |
| 141 | void gfs2_sb_print(struct gfs2_sb *sb) |
| 142 | { |
| 143 | gfs2_meta_header_print(&sb->sb_header); |
| 144 | |
| 145 | pv(sb, sb_fs_format, "%u"); |
| 146 | pv(sb, sb_multihost_format, "%u"); |
| 147 | |
| 148 | pv(sb, sb_bsize, "%u"); |
| 149 | pv(sb, sb_bsize_shift, "%u"); |
| 150 | |
| 151 | gfs2_inum_print(&sb->sb_master_dir); |
| 152 | |
| 153 | pv(sb, sb_lockproto, "%s"); |
| 154 | pv(sb, sb_locktable, "%s"); |
| 155 | } |
| 156 | |
| 157 | void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf) |
| 158 | { |
| 159 | struct gfs2_rindex *str = (struct gfs2_rindex *)buf; |
| 160 | |
| 161 | ri->ri_addr = be64_to_cpu(str->ri_addr); |
| 162 | ri->ri_length = be32_to_cpu(str->ri_length); |
| 163 | ri->ri_data0 = be64_to_cpu(str->ri_data0); |
| 164 | ri->ri_data = be32_to_cpu(str->ri_data); |
| 165 | ri->ri_bitbytes = be32_to_cpu(str->ri_bitbytes); |
| 166 | |
| 167 | } |
| 168 | |
| 169 | void gfs2_rindex_out(struct gfs2_rindex *ri, char *buf) |
| 170 | { |
| 171 | struct gfs2_rindex *str = (struct gfs2_rindex *)buf; |
| 172 | |
| 173 | str->ri_addr = cpu_to_be64(ri->ri_addr); |
| 174 | str->ri_length = cpu_to_be32(ri->ri_length); |
| 175 | str->__pad = 0; |
| 176 | |
| 177 | str->ri_data0 = cpu_to_be64(ri->ri_data0); |
| 178 | str->ri_data = cpu_to_be32(ri->ri_data); |
| 179 | str->ri_bitbytes = cpu_to_be32(ri->ri_bitbytes); |
| 180 | memset(str->ri_reserved, 0, sizeof(str->ri_reserved)); |
| 181 | } |
| 182 | |
| 183 | void gfs2_rindex_print(struct gfs2_rindex *ri) |
| 184 | { |
| 185 | pv(ri, ri_addr, "%llu"); |
| 186 | pv(ri, ri_length, "%u"); |
| 187 | |
| 188 | pv(ri, ri_data0, "%llu"); |
| 189 | pv(ri, ri_data, "%u"); |
| 190 | |
| 191 | pv(ri, ri_bitbytes, "%u"); |
| 192 | } |
| 193 | |
| 194 | void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf) |
| 195 | { |
| 196 | struct gfs2_rgrp *str = (struct gfs2_rgrp *)buf; |
| 197 | |
| 198 | gfs2_meta_header_in(&rg->rg_header, buf); |
| 199 | rg->rg_flags = be32_to_cpu(str->rg_flags); |
| 200 | rg->rg_free = be32_to_cpu(str->rg_free); |
| 201 | rg->rg_dinodes = be32_to_cpu(str->rg_dinodes); |
| 202 | } |
| 203 | |
| 204 | void gfs2_rgrp_out(struct gfs2_rgrp *rg, char *buf) |
| 205 | { |
| 206 | struct gfs2_rgrp *str = (struct gfs2_rgrp *)buf; |
| 207 | |
| 208 | gfs2_meta_header_out(&rg->rg_header, buf); |
| 209 | str->rg_flags = cpu_to_be32(rg->rg_flags); |
| 210 | str->rg_free = cpu_to_be32(rg->rg_free); |
| 211 | str->rg_dinodes = cpu_to_be32(rg->rg_dinodes); |
| 212 | |
| 213 | memset(&str->rg_reserved, 0, sizeof(str->rg_reserved)); |
| 214 | } |
| 215 | |
| 216 | void gfs2_rgrp_print(struct gfs2_rgrp *rg) |
| 217 | { |
| 218 | gfs2_meta_header_print(&rg->rg_header); |
| 219 | pv(rg, rg_flags, "%u"); |
| 220 | pv(rg, rg_free, "%u"); |
| 221 | pv(rg, rg_dinodes, "%u"); |
| 222 | |
| 223 | pa(rg, rg_reserved, 36); |
| 224 | } |
| 225 | |
| 226 | void gfs2_quota_in(struct gfs2_quota *qu, char *buf) |
| 227 | { |
| 228 | struct gfs2_quota *str = (struct gfs2_quota *)buf; |
| 229 | |
| 230 | qu->qu_limit = be64_to_cpu(str->qu_limit); |
| 231 | qu->qu_warn = be64_to_cpu(str->qu_warn); |
| 232 | qu->qu_value = be64_to_cpu(str->qu_value); |
| 233 | } |
| 234 | |
| 235 | void gfs2_quota_out(struct gfs2_quota *qu, char *buf) |
| 236 | { |
| 237 | struct gfs2_quota *str = (struct gfs2_quota *)buf; |
| 238 | |
| 239 | str->qu_limit = cpu_to_be64(qu->qu_limit); |
| 240 | str->qu_warn = cpu_to_be64(qu->qu_warn); |
| 241 | str->qu_value = cpu_to_be64(qu->qu_value); |
| 242 | } |
| 243 | |
| 244 | void gfs2_quota_print(struct gfs2_quota *qu) |
| 245 | { |
| 246 | pv(qu, qu_limit, "%llu"); |
| 247 | pv(qu, qu_warn, "%llu"); |
| 248 | pv(qu, qu_value, "%lld"); |
| 249 | } |
| 250 | |
| 251 | void gfs2_dinode_in(struct gfs2_dinode *di, char *buf) |
| 252 | { |
| 253 | struct gfs2_dinode *str = (struct gfs2_dinode *)buf; |
| 254 | |
| 255 | gfs2_meta_header_in(&di->di_header, buf); |
| 256 | gfs2_inum_in(&di->di_num, (char *)&str->di_num); |
| 257 | |
| 258 | di->di_mode = be32_to_cpu(str->di_mode); |
| 259 | di->di_uid = be32_to_cpu(str->di_uid); |
| 260 | di->di_gid = be32_to_cpu(str->di_gid); |
| 261 | di->di_nlink = be32_to_cpu(str->di_nlink); |
| 262 | di->di_size = be64_to_cpu(str->di_size); |
| 263 | di->di_blocks = be64_to_cpu(str->di_blocks); |
| 264 | di->di_atime = be64_to_cpu(str->di_atime); |
| 265 | di->di_mtime = be64_to_cpu(str->di_mtime); |
| 266 | di->di_ctime = be64_to_cpu(str->di_ctime); |
| 267 | di->di_major = be32_to_cpu(str->di_major); |
| 268 | di->di_minor = be32_to_cpu(str->di_minor); |
| 269 | |
| 270 | di->di_goal_meta = be64_to_cpu(str->di_goal_meta); |
| 271 | di->di_goal_data = be64_to_cpu(str->di_goal_data); |
| 272 | |
| 273 | di->di_flags = be32_to_cpu(str->di_flags); |
| 274 | di->di_payload_format = be32_to_cpu(str->di_payload_format); |
| 275 | di->di_height = be16_to_cpu(str->di_height); |
| 276 | |
| 277 | di->di_depth = be16_to_cpu(str->di_depth); |
| 278 | di->di_entries = be32_to_cpu(str->di_entries); |
| 279 | |
| 280 | di->di_eattr = be64_to_cpu(str->di_eattr); |
| 281 | |
| 282 | } |
| 283 | |
| 284 | void gfs2_dinode_out(struct gfs2_dinode *di, char *buf) |
| 285 | { |
| 286 | struct gfs2_dinode *str = (struct gfs2_dinode *)buf; |
| 287 | |
| 288 | gfs2_meta_header_out(&di->di_header, buf); |
| 289 | gfs2_inum_out(&di->di_num, (char *)&str->di_num); |
| 290 | |
| 291 | str->di_mode = cpu_to_be32(di->di_mode); |
| 292 | str->di_uid = cpu_to_be32(di->di_uid); |
| 293 | str->di_gid = cpu_to_be32(di->di_gid); |
| 294 | str->di_nlink = cpu_to_be32(di->di_nlink); |
| 295 | str->di_size = cpu_to_be64(di->di_size); |
| 296 | str->di_blocks = cpu_to_be64(di->di_blocks); |
| 297 | str->di_atime = cpu_to_be64(di->di_atime); |
| 298 | str->di_mtime = cpu_to_be64(di->di_mtime); |
| 299 | str->di_ctime = cpu_to_be64(di->di_ctime); |
| 300 | str->di_major = cpu_to_be32(di->di_major); |
| 301 | str->di_minor = cpu_to_be32(di->di_minor); |
| 302 | |
| 303 | str->di_goal_meta = cpu_to_be64(di->di_goal_meta); |
| 304 | str->di_goal_data = cpu_to_be64(di->di_goal_data); |
| 305 | |
| 306 | str->di_flags = cpu_to_be32(di->di_flags); |
| 307 | str->di_payload_format = cpu_to_be32(di->di_payload_format); |
| 308 | str->di_height = cpu_to_be16(di->di_height); |
| 309 | |
| 310 | str->di_depth = cpu_to_be16(di->di_depth); |
| 311 | str->di_entries = cpu_to_be32(di->di_entries); |
| 312 | |
| 313 | str->di_eattr = cpu_to_be64(di->di_eattr); |
| 314 | |
| 315 | } |
| 316 | |
| 317 | void gfs2_dinode_print(struct gfs2_dinode *di) |
| 318 | { |
| 319 | gfs2_meta_header_print(&di->di_header); |
| 320 | gfs2_inum_print(&di->di_num); |
| 321 | |
| 322 | pv(di, di_mode, "0%o"); |
| 323 | pv(di, di_uid, "%u"); |
| 324 | pv(di, di_gid, "%u"); |
| 325 | pv(di, di_nlink, "%u"); |
| 326 | pv(di, di_size, "%llu"); |
| 327 | pv(di, di_blocks, "%llu"); |
| 328 | pv(di, di_atime, "%lld"); |
| 329 | pv(di, di_mtime, "%lld"); |
| 330 | pv(di, di_ctime, "%lld"); |
| 331 | pv(di, di_major, "%u"); |
| 332 | pv(di, di_minor, "%u"); |
| 333 | |
| 334 | pv(di, di_goal_meta, "%llu"); |
| 335 | pv(di, di_goal_data, "%llu"); |
| 336 | |
| 337 | pv(di, di_flags, "0x%.8X"); |
| 338 | pv(di, di_payload_format, "%u"); |
| 339 | pv(di, di_height, "%u"); |
| 340 | |
| 341 | pv(di, di_depth, "%u"); |
| 342 | pv(di, di_entries, "%u"); |
| 343 | |
| 344 | pv(di, di_eattr, "%llu"); |
| 345 | } |
| 346 | |
| 347 | void gfs2_dirent_in(struct gfs2_dirent *de, char *buf) |
| 348 | { |
| 349 | struct gfs2_dirent *str = (struct gfs2_dirent *)buf; |
| 350 | |
| 351 | gfs2_inum_in(&de->de_inum, buf); |
| 352 | de->de_hash = be32_to_cpu(str->de_hash); |
| 353 | de->de_rec_len = be32_to_cpu(str->de_rec_len); |
| 354 | de->de_name_len = str->de_name_len; |
| 355 | de->de_type = str->de_type; |
| 356 | } |
| 357 | |
| 358 | void gfs2_dirent_out(struct gfs2_dirent *de, char *buf) |
| 359 | { |
| 360 | struct gfs2_dirent *str = (struct gfs2_dirent *)buf; |
| 361 | |
| 362 | gfs2_inum_out(&de->de_inum, buf); |
| 363 | str->de_hash = cpu_to_be32(de->de_hash); |
| 364 | str->de_rec_len = cpu_to_be32(de->de_rec_len); |
| 365 | str->de_name_len = de->de_name_len; |
| 366 | str->de_type = de->de_type; |
| 367 | str->__pad1 = 0; |
| 368 | str->__pad2 = 0; |
| 369 | } |
| 370 | |
| 371 | void gfs2_dirent_print(struct gfs2_dirent *de, char *name) |
| 372 | { |
| 373 | char buf[GFS2_FNAMESIZE + 1]; |
| 374 | |
| 375 | gfs2_inum_print(&de->de_inum); |
| 376 | pv(de, de_hash, "0x%.8X"); |
| 377 | pv(de, de_rec_len, "%u"); |
| 378 | pv(de, de_name_len, "%u"); |
| 379 | pv(de, de_type, "%u"); |
| 380 | |
| 381 | memset(buf, 0, GFS2_FNAMESIZE + 1); |
| 382 | memcpy(buf, name, de->de_name_len); |
| 383 | printk(" name = %s\n", buf); |
| 384 | } |
| 385 | |
| 386 | void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf) |
| 387 | { |
| 388 | struct gfs2_leaf *str = (struct gfs2_leaf *)buf; |
| 389 | |
| 390 | gfs2_meta_header_in(&lf->lf_header, buf); |
| 391 | lf->lf_depth = be16_to_cpu(str->lf_depth); |
| 392 | lf->lf_entries = be16_to_cpu(str->lf_entries); |
| 393 | lf->lf_dirent_format = be32_to_cpu(str->lf_dirent_format); |
| 394 | lf->lf_next = be64_to_cpu(str->lf_next); |
| 395 | } |
| 396 | |
| 397 | void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf) |
| 398 | { |
| 399 | struct gfs2_leaf *str = (struct gfs2_leaf *)buf; |
| 400 | |
| 401 | gfs2_meta_header_out(&lf->lf_header, buf); |
| 402 | str->lf_depth = cpu_to_be16(lf->lf_depth); |
| 403 | str->lf_entries = cpu_to_be16(lf->lf_entries); |
| 404 | str->lf_dirent_format = cpu_to_be32(lf->lf_dirent_format); |
| 405 | str->lf_next = cpu_to_be64(lf->lf_next); |
| 406 | memset(&str->lf_reserved, 0, sizeof(str->lf_reserved)); |
| 407 | } |
| 408 | |
| 409 | void gfs2_leaf_print(struct gfs2_leaf *lf) |
| 410 | { |
| 411 | gfs2_meta_header_print(&lf->lf_header); |
| 412 | pv(lf, lf_depth, "%u"); |
| 413 | pv(lf, lf_entries, "%u"); |
| 414 | pv(lf, lf_dirent_format, "%u"); |
| 415 | pv(lf, lf_next, "%llu"); |
| 416 | |
| 417 | pa(lf, lf_reserved, 32); |
| 418 | } |
| 419 | |
| 420 | void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf) |
| 421 | { |
| 422 | struct gfs2_ea_header *str = (struct gfs2_ea_header *)buf; |
| 423 | |
| 424 | ea->ea_rec_len = be32_to_cpu(str->ea_rec_len); |
| 425 | ea->ea_data_len = be32_to_cpu(str->ea_data_len); |
| 426 | ea->ea_name_len = str->ea_name_len; |
| 427 | ea->ea_type = str->ea_type; |
| 428 | ea->ea_flags = str->ea_flags; |
| 429 | ea->ea_num_ptrs = str->ea_num_ptrs; |
| 430 | } |
| 431 | |
| 432 | void gfs2_ea_header_out(struct gfs2_ea_header *ea, char *buf) |
| 433 | { |
| 434 | struct gfs2_ea_header *str = (struct gfs2_ea_header *)buf; |
| 435 | |
| 436 | str->ea_rec_len = cpu_to_be32(ea->ea_rec_len); |
| 437 | str->ea_data_len = cpu_to_be32(ea->ea_data_len); |
| 438 | str->ea_name_len = ea->ea_name_len; |
| 439 | str->ea_type = ea->ea_type; |
| 440 | str->ea_flags = ea->ea_flags; |
| 441 | str->ea_num_ptrs = ea->ea_num_ptrs; |
| 442 | str->__pad = 0; |
| 443 | } |
| 444 | |
| 445 | void gfs2_ea_header_print(struct gfs2_ea_header *ea, char *name) |
| 446 | { |
| 447 | char buf[GFS2_EA_MAX_NAME_LEN + 1]; |
| 448 | |
| 449 | pv(ea, ea_rec_len, "%u"); |
| 450 | pv(ea, ea_data_len, "%u"); |
| 451 | pv(ea, ea_name_len, "%u"); |
| 452 | pv(ea, ea_type, "%u"); |
| 453 | pv(ea, ea_flags, "%u"); |
| 454 | pv(ea, ea_num_ptrs, "%u"); |
| 455 | |
| 456 | memset(buf, 0, GFS2_EA_MAX_NAME_LEN + 1); |
| 457 | memcpy(buf, name, ea->ea_name_len); |
| 458 | printk(" name = %s\n", buf); |
| 459 | } |
| 460 | |
| 461 | void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf) |
| 462 | { |
| 463 | struct gfs2_log_header *str = (struct gfs2_log_header *)buf; |
| 464 | |
| 465 | gfs2_meta_header_in(&lh->lh_header, buf); |
| 466 | lh->lh_sequence = be64_to_cpu(str->lh_sequence); |
| 467 | lh->lh_flags = be32_to_cpu(str->lh_flags); |
| 468 | lh->lh_tail = be32_to_cpu(str->lh_tail); |
| 469 | lh->lh_blkno = be32_to_cpu(str->lh_blkno); |
| 470 | lh->lh_hash = be32_to_cpu(str->lh_hash); |
| 471 | } |
| 472 | |
| 473 | void gfs2_log_header_print(struct gfs2_log_header *lh) |
| 474 | { |
| 475 | gfs2_meta_header_print(&lh->lh_header); |
| 476 | pv(lh, lh_sequence, "%llu"); |
| 477 | pv(lh, lh_flags, "0x%.8X"); |
| 478 | pv(lh, lh_tail, "%u"); |
| 479 | pv(lh, lh_blkno, "%u"); |
| 480 | pv(lh, lh_hash, "0x%.8X"); |
| 481 | } |
| 482 | |
| 483 | void gfs2_log_descriptor_print(struct gfs2_log_descriptor *ld) |
| 484 | { |
| 485 | gfs2_meta_header_print(&ld->ld_header); |
| 486 | pv(ld, ld_type, "%u"); |
| 487 | pv(ld, ld_length, "%u"); |
| 488 | pv(ld, ld_data1, "%u"); |
| 489 | pv(ld, ld_data2, "%u"); |
| 490 | |
| 491 | pa(ld, ld_reserved, 32); |
| 492 | } |
| 493 | |
| 494 | void gfs2_inum_range_in(struct gfs2_inum_range *ir, char *buf) |
| 495 | { |
| 496 | struct gfs2_inum_range *str = (struct gfs2_inum_range *)buf; |
| 497 | |
| 498 | ir->ir_start = be64_to_cpu(str->ir_start); |
| 499 | ir->ir_length = be64_to_cpu(str->ir_length); |
| 500 | } |
| 501 | |
| 502 | void gfs2_inum_range_out(struct gfs2_inum_range *ir, char *buf) |
| 503 | { |
| 504 | struct gfs2_inum_range *str = (struct gfs2_inum_range *)buf; |
| 505 | |
| 506 | str->ir_start = cpu_to_be64(ir->ir_start); |
| 507 | str->ir_length = cpu_to_be64(ir->ir_length); |
| 508 | } |
| 509 | |
| 510 | void gfs2_inum_range_print(struct gfs2_inum_range *ir) |
| 511 | { |
| 512 | pv(ir, ir_start, "%llu"); |
| 513 | pv(ir, ir_length, "%llu"); |
| 514 | } |
| 515 | |
| 516 | void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf) |
| 517 | { |
| 518 | struct gfs2_statfs_change *str = (struct gfs2_statfs_change *)buf; |
| 519 | |
| 520 | sc->sc_total = be64_to_cpu(str->sc_total); |
| 521 | sc->sc_free = be64_to_cpu(str->sc_free); |
| 522 | sc->sc_dinodes = be64_to_cpu(str->sc_dinodes); |
| 523 | } |
| 524 | |
| 525 | void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf) |
| 526 | { |
| 527 | struct gfs2_statfs_change *str = (struct gfs2_statfs_change *)buf; |
| 528 | |
| 529 | str->sc_total = cpu_to_be64(sc->sc_total); |
| 530 | str->sc_free = cpu_to_be64(sc->sc_free); |
| 531 | str->sc_dinodes = cpu_to_be64(sc->sc_dinodes); |
| 532 | } |
| 533 | |
| 534 | void gfs2_statfs_change_print(struct gfs2_statfs_change *sc) |
| 535 | { |
| 536 | pv(sc, sc_total, "%lld"); |
| 537 | pv(sc, sc_free, "%lld"); |
| 538 | pv(sc, sc_dinodes, "%lld"); |
| 539 | } |
| 540 | |
| 541 | void gfs2_unlinked_tag_in(struct gfs2_unlinked_tag *ut, char *buf) |
| 542 | { |
| 543 | struct gfs2_unlinked_tag *str = (struct gfs2_unlinked_tag *)buf; |
| 544 | |
| 545 | gfs2_inum_in(&ut->ut_inum, buf); |
| 546 | ut->ut_flags = be32_to_cpu(str->ut_flags); |
| 547 | } |
| 548 | |
| 549 | void gfs2_unlinked_tag_out(struct gfs2_unlinked_tag *ut, char *buf) |
| 550 | { |
| 551 | struct gfs2_unlinked_tag *str = (struct gfs2_unlinked_tag *)buf; |
| 552 | |
| 553 | gfs2_inum_out(&ut->ut_inum, buf); |
| 554 | str->ut_flags = cpu_to_be32(ut->ut_flags); |
| 555 | str->__pad = 0; |
| 556 | } |
| 557 | |
| 558 | void gfs2_unlinked_tag_print(struct gfs2_unlinked_tag *ut) |
| 559 | { |
| 560 | gfs2_inum_print(&ut->ut_inum); |
| 561 | pv(ut, ut_flags, "%u"); |
| 562 | } |
| 563 | |
| 564 | void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf) |
| 565 | { |
| 566 | struct gfs2_quota_change *str = (struct gfs2_quota_change *)buf; |
| 567 | |
| 568 | qc->qc_change = be64_to_cpu(str->qc_change); |
| 569 | qc->qc_flags = be32_to_cpu(str->qc_flags); |
| 570 | qc->qc_id = be32_to_cpu(str->qc_id); |
| 571 | } |
| 572 | |
| 573 | void gfs2_quota_change_out(struct gfs2_quota_change *qc, char *buf) |
| 574 | { |
| 575 | struct gfs2_quota_change *str = (struct gfs2_quota_change *)buf; |
| 576 | |
| 577 | str->qc_change = cpu_to_be64(qc->qc_change); |
| 578 | str->qc_flags = cpu_to_be32(qc->qc_flags); |
| 579 | str->qc_id = cpu_to_be32(qc->qc_id); |
| 580 | } |
| 581 | |
| 582 | void gfs2_quota_change_print(struct gfs2_quota_change *qc) |
| 583 | { |
| 584 | pv(qc, qc_change, "%lld"); |
| 585 | pv(qc, qc_flags, "0x%.8X"); |
| 586 | pv(qc, qc_id, "%u"); |
| 587 | } |
| 588 | |
| 589 | |
| 590 | |