1 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/disk_format/disk_format40.c 2005-03-27 21:36:10.656270448 -0800
2 +++ linux-2.6.11/fs/reiser4/plugin/disk_format/disk_format40.c 2005-03-27 23:39:18.967076480 -0800
7 -#define FORMAT40_ROOT_LOCALITY 41
8 -#define FORMAT40_ROOT_OBJECTID 42
9 +#define FORMAT40_ROOT_LOCALITY 41ull
10 +#define FORMAT40_ROOT_OBJECTID 42ull
12 /* plugin->u.format.root_dir_key */
13 reiser4_internal const reiser4_key *
14 root_dir_key_format40(const struct super_block *super UNUSED_ARG)
16 static const reiser4_key FORMAT40_ROOT_DIR_KEY = {
17 - .el = {{(FORMAT40_ROOT_LOCALITY << 4) | KEY_SD_MINOR},
18 -#if REISER4_LARGE_KEY
21 - {FORMAT40_ROOT_OBJECTID}, {0ull}}
22 + .el = { KEY_INIT(KEY_SD_MINOR,FORMAT40_ROOT_LOCALITY,0ull,0,FORMAT40_ROOT_OBJECTID,0ull) }
25 return &FORMAT40_ROOT_DIR_KEY;
26 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/disk_format/disk_format40.h 2005-03-27 21:24:00.618253096 -0800
27 +++ linux-2.6.11/fs/reiser4/plugin/disk_format/disk_format40.h 2005-03-27 21:24:02.747929336 -0800
29 /* 70 */ d16 formatting_policy;
31 /* 72 */ char not_used[432];
32 -} format40_disk_super_block;
33 +} PACKED64 format40_disk_super_block;
35 /* format 40 specific part of reiser4_super_info_data */
36 typedef struct format40_super_info {
37 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/file/invert.c 2005-03-27 21:24:00.625252032 -0800
38 +++ linux-2.6.11/fs/reiser4/plugin/file/invert.c 2005-03-27 21:24:02.747929336 -0800
40 typedef struct flow_header {
42 d16 fl_nr; /* number of subfiles in the flow */
46 typedef struct subfile_header {
47 d32 sh_magic; /* subfile magic */
48 d16 sh_type; /* type of subfile: light-weight, ordinary, invert */
49 d16 sh_arg_len; /* lenght of lookup argument (filename, key) */
50 d32 sh_body_len; /* lenght of subfile body */
54 /* functions to get/set fields of flow header */
56 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/static_stat.c 2005-03-27 21:24:00.648248536 -0800
57 +++ linux-2.6.11/fs/reiser4/plugin/item/static_stat.c 2005-03-27 21:34:27.331978128 -0800
60 /* see static_stat.h for explanation */
62 +/* compile time verify of the data structure sizes and alignments */
64 +r4static_stat_verify(void)
66 + /* All these structures are PACKED, so the __alignof__ should
67 + * be 1. The sizes need to be correct as they map to disk
70 + cassert(sizeof (reiser4_stat_data_base) == 2);
71 + /* cassert(sizeof (reiser4_light_weight_stat) == 16);
72 + * 14 bytes, comments in code do not take into account PACKED!
74 + cassert(sizeof (reiser4_light_weight_stat) == 14);
75 + cassert(sizeof (reiser4_unix_stat) == 28);
76 + cassert(sizeof (reiser4_symlink_stat) == 0);
77 + cassert(sizeof (reiser4_plugin_slot) == 4);
78 + cassert(sizeof (reiser4_plugin_stat) == 2);
79 + cassert(sizeof (reiser4_flags_stat) == 4);
80 + /* cassert(sizeof (reiser4_capabilities_stat) == 16);
81 + * comments in the file look wrong - capabilities are 2 x d32
82 + * not 2 x d64 in the declaration.
84 + cassert(sizeof (reiser4_capabilities_stat) == 8);
85 + cassert(sizeof (reiser4_cluster_stat) == 1);
86 + cassert(sizeof (reiser4_crypto_stat) == 2);
87 + /* cassert(sizeof (reiser4_large_times_stat) == 24);
88 + * should be 12 bytes - 3 x d32, probably a bug in the def in
89 + * the header file (meant to be 3 x d64?)
91 + cassert(sizeof (reiser4_large_times_stat) == 12);
94 /* helper function used while we are dumping/loading inode/plugin state
95 to/from the stat-data. */
97 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/acl.h 2005-03-27 21:24:00.629251424 -0800
98 +++ linux-2.6.11/fs/reiser4/plugin/item/acl.h 2005-03-27 21:24:02.749929032 -0800
101 /* file name. Null terminated string. */
103 -} directory_entry_format;
104 +} PACKEDt(obj_key_id) directory_entry_format;
106 void print_de(const char *prefix, coord_t * coord);
107 int extract_key_de(const coord_t * coord, reiser4_key * key);
108 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/cde.h 2005-03-27 21:24:00.632250968 -0800
109 +++ linux-2.6.11/fs/reiser4/plugin/item/cde.h 2005-03-27 21:24:02.750928880 -0800
111 typedef struct cde_unit_header {
115 +} PACKEDt2(de_id,d16) cde_unit_header;
117 typedef struct cde_item_format {
119 cde_unit_header entry[0];
121 +} PACKEDt2(d16,cde_unit_header) cde_item_format;
123 typedef struct cde_entry {
124 const struct inode *dir;
125 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/extent.h 2005-03-27 21:32:13.758284416 -0800
126 +++ linux-2.6.11/fs/reiser4/plugin/item/extent.h 2005-03-27 21:32:30.786695704 -0800
129 reiser4_dblock_nr start;
130 reiser4_dblock_nr width;
132 +} PACKED64 reiser4_extent;
134 typedef struct extent_stat {
135 int unallocated_units;
136 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/internal.h 2005-03-27 21:33:08.971890672 -0800
137 +++ linux-2.6.11/fs/reiser4/plugin/item/internal.h 2005-03-27 22:15:43.290575208 -0800
139 typedef struct internal_item_layout {
140 /* 0 */ reiser4_dblock_nr pointer;
142 -} internal_item_layout;
143 +} PACKED64 internal_item_layout;
147 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/item/sde.h 2005-03-27 21:24:00.646248840 -0800
148 +++ linux-2.6.11/fs/reiser4/plugin/item/sde.h 2005-03-27 21:24:02.750928880 -0800
151 /* file name. Null terminated string. */
153 -} directory_entry_format;
154 +} PACKEDt(obj_key_id) directory_entry_format;
156 void print_de(const char *prefix, coord_t * coord);
157 int extract_key_de(const coord_t * coord, reiser4_key * key);
158 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/node/node40.c 2005-03-27 21:24:00.654247624 -0800
159 +++ linux-2.6.11/fs/reiser4/plugin/node/node40.c 2005-03-27 21:35:08.677692624 -0800
164 +/* compile time verify of the data structure sizes and alignments */
166 +r4node40_stat_verify(void)
168 + /* The alignment of these structures is intended to be '1', but
169 + * it doesn't matter so long as the size is right.
171 + cassert(sizeof (common_node_header) == 2);
172 + cassert(sizeof (node40_header) == 28);
173 +#if REISER4_LARGE_KEY
174 + cassert(sizeof (item_header40) == 38);
176 + cassert(sizeof (item_header40) == 30);
180 /* NIKITA-FIXME-HANS: I told you guys not less than 10 times to not call it r4fs. Change to "ReIs". */
181 /* magic number that is stored in ->magic field of node header */
182 static const __u32 REISER4_NODE_MAGIC = 0x52344653; /* (*(__u32 *)"R4FS"); */
183 --- linux-2.6.11/.pc/reiser4/fs/reiser4/plugin/node/node.h 2005-03-27 21:24:00.656247320 -0800
184 +++ linux-2.6.11/fs/reiser4/plugin/node/node.h 2005-03-27 21:24:02.753928424 -0800
186 /* identifier of node plugin. Must be located at the very beginning
189 -} common_node_header;
190 +} PACKED16 common_node_header;
192 /* __REISER4_NODE_H__ */
194 --- linux-2.6.11/.pc/reiser4/fs/reiser4/debug.c 2005-03-27 21:24:00.563261456 -0800
195 +++ linux-2.6.11/fs/reiser4/debug.c 2005-03-27 23:27:58.569512632 -0800
200 + * this is here to make sure that we don't compile code which we
201 + * know a-priori will panic, or fail without panicing, since this
202 + * compiles first if you find a duplicate case label error then
203 + * you need to rewrite this code to match your compiler.
205 + cassert(sizeof (d8) == 1);
206 + cassert(__alignof__ (d8) == 1);
212 + cassert(sizeof test == 2);
213 + cassert(sizeof test.data == 1);
214 + cassert(__alignof__ test.data == 1);
215 + cassert(__alignof__ test == 1);
217 + cassert(sizeof (d16) == 2);
218 + cassert(__alignof__ (d16) == 2);
224 + cassert(sizeof test == 4);
225 + cassert(sizeof test.data == 2);
227 + cassert(__alignof__ test.data == 2);
229 + cassert(__alignof__ test == 2);
231 + cassert(test.data.datum - &test.pad == 2);
234 + cassert(sizeof (d32) == 4);
235 + cassert(__alignof__ (d32) == 4);
241 + cassert(sizeof test == 8);
242 + cassert(sizeof test.data == 4);
243 + cassert(__alignof__ test.data == 4);
244 + cassert(__alignof__ test == 4);
245 + cassert(test.data.datum - &test.pad == 4);
247 + cassert(sizeof (d64) == 8);
248 + cassert(__alignof__ (d64) == 8);
254 + cassert(sizeof test == 16);
255 + cassert(sizeof test.data == 8);
256 + cassert(__alignof__ test.data == 8);
257 + cassert(__alignof__ test == 8);
258 + cassert(test.data.datum - &test.pad == 8);
261 + /* This is just a test of a struct with a single d64 element. */
262 + cassert(sizeof (reiser4_dblock_nr) == 8);
263 + cassert(__alignof__(reiser4_dblock_nr) == 8);
266 * check for recursive panic.
269 --- linux-2.6.11/.pc/reiser4/fs/reiser4/flush_queue.c 2005-03-27 21:24:00.577259328 -0800
270 +++ linux-2.6.11/fs/reiser4/flush_queue.c 2005-03-27 21:24:02.755928120 -0800
273 /* If all write requests registered in this "fq" are done we up
275 - if (atomic_sub_and_test(bio->bi_vcnt, &fq->nr_submitted))
276 + if (atomic_sub_return(bio->bi_vcnt, &fq->nr_submitted) == 0)
280 --- linux-2.6.11/.pc/reiser4/fs/reiser4/key.c 2005-03-27 22:42:43.481268784 -0800
281 +++ linux-2.6.11/fs/reiser4/key.c 2005-03-27 23:42:53.958392832 -0800
283 independent of key scheme. */
284 static const reiser4_key MINIMAL_KEY = {
287 - ON_LARGE_KEY({0ull},)
290 + {{0,0,0,0,0,0,0,0}},
291 + ON_LARGE_KEY({{0,0,0,0,0,0,0,0}},)
292 + {{0,0,0,0,0,0,0,0}},
293 + {{0,0,0,0,0,0,0,0}}
298 independent of key scheme. */
299 static const reiser4_key MAXIMAL_KEY = {
302 - ON_LARGE_KEY({~0ull},)
305 + {{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}},
306 + ON_LARGE_KEY({{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}},)
307 + {{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}},
308 + {{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}}
312 --- linux-2.6.11/.pc/reiser4/fs/reiser4/safe_link.c 2005-03-27 21:24:00.677244128 -0800
313 +++ linux-2.6.11/fs/reiser4/safe_link.c 2005-03-27 21:24:02.756927968 -0800
315 reiser4_key sdkey; /* key of stat-data for the file safe-link is
317 d64 size; /* size to which file should be truncated */
319 +} PACKEDt2(reiser4_key, d64) safelink_t;
322 * locality where safe-link items are stored. Next to the objectid of root
323 --- linux-2.6.11/.pc/reiser4/fs/reiser4/status_flags.c 2005-03-27 21:24:00.682243368 -0800
324 +++ linux-2.6.11/fs/reiser4/status_flags.c 2005-03-27 21:24:02.756927968 -0800
326 &statuspage->stacktrace[no])
341 --- linux-2.6.11/.pc/reiser4/fs/reiser4/dformat.h 2005-03-27 21:24:00.564261304 -0800
342 +++ linux-2.6.11/fs/reiser4/dformat.h 2005-03-27 23:29:03.223683704 -0800
345 /* code on-disk data-types as structs with a single field
346 to rely on compiler type-checking. Like include/asm-i386/page.h */
347 +/* This code did not work on the arm with gcc 3.4.3 because the
348 + * arm has a minimum structure size of 4 - packed is necessary to
349 + * allow these types to be smaller than 4 - and because this version
350 + * of gcc 'loses' the alignment if the structure contains just one
351 + * element of alignment 8 (or probably any value greater than 4).
352 + * To fix this and to make the code much more portable all the basic
353 + * types are now just done as arrays of bytes - __u8.
355 + * This is highly tricky, however the check code in debug.c should
356 + * fire a compile time assert if it goes wrong.
359 +#define PACKED8 __attribute__ ((packed,aligned(1)))
360 +/* Warning: the presence of the packed attribute here means that any
361 + * d16 in a structure so marked will lose its alignment. That doesn't
362 + * seem to matter because there don't seem to be any d16's with odd
363 + * structure offsets, but it might.
365 +#define PACKED16 __attribute__ ((packed,aligned(2)))
366 +#define PACKED32 __attribute__ ((aligned(4)))
367 +#define PACKED64 __attribute__ ((aligned(8)))
369 +#define PACKED8 __attribute__ ((aligned(1)))
370 +#define PACKED16 __attribute__ ((aligned(2)))
371 +#define PACKED32 __attribute__ ((aligned(4)))
372 +#define PACKED64 __attribute__ ((aligned(8)))
376 -} d8 __attribute__ ((aligned(1)));
381 -} d16 __attribute__ ((aligned(2)));
386 -} d32 __attribute__ ((aligned(4)));
391 -} d64 __attribute__ ((aligned(8)));
395 +#define PACKEDt(t) __attribute__ ((packed,aligned(__alignof__ (t)) ))
396 +#define PACKEDt2(t1,t2) __attribute__ ((packed,aligned(\
397 + __alignof__ (t1) < __alignof__ (t2) ? __alignof__ (t2) : __alignof__ (t1) )))
398 #define PACKED __attribute__((packed))
401 d8tocpu(const d8 * ondisk /* on-disk value to convert */ )
403 - return ondisk->datum;
404 + return ondisk->datum[0];
408 d16tocpu(const d16 * ondisk /* on-disk value to convert */ )
410 - return __le16_to_cpu(get_unaligned(&ondisk->datum));
411 + return ondisk->datum[0] + (ondisk->datum[1] << 8);
415 d32tocpu(const d32 * ondisk /* on-disk value to convert */ )
417 - return __le32_to_cpu(get_unaligned(&ondisk->datum));
418 + return ondisk->datum[0] +
419 + (ondisk->datum[1] << 8) +
420 + (ondisk->datum[2] << 16) +
421 + (ondisk->datum[3] << 24);
425 d64tocpu(const d64 * ondisk /* on-disk value to convert */ )
427 - return __le64_to_cpu(get_unaligned(&ondisk->datum));
428 + __u32 low = ondisk->datum[0] +
429 + (ondisk->datum[1] << 8) +
430 + (ondisk->datum[2] << 16) +
431 + (ondisk->datum[3] << 24);
432 + __u64 high = ondisk->datum[4] +
433 + (ondisk->datum[5] << 8) +
434 + (ondisk->datum[6] << 16) +
435 + (ondisk->datum[7] << 24);
436 + return low + (high << 32);
441 d8 * ondisk /* result */ )
443 assert("nikita-1264", oncpu < 0x100);
444 - put_unaligned(oncpu, &ondisk->datum);
445 + ondisk->datum[0] = oncpu;
450 d16 * ondisk /* result */ )
452 assert("nikita-1265", oncpu < 0x10000);
453 - put_unaligned(__cpu_to_le16(oncpu), &ondisk->datum);
454 + ondisk->datum[0] = oncpu;
455 + ondisk->datum[1] = oncpu >> 8;
460 cputod32(__u32 oncpu /* CPU value to convert */ ,
461 d32 * ondisk /* result */ )
463 - put_unaligned(__cpu_to_le32(oncpu), &ondisk->datum);
464 + ondisk->datum[0] = oncpu; oncpu >>= 8;
465 + ondisk->datum[1] = oncpu; oncpu >>= 8;
466 + ondisk->datum[2] = oncpu; oncpu >>= 8;
467 + ondisk->datum[3] = oncpu;
472 -cputod64(__u64 oncpu /* CPU value to convert */ ,
473 +cputod64(__u64 oncpuIn /* CPU value to convert */ ,
474 d64 * ondisk /* result */ )
476 - put_unaligned(__cpu_to_le64(oncpu), &ondisk->datum);
477 + __u32 oncpu = oncpuIn;
478 + ondisk->datum[0] = oncpu; oncpu >>= 8;
479 + ondisk->datum[1] = oncpu; oncpu >>= 8;
480 + ondisk->datum[2] = oncpu; oncpu >>= 8;
481 + ondisk->datum[3] = oncpu;
482 + oncpu = oncpuIn >> 32;
483 + ondisk->datum[4] = oncpu; oncpu >>= 8;
484 + ondisk->datum[5] = oncpu; oncpu >>= 8;
485 + ondisk->datum[6] = oncpu; oncpu >>= 8;
486 + ondisk->datum[7] = oncpu;
491 /* data-type for block number on disk, disk format */
492 union reiser4_dblock_nr {
497 static inline reiser4_block_nr
498 dblock_to_cpu(const reiser4_dblock_nr * dblock)
500 char uuid[16]; /* unique id */
501 char label[16]; /* filesystem label */
502 d64 diskmap; /* location of the diskmap. 0 if not present */
503 -} reiser4_master_sb;
504 +} PACKED64 reiser4_master_sb;
506 /* __FS_REISER4_DFORMAT_H__ */
508 --- linux-2.6.11/.pc/reiser4/fs/reiser4/kassign.h 2005-03-27 21:24:00.588257656 -0800
509 +++ linux-2.6.11/fs/reiser4/kassign.h 2005-03-27 21:24:02.757927816 -0800
511 d8 locality[sizeof (__u64)];
512 ON_LARGE_KEY(d8 ordering[sizeof (__u64)];)
513 d8 objectid[sizeof (__u64)];
515 +} PACKED8 obj_key_id;
517 /* Information sufficient to uniquely identify directory entry within
518 compressed directory item.
520 ON_LARGE_KEY(d8 ordering[sizeof (__u64)];)
521 d8 objectid[sizeof (__u64)];
522 d8 offset[sizeof (__u64)];
526 extern int inode_onwire_size(const struct inode *obj);
527 extern char *build_inode_onwire(const struct inode *obj, char *area);
528 --- linux-2.6.11/.pc/reiser4/fs/reiser4/key.h 2005-03-27 21:24:00.591257200 -0800
529 +++ linux-2.6.11/fs/reiser4/key.h 2005-03-27 23:41:07.744539792 -0800
532 d64 el[KEY_LAST_INDEX];
537 /* bitmasks showing where within reiser4_key particular key is
540 KEY_ORDERING_SHIFT = 0,
541 } reiser4_key_field_shift;
543 +/* initialise a key, this is a compile time constant initialiser expressed as
544 + * three or four (as appropriate) 8 byte initialisers, there are braces around
545 + * each 8 byte quantity but not around the whole initializer.
547 +#define KEY_INIT(type,loc,order,band,oid,off)\
548 +{{ (0xf&(type))+(0xf0&((loc) << 4)), 0xff&((loc) >> 4), 0xff&((loc) >> 12), 0xff&((loc) >> 20),\
549 + 0xff&((loc) >> 28), 0xff&((loc) >> 36), 0xff&((loc) >> 44), 0xff&((loc) >> 52) }},\
550 +ON_LARGE_KEY({{ 0xff&(order), 0xff&((order)>>8), 0xff&((order)>>16), 0xff&((order)>>24),\
551 + 0xff&((order)>>32), 0xff&((order)>>40), 0xff&((order)>>48), 0xff&((order)>>56) }},)\
552 +{{ 0xff&(oid), 0xff&((oid)>>8), 0xff&((oid)>>16), 0xff&((oid)>>24),\
553 + 0xff&((oid)>>32), 0xff&((oid)>>40), 0xff&((oid)>>48), (0xf&((oid)>>56))+(0xf0&((band)<<4))}},\
554 +{{ 0xff&(off), 0xff&((off)>>8), 0xff&((off)>>16), 0xff&((off)>>24),\
555 + 0xff&((off)>>32), 0xff&((off)>>40), 0xff&((off)>>48), 0xff&((off)>>56) }}
558 get_key_el(const reiser4_key * key, reiser4_key_field_index off)
560 --- linux-2.6.11/.pc/reiser4/fs/reiser4/status_flags.h 2005-03-27 21:24:00.682243368 -0800
561 +++ linux-2.6.11/fs/reiser4/status_flags.h 2005-03-27 21:24:02.758927664 -0800
563 last sector where io error happened if status is "io error encountered" */
564 d64 stacktrace[10]; /* Last ten functional calls made (addresses)*/
565 char texterror[REISER4_TEXTERROR_LEN]; /* Any error message if appropriate, otherwise filled with zeroes */
569 int reiser4_status_init(reiser4_block_nr block);
570 int reiser4_status_query(u64 *status, u64 *extended);
571 --- linux-2.6.11/.pc/reiser4/fs/reiser4/wander.h 2005-03-27 21:24:00.709239264 -0800
572 +++ linux-2.6.11/fs/reiser4/wander.h 2005-03-27 22:14:59.663207576 -0800
574 struct journal_header {
575 /* last written transaction head location */
576 d64 last_committed_tx;
580 typedef struct journal_location {
581 reiser4_block_nr footer;
589 /* Each wander record (except the first one) has unified format with wander
590 record header followed by an array of log entries */
593 /* number of previous block in commit */
598 /* The first wander record (transaction head) of written transaction has the
601 separately from super block */
607 /* A transaction gets written to disk as a set of wander records (each wander
608 record size is fs block) */
610 struct wander_entry {
611 d64 original; /* block original location */
612 d64 wandered; /* block wandered location */
616 /* REISER4 JOURNAL WRITER FUNCTIONS */