summaryrefslogtreecommitdiff
path: root/packages/linux/nslu2-kernel/2.6.11-mm/reiser4.patch
blob: b752ddac9830d029e2b2d31f1699ac572b800fba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/disk_format/disk_format40.c	2005-03-27 21:36:10.656270448 -0800
+++ linux-2.6.11/fs/reiser4/plugin/disk_format/disk_format40.c	2005-03-27 23:39:18.967076480 -0800
@@ -467,19 +467,15 @@
 	return 0;
 }
 
-#define FORMAT40_ROOT_LOCALITY 41
-#define FORMAT40_ROOT_OBJECTID 42
+#define FORMAT40_ROOT_LOCALITY 41ull
+#define FORMAT40_ROOT_OBJECTID 42ull
 
 /* plugin->u.format.root_dir_key */
 reiser4_internal const reiser4_key *
 root_dir_key_format40(const struct super_block *super UNUSED_ARG)
 {
 	static const reiser4_key FORMAT40_ROOT_DIR_KEY = {
-		.el = {{(FORMAT40_ROOT_LOCALITY << 4) | KEY_SD_MINOR},
-#if REISER4_LARGE_KEY
-		       {0ull},
-#endif
-		       {FORMAT40_ROOT_OBJECTID}, {0ull}}
+		.el = { KEY_INIT(KEY_SD_MINOR,FORMAT40_ROOT_LOCALITY,0ull,0,FORMAT40_ROOT_OBJECTID,0ull) }
 	};
 
 	return &FORMAT40_ROOT_DIR_KEY;
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/disk_format/disk_format40.h	2005-03-27 21:24:00.618253096 -0800
+++ linux-2.6.11/fs/reiser4/plugin/disk_format/disk_format40.h	2005-03-27 21:24:02.747929336 -0800
@@ -49,7 +49,7 @@
 	/*  70 */ d16 formatting_policy;
 	/*  72 */ d64 flags;
 	/*  72 */ char not_used[432];
-} format40_disk_super_block;
+} PACKED64 format40_disk_super_block;
 
 /* format 40 specific part of reiser4_super_info_data */
 typedef struct format40_super_info {
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/file/invert.c	2005-03-27 21:24:00.625252032 -0800
+++ linux-2.6.11/fs/reiser4/plugin/file/invert.c	2005-03-27 21:24:02.747929336 -0800
@@ -240,14 +240,14 @@
 typedef struct flow_header {
 	d32 fl_magic;
 	d16 fl_nr;		/* number of subfiles in the flow */
-};
+} PACKED32;
 
 typedef struct subfile_header {
 	d32 sh_magic;		/* subfile magic */
 	d16 sh_type;		/* type of subfile: light-weight, ordinary, invert */
 	d16 sh_arg_len;		/* lenght of lookup argument (filename, key) */
 	d32 sh_body_len;	/* lenght of subfile body */
-};
+} PACKED32;
 
 /* functions to get/set fields of flow header */
 
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/static_stat.c	2005-03-27 21:24:00.648248536 -0800
+++ linux-2.6.11/fs/reiser4/plugin/item/static_stat.c	2005-03-27 21:34:27.331978128 -0800
@@ -19,6 +19,38 @@
 
 /* see static_stat.h for explanation */
 
