Skip to content

Commit

Permalink
byteorder: move le32_add_cpu & friends from OCFS2 to core
Browse files Browse the repository at this point in the history
This patchset moves le*_add_cpu and be*_add_cpu functions from OCFS2 to core
header (1st), converts ext3 filesystem to this API (2nd) and replaces XFS
different named functions with new ones (3rd).

There are many places where these functions will be useful.  Just look at:
grep -r 'cpu_to_[ble12346]*([ble12346]*_to_cpu.*[-+]' linux-src/ Patch for
ext3 is an example how conversions will probably look like.

This patch:

- move inline functions which add native byte order variable to
  little/big endian variable to core header
  * le16_add_cpu(__le16 *var, u16 val)
  * le32_add_cpu(__le32 *var, u32 val)
  * le64_add_cpu(__le64 *var, u64 val)
  * be32_add_cpu(__be32 *var, u32 val)
- add for completeness:
  * be16_add_cpu(__be16 *var, u16 val)
  * be64_add_cpu(__be64 *var, u64 val)

Signed-off-by: Marcin Slusarz <[email protected]>
Acked-by: Mark Fasheh <[email protected]>
Cc: David Chinner <[email protected]>
Cc: Timothy Shimmin <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
mslusarz authored and Linus Torvalds committed Feb 8, 2008
1 parent 2004dc8 commit 8b5f688
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 78 deletions.
30 changes: 0 additions & 30 deletions fs/ocfs2/cluster/endian.h

This file was deleted.

1 change: 0 additions & 1 deletion fs/ocfs2/cluster/nodemanager.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <linux/sysctl.h>
#include <linux/configfs.h>

#include "endian.h"
#include "tcp.h"
#include "nodemanager.h"
#include "heartbeat.h"
Expand Down
1 change: 0 additions & 1 deletion fs/ocfs2/dlm/dlmast.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "cluster/heartbeat.h"
#include "cluster/nodemanager.h"
#include "cluster/tcp.h"
#include "cluster/endian.h"

#include "dlmapi.h"
#include "dlmcommon.h"
Expand Down
45 changes: 0 additions & 45 deletions fs/ocfs2/endian.h

This file was deleted.

1 change: 0 additions & 1 deletion fs/ocfs2/ocfs2.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "dlm/dlmapi.h"

#include "ocfs2_fs.h"
#include "endian.h"
#include "ocfs2_lockid.h"

/* Most user visible OCFS2 inodes will have very few pieces of
Expand Down
30 changes: 30 additions & 0 deletions include/linux/byteorder/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,36 @@
#define htons(x) ___htons(x)
#define ntohs(x) ___ntohs(x)

static inline void le16_add_cpu(__le16 *var, u16 val)
{
*var = cpu_to_le16(le16_to_cpu(*var) + val);
}

static inline void le32_add_cpu(__le32 *var, u32 val)
{
*var = cpu_to_le32(le32_to_cpu(*var) + val);
}

static inline void le64_add_cpu(__le64 *var, u64 val)
{
*var = cpu_to_le64(le64_to_cpu(*var) + val);
}

static inline void be16_add_cpu(__be16 *var, u16 val)
{
*var = cpu_to_be16(be16_to_cpu(*var) + val);
}

static inline void be32_add_cpu(__be32 *var, u32 val)
{
*var = cpu_to_be32(be32_to_cpu(*var) + val);
}

static inline void be64_add_cpu(__be64 *var, u64 val)
{
*var = cpu_to_be64(be64_to_cpu(*var) + val);
}

#endif /* KERNEL */

#endif /* _LINUX_BYTEORDER_GENERIC_H */

0 comments on commit 8b5f688

Please sign in to comment.