nvme: use default mutex init under FreeBSD

Change-Id: I0bd06efb4a87b92f924df21ef8a8782aff1bef1a
Signed-off-by: GangCao <gang.cao@intel.com>
This commit is contained in:
GangCao 2016-11-16 15:53:28 -05:00 committed by Daniel Verkamp
parent e235cf5a2d
commit 224e0ff0b7

View File

@ -210,9 +210,13 @@ nvme_free_request(struct nvme_request *req)
int
nvme_mutex_init_shared(pthread_mutex_t *mtx)
{
pthread_mutexattr_t attr;
int rc = 0;
#ifdef __FreeBSD__
pthread_mutex_init(mtx, NULL);
#else
pthread_mutexattr_t attr;
if (pthread_mutexattr_init(&attr)) {
return -1;
}
@ -221,6 +225,8 @@ nvme_mutex_init_shared(pthread_mutex_t *mtx)
rc = -1;
}
pthread_mutexattr_destroy(&attr);
#endif
return rc;
}