aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ondisk.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-09-04 14:48:37 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-09-04 14:48:37 -0400
commit38c60ef228596c8e331437ea9287ce035706b107 (patch)
treee54d14229904e3abc7a6cf2176bc150bded3ad07 /fs/gfs2/ondisk.c
parent82ffa51637f9239aaddd3151fb0d41c657f760db (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>
Diffstat (limited to 'fs/gfs2/ondisk.c')
-rw-r--r--fs/gfs2/ondisk.c78
1 files changed, 39 insertions, 39 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
35void gfs2_inum_in(struct gfs2_inum *no, char *buf) 35void 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
43void gfs2_inum_out(const struct gfs2_inum *no, char *buf) 43void 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
51static void gfs2_inum_print(struct gfs2_inum *no) 51static 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
57static void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf) 57static 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
66static void gfs2_meta_header_out(struct gfs2_meta_header *mh, char *buf) 66static 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
75static void gfs2_meta_header_print(struct gfs2_meta_header *mh) 75static 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
82void gfs2_sb_in(struct gfs2_sb *sb, char *buf) 82void 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
100void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf) 100void 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
112void gfs2_rindex_print(struct gfs2_rindex *ri) 112void 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
123void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf) 123void 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
134void gfs2_rgrp_out(struct gfs2_rgrp *rg, char *buf) 134void 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
147void gfs2_quota_in(struct gfs2_quota *qu, char *buf) 147void 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
156void gfs2_dinode_in(struct gfs2_dinode *di, char *buf) 156void 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
190void gfs2_dinode_out(struct gfs2_dinode *di, char *buf) 190void 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
224void gfs2_dinode_print(struct gfs2_dinode *di) 224void 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
254void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf) 254void 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
266void gfs2_inum_range_in(struct gfs2_inum_range *ir, char *buf) 266void 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
274void gfs2_inum_range_out(struct gfs2_inum_range *ir, char *buf) 274void 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
282void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf) 282void 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
291void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf) 291void 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
300void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf) 300void 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);