Skip to content
Permalink
Browse files

Add FreeBSD support to ZoL

- Import FreeBSD specific parts
- Update tests to work on FreeBSD

Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Co-authored-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>

Requires-builders: amazon2, debian10, freebsd12, freebsd13, style

TEST_ZTEST_SKIP="yes"
  • Loading branch information
mattmacy authored and freqlabs committed Jan 4, 2019
1 parent 2476f10 commit ba5bc101c389cd2ced9eec21acbcb96d5737734b
Showing with 48,416 additions and 299 deletions.
  1. +4 −1 .github/suppressions.txt
  2. +5 −0 .gitignore
  3. +1 −0 Makefile.am
  4. +2 −2 cmd/Makefile.am
  5. +7 −0 cmd/zpool/Makefile.am
  6. +136 −0 cmd/zpool/os/freebsd/zpool_vdev_os.c
  7. +13 −5 cmd/zpool/zpool.d/iostat
  8. +27 −2 config/Rules.am
  9. +2 −1 config/always-arch.m4
  10. +25 −4 config/always-compiler-options.m4
  11. +24 −22 config/kernel.m4
  12. +1 −1 config/toolchain-simd.m4
  13. +9 −0 config/user-libfetch.m4
  14. +8 −6 config/user.m4
  15. +22 −11 config/zfs-build.m4
  16. +12 −0 configure.ac
  17. +4 −1 contrib/Makefile.am
  18. +4 −1 etc/Makefile.am
  19. +3 −0 include/os/Makefile.am
  20. +1 −0 include/os/freebsd/Makefile.am
  21. +5 −0 include/os/freebsd/linux/Makefile.am
  22. +101 −0 include/os/freebsd/linux/compiler.h
  23. +81 −0 include/os/freebsd/linux/types.h
  24. +1 −0 include/os/freebsd/spl/Makefile.am
  25. +4 −0 include/os/freebsd/spl/acl/Makefile.am
  26. +68 −0 include/os/freebsd/spl/acl/acl_common.h
  27. +8 −0 include/os/freebsd/spl/rpc/Makefile.am
  28. +71 −0 include/os/freebsd/spl/rpc/xdr.h
  29. +77 −0 include/os/freebsd/spl/sys/Makefile.am
  30. +315 −0 include/os/freebsd/spl/sys/acl.h
  31. +61 −0 include/os/freebsd/spl/sys/acl_impl.h
  32. +188 −0 include/os/freebsd/spl/sys/atomic.h
  33. +98 −0 include/os/freebsd/spl/sys/byteorder.h
  34. +215 −0 include/os/freebsd/spl/sys/callb.h
  35. +364 −0 include/os/freebsd/spl/sys/ccompile.h
  36. +133 −0 include/os/freebsd/spl/sys/cmn_err.h
  37. +164 −0 include/os/freebsd/spl/sys/condvar.h
  38. +48 −0 include/os/freebsd/spl/sys/console.h
  39. +192 −0 include/os/freebsd/spl/sys/cred.h
  40. +47 −0 include/os/freebsd/spl/sys/ctype.h
  41. +168 −0 include/os/freebsd/spl/sys/debug.h
  42. +45 −0 include/os/freebsd/spl/sys/dirent.h
  43. +40 −0 include/os/freebsd/spl/sys/disp.h
  44. +484 −0 include/os/freebsd/spl/sys/dkio.h
  45. +268 −0 include/os/freebsd/spl/sys/dklabel.h
  46. +40 −0 include/os/freebsd/spl/sys/dnlc.h
  47. +42 −0 include/os/freebsd/spl/sys/endian.h
  48. +78 −0 include/os/freebsd/spl/sys/extdirent.h
  49. +54 −0 include/os/freebsd/spl/sys/file.h
  50. +6 −0 include/os/freebsd/spl/sys/fm/Makefile.am
  51. +4 −0 include/os/freebsd/spl/sys/fm/fs/Makefile.am
  52. +98 −0 include/os/freebsd/spl/sys/fm/fs/zfs.h
  53. +369 −0 include/os/freebsd/spl/sys/fm/protocol.h
  54. +34 −0 include/os/freebsd/spl/sys/freebsd_rwlock.h
  55. +1 −0 include/os/freebsd/spl/sys/inttypes.h
  56. +697 −0 include/os/freebsd/spl/sys/isa_defs.h
  57. +104 −0 include/os/freebsd/spl/sys/kmem.h
  58. +49 −0 include/os/freebsd/spl/sys/kmem_cache.h
  59. +236 −0 include/os/freebsd/spl/sys/kstat.h
  60. +67 −0 include/os/freebsd/spl/sys/list.h
  61. +53 −0 include/os/freebsd/spl/sys/list_impl.h
  62. +44 −0 include/os/freebsd/spl/sys/lock.h
  63. +58 −0 include/os/freebsd/spl/sys/misc.h
  64. +59 −0 include/os/freebsd/spl/sys/mod_os.h
  65. +1 −0 include/os/freebsd/spl/sys/mode.h
  66. +41 −0 include/os/freebsd/spl/sys/mount.h
  67. +79 −0 include/os/freebsd/spl/sys/mutex.h
  68. +41 −0 include/os/freebsd/spl/sys/param.h
  69. +83 −0 include/os/freebsd/spl/sys/policy.h
  70. +125 −0 include/os/freebsd/spl/sys/proc.h
  71. +139 −0 include/os/freebsd/spl/sys/processor.h
  72. +64 −0 include/os/freebsd/spl/sys/procfs_list.h
  73. +48 −0 include/os/freebsd/spl/sys/random.h
  74. +103 −0 include/os/freebsd/spl/sys/rwlock.h
  75. +45 −0 include/os/freebsd/spl/sys/sdt.h
  76. +84 −0 include/os/freebsd/spl/sys/sid.h
  77. +70 −0 include/os/freebsd/spl/sys/sig.h
  78. +43 −0 include/os/freebsd/spl/sys/simd.h
  79. +418 −0 include/os/freebsd/spl/sys/simd_x86.h
  80. +83 −0 include/os/freebsd/spl/sys/spl_condvar.h
  81. +39 −0 include/os/freebsd/spl/sys/string.h
  82. +1 −0 include/os/freebsd/spl/sys/strings.h
  83. +69 −0 include/os/freebsd/spl/sys/sunddi.h
  84. +469 −0 include/os/freebsd/spl/sys/sysmacros.h
  85. +34 −0 include/os/freebsd/spl/sys/systeminfo.h
  86. +50 −0 include/os/freebsd/spl/sys/systm.h
  87. +119 −0 include/os/freebsd/spl/sys/taskq.h
  88. +34 −0 include/os/freebsd/spl/sys/thread.h
  89. +101 −0 include/os/freebsd/spl/sys/time.h
  90. +39 −0 include/os/freebsd/spl/sys/timer.h
  91. +1 −0 include/os/freebsd/spl/sys/trace.h
  92. +1 −0 include/os/freebsd/spl/sys/trace_zfs.h
  93. +109 −0 include/os/freebsd/spl/sys/types.h
  94. +39 −0 include/os/freebsd/spl/sys/types32.h
  95. +77 −0 include/os/freebsd/spl/sys/uio.h
  96. +99 −0 include/os/freebsd/spl/sys/uuid.h
  97. +38 −0 include/os/freebsd/spl/sys/varargs.h
  98. +130 −0 include/os/freebsd/spl/sys/vfs.h
  99. +61 −0 include/os/freebsd/spl/sys/vm.h
  100. +34 −0 include/os/freebsd/spl/sys/vmsystm.h
  101. +207 −0 include/os/freebsd/spl/sys/vnode.h
  102. +271 −0 include/os/freebsd/spl/sys/vnode_impl.h
  103. +68 −0 include/os/freebsd/spl/sys/zmod.h
  104. +76 −0 include/os/freebsd/spl/sys/zone.h
  105. +1 −0 include/os/freebsd/zfs/Makefile.am
  106. +14 −0 include/os/freebsd/zfs/sys/Makefile.am
  107. +105 −0 include/os/freebsd/zfs/sys/freebsd_crypto.h
  108. +200 −0 include/os/freebsd/zfs/sys/sha2.h
  109. +30 −0 include/os/freebsd/zfs/sys/vdev_os.h
  110. +106 −0 include/os/freebsd/zfs/sys/zfs_context_os.h
  111. +65 −0 include/os/freebsd/zfs/sys/zfs_ctldir.h
  112. +74 −0 include/os/freebsd/zfs/sys/zfs_dir.h
  113. +677 −0 include/os/freebsd/zfs/sys/zfs_ioctl_compat.h
  114. +176 −0 include/os/freebsd/zfs/sys/zfs_vfsops.h
  115. +58 −0 include/os/freebsd/zfs/sys/zfs_vnops.h
  116. +187 −0 include/os/freebsd/zfs/sys/zfs_znode_impl.h
  117. +1 −0 include/os/freebsd/zfs/sys/zpl.h
  118. +8 −1 lib/Makefile.am
  119. +7 −0 lib/libnvpair/Makefile.am
  120. +9 −0 lib/libspl/Makefile.am
  121. +4 −0 lib/libspl/include/os/Makefile.am
  122. +1 −0 lib/libspl/include/os/freebsd/Makefile.am
  123. +12 −0 lib/libspl/include/os/freebsd/sys/Makefile.am
  124. +314 −0 lib/libspl/include/os/freebsd/sys/byteorder.h
  125. +43 −0 lib/libspl/include/os/freebsd/sys/file.h
  126. +108 −0 lib/libspl/include/os/freebsd/sys/mnttab.h
  127. +113 −0 lib/libspl/include/os/freebsd/sys/mount.h
  128. +70 −0 lib/libspl/include/os/freebsd/sys/param.h
  129. +76 −0 lib/libspl/include/os/freebsd/sys/stat.h
  130. +105 −0 lib/libspl/include/os/freebsd/sys/sysmacros.h
  131. +111 −0 lib/libspl/include/os/freebsd/sys/uio.h
  132. +37 −0 lib/libspl/include/os/freebsd/sys/vfs.h
  133. +39 −0 lib/libspl/include/os/freebsd/sys/zfs_context_os.h
  134. +70 −0 lib/libspl/os/freebsd/getexecname.c
  135. +36 −0 lib/libspl/os/freebsd/gethostid.c
  136. +67 −0 lib/libspl/os/freebsd/getmntany.c
  137. +216 −0 lib/libspl/os/freebsd/mnttab.c
  138. +4 −0 lib/libuutil/Makefile.am
  139. +16 −1 lib/libzfs/Makefile.am
  140. +2 −0 lib/libzfs/libzfs_dataset.c
  141. +310 −0 lib/libzfs/os/freebsd/libzfs_compat.c
  142. +407 −0 lib/libzfs/os/freebsd/libzfs_fsshare.c
  143. +432 −0 lib/libzfs/os/freebsd/libzfs_ioctl_compat.c
  144. +136 −0 lib/libzfs/os/freebsd/libzfs_zmount.c
  145. +5 −1 lib/libzfs_core/Makefile.am
  146. +47 −0 lib/libzfs_core/libzfs_core_compat.h
  147. +5 −1 lib/libzpool/Makefile.am
  148. +12 −1 lib/libzutil/Makefile.am
  149. +74 −0 lib/libzutil/os/freebsd/zutil_compat.c
  150. +132 −0 lib/libzutil/os/freebsd/zutil_device_path_os.c
  151. +206 −0 lib/libzutil/os/freebsd/zutil_import_os.c
  152. +9 −0 module/.gitignore
  153. +377 −0 module/Makefile.bsd
  154. +23 −4 module/Makefile.in
  155. +1,731 −0 module/os/freebsd/spl/acl_common.c
  156. +438 −0 module/os/freebsd/spl/callb.c
  157. +245 −0 module/os/freebsd/spl/list.c
  158. +96 −0 module/os/freebsd/spl/sha224.h
  159. +99 −0 module/os/freebsd/spl/sha256.h
  160. +378 −0 module/os/freebsd/spl/sha256c.c
  161. +96 −0 module/os/freebsd/spl/sha384.h
  162. +101 −0 module/os/freebsd/spl/sha512.h
  163. +508 −0 module/os/freebsd/spl/sha512c.c
  164. +143 −0 module/os/freebsd/spl/sha512t.h
  165. +222 −0 module/os/freebsd/spl/spl_acl.c
  166. +138 −0 module/os/freebsd/spl/spl_atomic.c
  167. +74 −0 module/os/freebsd/spl/spl_cmn_err.c
  168. +37 −0 module/os/freebsd/spl/spl_dtrace.c
  169. +351 −0 module/os/freebsd/spl/spl_kmem.c
  170. +321 −0 module/os/freebsd/spl/spl_kstat.c
  171. +107 −0 module/os/freebsd/spl/spl_misc.c
  172. +429 −0 module/os/freebsd/spl/spl_policy.c
  173. +79 −0 module/os/freebsd/spl/spl_procfs_list.c
  174. +106 −0 module/os/freebsd/spl/spl_string.c
  175. +74 −0 module/os/freebsd/spl/spl_sunddi.c
  176. +255 −0 module/os/freebsd/spl/spl_sysevent.c
  177. +267 −0 module/os/freebsd/spl/spl_taskq.c
  178. +92 −0 module/os/freebsd/spl/spl_uio.c
  179. +278 −0 module/os/freebsd/spl/spl_vfs.c
  180. +71 −0 module/os/freebsd/spl/spl_vm.c
  181. +268 −0 module/os/freebsd/spl/spl_zlib.c
  182. +265 −0 module/os/freebsd/spl/spl_zone.c
  183. +1,134 −0 module/os/freebsd/zfs/abd.c
  184. +230 −0 module/os/freebsd/zfs/arc_os.c
  185. +474 −0 module/os/freebsd/zfs/crypto_os.c
  186. +346 −0 module/os/freebsd/zfs/dmu_os.c
  187. +213 −0 module/os/freebsd/zfs/hkdf.c
  188. +415 −0 module/os/freebsd/zfs/kmod_core.c
  189. +279 −0 module/os/freebsd/zfs/spa_os.c
  190. +114 −0 module/os/freebsd/zfs/spa_stats.c
  191. +641 −0 module/os/freebsd/zfs/sysctl_os.c
  192. +329 −0 module/os/freebsd/zfs/vdev_file.c
  193. +1,162 −0 module/os/freebsd/zfs/vdev_geom.c
  194. +75 −0 module/os/freebsd/zfs/vdev_label_os.c
  195. +2,731 −0 module/os/freebsd/zfs/zfs_acl.c
  196. +1,345 −0 module/os/freebsd/zfs/zfs_ctldir.c
  197. +272 −0 module/os/freebsd/zfs/zfs_debug.c
  198. +958 −0 module/os/freebsd/zfs/zfs_dir.c
  199. +300 −0 module/os/freebsd/zfs/zfs_file_os.c
  200. +53 −0 module/os/freebsd/zfs/zfs_fuid_os.c
  201. +200 −0 module/os/freebsd/zfs/zfs_ioctl_os.c
  202. +70 −0 module/os/freebsd/zfs/zfs_onexit_os.c
  203. +2,449 −0 module/os/freebsd/zfs/zfs_vfsops.c
  204. +6,618 −0 module/os/freebsd/zfs/zfs_vnops.c
  205. +1,973 −0 module/os/freebsd/zfs/zfs_znode.c
  206. +2,437 −0 module/os/freebsd/zfs/zio_crypt.c
  207. +1,387 −0 module/os/freebsd/zfs/zvol_os.c
  208. +0 −1 module/os/linux/zfs/Makefile.in
  209. +0 −3 module/zfs/fm.c
  210. +12 −24 module/zfs/zfs_replay.c
  211. +71 −0 module/zfs/zio.c
  212. +2 −2 scripts/zfs-tests.sh
  213. +1 −0 tests/runfiles/Makefile.am
  214. +10 −5 tests/runfiles/common.run
  215. 0 tests/runfiles/freebsd.run
  216. +0 −7 tests/runfiles/linux.run
  217. +8 −0 tests/runfiles/sunos.run
  218. +0 −6 tests/test-runner/bin/zts-report.py
  219. +8 −9 tests/zfs-tests/include/blkdev.shlib
  220. +6 −1 tests/zfs-tests/include/properties.shlib
  221. +5 −16 tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh
  222. +2 −2 tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh
  223. +2 −2 tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh
  224. +13 −7 tests/zfs-tests/tests/functional/cli_root/zpool_trim/setup.ksh
  225. +2 −1 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
  226. +1 −0 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh
  227. +1 −1 tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh
  228. +11 −2 tests/zfs-tests/tests/functional/rsend/send-wDR_encrypted_zvol.ksh
  229. +1 −1 tests/zfs-tests/tests/functional/rsend/send_realloc_encrypted_files.ksh
  230. +1 −0 tests/zfs-tests/tests/functional/trim/setup.ksh
  231. +4 −4 tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh
  232. +53 −31 tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh
  233. +8 −8 tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh
  234. +0 −4 tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh
  235. +0 −4 tests/zfs-tests/tests/functional/xattr/xattr_009_neg.ksh
  236. +0 −4 tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh
  237. +40 −30 tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh
  238. +14 −1 tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh
  239. +12 −12 tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh
  240. +32 −32 tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib
  241. +1 −1 tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib
  242. +2 −0 tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_002_pos.ksh
  243. +0 −4 tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_003_pos.ksh
  244. +0 −4 tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_005_pos.ksh
  245. +0 −4 tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_006_pos.ksh
