android_vendor.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * android_vendor.h - Android vendor data
  4. *
  5. * Copyright 2020 Google LLC
  6. *
  7. * These macros are to be used to reserve space in kernel data structures
  8. * for use by vendor modules.
  9. *
  10. * These macros should be used before the kernel abi is "frozen".
  11. * Fields can be added to various kernel structures that need space
  12. * for functionality implemented in vendor modules. The use of
  13. * these fields is vendor specific.
  14. */
  15. #ifndef _ANDROID_VENDOR_H
  16. #define _ANDROID_VENDOR_H
  17. /*
  18. * ANDROID_VENDOR_DATA
  19. * Reserve some "padding" in a structure for potential future use.
  20. * This normally placed at the end of a structure.
  21. * number: the "number" of the padding variable in the structure. Start with
  22. * 1 and go up.
  23. *
  24. * ANDROID_VENDOR_DATA_ARRAY
  25. * Same as ANDROID_VENDOR_DATA but allocates an array of u64 with
  26. * the specified size
  27. */
  28. #ifdef CONFIG_ANDROID_VENDOR_OEM_DATA
  29. #define ANDROID_VENDOR_DATA(n) u64 android_vendor_data##n
  30. #define ANDROID_VENDOR_DATA_ARRAY(n, s) u64 android_vendor_data##n[s]
  31. #define ANDROID_OEM_DATA(n) u64 android_oem_data##n
  32. #define ANDROID_OEM_DATA_ARRAY(n, s) u64 android_oem_data##n[s]
  33. #define android_init_vendor_data(p, n) \
  34. memset(&p->android_vendor_data##n, 0, sizeof(p->android_vendor_data##n))
  35. #define android_init_oem_data(p, n) \
  36. memset(&p->android_oem_data##n, 0, sizeof(p->android_oem_data##n))
  37. #else
  38. #define ANDROID_VENDOR_DATA(n)
  39. #define ANDROID_VENDOR_DATA_ARRAY(n, s)
  40. #define ANDROID_OEM_DATA(n)
  41. #define ANDROID_OEM_DATA_ARRAY(n, s)
  42. #define android_init_vendor_data(p, n)
  43. #define android_init_oem_data(p, n)
  44. #endif
  45. #endif /* _ANDROID_VENDOR_H */