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