Whamcloud - gitweb
LU-6245 libcfs: remove byteorder.h 16/16916/8
authorJames Simmons <uja.ornl@yahoo.com>
Fri, 16 Sep 2016 15:02:15 +0000 (11:02 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 26 Sep 2016 15:19:16 +0000 (15:19 +0000)
With the cleanup of userland with libcfs we no longer
need the special byte ordering macros. Kernel space
can just use what is provided by the kernel already.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: Ic154005a24ffae6d6773d4664a6e75d3ead346af
Reviewed-on: http://review.whamcloud.com/16916
Reviewed-by: Frank Zago <fzago@cray.com>
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
15 files changed:
libcfs/include/libcfs/Makefile.am
libcfs/include/libcfs/byteorder.h [deleted file]
libcfs/include/libcfs/libcfs.h
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_disk.h
lustre/tests/test_brw.c
lustre/utils/create_iam.c
lustre/utils/gss/lgss_null_utils.c
lustre/utils/gss/lgss_sk_utils.c
lustre/utils/gss/sk_utils.c
lustre/utils/gss/svcgssd_proc.c
lustre/utils/libiam.c
lustre/utils/ll_decode_filter_fid.c
lustre/utils/llog_reader.c
lustre/utils/lr_reader.c

index 6c5a811..b9972ad 100644 (file)
@@ -9,7 +9,6 @@ endif
 
 EXTRA_DIST = \
        bitmap.h \
 
 EXTRA_DIST = \
        bitmap.h \
-       byteorder.h \
        curproc.h \
        libcfs.h \
        libcfs_cpu.h \
        curproc.h \
        libcfs.h \
        libcfs_cpu.h \
diff --git a/libcfs/include/libcfs/byteorder.h b/libcfs/include/libcfs/byteorder.h
deleted file mode 100644 (file)
index 8b6ff04..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2014, 2015, Intel Corporation.
- * Author: John L. Hammond <john.hammond@intel.com>
- */
-#ifndef _LIBCFS_BYTEORDER_H
-#define _LIBCFS_BYTERODER_H
-
-#ifdef __KERNEL__
-# include <asm/byteorder.h>
-#else /* __KERNEL__ */
-
-# ifdef HAVE_ENDIAN_H
-#  include <endian.h>
-# endif
-# include <byteswap.h>
-
-# define __swab16(x) bswap_16(x)
-# define __swab32(x) bswap_32(x)
-# define __swab64(x) bswap_64(x)
-# define __swab16s(x)                          \
-       do {                                    \
-               *(x) = bswap_16(*(x));          \
-       } while (0)
-# define __swab32s(x)                          \
-       do {                                    \
-               *(x) = bswap_32(*(x));          \
-       } while (0)
-# define __swab64s(x)                          \
-       do {                                    \
-               *(x) = bswap_64(*(x));          \
-       } while (0)
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define le16_to_cpu(x) (x)
-#  define cpu_to_le16(x) (x)
-#  define le32_to_cpu(x) (x)
-#  define cpu_to_le32(x) (x)
-#  define le64_to_cpu(x) (x)
-#  define cpu_to_le64(x) (x)
-
-#  define be16_to_cpu(x) bswap_16(x)
-#  define cpu_to_be16(x) bswap_16(x)
-#  define be32_to_cpu(x) bswap_32(x)
-#  define cpu_to_be32(x) bswap_32(x)
-#  define be64_to_cpu(x) ((__u64)bswap_64(x))
-#  define cpu_to_be64(x) ((__u64)bswap_64(x))
-# elif __BYTE_ORDER == __BIG_ENDIAN
-#  define le16_to_cpu(x) bswap_16(x)
-#  define cpu_to_le16(x) bswap_16(x)
-#  define le32_to_cpu(x) bswap_32(x)
-#  define cpu_to_le32(x) bswap_32(x)
-#  define le64_to_cpu(x) ((__u64)bswap_64(x))
-#  define cpu_to_le64(x) ((__u64)bswap_64(x))
-
-#  define be16_to_cpu(x) (x)
-#  define cpu_to_be16(x) (x)
-#  define be32_to_cpu(x) (x)
-#  define cpu_to_be32(x) (x)
-#  define be64_to_cpu(x) (x)
-#  define cpu_to_be64(x) (x)
-# else /*  __BYTE_ORDER == __BIG_ENDIAN */
-#  error "Unknown byte order"
-# endif /* __BYTE_ORDER != __BIG_ENDIAN */
-
-#endif /* !__KERNEL__ */
-
-#endif /* _LIBCFS_BYTEORDER_H */
index e8bee85..b09d8f1 100644 (file)
@@ -114,7 +114,6 @@ void cfs_srand(unsigned int, unsigned int);
 void cfs_get_random_bytes(void *buf, int size);
 #endif /* __KERNEL__ */
 
 void cfs_get_random_bytes(void *buf, int size);
 #endif /* __KERNEL__ */
 
-#include <libcfs/byteorder.h>
 #include <libcfs/libcfs_debug.h>
 #include <libcfs/libcfs_private.h>
 #ifdef __KERNEL__
 #include <libcfs/libcfs_debug.h>
 #include <libcfs/libcfs_private.h>
 #ifdef __KERNEL__
index e0a7171..ffa2020 100644 (file)
@@ -73,7 +73,9 @@
 #ifndef _LUSTRE_IDL_H_
 #define _LUSTRE_IDL_H_
 
 #ifndef _LUSTRE_IDL_H_
 #define _LUSTRE_IDL_H_
 
+#include <asm/byteorder.h>
 #include <linux/types.h>
 #include <linux/types.h>
+
 #include <libcfs/libcfs.h>
 #include <lnet/types.h>
 #include <lustre/lustre_user.h> /* Defn's shared with user-space. */
 #include <libcfs/libcfs.h>
 #include <lnet/types.h>
 #include <lustre/lustre_user.h> /* Defn's shared with user-space. */
@@ -764,30 +766,30 @@ static inline void lu_igif_build(struct lu_fid *fid, __u32 ino, __u32 gen)
  */
 static inline void fid_cpu_to_le(struct lu_fid *dst, const struct lu_fid *src)
 {
  */
 static inline void fid_cpu_to_le(struct lu_fid *dst, const struct lu_fid *src)
 {
-       dst->f_seq = cpu_to_le64(fid_seq(src));
-       dst->f_oid = cpu_to_le32(fid_oid(src));
-       dst->f_ver = cpu_to_le32(fid_ver(src));
+       dst->f_seq = __cpu_to_le64(fid_seq(src));
+       dst->f_oid = __cpu_to_le32(fid_oid(src));
+       dst->f_ver = __cpu_to_le32(fid_ver(src));
 }
 
 static inline void fid_le_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
 {
 }
 
 static inline void fid_le_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
 {
-       dst->f_seq = le64_to_cpu(fid_seq(src));
-       dst->f_oid = le32_to_cpu(fid_oid(src));
-       dst->f_ver = le32_to_cpu(fid_ver(src));
+       dst->f_seq = __le64_to_cpu(fid_seq(src));
+       dst->f_oid = __le32_to_cpu(fid_oid(src));
+       dst->f_ver = __le32_to_cpu(fid_ver(src));
 }
 
 static inline void fid_cpu_to_be(struct lu_fid *dst, const struct lu_fid *src)
 {
 }
 
 static inline void fid_cpu_to_be(struct lu_fid *dst, const struct lu_fid *src)
 {
-       dst->f_seq = cpu_to_be64(fid_seq(src));
-       dst->f_oid = cpu_to_be32(fid_oid(src));
-       dst->f_ver = cpu_to_be32(fid_ver(src));
+       dst->f_seq = __cpu_to_be64(fid_seq(src));
+       dst->f_oid = __cpu_to_be32(fid_oid(src));
+       dst->f_ver = __cpu_to_be32(fid_ver(src));
 }
 
 static inline void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
 {
 }
 
 static inline void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
 {
-       dst->f_seq = be64_to_cpu(fid_seq(src));
-       dst->f_oid = be32_to_cpu(fid_oid(src));
-       dst->f_ver = be32_to_cpu(fid_ver(src));
+       dst->f_seq = __be64_to_cpu(fid_seq(src));
+       dst->f_oid = __be32_to_cpu(fid_oid(src));
+       dst->f_ver = __be32_to_cpu(fid_ver(src));
 }
 
 static inline bool fid_is_sane(const struct lu_fid *fid)
 }
 
 static inline bool fid_is_sane(const struct lu_fid *fid)
@@ -824,8 +826,8 @@ static inline void ostid_cpu_to_le(const struct ost_id *src_oi,
                                   struct ost_id *dst_oi)
 {
        if (fid_seq_is_mdt0(src_oi->oi.oi_seq)) {
                                   struct ost_id *dst_oi)
 {
        if (fid_seq_is_mdt0(src_oi->oi.oi_seq)) {
-               dst_oi->oi.oi_id = cpu_to_le64(src_oi->oi.oi_id);
-               dst_oi->oi.oi_seq = cpu_to_le64(src_oi->oi.oi_seq);
+               dst_oi->oi.oi_id = __cpu_to_le64(src_oi->oi.oi_id);
+               dst_oi->oi.oi_seq = __cpu_to_le64(src_oi->oi.oi_seq);
        } else {
                fid_cpu_to_le(&dst_oi->oi_fid, &src_oi->oi_fid);
        }
        } else {
                fid_cpu_to_le(&dst_oi->oi_fid, &src_oi->oi_fid);
        }
@@ -835,8 +837,8 @@ static inline void ostid_le_to_cpu(const struct ost_id *src_oi,
                                   struct ost_id *dst_oi)
 {
        if (fid_seq_is_mdt0(src_oi->oi.oi_seq)) {
                                   struct ost_id *dst_oi)
 {
        if (fid_seq_is_mdt0(src_oi->oi.oi_seq)) {
-               dst_oi->oi.oi_id = le64_to_cpu(src_oi->oi.oi_id);
-               dst_oi->oi.oi_seq = le64_to_cpu(src_oi->oi.oi_seq);
+               dst_oi->oi.oi_id = __le64_to_cpu(src_oi->oi.oi_id);
+               dst_oi->oi.oi_seq = __le64_to_cpu(src_oi->oi.oi_seq);
        } else {
                fid_le_to_cpu(&dst_oi->oi_fid, &src_oi->oi_fid);
        }
        } else {
                fid_le_to_cpu(&dst_oi->oi_fid, &src_oi->oi_fid);
        }
@@ -962,22 +964,22 @@ enum lu_dirpage_flags {
 
 static inline struct lu_dirent *lu_dirent_start(struct lu_dirpage *dp)
 {
 
 static inline struct lu_dirent *lu_dirent_start(struct lu_dirpage *dp)
 {
-        if (le32_to_cpu(dp->ldp_flags) & LDF_EMPTY)
-                return NULL;
-        else
-                return dp->ldp_entries;
+       if (__le32_to_cpu(dp->ldp_flags) & LDF_EMPTY)
+               return NULL;
+       else
+               return dp->ldp_entries;
 }
 
 static inline struct lu_dirent *lu_dirent_next(struct lu_dirent *ent)
 {
 }
 
 static inline struct lu_dirent *lu_dirent_next(struct lu_dirent *ent)
 {
-        struct lu_dirent *next;
+       struct lu_dirent *next;
 
 
-        if (le16_to_cpu(ent->lde_reclen) != 0)
-                next = ((void *)ent) + le16_to_cpu(ent->lde_reclen);
-        else
-                next = NULL;
+       if (__le16_to_cpu(ent->lde_reclen) != 0)
+               next = ((void *)ent) + __le16_to_cpu(ent->lde_reclen);
+       else
+               next = NULL;
 
 
-        return next;
+       return next;
 }
 
 static inline size_t lu_dirent_calc_size(size_t namelen, __u16 attr)
 }
 
 static inline size_t lu_dirent_calc_size(size_t namelen, __u16 attr)
@@ -1580,15 +1582,15 @@ static inline __u64 lmm_oi_seq(const struct ost_id *oi)
 static inline void lmm_oi_le_to_cpu(struct ost_id *dst_oi,
                                    const struct ost_id *src_oi)
 {
 static inline void lmm_oi_le_to_cpu(struct ost_id *dst_oi,
                                    const struct ost_id *src_oi)
 {
-       dst_oi->oi.oi_id = le64_to_cpu(src_oi->oi.oi_id);
-       dst_oi->oi.oi_seq = le64_to_cpu(src_oi->oi.oi_seq);
+       dst_oi->oi.oi_id = __le64_to_cpu(src_oi->oi.oi_id);
+       dst_oi->oi.oi_seq = __le64_to_cpu(src_oi->oi.oi_seq);
 }
 
 static inline void lmm_oi_cpu_to_le(struct ost_id *dst_oi,
                                    const struct ost_id *src_oi)
 {
 }
 
 static inline void lmm_oi_cpu_to_le(struct ost_id *dst_oi,
                                    const struct ost_id *src_oi)
 {
-       dst_oi->oi.oi_id = cpu_to_le64(src_oi->oi.oi_id);
-       dst_oi->oi.oi_seq = cpu_to_le64(src_oi->oi.oi_seq);
+       dst_oi->oi.oi_id = __cpu_to_le64(src_oi->oi.oi_id);
+       dst_oi->oi.oi_seq = __cpu_to_le64(src_oi->oi.oi_seq);
 }
 
 #define MAX_MD_SIZE (sizeof(struct lov_mds_md) + 4 * sizeof(struct lov_ost_data))
 }
 
 #define MAX_MD_SIZE (sizeof(struct lov_mds_md) + 4 * sizeof(struct lov_ost_data))
@@ -2647,11 +2649,11 @@ static inline int lmv_mds_md_size(int stripe_count, unsigned int lmm_magic)
 
 static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm)
 {
 
 static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm)
 {
-       switch (le32_to_cpu(lmm->lmv_magic)) {
+       switch (__le32_to_cpu(lmm->lmv_magic)) {
        case LMV_MAGIC_V1:
        case LMV_MAGIC_V1:
-               return le32_to_cpu(lmm->lmv_md_v1.lmv_stripe_count);
+               return __le32_to_cpu(lmm->lmv_md_v1.lmv_stripe_count);
        case LMV_USER_MAGIC:
        case LMV_USER_MAGIC:
-               return le32_to_cpu(lmm->lmv_user_md.lum_stripe_count);
+               return __le32_to_cpu(lmm->lmv_user_md.lum_stripe_count);
        default:
                return -EINVAL;
        }
        default:
                return -EINVAL;
        }
index 46aeaa0..e8c6026 100644 (file)
@@ -47,7 +47,7 @@
  *
  * @{
  */
  *
  * @{
  */
-
+#include <asm/byteorder.h>
 #include <linux/types.h>
 #include <libcfs/libcfs.h>
 #ifdef __KERNEL__
 #include <linux/types.h>
 #include <libcfs/libcfs.h>
 #ifdef __KERNEL__
@@ -421,26 +421,26 @@ static inline void lsd_le_to_cpu(struct lr_server_data *buf,
 {
        int i;
        memcpy(lsd->lsd_uuid, buf->lsd_uuid, sizeof(lsd->lsd_uuid));
 {
        int i;
        memcpy(lsd->lsd_uuid, buf->lsd_uuid, sizeof(lsd->lsd_uuid));
-       lsd->lsd_last_transno     = le64_to_cpu(buf->lsd_last_transno);
-       lsd->lsd_compat14         = le64_to_cpu(buf->lsd_compat14);
-       lsd->lsd_mount_count      = le64_to_cpu(buf->lsd_mount_count);
-       lsd->lsd_feature_compat   = le32_to_cpu(buf->lsd_feature_compat);
-       lsd->lsd_feature_rocompat = le32_to_cpu(buf->lsd_feature_rocompat);
-       lsd->lsd_feature_incompat = le32_to_cpu(buf->lsd_feature_incompat);
-       lsd->lsd_server_size      = le32_to_cpu(buf->lsd_server_size);
-       lsd->lsd_client_start     = le32_to_cpu(buf->lsd_client_start);
-       lsd->lsd_client_size      = le16_to_cpu(buf->lsd_client_size);
-       lsd->lsd_subdir_count     = le16_to_cpu(buf->lsd_subdir_count);
-       lsd->lsd_catalog_oid      = le64_to_cpu(buf->lsd_catalog_oid);
-       lsd->lsd_catalog_ogen     = le32_to_cpu(buf->lsd_catalog_ogen);
+       lsd->lsd_last_transno     = __le64_to_cpu(buf->lsd_last_transno);
+       lsd->lsd_compat14         = __le64_to_cpu(buf->lsd_compat14);
+       lsd->lsd_mount_count      = __le64_to_cpu(buf->lsd_mount_count);
+       lsd->lsd_feature_compat   = __le32_to_cpu(buf->lsd_feature_compat);
+       lsd->lsd_feature_rocompat = __le32_to_cpu(buf->lsd_feature_rocompat);
+       lsd->lsd_feature_incompat = __le32_to_cpu(buf->lsd_feature_incompat);
+       lsd->lsd_server_size      = __le32_to_cpu(buf->lsd_server_size);
+       lsd->lsd_client_start     = __le32_to_cpu(buf->lsd_client_start);
+       lsd->lsd_client_size      = __le16_to_cpu(buf->lsd_client_size);
+       lsd->lsd_subdir_count     = __le16_to_cpu(buf->lsd_subdir_count);
+       lsd->lsd_catalog_oid      = __le64_to_cpu(buf->lsd_catalog_oid);
+       lsd->lsd_catalog_ogen     = __le32_to_cpu(buf->lsd_catalog_ogen);
        memcpy(lsd->lsd_peeruuid, buf->lsd_peeruuid, sizeof(lsd->lsd_peeruuid));
        memcpy(lsd->lsd_peeruuid, buf->lsd_peeruuid, sizeof(lsd->lsd_peeruuid));
-       lsd->lsd_osd_index        = le32_to_cpu(buf->lsd_osd_index);
-       lsd->lsd_padding1        le32_to_cpu(buf->lsd_padding1);
-       lsd->lsd_start_epoch      = le32_to_cpu(buf->lsd_start_epoch);
+       lsd->lsd_osd_index        = __le32_to_cpu(buf->lsd_osd_index);
+       lsd->lsd_padding1         = __le32_to_cpu(buf->lsd_padding1);
+       lsd->lsd_start_epoch      = __le32_to_cpu(buf->lsd_start_epoch);
        for (i = 0; i < LR_EXPIRE_INTERVALS; i++)
        for (i = 0; i < LR_EXPIRE_INTERVALS; i++)
-               lsd->lsd_trans_table[i] = le64_to_cpu(buf->lsd_trans_table[i]);
-       lsd->lsd_trans_table_time = le32_to_cpu(buf->lsd_trans_table_time);
-       lsd->lsd_expire_intervals = le32_to_cpu(buf->lsd_expire_intervals);
+               lsd->lsd_trans_table[i] = __le64_to_cpu(buf->lsd_trans_table[i]);
+       lsd->lsd_trans_table_time = __le32_to_cpu(buf->lsd_trans_table_time);
+       lsd->lsd_expire_intervals = __le32_to_cpu(buf->lsd_expire_intervals);
 }
 
 static inline void lsd_cpu_to_le(struct lr_server_data *lsd,
 }
 
 static inline void lsd_cpu_to_le(struct lr_server_data *lsd,
@@ -448,66 +448,66 @@ static inline void lsd_cpu_to_le(struct lr_server_data *lsd,
 {
        int i;
        memcpy(buf->lsd_uuid, lsd->lsd_uuid, sizeof(buf->lsd_uuid));
 {
        int i;
        memcpy(buf->lsd_uuid, lsd->lsd_uuid, sizeof(buf->lsd_uuid));
-       buf->lsd_last_transno     = cpu_to_le64(lsd->lsd_last_transno);
-       buf->lsd_compat14         = cpu_to_le64(lsd->lsd_compat14);
-       buf->lsd_mount_count      = cpu_to_le64(lsd->lsd_mount_count);
-       buf->lsd_feature_compat   = cpu_to_le32(lsd->lsd_feature_compat);
-       buf->lsd_feature_rocompat = cpu_to_le32(lsd->lsd_feature_rocompat);
-       buf->lsd_feature_incompat = cpu_to_le32(lsd->lsd_feature_incompat);
-       buf->lsd_server_size      = cpu_to_le32(lsd->lsd_server_size);
-       buf->lsd_client_start     = cpu_to_le32(lsd->lsd_client_start);
-       buf->lsd_client_size      = cpu_to_le16(lsd->lsd_client_size);
-       buf->lsd_subdir_count     = cpu_to_le16(lsd->lsd_subdir_count);
-       buf->lsd_catalog_oid      = cpu_to_le64(lsd->lsd_catalog_oid);
-       buf->lsd_catalog_ogen     = cpu_to_le32(lsd->lsd_catalog_ogen);
+       buf->lsd_last_transno     = __cpu_to_le64(lsd->lsd_last_transno);
+       buf->lsd_compat14         = __cpu_to_le64(lsd->lsd_compat14);
+       buf->lsd_mount_count      = __cpu_to_le64(lsd->lsd_mount_count);
+       buf->lsd_feature_compat   = __cpu_to_le32(lsd->lsd_feature_compat);
+       buf->lsd_feature_rocompat = __cpu_to_le32(lsd->lsd_feature_rocompat);
+       buf->lsd_feature_incompat = __cpu_to_le32(lsd->lsd_feature_incompat);
+       buf->lsd_server_size      = __cpu_to_le32(lsd->lsd_server_size);
+       buf->lsd_client_start     = __cpu_to_le32(lsd->lsd_client_start);
+       buf->lsd_client_size      = __cpu_to_le16(lsd->lsd_client_size);
+       buf->lsd_subdir_count     = __cpu_to_le16(lsd->lsd_subdir_count);
+       buf->lsd_catalog_oid      = __cpu_to_le64(lsd->lsd_catalog_oid);
+       buf->lsd_catalog_ogen     = __cpu_to_le32(lsd->lsd_catalog_ogen);
        memcpy(buf->lsd_peeruuid, lsd->lsd_peeruuid, sizeof(buf->lsd_peeruuid));
        memcpy(buf->lsd_peeruuid, lsd->lsd_peeruuid, sizeof(buf->lsd_peeruuid));
-       buf->lsd_osd_index        = cpu_to_le32(lsd->lsd_osd_index);
-       buf->lsd_padding1         = cpu_to_le32(lsd->lsd_padding1);
-       buf->lsd_start_epoch      = cpu_to_le32(lsd->lsd_start_epoch);
+       buf->lsd_osd_index        = __cpu_to_le32(lsd->lsd_osd_index);
+       buf->lsd_padding1         = __cpu_to_le32(lsd->lsd_padding1);
+       buf->lsd_start_epoch      = __cpu_to_le32(lsd->lsd_start_epoch);
        for (i = 0; i < LR_EXPIRE_INTERVALS; i++)
        for (i = 0; i < LR_EXPIRE_INTERVALS; i++)
-               buf->lsd_trans_table[i] = cpu_to_le64(lsd->lsd_trans_table[i]);
-       buf->lsd_trans_table_time = cpu_to_le32(lsd->lsd_trans_table_time);
-       buf->lsd_expire_intervals = cpu_to_le32(lsd->lsd_expire_intervals);
+               buf->lsd_trans_table[i] = __cpu_to_le64(lsd->lsd_trans_table[i]);
+       buf->lsd_trans_table_time = __cpu_to_le32(lsd->lsd_trans_table_time);
+       buf->lsd_expire_intervals = __cpu_to_le32(lsd->lsd_expire_intervals);
 }
 
 static inline void lcd_le_to_cpu(struct lsd_client_data *buf,
                                  struct lsd_client_data *lcd)
 {
         memcpy(lcd->lcd_uuid, buf->lcd_uuid, sizeof (lcd->lcd_uuid));
 }
 
 static inline void lcd_le_to_cpu(struct lsd_client_data *buf,
                                  struct lsd_client_data *lcd)
 {
         memcpy(lcd->lcd_uuid, buf->lcd_uuid, sizeof (lcd->lcd_uuid));
-        lcd->lcd_last_transno       = le64_to_cpu(buf->lcd_last_transno);
-        lcd->lcd_last_xid           = le64_to_cpu(buf->lcd_last_xid);
-        lcd->lcd_last_result        = le32_to_cpu(buf->lcd_last_result);
-        lcd->lcd_last_data          = le32_to_cpu(buf->lcd_last_data);
-        lcd->lcd_last_close_transno = le64_to_cpu(buf->lcd_last_close_transno);
-        lcd->lcd_last_close_xid     = le64_to_cpu(buf->lcd_last_close_xid);
-        lcd->lcd_last_close_result  = le32_to_cpu(buf->lcd_last_close_result);
-        lcd->lcd_last_close_data    = le32_to_cpu(buf->lcd_last_close_data);
-        lcd->lcd_pre_versions[0]    = le64_to_cpu(buf->lcd_pre_versions[0]);
-        lcd->lcd_pre_versions[1]    = le64_to_cpu(buf->lcd_pre_versions[1]);
-        lcd->lcd_pre_versions[2]    = le64_to_cpu(buf->lcd_pre_versions[2]);
-        lcd->lcd_pre_versions[3]    = le64_to_cpu(buf->lcd_pre_versions[3]);
-        lcd->lcd_last_epoch         = le32_to_cpu(buf->lcd_last_epoch);
-       lcd->lcd_generation         = le32_to_cpu(buf->lcd_generation);
+       lcd->lcd_last_transno       = __le64_to_cpu(buf->lcd_last_transno);
+       lcd->lcd_last_xid           = __le64_to_cpu(buf->lcd_last_xid);
+       lcd->lcd_last_result        = __le32_to_cpu(buf->lcd_last_result);
+       lcd->lcd_last_data          = __le32_to_cpu(buf->lcd_last_data);
+       lcd->lcd_last_close_transno = __le64_to_cpu(buf->lcd_last_close_transno);
+       lcd->lcd_last_close_xid     = __le64_to_cpu(buf->lcd_last_close_xid);
+       lcd->lcd_last_close_result  = __le32_to_cpu(buf->lcd_last_close_result);
+       lcd->lcd_last_close_data    = __le32_to_cpu(buf->lcd_last_close_data);
+       lcd->lcd_pre_versions[0]    = __le64_to_cpu(buf->lcd_pre_versions[0]);
+       lcd->lcd_pre_versions[1]    = __le64_to_cpu(buf->lcd_pre_versions[1]);
+       lcd->lcd_pre_versions[2]    = __le64_to_cpu(buf->lcd_pre_versions[2]);
+       lcd->lcd_pre_versions[3]    = __le64_to_cpu(buf->lcd_pre_versions[3]);
+       lcd->lcd_last_epoch         = __le32_to_cpu(buf->lcd_last_epoch);
+       lcd->lcd_generation         = __le32_to_cpu(buf->lcd_generation);
 }
 
 static inline void lcd_cpu_to_le(struct lsd_client_data *lcd,
                                  struct lsd_client_data *buf)
 {
         memcpy(buf->lcd_uuid, lcd->lcd_uuid, sizeof (lcd->lcd_uuid));
 }
 
 static inline void lcd_cpu_to_le(struct lsd_client_data *lcd,
                                  struct lsd_client_data *buf)
 {
         memcpy(buf->lcd_uuid, lcd->lcd_uuid, sizeof (lcd->lcd_uuid));
-        buf->lcd_last_transno       = cpu_to_le64(lcd->lcd_last_transno);
-        buf->lcd_last_xid           = cpu_to_le64(lcd->lcd_last_xid);
-        buf->lcd_last_result        = cpu_to_le32(lcd->lcd_last_result);
-        buf->lcd_last_data          = cpu_to_le32(lcd->lcd_last_data);
-        buf->lcd_last_close_transno = cpu_to_le64(lcd->lcd_last_close_transno);
-        buf->lcd_last_close_xid     = cpu_to_le64(lcd->lcd_last_close_xid);
-        buf->lcd_last_close_result  = cpu_to_le32(lcd->lcd_last_close_result);
-        buf->lcd_last_close_data    = cpu_to_le32(lcd->lcd_last_close_data);
-        buf->lcd_pre_versions[0]    = cpu_to_le64(lcd->lcd_pre_versions[0]);
-        buf->lcd_pre_versions[1]    = cpu_to_le64(lcd->lcd_pre_versions[1]);
-        buf->lcd_pre_versions[2]    = cpu_to_le64(lcd->lcd_pre_versions[2]);
-        buf->lcd_pre_versions[3]    = cpu_to_le64(lcd->lcd_pre_versions[3]);
-        buf->lcd_last_epoch         = cpu_to_le32(lcd->lcd_last_epoch);
-       buf->lcd_generation         = cpu_to_le32(lcd->lcd_generation);
+       buf->lcd_last_transno       = __cpu_to_le64(lcd->lcd_last_transno);
+       buf->lcd_last_xid           = __cpu_to_le64(lcd->lcd_last_xid);
+       buf->lcd_last_result        = __cpu_to_le32(lcd->lcd_last_result);
+       buf->lcd_last_data          = __cpu_to_le32(lcd->lcd_last_data);
+       buf->lcd_last_close_transno = __cpu_to_le64(lcd->lcd_last_close_transno);
+       buf->lcd_last_close_xid     = __cpu_to_le64(lcd->lcd_last_close_xid);
+       buf->lcd_last_close_result  = __cpu_to_le32(lcd->lcd_last_close_result);
+       buf->lcd_last_close_data    = __cpu_to_le32(lcd->lcd_last_close_data);
+       buf->lcd_pre_versions[0]    = __cpu_to_le64(lcd->lcd_pre_versions[0]);
+       buf->lcd_pre_versions[1]    = __cpu_to_le64(lcd->lcd_pre_versions[1]);
+       buf->lcd_pre_versions[2]    = __cpu_to_le64(lcd->lcd_pre_versions[2]);
+       buf->lcd_pre_versions[3]    = __cpu_to_le64(lcd->lcd_pre_versions[3]);
+       buf->lcd_last_epoch         = __cpu_to_le32(lcd->lcd_last_epoch);
+       buf->lcd_generation         = __cpu_to_le32(lcd->lcd_generation);
 }
 
 static inline __u64 lcd_last_transno(struct lsd_client_data *lcd)
 }
 
 static inline __u64 lcd_last_transno(struct lsd_client_data *lcd)
index 9d7dacb..2a27603 100644 (file)
 #include <sys/stat.h>
 #include <linux/types.h>
 
 #include <sys/stat.h>
 #include <linux/types.h>
 
-#include <libcfs/byteorder.h>
-
 #define READ  1
 #define WRITE 2
 
 #define READ  1
 #define WRITE 2
 
-#define LPDS sizeof(__u64)
-int block_debug_setup(void *addr, int len, __u64 off, __u64 id)
+#define LPDS sizeof(uint64_t)
+int block_debug_setup(void *addr, int len, uint64_t off, uint64_t id)
 {
 {
-        off = cpu_to_le64(off);
-        id = cpu_to_le64(id);
+       off = htole64(off);
+       id = htole64(id);
         memcpy(addr, (char *)&off, LPDS);
         memcpy(addr + LPDS, (char *)&id, LPDS);
 
         memcpy(addr, (char *)&off, LPDS);
         memcpy(addr + LPDS, (char *)&id, LPDS);
 
@@ -76,8 +74,8 @@ int block_debug_check(char *who, void *addr, int size, uint64_t off, uint64_t id
        uint64_t ne_off;
         int err = 0;
 
        uint64_t ne_off;
         int err = 0;
 
-        ne_off = le64_to_cpu(off);
-        id = le64_to_cpu(id);
+       ne_off = le64toh(off);
+       id = le64toh(id);
         if (memcmp(addr, (char *)&ne_off, LPDS)) {
                fprintf(stderr, "%s: for offset %"PRIu64" off: %"PRIx64" != %"PRIx64"\n",
                        who, off, *(uint64_t *)addr, ne_off);
         if (memcmp(addr, (char *)&ne_off, LPDS)) {
                fprintf(stderr, "%s: for offset %"PRIu64" off: %"PRIx64" != %"PRIx64"\n",
                        who, off, *(uint64_t *)addr, ne_off);
@@ -117,9 +115,9 @@ int main(int argc, char **argv)
 {
         int fd;
         char *buf;
 {
         int fd;
         char *buf;
-        long long count, last, offset;
+       long long count, last;
         long pg_vec, len;
         long pg_vec, len;
-       uint64_t objid;
+       uint64_t objid, offset;
         struct stat st;
         int flags = 0;
         int cmd = 0;
         struct stat st;
         int flags = 0;
         int cmd = 0;
@@ -222,10 +220,10 @@ int main(int argc, char **argv)
         }
 
         for (offset = 0; offset < last && cmd & WRITE; offset += len) {
         }
 
         for (offset = 0; offset < last && cmd & WRITE; offset += len) {
-                int i;
+               unsigned int i;
 
                 for (i = 0; i < len; i += st.st_blksize)
 
                 for (i = 0; i < len; i += st.st_blksize)
-                        block_debug_setup(buf + i, st.st_blksize, 
+                       block_debug_setup(buf + i, st.st_blksize,
                                           offset + i, objid);
 
                 rc = write(fd, buf, len);
                                           offset + i, objid);
 
                 rc = write(fd, buf, len);
index 98d7dea..11a0398 100644 (file)
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
+#include <endian.h>
 #include <errno.h>
 
 #include <sys/types.h>
 
 #include <errno.h>
 
 #include <sys/types.h>
 
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#endif
-
 void usage(void)
 {
         printf("usage: create_iam "
 void usage(void)
 {
         printf("usage: create_iam "
index feae9eb..97e266a 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <string.h>
 #include <time.h>
 
 #include <string.h>
 #include <time.h>
-#include <libcfs/byteorder.h>
 #include "lgss_utils.h"
 
 static int lgss_null_prepare_cred(struct lgss_cred *cred)
 #include "lgss_utils.h"
 
 static int lgss_null_prepare_cred(struct lgss_cred *cred)
@@ -47,7 +46,7 @@ static int lgss_null_prepare_cred(struct lgss_cred *cred)
        tmp |= cred->lc_root_flags;
 
        /* big-endian for the wire */
        tmp |= cred->lc_root_flags;
 
        /* big-endian for the wire */
-       tmp = cpu_to_be64(tmp);
+       tmp = htobe64(tmp);
        memcpy(cred->lc_mech_token.value, &tmp, cred->lc_mech_token.length);
 
        return 0;
        memcpy(cred->lc_mech_token.value, &tmp, cred->lc_mech_token.length);
 
        return 0;
index 9b5ce23..39cd25d 100644 (file)
@@ -105,7 +105,7 @@ static int lgss_sk_using_cred(struct lgss_cred *cred)
        bufs[4] = skc->sc_nodemap_hash;
 
        /* big endian flags for the wire */
        bufs[4] = skc->sc_nodemap_hash;
 
        /* big endian flags for the wire */
-       flags = cpu_to_be32(skc->sc_flags);
+       flags = htobe64(skc->sc_flags);
        bufs[5].value = &flags;
        bufs[5].length = sizeof(flags);
 
        bufs[5].value = &flags;
        bufs[5].length = sizeof(flags);
 
index a6eec75..2dc453e 100644 (file)
@@ -298,15 +298,15 @@ void sk_config_cpu_to_disk(struct sk_keyfile_config *config)
        if (!config)
                return;
 
        if (!config)
                return;
 
-       config->skc_version = be32_to_cpu(config->skc_version);
-       config->skc_hmac_alg = be16_to_cpu(config->skc_hmac_alg);
-       config->skc_crypt_alg = be16_to_cpu(config->skc_crypt_alg);
-       config->skc_expire = be32_to_cpu(config->skc_expire);
-       config->skc_shared_keylen = be32_to_cpu(config->skc_shared_keylen);
-       config->skc_session_keylen = be32_to_cpu(config->skc_session_keylen);
+       config->skc_version = htobe32(config->skc_version);
+       config->skc_hmac_alg = htobe16(config->skc_hmac_alg);
+       config->skc_crypt_alg = htobe16(config->skc_crypt_alg);
+       config->skc_expire = htobe32(config->skc_expire);
+       config->skc_shared_keylen = htobe32(config->skc_shared_keylen);
+       config->skc_session_keylen = htobe32(config->skc_session_keylen);
 
        for (i = 0; i < MAX_MGSNIDS; i++)
 
        for (i = 0; i < MAX_MGSNIDS; i++)
-               config->skc_mgsnids[i] = be64_to_cpu(config->skc_mgsnids[i]);
+               config->skc_mgsnids[i] = htobe64(config->skc_mgsnids[i]);
 
        return;
 }
 
        return;
 }
@@ -323,15 +323,15 @@ void sk_config_disk_to_cpu(struct sk_keyfile_config *config)
        if (!config)
                return;
 
        if (!config)
                return;
 
-       config->skc_version = cpu_to_be32(config->skc_version);
-       config->skc_hmac_alg = cpu_to_be16(config->skc_hmac_alg);
-       config->skc_crypt_alg = cpu_to_be16(config->skc_crypt_alg);
-       config->skc_expire = cpu_to_be32(config->skc_expire);
-       config->skc_shared_keylen = cpu_to_be32(config->skc_shared_keylen);
-       config->skc_session_keylen = cpu_to_be32(config->skc_session_keylen);
+       config->skc_version = be32toh(config->skc_version);
+       config->skc_hmac_alg = be16toh(config->skc_hmac_alg);
+       config->skc_crypt_alg = be16toh(config->skc_crypt_alg);
+       config->skc_expire = be32toh(config->skc_expire);
+       config->skc_shared_keylen = be32toh(config->skc_shared_keylen);
+       config->skc_session_keylen = be32toh(config->skc_session_keylen);
 
        for (i = 0; i < MAX_MGSNIDS; i++)
 
        for (i = 0; i < MAX_MGSNIDS; i++)
-               config->skc_mgsnids[i] = cpu_to_be64(config->skc_mgsnids[i]);
+               config->skc_mgsnids[i] = be64toh(config->skc_mgsnids[i]);
 
        return;
 }
 
        return;
 }
@@ -1087,7 +1087,7 @@ int sk_kdf(struct sk_cred *skc, lnet_nid_t client_nid,
        skp = session_key->value;
        i = 0;
        while (remain > 0) {
        skp = session_key->value;
        i = 0;
        while (remain > 0) {
-               counter = cpu_to_be32(i++);
+               counter = be32toh(i++);
                rc = sk_sign_bufs(&kctx->skc_shared_key, bufs, 4,
                             sk_hash_to_evp_md(kctx->skc_hmac_alg), &tmp_hash);
                if (rc) {
                rc = sk_sign_bufs(&kctx->skc_shared_key, bufs, 4,
                             sk_hash_to_evp_md(kctx->skc_hmac_alg), &tmp_hash);
                if (rc) {
index 731f340..d2b71ee 100644 (file)
@@ -398,7 +398,7 @@ int handle_sk(struct svc_nego_data *snd)
        }
 
        memcpy(&flags, bufs[5].value, sizeof(flags));
        }
 
        memcpy(&flags, bufs[5].value, sizeof(flags));
-       skc = sk_create_cred(target, snd->nm_name, be32_to_cpu(flags));
+       skc = sk_create_cred(target, snd->nm_name, be32toh(flags));
        if (!skc) {
                printerr(0, "Failed to create sk credentials\n");
                for (i = 0; i < numbufs; i++)
        if (!skc) {
                printerr(0, "Failed to create sk credentials\n");
                for (i = 0; i < numbufs; i++)
@@ -551,7 +551,7 @@ int handle_null(struct svc_nego_data *snd)
        snd->maj_stat = GSS_S_COMPLETE;
 
        memcpy(&tmp, snd->in_tok.value, sizeof(tmp));
        snd->maj_stat = GSS_S_COMPLETE;
 
        memcpy(&tmp, snd->in_tok.value, sizeof(tmp));
-       tmp = be64_to_cpu(tmp);
+       tmp = be64toh(tmp);
        flags = (uint32_t)(tmp & 0x00000000ffffffff);
        memset(&cred, 0, sizeof(cred));
        cred.cr_mapped_uid = -1;
        flags = (uint32_t)(tmp & 0x00000000ffffffff);
        memset(&cred, 0, sizeof(cred));
        cred.cr_mapped_uid = -1;
index 1b12696..2298e3c 100644 (file)
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
+#include <endian.h>
 #include <errno.h>
 #include <assert.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 
 #include <errno.h>
 #include <assert.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 
-#include <libcfs/byteorder.h>
 #include <libcfs/util/string.h>
 #include <lustre/libiam.h>
 
 #include <libcfs/util/string.h>
 #include <lustre/libiam.h>
 
@@ -149,10 +149,10 @@ static void lfix_root(void *buf,
 
         root = buf;
         *root = (typeof(*root)) {
 
         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
         };
 
                 .ilr_indirect_levels = 0
         };
 
@@ -161,7 +161,7 @@ static void lfix_root(void *buf,
                 /*
                  * limit itself + one pointer to the leaf.
                  */
                 /*
                  * limit itself + one pointer to the leaf.
                  */
-                .count = cpu_to_le16(2),
+               .count = htole16(2),
                 .limit = lfix_root_limit(blocksize, keysize + ptrsize)
         };
 
                 .limit = lfix_root_limit(blocksize, keysize + ptrsize)
         };
 
@@ -181,9 +181,9 @@ static void lfix_root(void *buf,
         entry += keysize;
         /* now @entry points to <ptr> */
         if (ptrsize == 4)
         entry += keysize;
         /* now @entry points to <ptr> */
         if (ptrsize == 4)
-                STORE_UNALIGNED(cpu_to_le32(1), (u_int32_t *)entry);
+               STORE_UNALIGNED(htole32(1), (u_int32_t *)entry);
         else
         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,
 }
 
 static void lfix_leaf(void *buf,
@@ -194,12 +194,12 @@ static void lfix_leaf(void *buf,
         /* form leaf */
         head = buf;
         *head = (typeof(*head)) {
         /* 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).
                  */
                 /*
                  * Leaf contains an entry with the smallest possible key
                  * (created by zeroing).
                  */
-                .ill_count = cpu_to_le16(1),
+               .ill_count = htole16(1),
         };
 }
 
         };
 }
 
@@ -219,9 +219,9 @@ static void lvar_root(void *buf,
         isize = sizeof(lvar_hash_t) + ptrsize;
         root = buf;
         *root = (typeof(*root)) {
         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
         };
 
                 .vr_indirect_levels  = 0
         };
 
@@ -230,7 +230,7 @@ static void lvar_root(void *buf,
                 /*
                  * limit itself + one pointer to the leaf.
                  */
                 /*
                  * limit itself + one pointer to the leaf.
                  */
-                .count = cpu_to_le16(2),
+               .count = htole16(2),
                 .limit = lvar_root_limit(blocksize, keysize + ptrsize)
         };
 
                 .limit = lvar_root_limit(blocksize, keysize + ptrsize)
         };
 
@@ -250,9 +250,9 @@ static void lvar_root(void *buf,
         entry += sizeof(lvar_hash_t);
         /* now @entry points to <ptr> */
         if (ptrsize == 4)
         entry += sizeof(lvar_hash_t);
         /* now @entry points to <ptr> */
         if (ptrsize == 4)
-                STORE_UNALIGNED(cpu_to_le32(1), (u_int32_t *)entry);
+               STORE_UNALIGNED(htole32(1), (u_int32_t *)entry);
         else
         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)
 }
 
 static int lvar_esize(int namelen, int recsize)
@@ -270,8 +270,8 @@ static void lvar_leaf(void *buf,
         /* form leaf */
         head = buf;
         *head = (typeof(*head)) {
         /* 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;
         };
         rec = (void *)(head + 1);
         rec[offsetof(struct lvar_leaf_entry, vle_key)] = recsize;
index 00de58e..8eb7b66 100644 (file)
@@ -46,7 +46,7 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/xattr.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/xattr.h>
-#include <libcfs/byteorder.h>
+#include <asm/byteorder.h>
 #include <lustre/lustre_user.h>
 
 int main(int argc, char *argv[])
 #include <lustre/lustre_user.h>
 
 int main(int argc, char *argv[])
@@ -77,18 +77,18 @@ int main(int argc, char *argv[])
                        /* old filter_fid */
                        printf("%s: objid=%llu seq=%llu parent="DFID
                               " stripe=%u\n", argv[i],
                        /* old filter_fid */
                        printf("%s: objid=%llu seq=%llu parent="DFID
                               " stripe=%u\n", argv[i],
-                              (unsigned long long)le64_to_cpu(ffo->ff_objid),
-                              (unsigned long long)le64_to_cpu(ffo->ff_seq),
-                              (unsigned long long)le64_to_cpu(ffo->ff_parent.f_seq),
-                              le32_to_cpu(ffo->ff_parent.f_oid), 0 /* ver */,
+                              (unsigned long long)__le64_to_cpu(ffo->ff_objid),
+                              (unsigned long long)__le64_to_cpu(ffo->ff_seq),
+                              (unsigned long long)__le64_to_cpu(ffo->ff_parent.f_seq),
+                              le32toh(ffo->ff_parent.f_oid), 0 /* ver */,
                               /* this is stripe_nr actually */
                               /* this is stripe_nr actually */
-                              le32_to_cpu(ffo->ff_parent.f_stripe_idx));
+                              le32toh(ffo->ff_parent.f_stripe_idx));
                } else {
                        printf("%s: parent="DFID" stripe=%u\n", argv[i],
                } else {
                        printf("%s: parent="DFID" stripe=%u\n", argv[i],
-                              (unsigned long long)le64_to_cpu(ff->ff_parent.f_seq),
-                              le32_to_cpu(ff->ff_parent.f_oid), 0, /* ver */
+                              (unsigned long long)__le64_to_cpu(ff->ff_parent.f_seq),
+                              __le32_to_cpu(ff->ff_parent.f_oid), 0, /* ver */
                               /* this is stripe_nr actually */
                               /* this is stripe_nr actually */
-                              le32_to_cpu(ff->ff_parent.f_stripe_idx));
+                              __le32_to_cpu(ff->ff_parent.f_stripe_idx));
                }
        }
 
                }
        }
 
index c5922c1..3167d92 100644 (file)
@@ -262,7 +262,7 @@ int llog_pack_buffer(int fd, struct llog_log_hdr **llog,
        }
 
        /* the llog header not countable here.*/
        }
 
        /* the llog header not countable here.*/
-       recs_num = le32_to_cpu((*llog)->llh_count) - 1;
+       recs_num = __le32_to_cpu((*llog)->llh_count) - 1;
 
        recs_buf = malloc(recs_num * sizeof(**recs_pr));
        if (recs_buf == NULL) {
 
        recs_buf = malloc(recs_num * sizeof(**recs_pr));
        if (recs_buf == NULL) {
@@ -274,7 +274,7 @@ int llog_pack_buffer(int fd, struct llog_log_hdr **llog,
        }
        recs_pr = (struct llog_rec_hdr **)recs_buf;
 
        }
        recs_pr = (struct llog_rec_hdr **)recs_buf;
 
-       ptr = file_buf + le32_to_cpu((*llog)->llh_hdr.lrh_len);
+       ptr = file_buf + __le32_to_cpu((*llog)->llh_hdr.lrh_len);
        i = 0;
 
        while (ptr < (file_buf + file_size)) {
        i = 0;
 
        while (ptr < (file_buf + file_size)) {
@@ -290,7 +290,7 @@ int llog_pack_buffer(int fd, struct llog_log_hdr **llog,
                }
 
                cur_rec = (struct llog_rec_hdr *)ptr;
                }
 
                cur_rec = (struct llog_rec_hdr *)ptr;
-               idx = le32_to_cpu(cur_rec->lrh_index);
+               idx = __le32_to_cpu(cur_rec->lrh_index);
                recs_pr[i] = cur_rec;
                offset = (unsigned long)ptr - (unsigned long)file_buf;
                if (cur_rec->lrh_len == 0 ||
                recs_pr[i] = cur_rec;
                offset = (unsigned long)ptr - (unsigned long)file_buf;
                if (cur_rec->lrh_len == 0 ||
@@ -310,7 +310,7 @@ int llog_pack_buffer(int fd, struct llog_log_hdr **llog,
                        i--;
                }
 
                        i--;
                }
 
-               ptr += le32_to_cpu(cur_rec->lrh_len);
+               ptr += __le32_to_cpu(cur_rec->lrh_len);
                if ((ptr - file_buf) > file_size) {
                        printf("The log is corrupt (too big at %d)\n", i);
                        rc = -EINVAL;
                if ((ptr - file_buf) > file_size) {
                        printf("The log is corrupt (too big at %d)\n", i);
                        rc = -EINVAL;
@@ -345,24 +345,24 @@ void llog_unpack_buffer(int fd, struct llog_log_hdr *llog_buf,
 
 void print_llog_header(struct llog_log_hdr *llog_buf)
 {
 
 void print_llog_header(struct llog_log_hdr *llog_buf)
 {
-        time_t t;
+       time_t t;
 
 
-        printf("Header size : %u\n",
-               le32_to_cpu(llog_buf->llh_hdr.lrh_len));
+       printf("Header size : %u\n",
+              __le32_to_cpu(llog_buf->llh_hdr.lrh_len));
 
 
-        t = le64_to_cpu(llog_buf->llh_timestamp);
-        printf("Time : %s", ctime(&t));
+       t = __le64_to_cpu(llog_buf->llh_timestamp);
+       printf("Time : %s", ctime(&t));
 
 
-        printf("Number of records: %u\n",
-               le32_to_cpu(llog_buf->llh_count)-1);
+       printf("Number of records: %u\n",
+              __le32_to_cpu(llog_buf->llh_count)-1);
 
 
-        printf("Target uuid : %s \n",
-               (char *)(&llog_buf->llh_tgtuuid));
+       printf("Target uuid : %s\n",
+              (char *)(&llog_buf->llh_tgtuuid));
 
 
-        /* Add the other info you want to view here */
+       /* Add the other info you want to view here */
 
 
-        printf("-----------------------\n");
-        return;
+       printf("-----------------------\n");
+       return;
 }
 
 static void print_1_cfg(struct lustre_cfg *lcfg)
 }
 
 static void print_1_cfg(struct lustre_cfg *lcfg)
@@ -407,7 +407,7 @@ static void print_setup_cfg(struct lustre_cfg *lcfg)
 
 void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip)
 {
 
 void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip)
 {
-        enum lcfg_command_type cmd = le32_to_cpu(lcfg->lcfg_command);
+       enum lcfg_command_type cmd = __le32_to_cpu(lcfg->lcfg_command);
 
         if (*skip > 0)
                 printf("SKIP ");
 
         if (*skip > 0)
                 printf("SKIP ");
@@ -625,10 +625,10 @@ static void print_hsm_action(struct llog_agent_req_rec *larr)
 void print_changelog_rec(struct llog_changelog_rec *rec)
 {
        printf("changelog record id:0x%x cr_flags:0x%x cr_type:%s(0x%x)\n",
 void print_changelog_rec(struct llog_changelog_rec *rec)
 {
        printf("changelog record id:0x%x cr_flags:0x%x cr_type:%s(0x%x)\n",
-              le32_to_cpu(rec->cr_hdr.lrh_id),
-              le32_to_cpu(rec->cr.cr_flags),
-              changelog_type2str(le32_to_cpu(rec->cr.cr_type)),
-              le32_to_cpu(rec->cr.cr_type));
+              __le32_to_cpu(rec->cr_hdr.lrh_id),
+              __le32_to_cpu(rec->cr.cr_flags),
+              changelog_type2str(__le32_to_cpu(rec->cr.cr_type)),
+              __le32_to_cpu(rec->cr.cr_type));
 }
 
 static void print_records(struct llog_rec_hdr **recs,
 }
 
 static void print_records(struct llog_rec_hdr **recs,
@@ -638,10 +638,10 @@ static void print_records(struct llog_rec_hdr **recs,
        int i, skip = 0;
 
        for (i = 0; i < rec_number; i++) {
        int i, skip = 0;
 
        for (i = 0; i < rec_number; i++) {
-               printf("#%.2d (%.3d)", le32_to_cpu(recs[i]->lrh_index),
-                      le32_to_cpu(recs[i]->lrh_len));
+               printf("#%.2d (%.3d)", __le32_to_cpu(recs[i]->lrh_index),
+                      __le32_to_cpu(recs[i]->lrh_len));
 
 
-               lopt = le32_to_cpu(recs[i]->lrh_type);
+               lopt = __le32_to_cpu(recs[i]->lrh_type);
 
                if (recs[i]->lrh_id == CANCELLED)
                        printf("NOT SET ");
 
                if (recs[i]->lrh_id == CANCELLED)
                        printf("NOT SET ");
@@ -668,7 +668,7 @@ static void print_records(struct llog_rec_hdr **recs,
                        break;
                case CHANGELOG_USER_REC:
                        printf("changelog_user record id:0x%x\n",
                        break;
                case CHANGELOG_USER_REC:
                        printf("changelog_user record id:0x%x\n",
-                              le32_to_cpu(recs[i]->lrh_id));
+                              __le32_to_cpu(recs[i]->lrh_id));
                        break;
                default:
                        printf("unknown type %x\n", lopt);
                        break;
                default:
                        printf("unknown type %x\n", lopt);
index 4d07027..f0c64dc 100644 (file)
@@ -201,12 +201,12 @@ int main(int argc, char *const argv[])
        }
 
        /* swab structure fields of interest */
        }
 
        /* swab structure fields of interest */
-       lsd.lsd_feature_compat = le32_to_cpu(lsd.lsd_feature_compat);
-       lsd.lsd_feature_incompat = le32_to_cpu(lsd.lsd_feature_incompat);
-       lsd.lsd_feature_rocompat = le32_to_cpu(lsd.lsd_feature_rocompat);
-       lsd.lsd_last_transno = le64_to_cpu(lsd.lsd_last_transno);
-       lsd.lsd_osd_index = le32_to_cpu(lsd.lsd_osd_index);
-       lsd.lsd_mount_count = le64_to_cpu(lsd.lsd_mount_count);
+       lsd.lsd_feature_compat = __le32_to_cpu(lsd.lsd_feature_compat);
+       lsd.lsd_feature_incompat = __le32_to_cpu(lsd.lsd_feature_incompat);
+       lsd.lsd_feature_rocompat = __le32_to_cpu(lsd.lsd_feature_rocompat);
+       lsd.lsd_last_transno = __le64_to_cpu(lsd.lsd_last_transno);
+       lsd.lsd_osd_index = __le32_to_cpu(lsd.lsd_osd_index);
+       lsd.lsd_mount_count = __le64_to_cpu(lsd.lsd_mount_count);
 
        /* display */
        printf("  uuid: %.40s\n", lsd.lsd_uuid);
 
        /* display */
        printf("  uuid: %.40s\n", lsd.lsd_uuid);
@@ -219,8 +219,8 @@ int main(int argc, char *const argv[])
 
        /* read client information */
        if (opt_client) {
 
        /* read client information */
        if (opt_client) {
-               lsd.lsd_client_start = le32_to_cpu(lsd.lsd_client_start);
-               lsd.lsd_client_size = le16_to_cpu(lsd.lsd_client_size);
+               lsd.lsd_client_start = __le32_to_cpu(lsd.lsd_client_start);
+               lsd.lsd_client_size = __le16_to_cpu(lsd.lsd_client_size);
                printf("  client_area_start: %u\n", lsd.lsd_client_start);
                printf("  client_area_size: %hu\n", lsd.lsd_client_size);
 
                printf("  client_area_start: %u\n", lsd.lsd_client_start);
                printf("  client_area_size: %hu\n", lsd.lsd_client_size);
 
@@ -253,11 +253,11 @@ int main(int argc, char *const argv[])
 
                        /* swab structure fields */
                        lcd.lcd_last_transno =
 
                        /* swab structure fields */
                        lcd.lcd_last_transno =
-                                       le64_to_cpu(lcd.lcd_last_transno);
-                       lcd.lcd_last_xid = le64_to_cpu(lcd.lcd_last_xid);
-                       lcd.lcd_last_result = le32_to_cpu(lcd.lcd_last_result);
-                       lcd.lcd_last_data = le32_to_cpu(lcd.lcd_last_data);
-                       lcd.lcd_generation = le32_to_cpu(lcd.lcd_generation);
+                                       __le64_to_cpu(lcd.lcd_last_transno);
+                       lcd.lcd_last_xid = __le64_to_cpu(lcd.lcd_last_xid);
+                       lcd.lcd_last_result = __le32_to_cpu(lcd.lcd_last_result);
+                       lcd.lcd_last_data = __le32_to_cpu(lcd.lcd_last_data);
+                       lcd.lcd_generation = __le32_to_cpu(lcd.lcd_generation);
 
                        /* display per-client data area */
                        printf("\n  %.40s:\n", lcd.lcd_uuid);
 
                        /* display per-client data area */
                        printf("\n  %.40s:\n", lcd.lcd_uuid);
@@ -271,13 +271,13 @@ int main(int argc, char *const argv[])
                        if (lcd.lcd_last_close_transno != 0 &&
                            lcd.lcd_last_close_xid != 0) {
                                lcd.lcd_last_close_transno =
                        if (lcd.lcd_last_close_transno != 0 &&
                            lcd.lcd_last_close_xid != 0) {
                                lcd.lcd_last_close_transno =
-                                       le64_to_cpu(lcd.lcd_last_close_transno);
+                                       __le64_to_cpu(lcd.lcd_last_close_transno);
                                lcd.lcd_last_close_xid =
                                lcd.lcd_last_close_xid =
-                                       le64_to_cpu(lcd.lcd_last_close_xid);
+                                       __le64_to_cpu(lcd.lcd_last_close_xid);
                                lcd.lcd_last_close_result =
                                lcd.lcd_last_close_result =
-                                       le32_to_cpu(lcd.lcd_last_close_result);
+                                       __le32_to_cpu(lcd.lcd_last_close_result);
                                lcd.lcd_last_close_data =
                                lcd.lcd_last_close_data =
-                                       le32_to_cpu(lcd.lcd_last_close_data);
+                                       __le32_to_cpu(lcd.lcd_last_close_data);
                                printf("    last_close_transation: %llu\n",
                                       lcd.lcd_last_close_transno);
                                printf("    last_close_xid: %llu\n",
                                printf("    last_close_transation: %llu\n",
                                       lcd.lcd_last_close_transno);
                                printf("    last_close_xid: %llu\n",
@@ -332,9 +332,9 @@ int main(int argc, char *const argv[])
                }
 
                /* check header */
                }
 
                /* check header */
-               lrh.lrh_magic = le32_to_cpu(lrh.lrh_magic);
-               lrh.lrh_header_size = le32_to_cpu(lrh.lrh_header_size);
-               lrh.lrh_reply_size = le32_to_cpu(lrh.lrh_reply_size);
+               lrh.lrh_magic = __le32_to_cpu(lrh.lrh_magic);
+               lrh.lrh_header_size = __le32_to_cpu(lrh.lrh_header_size);
+               lrh.lrh_reply_size = __le32_to_cpu(lrh.lrh_reply_size);
                if (lrh.lrh_magic != LRH_MAGIC) {
                        fprintf(stderr, "%s: invalid %s header: "
                                "lrh_magic=%08x expected %08x\n",
                if (lrh.lrh_magic != LRH_MAGIC) {
                        fprintf(stderr, "%s: invalid %s header: "
                                "lrh_magic=%08x expected %08x\n",
@@ -370,11 +370,11 @@ int main(int argc, char *const argv[])
                        }
 
                        /* display reply data */
                        }
 
                        /* display reply data */
-                       lrd.lrd_transno = le64_to_cpu(lrd.lrd_transno);
-                       lrd.lrd_xid = le64_to_cpu(lrd.lrd_xid);
-                       lrd.lrd_data = le64_to_cpu(lrd.lrd_data);
-                       lrd.lrd_result = le32_to_cpu(lrd.lrd_result);
-                       lrd.lrd_client_gen = le32_to_cpu(lrd.lrd_client_gen);
+                       lrd.lrd_transno = __le64_to_cpu(lrd.lrd_transno);
+                       lrd.lrd_xid = __le64_to_cpu(lrd.lrd_xid);
+                       lrd.lrd_data = __le64_to_cpu(lrd.lrd_data);
+                       lrd.lrd_result = __le32_to_cpu(lrd.lrd_result);
+                       lrd.lrd_client_gen = __le32_to_cpu(lrd.lrd_client_gen);
 
                        printf("  %lld:\n", slot);
                        printf("    client_generation: %u\n",
 
                        printf("  %lld:\n", slot);
                        printf("    client_generation: %u\n",