@@ -1,3 +1,6 @@
preprocessorErrorDirective:./module/zfs/vdev_raidz_math_avx512f.c:243
preprocessorErrorDirective:./module/zfs/vdev_raidz_math_sse2.c:266

uninitvar:module/os/freebsd/zfs/vdev_geom.c
uninitvar:module/os/freebsd/zfs/zfs_vfsops.c
uninitvar:module/os/freebsd/spl/spl_zone.c
uninitvar:lib/libzutil/os/freebsd/zutil_import_os.c
@@ -62,4 +62,9 @@ cscope.*
*.patch
*.orig
*.log
*.tmp
venv

*.so
*.so.debug
*.so.full
@@ -106,6 +106,7 @@ commitcheck:
cstyle:
@find ${top_srcdir} -name build -prune -o -name '*.[hc]' \
! -name 'zfs_config.*' ! -name '*.mod.c' -type f \
! -name '*_if*.h' \
-exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+

filter_executable = -exec test -x '{}' \; -print
@@ -1,10 +1,10 @@
SUBDIRS = zfs zpool zdb zhack zinject zstreamdump ztest
SUBDIRS += fsck_zfs vdev_id raidz_test zgenhostid
SUBDIRS += fsck_zfs vdev_id raidz_test

if USING_PYTHON
SUBDIRS += arcstat arc_summary dbufstat
endif

