diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-04 14:48:37 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-04 14:48:37 -0400 |
commit | 38c60ef228596c8e331437ea9287ce035706b107 (patch) | |
tree | e54d14229904e3abc7a6cf2176bc150bded3ad07 | |
parent | 82ffa51637f9239aaddd3151fb0d41c657f760db (diff) |
[GFS2] Use const in endian conversion routines
Use const in endian conversion and printing of on-disk structures.
Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/ondisk.c | 78 | ||||
-rw-r--r-- | include/linux/gfs2_ondisk.h | 42 |
2 files changed, 60 insertions, 60 deletions
diff --git a/fs/gfs2/ondisk.c b/fs/gfs2/ondisk.c index 03881f9870f7..1025960b0e6e 100644 --- a/fs/gfs2/ondisk.c +++ b/fs/gfs2/ondisk.c | |||
@@ -32,56 +32,56 @@ | |||
32 | * first arg: the cpu-order structure | 32 | * first arg: the cpu-order structure |
33 | */ | 33 | */ |
34 | 34 | ||
35 | void gfs2_inum_in(struct gfs2_inum *no, char *buf) | 35 | void gfs2_inum_in(struct gfs2_inum *no, const void *buf) |
36 | { | 36 | { |
37 | struct gfs2_inum *str = (struct gfs2_inum *)buf; | 37 | const struct gfs2_inum *str = buf; |
38 | 38 | ||
39 | no->no_formal_ino = be64_to_cpu(str->no_formal_ino); | 39 | no->no_formal_ino = be64_to_cpu(str->no_formal_ino); |
40 | no->no_addr = be64_to_cpu(str->no_addr); | 40 | no->no_addr = be64_to_cpu(str->no_addr); |
41 | } | 41 | } |
42 | 42 | ||
43 | void gfs2_inum_out(const struct gfs2_inum *no, char *buf) | 43 | void gfs2_inum_out(const struct gfs2_inum *no, void *buf) |
44 | { | 44 | { |
45 | struct gfs2_inum *str = (struct gfs2_inum *)buf; | 45 | struct gfs2_inum *str = buf; |
46 | 46 | ||
47 | str->no_formal_ino = cpu_to_be64(no->no_formal_ino); | 47 | str->no_formal_ino = cpu_to_be64(no->no_formal_ino); |
48 | str->no_addr = cpu_to_be64(no->no_addr); | 48 | str->no_addr = cpu_to_be64(no->no_addr); |
49 | } | 49 | } |
50 | 50 | ||
51 | static void gfs2_inum_print(struct gfs2_inum *no) | 51 | static void gfs2_inum_print(const struct gfs2_inum *no) |
52 | { | 52 | { |
53 | printk(KERN_INFO " no_formal_ino = %llu\n", (unsigned long long)no->no_formal_ino); | 53 | printk(KERN_INFO " no_formal_ino = %llu\n", (unsigned long long)no->no_formal_ino); |
54 | printk(KERN_INFO " no_addr = %llu\n", (unsigned long long)no->no_addr); | 54 | printk(KERN_INFO " no_addr = %llu\n", (unsigned long long)no->no_addr); |
55 | } | 55 | } |
56 | 56 | ||
57 | static void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf) | 57 | static void gfs2_meta_header_in(struct gfs2_meta_header *mh, const void *buf) |
58 | { | 58 | { |
59 | struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf; | 59 | const struct gfs2_meta_header *str = buf; |
60 | 60 | ||
61 | mh->mh_magic = be32_to_cpu(str->mh_magic); | 61 | mh->mh_magic = be32_to_cpu(str->mh_magic); |
62 | mh->mh_type = be32_to_cpu(str->mh_type); | 62 | mh->mh_type = be32_to_cpu(str->mh_type); |
63 | mh->mh_format = be32_to_cpu(str->mh_format); | 63 | mh->mh_format = be32_to_cpu(str->mh_format); |
64 | } | 64 | } |
65 | 65 | ||
66 | static void gfs2_meta_header_out(struct gfs2_meta_header *mh, char *buf) | 66 | static void gfs2_meta_header_out(const struct gfs2_meta_header *mh, void *buf) |
67 | { | 67 | { |
68 | struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf; | 68 | struct gfs2_meta_header *str = buf; |
69 | 69 | ||
70 | str->mh_magic = cpu_to_be32(mh->mh_magic); | 70 | str->mh_magic = cpu_to_be32(mh->mh_magic); |
71 | str->mh_type = cpu_to_be32(mh->mh_type); | 71 | str->mh_type = cpu_to_be32(mh->mh_type); |
72 | str->mh_format = cpu_to_be32(mh->mh_format); | 72 | str->mh_format = cpu_to_be32(mh->mh_format); |
73 | } | 73 | } |
74 | 74 | ||
75 | static void gfs2_meta_header_print(struct gfs2_meta_header *mh) | 75 | static void gfs2_meta_header_print(const struct gfs2_meta_header *mh) |
76 | { | 76 | { |
77 | pv(mh, mh_magic, "0x%.8X"); | 77 | pv(mh, mh_magic, "0x%.8X"); |
78 | pv(mh, mh_type, "%u"); | 78 | pv(mh, mh_type, "%u"); |
79 | pv(mh, mh_format, "%u"); | 79 | pv(mh, mh_format, "%u"); |
80 | } | 80 | } |
81 | 81 | ||
82 | void gfs2_sb_in(struct gfs2_sb *sb, char *buf) | 82 | void gfs2_sb_in(struct gfs2_sb *sb, const void *buf) |
83 | { | 83 | { |
84 | struct gfs2_sb *str = (struct gfs2_sb *)buf; | 84 | const struct gfs2_sb *str = buf; |
85 | 85 | ||
86 | gfs2_meta_header_in(&sb->sb_header, buf); | 86 | gfs2_meta_header_in(&sb->sb_header, buf); |
87 | 87 | ||
@@ -97,9 +97,9 @@ void gfs2_sb_in(struct gfs2_sb *sb, char *buf) | |||
97 | memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); | 97 | memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); |
98 | } | 98 | } |
99 | 99 | ||
100 | void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf) | 100 | void gfs2_rindex_in(struct gfs2_rindex *ri, const void *buf) |
101 | { | 101 | { |
102 | struct gfs2_rindex *str = (struct gfs2_rindex *)buf; | 102 | const struct gfs2_rindex *str = buf; |
103 | 103 | ||
104 | ri->ri_addr = be64_to_cpu(str->ri_addr); | 104 | ri->ri_addr = be64_to_cpu(str->ri_addr); |
105 | ri->ri_length = be32_to_cpu(str->ri_length); | 105 | ri->ri_length = be32_to_cpu(str->ri_length); |
@@ -109,7 +109,7 @@ void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf) | |||
109 | 109 | ||
110 | } | 110 | } |
111 | 111 | ||
112 | void gfs2_rindex_print(struct gfs2_rindex *ri) | 112 | void gfs2_rindex_print(const struct gfs2_rindex *ri) |
113 | { | 113 | { |
114 | printk(KERN_INFO " ri_addr = %llu\n", (unsigned long long)ri->ri_addr); | 114 | printk(KERN_INFO " ri_addr = %llu\n", (unsigned long long)ri->ri_addr); |
115 | pv(ri, ri_length, "%u"); | 115 | pv(ri, ri_length, "%u"); |
@@ -120,9 +120,9 @@ void gfs2_rindex_print(struct gfs2_rindex *ri) | |||
120 | pv(ri, ri_bitbytes, "%u"); | 120 | pv(ri, ri_bitbytes, "%u"); |
121 | } | 121 | } |
122 | 122 | ||
123 | void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf) | 123 | void gfs2_rgrp_in(struct gfs2_rgrp *rg, const void *buf) |
124 | { | 124 | { |
125 | struct gfs2_rgrp *str = (struct gfs2_rgrp *)buf; | 125 | const struct gfs2_rgrp *str = buf; |
126 | 126 | ||
127 | gfs2_meta_header_in(&rg->rg_header, buf); | 127 | gfs2_meta_header_in(&rg->rg_header, buf); |
128 | rg->rg_flags = be32_to_cpu(str->rg_flags); | 128 | rg->rg_flags = be32_to_cpu(str->rg_flags); |
@@ -131,9 +131,9 @@ void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf) | |||
131 | rg->rg_igeneration = be64_to_cpu(str->rg_igeneration); | 131 | rg->rg_igeneration = be64_to_cpu(str->rg_igeneration); |
132 | } | 132 | } |
133 | 133 | ||
134 | void gfs2_rgrp_out(struct gfs2_rgrp *rg, char *buf) | 134 | void gfs2_rgrp_out(const struct gfs2_rgrp *rg, void *buf) |
135 | { | 135 | { |
136 | struct gfs2_rgrp *str = (struct gfs2_rgrp *)buf; | 136 | struct gfs2_rgrp *str = buf; |
137 | 137 | ||
138 | gfs2_meta_header_out(&rg->rg_header, buf); | 138 | gfs2_meta_header_out(&rg->rg_header, buf); |
139 | str->rg_flags = cpu_to_be32(rg->rg_flags); | 139 | str->rg_flags = cpu_to_be32(rg->rg_flags); |
@@ -144,21 +144,21 @@ void gfs2_rgrp_out(struct gfs2_rgrp *rg, char *buf) | |||
144 | memset(&str->rg_reserved, 0, sizeof(str->rg_reserved)); | 144 | memset(&str->rg_reserved, 0, sizeof(str->rg_reserved)); |
145 | } | 145 | } |
146 | 146 | ||
147 | void gfs2_quota_in(struct gfs2_quota *qu, char *buf) | 147 | void gfs2_quota_in(struct gfs2_quota *qu, const void *buf) |
148 | { | 148 | { |
149 | struct gfs2_quota *str = (struct gfs2_quota *)buf; | 149 | const struct gfs2_quota *str = buf; |
150 | 150 | ||
151 | qu->qu_limit = be64_to_cpu(str->qu_limit); | 151 | qu->qu_limit = be64_to_cpu(str->qu_limit); |
152 | qu->qu_warn = be64_to_cpu(str->qu_warn); | 152 | qu->qu_warn = be64_to_cpu(str->qu_warn); |
153 | qu->qu_value = be64_to_cpu(str->qu_value); | 153 | qu->qu_value = be64_to_cpu(str->qu_value); |
154 | } | 154 | } |
155 | 155 | ||
156 | void gfs2_dinode_in(struct gfs2_dinode *di, char *buf) | 156 | void gfs2_dinode_in(struct gfs2_dinode *di, const void *buf) |
157 | { | 157 | { |
158 | struct gfs2_dinode *str = (struct gfs2_dinode *)buf; | 158 | const struct gfs2_dinode *str = buf; |
159 | 159 | ||
160 | gfs2_meta_header_in(&di->di_header, buf); | 160 | gfs2_meta_header_in(&di->di_header, buf); |
161 | gfs2_inum_in(&di->di_num, (char *)&str->di_num); | 161 | gfs2_inum_in(&di->di_num, &str->di_num); |
162 | 162 | ||
163 | di->di_mode = be32_to_cpu(str->di_mode); | 163 | di->di_mode = be32_to_cpu(str->di_mode); |
164 | di->di_uid = be32_to_cpu(str->di_uid); | 164 | di->di_uid = be32_to_cpu(str->di_uid); |
@@ -187,9 +187,9 @@ void gfs2_dinode_in(struct gfs2_dinode *di, char *buf) | |||
187 | 187 | ||
188 | } | 188 | } |
189 | 189 | ||
190 | void gfs2_dinode_out(struct gfs2_dinode *di, char *buf) | 190 | void gfs2_dinode_out(const struct gfs2_dinode *di, void *buf) |
191 | { | 191 | { |
192 | struct gfs2_dinode *str = (struct gfs2_dinode *)buf; | 192 | struct gfs2_dinode *str = buf; |
193 | 193 | ||
194 | gfs2_meta_header_out(&di->di_header, buf); | 194 | gfs2_meta_header_out(&di->di_header, buf); |
195 | gfs2_inum_out(&di->di_num, (char *)&str->di_num); | 195 | gfs2_inum_out(&di->di_num, (char *)&str->di_num); |
@@ -221,7 +221,7 @@ void gfs2_dinode_out(struct gfs2_dinode *di, char *buf) | |||
221 | 221 | ||
222 | } | 222 | } |
223 | 223 | ||
224 | void gfs2_dinode_print(struct gfs2_dinode *di) | 224 | void gfs2_dinode_print(const struct gfs2_dinode *di) |
225 | { | 225 | { |
226 | gfs2_meta_header_print(&di->di_header); | 226 | gfs2_meta_header_print(&di->di_header); |
227 | gfs2_inum_print(&di->di_num); | 227 | gfs2_inum_print(&di->di_num); |
@@ -251,9 +251,9 @@ void gfs2_dinode_print(struct gfs2_dinode *di) | |||
251 | printk(KERN_INFO " di_eattr = %llu\n", (unsigned long long)di->di_eattr); | 251 | printk(KERN_INFO " di_eattr = %llu\n", (unsigned long long)di->di_eattr); |
252 | } | 252 | } |
253 | 253 | ||
254 | void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf) | 254 | void gfs2_log_header_in(struct gfs2_log_header *lh, const void *buf) |
255 | { | 255 | { |
256 | struct gfs2_log_header *str = (struct gfs2_log_header *)buf; | 256 | const struct gfs2_log_header *str = buf; |
257 | 257 | ||
258 | gfs2_meta_header_in(&lh->lh_header, buf); | 258 | gfs2_meta_header_in(&lh->lh_header, buf); |
259 | lh->lh_sequence = be64_to_cpu(str->lh_sequence); | 259 | lh->lh_sequence = be64_to_cpu(str->lh_sequence); |
@@ -263,43 +263,43 @@ void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf) | |||
263 | lh->lh_hash = be32_to_cpu(str->lh_hash); | 263 | lh->lh_hash = be32_to_cpu(str->lh_hash); |
264 | } | 264 | } |
265 | 265 | ||
266 | void gfs2_inum_range_in(struct gfs2_inum_range *ir, char *buf) | 266 | void gfs2_inum_range_in(struct gfs2_inum_range *ir, const void *buf) |
267 | { | 267 | { |
268 | struct gfs2_inum_range *str = (struct gfs2_inum_range *)buf; | 268 | const struct gfs2_inum_range *str = buf; |
269 | 269 | ||
270 | ir->ir_start = be64_to_cpu(str->ir_start); | 270 | ir->ir_start = be64_to_cpu(str->ir_start); |
271 | ir->ir_length = be64_to_cpu(str->ir_length); | 271 | ir->ir_length = be64_to_cpu(str->ir_length); |
272 | } | 272 | } |
273 | 273 | ||
274 | void gfs2_inum_range_out(struct gfs2_inum_range *ir, char *buf) | 274 | void gfs2_inum_range_out(const struct gfs2_inum_range *ir, void *buf) |
275 | { | 275 | { |
276 | struct gfs2_inum_range *str = (struct gfs2_inum_range *)buf; | 276 | struct gfs2_inum_range *str = buf; |
277 | 277 | ||
278 | str->ir_start = cpu_to_be64(ir->ir_start); | 278 | str->ir_start = cpu_to_be64(ir->ir_start); |
279 | str->ir_length = cpu_to_be64(ir->ir_length); | 279 | str->ir_length = cpu_to_be64(ir->ir_length); |
280 | } | 280 | } |
281 | 281 | ||
282 | void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf) | 282 | void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, const void *buf) |
283 | { | 283 | { |
284 | struct gfs2_statfs_change *str = (struct gfs2_statfs_change *)buf; | 284 | const struct gfs2_statfs_change *str = buf; |
285 | 285 | ||
286 | sc->sc_total = be64_to_cpu(str->sc_total); | 286 | sc->sc_total = be64_to_cpu(str->sc_total); |
287 | sc->sc_free = be64_to_cpu(str->sc_free); | 287 | sc->sc_free = be64_to_cpu(str->sc_free); |
288 | sc->sc_dinodes = be64_to_cpu(str->sc_dinodes); | 288 | sc->sc_dinodes = be64_to_cpu(str->sc_dinodes); |
289 | } | 289 | } |
290 | 290 | ||
291 | void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf) | 291 | void gfs2_statfs_change_out(const struct gfs2_statfs_change *sc, void *buf) |
292 | { | 292 | { |
293 | struct gfs2_statfs_change *str = (struct gfs2_statfs_change *)buf; | 293 | struct gfs2_statfs_change *str = buf; |
294 | 294 | ||
295 | str->sc_total = cpu_to_be64(sc->sc_total); | 295 | str->sc_total = cpu_to_be64(sc->sc_total); |
296 | str->sc_free = cpu_to_be64(sc->sc_free); | 296 | str->sc_free = cpu_to_be64(sc->sc_free); |
297 | str->sc_dinodes = cpu_to_be64(sc->sc_dinodes); | 297 | str->sc_dinodes = cpu_to_be64(sc->sc_dinodes); |
298 | } | 298 | } |
299 | 299 | ||
300 | void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf) | 300 | void gfs2_quota_change_in(struct gfs2_quota_change *qc, const void *buf) |
301 | { | 301 | { |
302 | struct gfs2_quota_change *str = (struct gfs2_quota_change *)buf; | 302 | const struct gfs2_quota_change *str = buf; |
303 | 303 | ||
304 | qc->qc_change = be64_to_cpu(str->qc_change); | 304 | qc->qc_change = be64_to_cpu(str->qc_change); |
305 | qc->qc_flags = be32_to_cpu(str->qc_flags); | 305 | qc->qc_flags = be32_to_cpu(str->qc_flags); |
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index 3ebd8743ce8c..a7ae7c177cac 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
@@ -413,30 +413,30 @@ struct gfs2_quota_change { | |||
413 | #ifdef __KERNEL__ | 413 | #ifdef __KERNEL__ |
414 | /* Translation functions */ | 414 | /* Translation functions */ |
415 | 415 | ||
416 | extern void gfs2_inum_in(struct gfs2_inum *no, char *buf); | 416 | extern void gfs2_inum_in(struct gfs2_inum *no, const void *buf); |
417 | extern void gfs2_inum_out(const struct gfs2_inum *no, char *buf); | 417 | extern void gfs2_inum_out(const struct gfs2_inum *no, void *buf); |
418 | extern void gfs2_sb_in(struct gfs2_sb *sb, char *buf); | 418 | extern void gfs2_sb_in(struct gfs2_sb *sb, const void *buf); |
419 | extern void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf); | 419 | extern void gfs2_rindex_in(struct gfs2_rindex *ri, const void *buf); |
420 | extern void gfs2_rindex_out(struct gfs2_rindex *ri, char *buf); | 420 | extern void gfs2_rindex_out(const struct gfs2_rindex *ri, void *buf); |
421 | extern void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf); | 421 | extern void gfs2_rgrp_in(struct gfs2_rgrp *rg, const void *buf); |
422 | extern void gfs2_rgrp_out(struct gfs2_rgrp *rg, char *buf); | 422 | extern void gfs2_rgrp_out(const struct gfs2_rgrp *rg, void *buf); |
423 | extern void gfs2_quota_in(struct gfs2_quota *qu, char *buf); | 423 | extern void gfs2_quota_in(struct gfs2_quota *qu, const void *buf); |
424 | extern void gfs2_quota_out(struct gfs2_quota *qu, char *buf); | 424 | extern void gfs2_quota_out(const struct gfs2_quota *qu, void *buf); |
425 | extern void gfs2_dinode_in(struct gfs2_dinode *di, char *buf); | 425 | extern void gfs2_dinode_in(struct gfs2_dinode *di, const void *buf); |
426 | extern void gfs2_dinode_out(struct gfs2_dinode *di, char *buf); | 426 | extern void gfs2_dinode_out(const struct gfs2_dinode *di, void *buf); |
427 | extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf); | 427 | extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf); |
428 | extern void gfs2_ea_header_out(struct gfs2_ea_header *ea, char *buf); | 428 | extern void gfs2_ea_header_out(const struct gfs2_ea_header *ea, void *buf); |
429 | extern void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf); | 429 | extern void gfs2_log_header_in(struct gfs2_log_header *lh, const void *buf); |
430 | extern void gfs2_inum_range_in(struct gfs2_inum_range *ir, char *buf); | 430 | extern void gfs2_inum_range_in(struct gfs2_inum_range *ir, const void *buf); |
431 | extern void gfs2_inum_range_out(struct gfs2_inum_range *ir, char *buf); | 431 | extern void gfs2_inum_range_out(const struct gfs2_inum_range *ir, void *buf); |
432 | extern void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf); | 432 | extern void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, const void *buf); |
433 | extern void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf); | 433 | extern void gfs2_statfs_change_out(const struct gfs2_statfs_change *sc, void *buf); |
434 | extern void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf); | 434 | extern void gfs2_quota_change_in(struct gfs2_quota_change *qc, const void *buf); |
435 | 435 | ||
436 | /* Printing functions */ | 436 | /* Printing functions */ |
437 | 437 | ||
438 | extern void gfs2_rindex_print(struct gfs2_rindex *ri); | 438 | extern void gfs2_rindex_print(const struct gfs2_rindex *ri); |
439 | extern void gfs2_dinode_print(struct gfs2_dinode *di); | 439 | extern void gfs2_dinode_print(const struct gfs2_dinode *di); |
440 | 440 | ||
441 | #endif /* __KERNEL__ */ | 441 | #endif /* __KERNEL__ */ |
442 | 442 | ||