+/* compile time verify of the data structure sizes and alignments */
+static inline void
+r4static_stat_verify(void)
+{
+	/* All these structures are PACKED, so the __alignof__ should
+	 * be 1.  The sizes need to be correct as they map to disk
+	 * structures.
+	 */
+	cassert(sizeof (reiser4_stat_data_base) == 2);
+	/* cassert(sizeof (reiser4_light_weight_stat) == 16);
+	 * 14 bytes, comments in code do not take into account PACKED!
+	 */
+	cassert(sizeof (reiser4_light_weight_stat) == 14);
+	cassert(sizeof (reiser4_unix_stat) == 28);
+	cassert(sizeof (reiser4_symlink_stat) == 0);
+	cassert(sizeof (reiser4_plugin_slot) == 4);
+	cassert(sizeof (reiser4_plugin_stat) == 2);
+	cassert(sizeof (reiser4_flags_stat) == 4);
+	/* cassert(sizeof (reiser4_capabilities_stat) == 16);
+	 * comments in the file look wrong - capabilities are 2 x d32
+	 * not 2 x d64 in the declaration.
+	 */
+	cassert(sizeof (reiser4_capabilities_stat) == 8);
+	cassert(sizeof (reiser4_cluster_stat) == 1);
+	cassert(sizeof (reiser4_crypto_stat) == 2);
+	/* cassert(sizeof (reiser4_large_times_stat) == 24);
+	 * should be 12 bytes - 3 x d32, probably a bug in the def in
+	 * the header file (meant to be 3 x d64?)
+	 */
+	cassert(sizeof (reiser4_large_times_stat) == 12);
+}
+
 /* helper function used while we are dumping/loading inode/plugin state
     to/from the stat-data. */
 
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/acl.h	2005-03-27 21:24:00.629251424 -0800
+++ linux-2.6.11/fs/reiser4/plugin/item/acl.h	2005-03-27 21:24:02.749929032 -0800
@@ -26,7 +26,7 @@
 	obj_key_id id;
 	/* file name. Null terminated string. */
 	d8 name[0];
-} directory_entry_format;
+} PACKEDt(obj_key_id) directory_entry_format;
 
 void print_de(const char *prefix, coord_t * coord);
 int extract_key_de(const coord_t * coord, reiser4_key * key);
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/cde.h	2005-03-27 21:24:00.632250968 -0800
+++ linux-2.6.11/fs/reiser4/plugin/item/cde.h	2005-03-27 21:24:02.750928880 -0800
@@ -15,12 +15,12 @@
 typedef struct cde_unit_header {
 	de_id hash;
 	d16 offset;
-} cde_unit_header;
+} PACKEDt2(de_id,d16) cde_unit_header;
 
 typedef struct cde_item_format {
 	d16 num_of_entries;
 	cde_unit_header entry[0];
-} cde_item_format;
+} PACKEDt2(d16,cde_unit_header) cde_item_format;
 
 typedef struct cde_entry {
 	const struct inode *dir;
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/extent.h	2005-03-27 21:32:13.758284416 -0800
+++ linux-2.6.11/fs/reiser4/plugin/item/extent.h	2005-03-27 21:32:30.786695704 -0800
@@ -7,7 +7,7 @@
 typedef struct {
 	reiser4_dblock_nr start;
 	reiser4_dblock_nr width;
-} reiser4_extent;
+} PACKED64 reiser4_extent;
 
 typedef struct extent_stat {
 	int unallocated_units;
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/internal.h	2005-03-27 21:33:08.971890672 -0800
+++ linux-2.6.11/fs/reiser4/plugin/item/internal.h	2005-03-27 22:15:43.290575208 -0800
@@ -13,7 +13,7 @@
 typedef struct internal_item_layout {
 	/*  0 */ reiser4_dblock_nr pointer;
 	/*  4 */
-} internal_item_layout;
+} PACKED64 internal_item_layout;
 
 struct cut_list;
 
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/sde.h	2005-03-27 21:24:00.646248840 -0800
+++ linux-2.6.11/fs/reiser4/plugin/item/sde.h	2005-03-27 21:24:02.750928880 -0800
@@ -26,7 +26,7 @@
 	obj_key_id id;
 	/* file name. Null terminated string. */
 	d8 name[0];
-} directory_entry_format;
+} PACKEDt(obj_key_id) directory_entry_format;
 
 void print_de(const char *prefix, coord_t * coord);
 int extract_key_de(const coord_t * coord, reiser4_key * key);
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/node/node40.c	2005-03-27 21:24:00.654247624 -0800
+++ linux-2.6.11/fs/reiser4/plugin/node/node40.c	2005-03-27 21:35:08.677692624 -0800
@@ -32,6 +32,22 @@
    magic (32)
    flush_time (32)
 */
+/* compile time verify of the data structure sizes and alignments */
+static inline void
+r4node40_stat_verify(void)
+{
+	/* The alignment of these structures is intended to be '1', but
+	 * it doesn't matter so long as the size is right.
+	 */
+	cassert(sizeof (common_node_header) == 2);
+	cassert(sizeof (node40_header) ==  28);
+#if REISER4_LARGE_KEY
+	cassert(sizeof (item_header40) == 38);
+#else
+	cassert(sizeof (item_header40) == 30);
+#endif
+}
+
 /* NIKITA-FIXME-HANS: I told you guys not less than 10 times to not call it r4fs.  Change to "ReIs". */
 /* magic number that is stored in ->magic field of node header */
 static const __u32 REISER4_NODE_MAGIC = 0x52344653;	/* (*(__u32 *)"R4FS"); */
--- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/node/node.h	2005-03-27 21:24:00.656247320 -0800
+++ linux-2.6.11/fs/reiser4/plugin/node/node.h	2005-03-27 21:24:02.753928424 -0800
@@ -250,7 +250,7 @@
 	/* identifier of node plugin. Must be located at the very beginning
 	   of a node. */
 	d16 plugin_id;
-} common_node_header;
+} PACKED16 common_node_header;
 
 /* __REISER4_NODE_H__ */
 #endif
--- linux-2.6.11/.pc/reiser4/fs/reiser4/debug.c	2005-03-27 21:24:00.563261456 -0800
+++ linux-2.6.11/fs/reiser4/debug.c	2005-03-27 23:27:58.569512632 -0800
@@ -75,6 +75,72 @@
 	va_list args;
 
 	/*
+	 * this is here to make sure that we don't compile code which we
+	 * know a-priori will panic, or fail without panicing, since this
+	 * compiles first if you find a duplicate case label error then
+	 * you need to rewrite this code to match your compiler.
+	 */
+	cassert(sizeof (d8) == 1);
+	cassert(__alignof__ (d8) == 1);
+	{
+		struct {
+			__u8 pad;
+			d8 data;
+		} PACKED8 test;
+		cassert(sizeof test == 2);
+		cassert(sizeof test.data == 1);
+		cassert(__alignof__ test.data == 1);
+		cassert(__alignof__ test == 1);
+	}
+	cassert(sizeof (d16) == 2);
+	cassert(__alignof__ (d16) == 2);
+	{
+		struct {
+			__u8 pad;
+			d16 data;
+		} PACKED16 test;
+		cassert(sizeof test == 4);
+		cassert(sizeof test.data == 2);
+#if !__arm__
+		cassert(__alignof__ test.data == 2);
+#endif
+		cassert(__alignof__ test == 2);
+#if !__arm__
+		cassert(test.data.datum - &test.pad == 2);
+#endif
+	}
+	cassert(sizeof (d32) == 4);
+	cassert(__alignof__ (d32) == 4);
+	{
+		struct {
+			__u8 pad;
+			d32 data;
+		} PACKED32 test;
+		cassert(sizeof test == 8);
+		cassert(sizeof test.data == 4);
+		cassert(__alignof__ test.data == 4);
+		cassert(__alignof__ test == 4);
+		cassert(test.data.datum - &test.pad == 4);
+	}
+	cassert(sizeof (d64) == 8);
+	cassert(__alignof__ (d64) == 8);
+	{
+		struct {
+			__u8 pad;
+			d64 data;
+		} PACKED64 test;
+		cassert(sizeof test == 16);
+		cassert(sizeof test.data == 8);
+		cassert(__alignof__ test.data == 8);
+		cassert(__alignof__ test == 8);
+		cassert(test.data.datum - &test.pad == 8);
+	}
+
+	/* This is just a test of a struct with a single d64 element. */
+	cassert(sizeof (reiser4_dblock_nr) == 8);
+	cassert(__alignof__(reiser4_dblock_nr) == 8);
+
+	/*
 	 * check for recursive panic.
 	 */
 	if (in_panic == 0) {
--- linux-2.6.11/.pc/reiser4/fs/reiser4/flush_queue.c	2005-03-27 21:24:00.577259328 -0800
+++ linux-2.6.11/fs/reiser4/flush_queue.c	2005-03-27 21:24:02.755928120 -0800
@@ -447,7 +447,7 @@
 
 		/* If all write requests registered in this "fq" are done we up
 		 * the semaphore. */
-		if (atomic_sub_and_test(bio->bi_vcnt, &fq->nr_submitted))
+		if (atomic_sub_return(bio->bi_vcnt, &fq->nr_submitted) == 0)
 			up(&fq->io_sem);
 	}
 
--- linux-2.6.11/.pc/reiser4/fs/reiser4/key.c	2005-03-27 22:42:43.481268784 -0800
+++ linux-2.6.11/fs/reiser4/key.c	2005-03-27 23:42:53.958392832 -0800
@@ -13,10 +13,10 @@
    independent of key scheme. */
 static const reiser4_key MINIMAL_KEY = {
 	.el = {
-		{0ull},
-		ON_LARGE_KEY({0ull},)
-		{0ull},
-		{0ull}
+		{{0,0,0,0,0,0,0,0}},
+		ON_LARGE_KEY({{0,0,0,0,0,0,0,0}},)
+		{{0,0,0,0,0,0,0,0}},
+		{{0,0,0,0,0,0,0,0}}
 	}
 };
 
@@ -24,10 +24,10 @@
    independent of key scheme. */
 static const reiser4_key MAXIMAL_KEY = {
 	.el = {
-		{~0ull},
-		ON_LARGE_KEY({~0ull},)
-		{~0ull},
-		{~0ull}
+		{{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}},
+		ON_LARGE_KEY({{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}},)
+		{{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}},
+		{{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}}
 	}
 };
 
--- linux-2.6.11/.pc/reiser4/fs/reiser4/safe_link.c	2005-03-27 21:24:00.677244128 -0800
+++ linux-2.6.11/fs/reiser4/safe_link.c	2005-03-27 21:24:02.756927968 -0800
@@ -61,7 +61,7 @@
 	reiser4_key sdkey; /* key of stat-data for the file safe-link is
 			    * for */
 	d64 size;          /* size to which file should be truncated */
-} safelink_t;
+} PACKEDt2(reiser4_key, d64) safelink_t;
 
 /*
  * locality where safe-link items are stored. Next to the objectid of root
--- linux-2.6.11/.pc/reiser4/fs/reiser4/status_flags.c	2005-03-27 21:24:00.682243368 -0800
+++ linux-2.6.11/fs/reiser4/status_flags.c	2005-03-27 21:24:02.756927968 -0800
@@ -153,6 +153,7 @@
 		 &statuspage->stacktrace[no])
 
 	GETFRAME(0);
+#ifndef __arm__
 	GETFRAME(1);
 	GETFRAME(2);
 	GETFRAME(3);
@@ -162,6 +163,7 @@
 	GETFRAME(7);
 	GETFRAME(8);
 	GETFRAME(9);
+#endif
 
 #undef GETFRAME
 #endif
--- linux-2.6.11/.pc/reiser4/fs/reiser4/dformat.h	2005-03-27 21:24:00.564261304 -0800
+++ linux-2.6.11/fs/reiser4/dformat.h	2005-03-27 23:29:03.223683704 -0800
@@ -28,43 +28,84 @@
 
 /* code on-disk data-types as structs with a single field
    to rely on compiler type-checking. Like include/asm-i386/page.h */
