Commit 7aae1934 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

headers: types.h -- Move BITS_PER_LONG to own header

This diet types.h and allows to include BITS_PER_LONG
only where really needed. It makes BITS_PER_LONG definition
close to one used in kernel.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 0109ea2b
#ifndef __CR_BITOPS_H__ #ifndef __CR_BITOPS_H__
#define __CR_BITOPS_H__ #define __CR_BITOPS_H__
#include "asm/bitsperlong.h"
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#define BITS_PER_LONG (8 * sizeof(long))
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG) #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
#define DECLARE_BITMAP(name, bits) \ #define DECLARE_BITMAP(name, bits) \
......
#ifndef __CR_BITSPERLONG_H__
#define __CR_BITSPERLONG_H__
#define BITS_PER_LONG 32
#endif /* __CR_BITSPERLONG_H__ */
...@@ -235,8 +235,6 @@ typedef uint32_t auxv_t; ...@@ -235,8 +235,6 @@ typedef uint32_t auxv_t;
static inline void *decode_pointer(uint64_t v) { return (void*)(uint32_t)v; } static inline void *decode_pointer(uint64_t v) { return (void*)(uint32_t)v; }
static inline uint64_t encode_pointer(void *p) { return (uint32_t)p; } static inline uint64_t encode_pointer(void *p) { return (uint32_t)p; }
#define BITS_PER_LONG 32
typedef struct { typedef struct {
struct user_vfp ufp; struct user_vfp ufp;
struct user_vfp_exc ufp_exc; struct user_vfp_exc ufp_exc;
......
#ifndef __CR_BITOPS_H__ #ifndef __CR_BITOPS_H__
#define __CR_BITOPS_H__ #define __CR_BITOPS_H__
#include "asm/bitsperlong.h"
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#define BITS_PER_LONG (8 * sizeof(long))
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG) #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
#define DECLARE_BITMAP(name, bits) \ #define DECLARE_BITMAP(name, bits) \
......
#ifndef __CR_BITSPERLONG_H__
#define __CR_BITSPERLONG_H__
#ifdef CONFIG_X86_64
# define BITS_PER_LONG 64
#else
# define BITS_PER_LONG 32
#endif
#endif /* __CR_BITSPERLONG_H__ */
...@@ -258,8 +258,6 @@ typedef uint64_t auxv_t; ...@@ -258,8 +258,6 @@ typedef uint64_t auxv_t;
typedef UserX86RegsEntry UserRegsEntry; typedef UserX86RegsEntry UserRegsEntry;
#define BITS_PER_LONG 64
static inline uint64_t encode_pointer(void *p) { return (uint64_t)p; } static inline uint64_t encode_pointer(void *p) { return (uint64_t)p; }
static inline void *decode_pointer(uint64_t v) { return (void*)v; } static inline void *decode_pointer(uint64_t v) { return (void*)v; }
......
#include <stdarg.h> #include <stdarg.h>
#include "asm/bitsperlong.h"
#include "syscall.h" #include "syscall.h"
#include "log.h" #include "log.h"
#include "log-levels.h" #include "log-levels.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment