/usr/include/ocfs2/byteorder.h is in ocfs2-tools-dev 1.8.5-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /* -*- mode: c; c-basic-offset: 8; -*-
* vim: noexpandtab sw=8 ts=8 sts=0:
*
* byteorder.h
*
* Byteswapping!
*
* Copyright (C) 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License, version 2, 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 for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*
* Authors: Joel Becker
*/
#ifndef _BYTEORDER_H
#define _BYTEORDER_H
#include <endian.h>
#include <byteswap.h>
#include <stdint.h>
/*
* All OCFS2 on-disk values are in little endian, except for jbd's journal
* fields which it takes care of itself.
*/
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define cpu_is_little_endian 1
# ifndef cpu_to_le16
# define cpu_to_le16(x) ((uint16_t)(x))
# endif
# ifndef le16_to_cpu
# define le16_to_cpu(x) ((uint16_t)(x))
# endif
# ifndef cpu_to_le32
# define cpu_to_le32(x) ((uint32_t)(x))
# endif
# ifndef le32_to_cpu
# define le32_to_cpu(x) ((uint32_t)(x))
# endif
# ifndef cpu_to_le64
# define cpu_to_le64(x) ((uint64_t)(x))
# endif
# ifndef le64_to_cpu
# define le64_to_cpu(x) ((uint64_t)(x))
# endif
# ifndef cpu_to_be16
# define cpu_to_be16(x) ((uint16_t)bswap_16(x))
# endif
# ifndef be16_to_cpu
# define be16_to_cpu(x) ((uint16_t)bswap_16(x))
# endif
# ifndef cpu_to_be32
# define cpu_to_be32(x) ((uint32_t)bswap_32(x))
# endif
# ifndef be32_to_cpu
# define be32_to_cpu(x) ((uint32_t)bswap_32(x))
# endif
# ifndef cpu_to_be64
# define cpu_to_be64(x) ((uint64_t)bswap_64(x))
# endif
# ifndef be64_to_cpu
# define be64_to_cpu(x) ((uint64_t)bswap_64(x))
# endif
#elif __BYTE_ORDER == __BIG_ENDIAN
#define cpu_is_little_endian 0
# ifndef cpu_to_le16
# define cpu_to_le16(x) ((uint16_t)bswap_16(x))
# endif
# ifndef le16_to_cpu
# define le16_to_cpu(x) ((uint16_t)bswap_16(x))
# endif
# ifndef cpu_to_le32
# define cpu_to_le32(x) ((uint32_t)bswap_32(x))
# endif
# ifndef le32_to_cpu
# define le32_to_cpu(x) ((uint32_t)bswap_32(x))
# endif
# ifndef cpu_to_le64
# define cpu_to_le64(x) ((uint64_t)bswap_64(x))
# endif
# ifndef le64_to_cpu
# define le64_to_cpu(x) ((uint64_t)bswap_64(x))
# endif
# ifndef cpu_to_be16
# define cpu_to_be16(x) ((uint16_t)(x))
# endif
# ifndef be16_to_cpu
# define be16_to_cpu(x) ((uint16_t)(x))
# endif
# ifndef cpu_to_be32
# define cpu_to_be32(x) ((uint32_t)(x))
# endif
# ifndef be32_to_cpu
# define be32_to_cpu(x) ((uint32_t)(x))
# endif
# ifndef cpu_to_be64
# define cpu_to_be64(x) ((uint64_t)(x))
# endif
# ifndef be64_to_cpu
# define be64_to_cpu(x) ((uint64_t)(x))
# endif
#else
# error Invalid byte order __BYTE_ORDER
#endif /* __BYTE_ORDER */
#define cpu_is_big_endian (!cpu_is_little_endian)
#endif /* _BYTEORDER_H */
|