+/* This code did not work on the arm with gcc 3.4.3 because the
+ * arm has a minimum structure size of 4 - packed is necessary to
+ * allow these types to be smaller than 4 - and because this version
+ * of gcc 'loses' the alignment if the structure contains just one
+ * element of alignment 8 (or probably any value greater than 4).
+ * To fix this and to make the code much more portable all the basic
+ * types are now just done as arrays of bytes - __u8.
+ *
+ * This is highly tricky, however the check code in debug.c should
+ * fire a compile time assert if it goes wrong.
+ */
+#if __arm__
+#define PACKED8  __attribute__ ((packed,aligned(1)))
+/* Warning: the presence of the packed attribute here means that any
+ * d16 in a structure so marked will lose its alignment.  That doesn't
+ * seem to matter because there don't seem to be any d16's with odd
+ * structure offsets, but it might.
+ */
+#define PACKED16 __attribute__ ((packed,aligned(2)))
+#define PACKED32 __attribute__ ((aligned(4)))
+#define PACKED64 __attribute__ ((aligned(8)))
+#else
+#define PACKED8  __attribute__ ((aligned(1)))
+#define PACKED16 __attribute__ ((aligned(2)))
+#define PACKED32 __attribute__ ((aligned(4)))
+#define PACKED64 __attribute__ ((aligned(8)))
+#endif
 typedef struct d8 {
-	__u8 datum;
-} d8 __attribute__ ((aligned(1)));
+	__u8 datum[1];
+} PACKED8 d8;
 typedef struct d16 {
-	__u16 datum;
-} d16 __attribute__ ((aligned(2)));
+	__u8 datum[2];
+} PACKED16 d16;
 typedef struct d32 {
-	__u32 datum;
-} d32 __attribute__ ((aligned(4)));
+	__u8 datum[4];
+} PACKED32 d32;
 typedef struct d64 {
-	__u64 datum;
-} d64 __attribute__ ((aligned(8)));
+	__u8 datum[8];
+} PACKED64 d64;
 
+#define PACKEDt(t) __attribute__ ((packed,aligned(__alignof__ (t)) ))
+#define PACKEDt2(t1,t2) __attribute__ ((packed,aligned(\
+		__alignof__ (t1) < __alignof__ (t2) ? __alignof__ (t2) : __alignof__ (t1) )))
 #define PACKED __attribute__((packed))
 
 static inline __u8
 d8tocpu(const d8 * ondisk /* on-disk value to convert */ )
 {
-	return ondisk->datum;
+	return ondisk->datum[0];
 }
 
 static inline __u16
 d16tocpu(const d16 * ondisk /* on-disk value to convert */ )
 {
-	return __le16_to_cpu(get_unaligned(&ondisk->datum));
+	return ondisk->datum[0] + (ondisk->datum[1] << 8);
 }
 
 static inline __u32
 d32tocpu(const d32 * ondisk /* on-disk value to convert */ )
 {
-	return __le32_to_cpu(get_unaligned(&ondisk->datum));
+	return ondisk->datum[0] +
+		(ondisk->datum[1] << 8) +
+		(ondisk->datum[2] << 16) +
+		(ondisk->datum[3] << 24);
 }
 
 static inline __u64
 d64tocpu(const d64 * ondisk /* on-disk value to convert */ )
 {
-	return __le64_to_cpu(get_unaligned(&ondisk->datum));
+	__u32 low = ondisk->datum[0] +
+		(ondisk->datum[1] << 8) +
+		(ondisk->datum[2] << 16) +
+		(ondisk->datum[3] << 24);
+	__u64 high = ondisk->datum[4] +
+		(ondisk->datum[5] << 8) +
+		(ondisk->datum[6] << 16) +
+		(ondisk->datum[7] << 24);
+	return low + (high << 32);
 }
 
 static inline d8 *
@@ -72,7 +113,7 @@
 	d8 * ondisk /* result */ )
 {
 	assert("nikita-1264", oncpu < 0x100);
-	put_unaligned(oncpu, &ondisk->datum);
+	ondisk->datum[0] = oncpu;
 	return ondisk;
 }
 
