jffs2-user.h 901 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * $Id: jffs2-user.h,v 1.1.1.1 2007/06/12 07:27:15 eyryu Exp $
  3. *
  4. * JFFS2 definitions for use in user space only
  5. */
  6. #ifndef __JFFS2_USER_H__
  7. #define __JFFS2_USER_H__
  8. /* This file is blessed for inclusion by userspace */
  9. #include <linux/jffs2.h>
  10. #include <endian.h>
  11. #include <byteswap.h>
  12. #undef cpu_to_je16
  13. #undef cpu_to_je32
  14. #undef cpu_to_jemode
  15. #undef je16_to_cpu
  16. #undef je32_to_cpu
  17. #undef jemode_to_cpu
  18. extern int target_endian;
  19. #define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
  20. #define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
  21. #define cpu_to_je16(x) ((jint16_t){t16(x)})
  22. #define cpu_to_je32(x) ((jint32_t){t32(x)})
  23. #define cpu_to_jemode(x) ((jmode_t){t32(x)})
  24. #define je16_to_cpu(x) (t16((x).v16))
  25. #define je32_to_cpu(x) (t32((x).v32))
  26. #define jemode_to_cpu(x) (t32((x).m))
  27. #endif /* __JFFS2_USER_H__ */