if BUILD_LINUX
SUBDIRS += mount_zfs zed zvol_id zvol_wait
SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait
endif
@@ -11,6 +11,10 @@ zpool_SOURCES = \
zpool_util.h \
zpool_vdev.c

if BUILD_FREEBSD
zpool_SOURCES += os/freebsd/zpool_vdev_os.c
endif

if BUILD_LINUX
zpool_SOURCES += os/linux/zpool_vdev_os.c
endif
@@ -20,6 +24,9 @@ zpool_LDADD = \
$(top_builddir)/lib/libuutil/libuutil.la \
$(top_builddir)/lib/libzfs/libzfs.la

if BUILD_FREEBSD
zpool_LDADD += -L/usr/local/lib -lintl -lgeom
endif
zpool_LDADD += -lm $(LIBBLKID)

zpoolconfdir = $(sysconfdir)/zfs/zpool.d
@@ -0,0 +1,136 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018 by Delphix. All rights reserved.
* Copyright (c) 2016, 2017 Intel Corporation.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>.
*/

/*
* Functions to convert between a list of vdevs and an nvlist representing the
* configuration. Each entry in the list can be one of:
*
* Device vdevs
* disk=(path=..., devid=...)
* file=(path=...)
*
* Group vdevs
* raidz[1|2]=(...)
* mirror=(...)
*
* Hot spares
*
* While the underlying implementation supports it, group vdevs cannot contain
* other group vdevs. All userland verification of devices is contained within
* this file. If successful, the nvlist returned can be passed directly to the
* kernel; we've done as much verification as possible in userland.
*
* Hot spares are a special case, and passed down as an array of disk vdevs, at
* the same level as the root of the vdev tree.
*
* The only function exported by this file is 'make_root_vdev'. The
* function performs several passes:
*
* 1. Construct the vdev specification. Performs syntax validation and
* makes sure each device is valid.
* 2. Check for devices in use. Using libdiskmgt, makes sure that no
* devices are also in use. Some can be overridden using the 'force'
* flag, others cannot.
* 3. Check for replication errors if the 'force' flag is not specified.
* validates that the replication level is consistent across the
* entire pool.
* 4. Call libzfs to label any whole disks with an EFI label.
*/

#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <libintl.h>
#include <libnvpair.h>
#include <libzutil.h>
#include <limits.h>
#include <sys/spa.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <paths.h>
#include <sys/stat.h>
#include <sys/disk.h>
#include <sys/mntent.h>
#include <libgeom.h>

#include "zpool_util.h"
#include <sys/zfs_context.h>

int
check_device(const char *name, boolean_t force, boolean_t isspare,
boolean_t iswholedisk)
{
char path[MAXPATHLEN];

if (strncmp(name, _PATH_DEV, sizeof (_PATH_DEV) - 1) != 0)
snprintf(path, sizeof (path), "%s%s", _PATH_DEV, name);
else
strlcpy(path, name, sizeof (path));

return (check_file(path, force, isspare));
}

#ifdef notyet
/*
* By "whole disk" we mean an entire physical disk (something we can
* label, toggle the write cache on, etc.) as opposed to the full
* capacity of a pseudo-device such as lofi or did. We act as if we
* are labeling the disk, which should be a pretty good test of whether
* it's a viable device or not. Returns B_TRUE if it is and B_FALSE if
* it isn't.
*/
static boolean_t
is_whole_disk(const char *arg)
{
int fd;

fd = g_open(arg, 0);
if (fd >= 0) {
g_close(fd);
return (B_TRUE);
}
return (B_FALSE);
}
#endif

