uaccess.h 702 B

1234567891011121314151617181920212223242526
  1. #ifndef _ASM_GENERIC_UACCESS_H_
  2. #define _ASM_GENERIC_UACCESS_H_
  3. /*
  4. * This macro should be used instead of __get_user() when accessing
  5. * values at locations that are not known to be aligned.
  6. */
  7. #define __get_user_unaligned(x, ptr) \
  8. ({ \
  9. __typeof__ (*(ptr)) __x; \
  10. __copy_from_user(&__x, (ptr), sizeof(*(ptr))) ? -EFAULT : 0; \
  11. (x) = __x; \
  12. })
  13. /*
  14. * This macro should be used instead of __put_user() when accessing
  15. * values at locations that are not known to be aligned.
  16. */
  17. #define __put_user_unaligned(x, ptr) \
  18. ({ \
  19. __typeof__ (*(ptr)) __x = (x); \
  20. __copy_to_user((ptr), &__x, sizeof(*(ptr))) ? -EFAULT : 0; \
  21. })
  22. #endif /* _ASM_GENERIC_UACCESS_H */