@@ -81,7 +122,8 @@
 	 d16 * ondisk /* result */ )
 {
 	assert("nikita-1265", oncpu < 0x10000);
-	put_unaligned(__cpu_to_le16(oncpu), &ondisk->datum);
+	ondisk->datum[0] = oncpu;
+	ondisk->datum[1] = oncpu >> 8;
 	return ondisk;
 }
 
@@ -89,15 +131,27 @@
 cputod32(__u32 oncpu /* CPU value to convert */ ,
 	 d32 * ondisk /* result */ )
 {
-	put_unaligned(__cpu_to_le32(oncpu), &ondisk->datum);
+	ondisk->datum[0] = oncpu; oncpu >>= 8;
+	ondisk->datum[1] = oncpu; oncpu >>= 8;
+	ondisk->datum[2] = oncpu; oncpu >>= 8;
+	ondisk->datum[3] = oncpu;
 	return ondisk;
 }
 
 static inline d64 *
-cputod64(__u64 oncpu /* CPU value to convert */ ,
+cputod64(__u64 oncpuIn /* CPU value to convert */ ,
 	 d64 * ondisk /* result */ )
 {
-	put_unaligned(__cpu_to_le64(oncpu), &ondisk->datum);
+	__u32 oncpu = oncpuIn;
+	ondisk->datum[0] = oncpu; oncpu >>= 8;
+	ondisk->datum[1] = oncpu; oncpu >>= 8;
+	ondisk->datum[2] = oncpu; oncpu >>= 8;
+	ondisk->datum[3] = oncpu;
+	oncpu = oncpuIn >> 32;
+	ondisk->datum[4] = oncpu; oncpu >>= 8;
+	ondisk->datum[5] = oncpu; oncpu >>= 8;
+	ondisk->datum[6] = oncpu; oncpu >>= 8;
+	ondisk->datum[7] = oncpu;
 	return ondisk;
 }
 
@@ -111,7 +165,7 @@
 /* data-type for block number on disk, disk format */
 union reiser4_dblock_nr {
 	d64 blk;
-};
+} PACKED64;
 
 static inline reiser4_block_nr
 dblock_to_cpu(const reiser4_dblock_nr * dblock)
@@ -148,7 +202,7 @@
 	char uuid[16];		/* unique id */
 	char label[16];		/* filesystem label */
 	d64 diskmap;		/* location of the diskmap. 0 if not present */
-} reiser4_master_sb;
+} PACKED64 reiser4_master_sb;
 
 /* __FS_REISER4_DFORMAT_H__ */
 #endif
--- linux-2.6.11/.pc/reiser4/fs/reiser4/kassign.h	2005-03-27 21:24:00.588257656 -0800
+++ linux-2.6.11/fs/reiser4/kassign.h	2005-03-27 21:24:02.757927816 -0800
@@ -46,7 +46,7 @@
 	d8 locality[sizeof (__u64)];
 	ON_LARGE_KEY(d8 ordering[sizeof (__u64)];)
 	d8 objectid[sizeof (__u64)];
-} obj_key_id;
+} PACKED8 obj_key_id;
 
 /* Information sufficient to uniquely identify directory entry within
    compressed directory item.
@@ -57,7 +57,7 @@
 	ON_LARGE_KEY(d8 ordering[sizeof (__u64)];)
 	d8 objectid[sizeof (__u64)];
 	d8 offset[sizeof (__u64)];
-} de_id;
+} PACKED8 de_id;
 
 extern int inode_onwire_size(const struct inode *obj);
 extern char *build_inode_onwire(const struct inode *obj, char *area);
--- linux-2.6.11/.pc/reiser4/fs/reiser4/key.h	2005-03-27 21:24:00.591257200 -0800
+++ linux-2.6.11/fs/reiser4/key.h	2005-03-27 23:41:07.744539792 -0800
@@ -106,7 +106,7 @@
 union reiser4_key {
 	d64 el[KEY_LAST_INDEX];
 	int pad;
-};
+} PACKED64;
 
 /* bitmasks showing where within reiser4_key particular key is
     stored. */