boolean_t
check_sector_size_database(char *path, int *sector_size)
{
return (0);
}

void
zpool_vdev_enable_file(struct stat64 *statbuf, boolean_t *wholedisk)
{
if (S_ISCHR(statbuf->st_mode)) {
statbuf->st_mode &= ~S_IFCHR;
statbuf->st_mode |= S_IFBLK;
*wholedisk = B_FALSE;
}
}
@@ -15,24 +15,32 @@ if [ "$1" = "-h" ] ; then
exit
fi

if [ "$(uname)" = "FreeBSD" ]; then
k="-K"
y=""
else
k="-k"
y="-y"
fi

if [ "$script" = "iostat-1s" ] ; then
# Do a single one-second sample
extra="1 1"
# Don't show summary stats
y="-y"
brief="$y"
elif [ "$script" = "iostat-10s" ] ; then
# Do a single ten-second sample
extra="10 1"
# Don't show summary stats
y="-y"
brief="$y"
fi

if [ -f "$VDEV_UPATH" ] ; then
# We're a file-based vdev, iostat doesn't work on us. Do nothing.
exit
fi

out=$(eval "iostat $y -k -x $VDEV_UPATH $extra")
out=$(eval "iostat -d $k $brief -x $VDEV_UPATH $extra" | tail -n 2)

