~ubuntu-branches/ubuntu/warty/linux-ntfs/warty

« back to all changes in this revision

Viewing changes to include/endians.h

  • Committer: Bazaar Package Importer
  • Author(s): David Martínez Moreno
  • Date: 2004-03-12 00:03:30 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040312000330-xv94ve7yg6bwplwu
Tags: 1.9.0-1
* New upstream release:
  - Merged Debian diff with upstream.
  - Fixed mkntfs for large volumes.
  - Add relocation support to ntfsresize. This modifies the command line
    options a little as well as the returned output so applications using
    ntfsresize might need modifications before they will work with the
    updated ntfsresize.
  - Revamped the build system completely.
  - Provide always own byteswap constant versions in order to avoid the mess
    that some architectures define only some of them (read m68k, ppc,
    mips...).
  - Made the warnings on 64 bit architectures go away.
  - Fixed lots of typos in the documentation.
  - Lots of fixes in general.
* Resolved several FTBFS (Fail To Build From Source) bugs (closes: #226989,
  #234104). With this, all the architectures go in sync again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * $Id: endians.h,v 1.4 2001/11/09 19:24:23 antona Exp $
3
 
 *
4
 
 * endians.h - Definitions related to handling of byte ordering. Part of the
5
 
 *             Linux-NTFS project.
6
 
 *             
7
 
 * Copyright (c) 2000,2001 Anton Altaparmakov.
8
 
 *
9
 
 * This program/include file is free software; you can redistribute it and/or
10
 
 * modify it under the terms of the GNU General Public License as published
11
 
 * by the Free Software Foundation; either version 2 of the License, or
12
 
 * (at your option) any later version.
13
 
 *
14
 
 * This program/include file is distributed in the hope that it will be 
15
 
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
16
 
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
 * GNU General Public License for more details.
18
 
 *
19
 
 * You should have received a copy of the GNU General Public License
20
 
 * along with this program (in the main directory of the Linux-NTFS 
21
 
 * distribution in the file COPYING); if not, write to the Free Software
22
 
 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
 
 */
24
 
 
25
 
/* 
26
 
 * Notes:
27
 
 *
28
 
 *      We define the conversion functions including typecasts since the
29
 
 * defaults don't necessarily perform appropriate typecasts.
30
 
 *      Also, using our own functions means that we can change them if it
31
 
 * turns out that we do need to use the unaligned access macros on 
32
 
 * architectures requirering aligned memory accesses...
33
 
 */
34
 
 
35
 
#ifndef ENDIANS_H
36
 
#define ENDIANS_H
37
 
 
38
 
#include <asm/byteorder.h>
39
 
 
40
 
#include "types.h"
41
 
 
42
 
/* Unsigned from LE to CPU conversion. */
43
 
 
44
 
#define le16_to_cpu(x)          (__u16)__le16_to_cpu((__u16)(x))
45
 
#define le32_to_cpu(x)          (__u32)__le32_to_cpu((__u32)(x))
46
 
#define le64_to_cpu(x)          (__u64)__le64_to_cpu((__u64)(x))
47
 
 
48
 
#define le16_to_cpup(x)         (__u16)__le16_to_cpu(*(__u16*)(x))
49
 
#define le32_to_cpup(x)         (__u32)__le32_to_cpu(*(__u32*)(x))
50
 
#define le64_to_cpup(x)         (__u64)__le64_to_cpu(*(__u64*)(x))
51
 
 
52
 
/* Signed from LE to CPU conversion. */
53
 
 
54
 
#define sle16_to_cpu(x)         (__s16)__le16_to_cpu((__s16)(x))
55
 
#define sle32_to_cpu(x)         (__s32)__le32_to_cpu((__s32)(x))
56
 
#define sle64_to_cpu(x)         (__s64)__le64_to_cpu((__s64)(x))
57
 
 
58
 
#define sle16_to_cpup(x)        (__s16)__le16_to_cpu(*(__s16*)(x))
59
 
#define sle32_to_cpup(x)        (__s32)__le32_to_cpu(*(__s32*)(x))
60
 
#define sle64_to_cpup(x)        (__s64)__le64_to_cpu(*(__s64*)(x))
61
 
 
62
 
/* Unsigned from CPU to LE conversion. */
63
 
 
64
 
#define cpu_to_le16(x)          (__u16)__cpu_to_le16((__u16)(x))
65
 
#define cpu_to_le32(x)          (__u32)__cpu_to_le32((__u32)(x))
66
 
#define cpu_to_le64(x)          (__u64)__cpu_to_le64((__u64)(x))
67
 
 
68
 
#define cpu_to_le16p(x)         (__u16)__cpu_to_le16(*(__u16*)(x))
69
 
#define cpu_to_le32p(x)         (__u32)__cpu_to_le32(*(__u32*)(x))
70
 
#define cpu_to_le64p(x)         (__u64)__cpu_to_le64(*(__u64*)(x))
71
 
 
72
 
/* Signed from CPU to LE conversion. */
73
 
 
74
 
#define scpu_to_le16(x)         (__s16)__cpu_to_le16((__s16)(x))
75
 
#define scpu_to_le32(x)         (__s32)__cpu_to_le32((__s32)(x))
76
 
#define scpu_to_le64(x)         (__s64)__cpu_to_le64((__s64)(x))
77
 
 
78
 
#define scpu_to_le16p(x)        (__s16)__cpu_to_le16(*(__s16*)(x))
79
 
#define scpu_to_le32p(x)        (__s32)__cpu_to_le32(*(__s32*)(x))
80
 
#define scpu_to_le64p(x)        (__s64)__cpu_to_le64(*(__s64*)(x))
81
 
 
82
 
/*
83
 
 * Constant endianness conversion defines.
84
 
 */
85
 
#define const_le16_to_cpu(x)    __constant_le16_to_cpu(x)
86
 
#define const_le32_to_cpu(x)    __constant_le32_to_cpu(x)
87
 
#define const_le64_to_cpu(x)    __constant_le64_to_cpu(x)
88
 
 
89
 
#define const_cpu_to_le16(x)    __constant_cpu_to_le16(x)
90
 
#define const_cpu_to_le32(x)    __constant_cpu_to_le32(x)
91
 
#define const_cpu_to_le64(x)    __constant_cpu_to_le64(x)
92
 
 
93
 
#endif /* defined ENDIANS_H */
94