~ubuntu-branches/ubuntu/natty/linux-backports-modules-2.6.38/natty-updates

« back to all changes in this revision

Viewing changes to updates/cw-2.6.39/include/linux/unaligned/packed_struct.h

  • Committer: Bazaar Package Importer
  • Author(s): Tim Gardner, Tim Gardner
  • Date: 2011-06-08 10:44:09 UTC
  • Revision ID: james.westby@ubuntu.com-20110608104409-fnl8carkdo15bwsz
Tags: 2.6.38-10.6
[ Tim Gardner ]

Shorten compat-wireless package name to cw to accomodate
CDROM file name length restrictions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H
 
2
#define _LINUX_UNALIGNED_PACKED_STRUCT_H
 
3
 
 
4
#include <linux/kernel.h>
 
5
 
 
6
struct __una_u16 { u16 x __attribute__((packed)); };
 
7
struct __una_u32 { u32 x __attribute__((packed)); };
 
8
struct __una_u64 { u64 x __attribute__((packed)); };
 
9
 
 
10
static inline u16 __get_unaligned_cpu16(const void *p)
 
11
{
 
12
        const struct __una_u16 *ptr = (const struct __una_u16 *)p;
 
13
        return ptr->x;
 
14
}
 
15
 
 
16
static inline u32 __get_unaligned_cpu32(const void *p)
 
17
{
 
18
        const struct __una_u32 *ptr = (const struct __una_u32 *)p;
 
19
        return ptr->x;
 
20
}
 
21
 
 
22
static inline u64 __get_unaligned_cpu64(const void *p)
 
23
{
 
24
        const struct __una_u64 *ptr = (const struct __una_u64 *)p;
 
25
        return ptr->x;
 
26
}
 
27
 
 
28
static inline void __put_unaligned_cpu16(u16 val, void *p)
 
29
{
 
30
        struct __una_u16 *ptr = (struct __una_u16 *)p;
 
31
        ptr->x = val;
 
32
}
 
33
 
 
34
static inline void __put_unaligned_cpu32(u32 val, void *p)
 
35
{
 
36
        struct __una_u32 *ptr = (struct __una_u32 *)p;
 
37
        ptr->x = val;
 
38
}
 
39
 
 
40
static inline void __put_unaligned_cpu64(u64 val, void *p)
 
41
{
 
42
        struct __una_u64 *ptr = (struct __una_u64 *)p;
 
43
        ptr->x = val;
 
44
}
 
45
 
 
46
#endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */