squashfs-bsd.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. diff -Nur squashfs4.0.orig/squashfs-tools/mksquashfs.c squashfs4.0/squashfs-tools/mksquashfs.c
  2. --- squashfs4.0.orig/squashfs-tools/mksquashfs.c Sun Apr 5 23:22:48 2009
  3. +++ squashfs4.0/squashfs-tools/mksquashfs.c Tue Dec 29 18:23:15 2009
  4. @@ -48,16 +48,9 @@
  5. #include <regex.h>
  6. #include <fnmatch.h>
  7. -#ifndef linux
  8. -#define __BYTE_ORDER BYTE_ORDER
  9. -#define __BIG_ENDIAN BIG_ENDIAN
  10. -#define __LITTLE_ENDIAN LITTLE_ENDIAN
  11. -#include <sys/sysctl.h>
  12. -#else
  13. -#include <endian.h>
  14. -#include <sys/sysinfo.h>
  15. -#endif
  16. +#include <sys/param.h>
  17. +
  18. #include "squashfs_fs.h"
  19. #include "squashfs_swap.h"
  20. #include "mksquashfs.h"
  21. @@ -3688,23 +3681,9 @@
  22. signal(SIGUSR1, sigusr1_handler);
  23. if(processors == -1) {
  24. -#ifndef linux
  25. - int mib[2];
  26. - size_t len = sizeof(processors);
  27. -
  28. - mib[0] = CTL_HW;
  29. -#ifdef HW_AVAILCPU
  30. - mib[1] = HW_AVAILCPU;
  31. +#if defined(BSD)
  32. + processors = 1;
  33. #else
  34. - mib[1] = HW_NCPU;
  35. -#endif
  36. -
  37. - if(sysctl(mib, 2, &processors, &len, NULL, 0) == -1) {
  38. - ERROR("Failed to get number of available processors. "
  39. - "Defaulting to 1\n");
  40. - processors = 1;
  41. - }
  42. -#else
  43. processors = get_nprocs();
  44. #endif
  45. }
  46. @@ -3974,9 +3953,15 @@
  47. int match = use_regex ?
  48. regexec(path->name[i].preg, name, (size_t) 0,
  49. NULL, 0) == 0 :
  50. +#if defined(BSD)
  51. fnmatch(path->name[i].name, name,
  52. + FNM_PATHNAME|FNM_PERIOD) ==
  53. + 0;
  54. +#else
  55. + fnmatch(path->name[i].name, name,
  56. FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
  57. 0;
  58. +#endif
  59. if(match && path->name[i].paths == NULL) {
  60. /* match on a leaf component, any subdirectories
  61. diff -Nur squashfs4.0.orig/squashfs-tools/pseudo.c squashfs4.0/squashfs-tools/pseudo.c
  62. --- squashfs4.0.orig/squashfs-tools/pseudo.c Sun Apr 5 04:01:58 2009
  63. +++ squashfs4.0/squashfs-tools/pseudo.c Tue Dec 29 18:07:33 2009
  64. @@ -30,6 +30,11 @@
  65. #include <string.h>
  66. #include <stdlib.h>
  67. #include <sys/types.h>
  68. +#include <sys/param.h>
  69. +
  70. +#if defined(BSD)
  71. +#include <sys/stat.h>
  72. +#endif
  73. #include "pseudo.h"
  74. diff -Nur squashfs4.0.orig/squashfs-tools/unsquashfs.c squashfs4.0/squashfs-tools/unsquashfs.c
  75. --- squashfs4.0.orig/squashfs-tools/unsquashfs.c Sun Apr 5 23:23:06 2009
  76. +++ squashfs4.0/squashfs-tools/unsquashfs.c Tue Dec 29 18:25:56 2009
  77. @@ -21,6 +21,8 @@
  78. * unsquashfs.c
  79. */
  80. +#include <sys/param.h>
  81. +
  82. #include "unsquashfs.h"
  83. #include "squashfs_swap.h"
  84. #include "squashfs_compat.h"
  85. @@ -1193,10 +1195,17 @@
  86. struct pathname *path = paths->path[n];
  87. for(i = 0; i < path->names; i++) {
  88. int match = use_regex ?
  89. +#if defined(BSD)
  90. regexec(path->name[i].preg, name, (size_t) 0,
  91. NULL, 0) == 0 : fnmatch(path->name[i].name,
  92. + name, FNM_PATHNAME|FNM_PERIOD) ==
  93. + 0;
  94. +#else
  95. + regexec(path->name[i].preg, name, (size_t) 0,
  96. + NULL, 0) == 0 : fnmatch(path->name[i].name,
  97. name, FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
  98. 0;
  99. +#endif
  100. if(match && path->name[i].paths == NULL)
  101. /*
  102. * match on a leaf component, any subdirectories
  103. @@ -1795,21 +1804,7 @@
  104. if(processors == -1) {
  105. #ifndef linux
  106. - int mib[2];
  107. - size_t len = sizeof(processors);
  108. -
  109. - mib[0] = CTL_HW;
  110. -#ifdef HW_AVAILCPU
  111. - mib[1] = HW_AVAILCPU;
  112. -#else
  113. - mib[1] = HW_NCPU;
  114. -#endif
  115. -
  116. - if(sysctl(mib, 2, &processors, &len, NULL, 0) == -1) {
  117. - ERROR("Failed to get number of available processors. "
  118. - "Defaulting to 1\n");
  119. - processors = 1;
  120. - }
  121. + processors = 1;
  122. #else
  123. processors = get_nprocs();
  124. #endif