OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.8 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../util-linux/0001-replace-container_of.patch
  5. # Copyright (C) 2013 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. This patch is fixing build issues by using a more simple but reasonable
  17. container_of function without abusing __typeof__.
  18. Besides that it is removing code duplication because the list_entry function
  19. macro is the same as container_of.
  20. Without the patch we are getting following error:
  21. ------------------------------------------------------------------------------
  22. sys-utils/prlimit.c: In function 'show_limits':
  23. sys-utils/prlimit.c:299:25: error: expected declaration specifiers or '...' before '(' token
  24. sys-utils/prlimit.c:299:25: error: '__mptr' undeclared (first use in this function)
  25. sys-utils/prlimit.c:299:25: note: each undeclared identifier is reported only once for each function it appears in
  26. sys-utils/prlimit.c: In function 'do_prlimit':
  27. sys-utils/prlimit.c:336:25: error: expected declaration specifiers or '...' before '(' token
  28. sys-utils/prlimit.c:336:25: error: '__mptr' undeclared (first use in this function
  29. ------------------------------------------------------------------------------
  30. --- util-linux-2.23.2/include/c.h.orig 2013-08-27 10:32:00.890399403 +0200
  31. +++ util-linux-2.23.2/include/c.h 2013-08-27 10:41:56.872040920 +0200
  32. @@ -115,9 +115,8 @@
  33. #endif
  34. #ifndef container_of
  35. -#define container_of(ptr, type, member) ({ \
  36. - const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
  37. - (type *)( (char *)__mptr - offsetof(type,member) );})
  38. +#define container_of(ptr, type, member) \
  39. + ((type *)((char *)(ptr) - offsetof(type, member)))
  40. #endif
  41. #ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
  42. --- util-linux-2.23.2/include/list.h.orig 2013-08-27 10:35:19.025606381 +0200
  43. +++ util-linux-2.23.2/include/list.h 2013-08-27 10:36:09.172435338 +0200
  44. @@ -166,10 +166,7 @@
  45. * @type: the type of the struct this is embedded in.
  46. * @member: the name of the list_struct within the struct.
  47. */
  48. -#define list_entry(ptr, type, member) ({ \
  49. - const typeof( ((type *)0)->member ) *__mptr = (ptr); \
  50. - (type *)( (char *)__mptr - offsetof(type,member) );})
  51. -
  52. +#define list_entry container_of
  53. #define list_first_entry(head, type, member) \
  54. ((head) && (head)->next != (head) ? list_entry((head)->next, type, member) : NULL)