X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Flibiam.c;h=b0649ac37cf86fefd284a48d1738f82d59fae29b;hp=3c1299c8bf0f430de4d631fe5764a2d0ba409ece;hb=f431777cf5cbb0f1493e91a35bbc2a26e1d14db9;hpb=f6995cf04407dff15d6ca79ca44cfa97dc6eb014 diff --git a/lustre/utils/libiam.c b/lustre/utils/libiam.c index 3c1299c..b0649ac 100644 --- a/lustre/utils/libiam.c +++ b/lustre/utils/libiam.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,7 +23,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2014, Intel Corporation. + * Copyright (c) 2014, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -47,17 +43,12 @@ #include #include #include +#include #include -#include - +#include #include -#ifdef HAVE_ENDIAN_H -#include -#endif - #include -#include #include typedef __u32 lvar_hash_t; @@ -153,10 +144,10 @@ static void lfix_root(void *buf, root = buf; *root = (typeof(*root)) { - .ilr_magic = cpu_to_le64(IAM_LFIX_ROOT_MAGIC), - .ilr_keysize = cpu_to_le16(keysize), - .ilr_recsize = cpu_to_le16(recsize), - .ilr_ptrsize = cpu_to_le16(ptrsize), + .ilr_magic = htole64(IAM_LFIX_ROOT_MAGIC), + .ilr_keysize = htole16(keysize), + .ilr_recsize = htole16(recsize), + .ilr_ptrsize = htole16(ptrsize), .ilr_indirect_levels = 0 }; @@ -165,7 +156,7 @@ static void lfix_root(void *buf, /* * limit itself + one pointer to the leaf. */ - .count = cpu_to_le16(2), + .count = htole16(2), .limit = lfix_root_limit(blocksize, keysize + ptrsize) }; @@ -185,9 +176,9 @@ static void lfix_root(void *buf, entry += keysize; /* now @entry points to */ if (ptrsize == 4) - STORE_UNALIGNED(cpu_to_le32(1), (u_int32_t *)entry); + STORE_UNALIGNED(htole32(1), (u_int32_t *)entry); else - STORE_UNALIGNED(cpu_to_le64(1), (u_int64_t *)entry); + STORE_UNALIGNED(htole64(1), (u_int64_t *)entry); } static void lfix_leaf(void *buf, @@ -198,12 +189,12 @@ static void lfix_leaf(void *buf, /* form leaf */ head = buf; *head = (typeof(*head)) { - .ill_magic = cpu_to_le16(IAM_LEAF_HEADER_MAGIC), + .ill_magic = htole16(IAM_LEAF_HEADER_MAGIC), /* * Leaf contains an entry with the smallest possible key * (created by zeroing). */ - .ill_count = cpu_to_le16(1), + .ill_count = htole16(1), }; } @@ -223,9 +214,9 @@ static void lvar_root(void *buf, isize = sizeof(lvar_hash_t) + ptrsize; root = buf; *root = (typeof(*root)) { - .vr_magic = cpu_to_le32(IAM_LVAR_ROOT_MAGIC), - .vr_recsize = cpu_to_le16(recsize), - .vr_ptrsize = cpu_to_le16(ptrsize), + .vr_magic = htole32(IAM_LVAR_ROOT_MAGIC), + .vr_recsize = htole16(recsize), + .vr_ptrsize = htole16(ptrsize), .vr_indirect_levels = 0 }; @@ -234,7 +225,7 @@ static void lvar_root(void *buf, /* * limit itself + one pointer to the leaf. */ - .count = cpu_to_le16(2), + .count = htole16(2), .limit = lvar_root_limit(blocksize, keysize + ptrsize) }; @@ -254,9 +245,9 @@ static void lvar_root(void *buf, entry += sizeof(lvar_hash_t); /* now @entry points to */ if (ptrsize == 4) - STORE_UNALIGNED(cpu_to_le32(1), (u_int32_t *)entry); + STORE_UNALIGNED(htole32(1), (u_int32_t *)entry); else - STORE_UNALIGNED(cpu_to_le64(1), (u_int64_t *)entry); + STORE_UNALIGNED(htole64(1), (u_int64_t *)entry); } static int lvar_esize(int namelen, int recsize) @@ -274,8 +265,8 @@ static void lvar_leaf(void *buf, /* form leaf */ head = buf; *head = (typeof(*head)) { - .vlh_magic = cpu_to_le16(IAM_LVAR_LEAF_MAGIC), - .vlh_used = cpu_to_le16(sizeof *head + lvar_esize(0, recsize)) + .vlh_magic = htole16(IAM_LVAR_LEAF_MAGIC), + .vlh_used = htole16(sizeof *head + lvar_esize(0, recsize)) }; rec = (void *)(head + 1); rec[offsetof(struct lvar_leaf_entry, vle_key)] = recsize;