# Sample output (we want the last two lines):
#
@@ -46,10 +54,10 @@ out=$(eval "iostat $y -k -x $VDEV_UPATH $extra")
#

# Get the column names
cols=$(echo "$out" | grep Device)
cols=$(echo "$out" | head -n 1)

# Get the values and tab separate them to make them cut-able.
vals="$(echo "$out" | grep -A1 Device | tail -n 1 | sed -r 's/[[:blank:]]+/\t/g')"
vals=$(echo "$out" | tail -n 1 | sed -r 's/[[:blank:]]+/\t/g')

i=0
for col in $cols ; do
@@ -14,26 +14,51 @@ DEFAULT_INCLUDES += \
-I$(top_srcdir)/lib/libspl/include/os/linux
endif

if BUILD_FREEBSD
DEFAULT_INCLUDES += \
-I$(top_srcdir)/lib/libspl/include/os/freebsd
endif

AM_LIBTOOLFLAGS = --silent

AM_CFLAGS = -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing
AM_CFLAGS += $(NO_OMIT_FRAME_POINTER)
AM_CFLAGS += $(DEBUG_CFLAGS)
AM_CFLAGS += $(ASAN_CFLAGS)
AM_CFLAGS += $(CODE_COVERAGE_CFLAGS)
AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) $(NO_FORMAT_ZERO_LENGTH)
if BUILD_FREEBSD
AM_CFLAGS += -fPIC -Werror -Wno-unknown-pragmas -Wno-enum-conversion
AM_CFLAGS += -include $(top_srcdir)/include/os/freebsd/spl/sys/ccompile.h
AM_CFLAGS += -I/usr/include -I/usr/local/include
AM_CFLAGS += -D_MACHINE_ENDIAN_H_
endif

