reiserfsprogs: add helpers for constant endian routines

Initializing structures with little endian values requires a const
value. This means that the endian routines that are macro blocks
cause build failures.

This patch introduces constant_ macros that don't involve an
assignment. These can only be used with constant values or
unexpected results may occur.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
This commit is contained in:
Jeff Mahoney committed 2013-09-17 13:28:53 -04:00
1 parent 19566d0878
commit 57eac8416c
3 files changed
+55 -32

No files matched your search

+5 -4
View File
@@ -174,13 +174,14 @@ int bin_search(void *p_v_key, /* Key to search for. */
/* Minimal possible key. It is never in the tree. */
const struct reiserfs_key MIN_KEY =
{ cpu_to_le32(0), cpu_to_le32(0),
{{cpu_to_le32(0), cpu_to_le32(0)},} };
{ constant_cpu_to_le32(0), constant_cpu_to_le32(0),
{{constant_cpu_to_le32(0), constant_cpu_to_le32(0)},} };
/* Maximal possible key. It is never in the tree. */
const struct reiserfs_key MAX_KEY =
{ cpu_to_le32(0xffffffff), cpu_to_le32(0xffffffff),
{{cpu_to_le32(0xffffffff), cpu_to_le32(0xffffffff)},} };
{ constant_cpu_to_le32(0xffffffff), constant_cpu_to_le32(0xffffffff),
{{constant_cpu_to_le32(0xffffffff),
constant_cpu_to_le32(0xffffffff)},} };
/* Get delimiting key of the buffer by looking for it in the buffers in the
path, starting from the bottom of the path, and going upwards. We must