@@ -138,6 +138,20 @@
 	KEY_ORDERING_SHIFT = 0,
 } reiser4_key_field_shift;
 
+/* initialise a key, this is a compile time constant initialiser expressed as
+ * three or four (as appropriate) 8 byte initialisers, there are braces around
+ * each 8 byte quantity but not around the whole initializer.
+ */
+#define KEY_INIT(type,loc,order,band,oid,off)\
+{{ (0xf&(type))+(0xf0&((loc) << 4)), 0xff&((loc) >> 4), 0xff&((loc) >> 12), 0xff&((loc) >> 20),\
+	0xff&((loc) >> 28), 0xff&((loc) >> 36), 0xff&((loc) >> 44), 0xff&((loc) >> 52) }},\
+ON_LARGE_KEY({{ 0xff&(order), 0xff&((order)>>8), 0xff&((order)>>16), 0xff&((order)>>24),\
+	0xff&((order)>>32), 0xff&((order)>>40), 0xff&((order)>>48), 0xff&((order)>>56) }},)\
+{{ 0xff&(oid), 0xff&((oid)>>8), 0xff&((oid)>>16), 0xff&((oid)>>24),\
+	0xff&((oid)>>32), 0xff&((oid)>>40), 0xff&((oid)>>48), (0xf&((oid)>>56))+(0xf0&((band)<<4))}},\
+{{ 0xff&(off), 0xff&((off)>>8), 0xff&((off)>>16), 0xff&((off)>>24),\
+	0xff&((off)>>32), 0xff&((off)>>40), 0xff&((off)>>48), 0xff&((off)>>56) }}
+
 static inline __u64
 get_key_el(const reiser4_key * key, reiser4_key_field_index off)
 {
--- linux-2.6.11/.pc/reiser4/fs/reiser4/status_flags.h	2005-03-27 21:24:00.682243368 -0800
+++ linux-2.6.11/fs/reiser4/status_flags.h	2005-03-27 21:24:02.758927664 -0800
@@ -33,7 +33,7 @@
 				last sector where io error happened if status is "io error encountered" */
 	d64 stacktrace[10];  /* Last ten functional calls made (addresses)*/
 	char texterror[REISER4_TEXTERROR_LEN]; /* Any error message if appropriate, otherwise filled with zeroes */
-};
+} PACKED64;
 
 int reiser4_status_init(reiser4_block_nr block);
 int reiser4_status_query(u64 *status, u64 *extended);
--- linux-2.6.11/.pc/reiser4/fs/reiser4/wander.h	2005-03-27 21:24:00.709239264 -0800
+++ linux-2.6.11/fs/reiser4/wander.h	2005-03-27 22:14:59.663207576 -0800
@@ -19,7 +19,7 @@
 struct journal_header {
 	/* last written transaction head location */
 	d64 last_committed_tx;
-};
+} PACKED64;
 
 typedef struct journal_location {
 	reiser4_block_nr footer;
@@ -46,7 +46,7 @@
 	   super block */
 	d64 nr_files;
 	d64 next_oid;
-};
+} PACKED64;
 
 /* Each wander record (except the first one) has unified format with wander
    record header followed by an array of log entries */
@@ -66,7 +66,7 @@
 
 	/* number of previous block in commit */
 	d64 next_block;
-};
+} PACKED64;
 
 /* The first wander record (transaction head) of written transaction has the
    special format */
@@ -98,7 +98,7 @@
 	   separately from super block */
 	d64 nr_files;
 	d64 next_oid;
-};
+} PACKED64;
 
 /* A transaction gets written to disk as a set of wander records (each wander
    record size is fs block) */
@@ -108,7 +108,7 @@
 struct wander_entry {
 	d64 original;		/* block original location */
 	d64 wandered;		/* block wandered location */
-};
+} PACKED64;
 
 /* REISER4 JOURNAL WRITER FUNCTIONS   */