AM_CPPFLAGS = -D_GNU_SOURCE
AM_CPPFLAGS += -D_REENTRANT
AM_CPPFLAGS += -D_FILE_OFFSET_BITS=64
AM_CPPFLAGS += -D_LARGEFILE64_SOURCE
AM_CPPFLAGS += -DHAVE_LARGE_STACKS=1
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\"
AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\"
AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\"
AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\"
AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CPPFLAGS += $(DEBUG_CPPFLAGS)
AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS)
if BUILD_LINUX
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-linux-user\"
endif
if BUILD_FREEBSD
AM_CPPFLAGS += -DTEXT_DOMAIN=\"zfs-freebsd-user\"
# FIXME: are the rest of these needed?
AM_CPPFLAGS += -D_SYS_VMEM_H_ -D_SYS_PROC_H_ -DVM_H -D_SYS_USER_H_
AM_CPPFLAGS += -DZFS_DEBUG
endif

AM_LDFLAGS = $(DEBUG_LDFLAGS)
AM_LDFLAGS += $(ASAN_LDFLAGS)

if BUILD_FREEBSD
AM_LDFLAGS += -fstack-protector-strong -shared
AM_LDFLAGS += -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel
AM_LDFLAGS += -lm
endif
@@ -3,7 +3,8 @@ dnl # Set the target arch for libspl atomic implementation and the icp
dnl #
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_ARCH], [
AC_MSG_CHECKING(for target asm dir)
TARGET_ARCH=`echo ${target_cpu} | sed -e s/i.86/i386/`
subs="-e s/i.86/i386/ -e s/amd64/x86_64/"
TARGET_ARCH=$(echo ${target_cpu} | sed ${subs})
case $TARGET_ARCH in
i386|x86_64)
@@ -52,7 +52,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN], [
AC_MSG_CHECKING([whether $CC supports -Wframe-larger-than=<size>])
saved_flags="$CFLAGS"
CFLAGS="$CFLAGS -Wframe-larger-than=4096"
CFLAGS="$CFLAGS -Werror -Wframe-larger-than=4096"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
FRAME_LARGER_THAN="-Wframe-larger-than=4096"
@@ -73,7 +73,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION], [
AC_MSG_CHECKING([whether $CC supports -Wno-format-truncation])
saved_flags="$CFLAGS"
CFLAGS="$CFLAGS -Wno-format-truncation"
CFLAGS="$CFLAGS -Werror -Wno-format-truncation"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
NO_FORMAT_TRUNCATION=-Wno-format-truncation
@@ -87,6 +87,27 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION], [
AC_SUBST([NO_FORMAT_TRUNCATION])
])

dnl #
dnl # Check if gcc supports -Wno-format-truncation option.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH], [
AC_MSG_CHECKING([whether $CC supports -Wno-format-zero-length])
saved_flags="$CFLAGS"
CFLAGS="$CFLAGS -Werror -Wno-format-zero-length"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
NO_FORMAT_ZERO_LENGTH=-Wno-format-zero-length
AC_MSG_RESULT([yes])
], [
NO_FORMAT_ZERO_LENGTH=
AC_MSG_RESULT([no])
])
CFLAGS="$saved_flags"
AC_SUBST([NO_FORMAT_ZERO_LENGTH])
])


dnl #
dnl # Check if gcc supports -Wno-bool-compare option.
@@ -100,7 +121,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_BOOL_COMPARE], [
AC_MSG_CHECKING([whether $CC supports -Wno-bool-compare])
saved_flags="$CFLAGS"
CFLAGS="$CFLAGS -Wbool-compare"
CFLAGS="$CFLAGS -Werror -Wbool-compare"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
NO_BOOL_COMPARE=-Wno-bool-compare
@@ -126,7 +147,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_UNUSED_BUT_SET_VARIABLE], [
AC_MSG_CHECKING([whether $CC supports -Wno-unused-but-set-variable])
saved_flags="$CFLAGS"
CFLAGS="$CFLAGS -Wunused-but-set-variable"
CFLAGS="$CFLAGS -Werror -Wunused-but-set-variable"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
NO_UNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable

0 comments on commit ba5bc10

Please sign in to comment.
You can’t perform that action at this time.