zbd: Fix compilation error on BSD
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 28 May 2020 12:56:42 +0000 (21:56 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 28 May 2020 16:35:45 +0000 (10:35 -0600)
commit44ec32cbf63c76a9d0e22e0505c0d7888d07afaa
treeb4f5c7354edcec900ad71f1883d645858bb7fa19
parent3ed6894b00c4929896ff169778cf05752e2ed825
zbd: Fix compilation error on BSD

Commit b76949618d55 ("fio: Generalize zonemode=zbd") enabled zbd.c
compilation on other operating systems than Linux. This caused a
compilation error on NetBSD as follows:

ld: zbd.o: in function `parse_zone_info':
fio/zbd.c:422: undefined reference to `pthread_mutexattr_setpshared'
ld: zbd.o: in function `init_zone_info':
fio/zbd.c:378: undefined reference to `pthread_mutexattr_setpshared'
gmake: *** [Makefile:483: fio] Error 1

Same error is expected on other BSD OSes.

Fix this by initializing mutex using helper functions pshared.c provides.
To initialize mutex with POSIX_MUTEX_RECURSIVE attribute type, utilize
mutex_init_pshared_with_type().

Reported-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Fixes: b76949618d55 ("fio: Generalize zonemode=zbd")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c