From 3ed81051e814e688f7b4ae1bbc7c4d4c3fbd7d0f Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 8 Aug 2018 12:26:01 -0400 Subject: Add an SHM-backed Lock Manager implementation Signed-off-by: Matthew Heon --- libpod/lock/shm_lock.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libpod/lock/shm_lock.go') diff --git a/libpod/lock/shm_lock.go b/libpod/lock/shm_lock.go index 4d7c26aa2..a8a969479 100644 --- a/libpod/lock/shm_lock.go +++ b/libpod/lock/shm_lock.go @@ -27,13 +27,13 @@ type SHMLocks struct { // semaphores, and returns a struct that can be used to operate on those locks. // numLocks must be a multiple of the lock bitmap size (by default, 32). func CreateSHMLock(numLocks uint32) (*SHMLocks, error) { - if numLocks % bitmapSize != 0 || numLocks == 0 { + if numLocks%bitmapSize != 0 || numLocks == 0 { return nil, errors.Wrapf(syscall.EINVAL, "number of locks must be a multiple of %d", C.bitmap_size_c) } locks := new(SHMLocks) - var errCode C.int = 0 + var errCode C.int lockStruct := C.setup_lock_shm(C.uint32_t(numLocks), &errCode) if lockStruct == nil { // We got a null pointer, so something errored @@ -52,13 +52,13 @@ func CreateSHMLock(numLocks uint32) (*SHMLocks, error) { // segment was created with and be a multiple of the lock bitmap size (default // 32). func OpenSHMLock(numLocks uint32) (*SHMLocks, error) { - if numLocks % bitmapSize != 0 || numLocks == 0 { + if numLocks%bitmapSize != 0 || numLocks == 0 { return nil, errors.Wrapf(syscall.EINVAL, "number of locks must be a multiple of %d", C.bitmap_size_c) } locks := new(SHMLocks) - var errCode C.int = 0 + var errCode C.int lockStruct := C.open_lock_shm(C.uint32_t(numLocks), &errCode) if lockStruct == nil { // We got a null pointer, so something errored -- cgit v1.2.3-54-g00ecf