summaryrefslogtreecommitdiff
path: root/util/lock
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /util/lock
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14498.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'util/lock')
-rw-r--r--util/lock/android.c51
-rw-r--r--util/lock/android.h54
-rw-r--r--util/lock/build.mk10
-rw-r--r--util/lock/file_lock.c262
-rw-r--r--util/lock/gec_lock.c45
-rw-r--r--util/lock/gec_lock.h51
-rw-r--r--util/lock/ipc_lock.h69
-rw-r--r--util/lock/locks.h38
8 files changed, 0 insertions, 580 deletions
diff --git a/util/lock/android.c b/util/lock/android.c
deleted file mode 100644
index 8472b6db68..0000000000
--- a/util/lock/android.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- */
-
-#include <stdlib.h>
-
-#include "android.h"
-
-int in_android(void)
-{
- if (getenv("ANDROID_ROOT"))
- return 1;
-
- return 0;
-}
-
-char *android_tmpdir_path(void)
-{
- return getenv("TMPDIR");
-}
diff --git a/util/lock/android.h b/util/lock/android.h
deleted file mode 100644
index bb08486919..0000000000
--- a/util/lock/android.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- */
-
-#ifndef ANDROID_H__
-#define ANDROID_H__
-
-/*
- * in_android - Test to see if the underlying OS is Android
- *
- * returns boolean 1 to indicate true, 0 otherwise
- */
-extern int in_android(void);
-
-/**
- * Determine where temporary files go.
- *
- * @return A pointer to value of directory containing temporary files if
- * successful, or NULL otherwise
- */
-extern char *android_tmpdir_path(void);
-
-#endif
diff --git a/util/lock/build.mk b/util/lock/build.mk
deleted file mode 100644
index 65a63ab9db..0000000000
--- a/util/lock/build.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- makefile -*-
-# Copyright 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Lock library
-#
-
-util-lock-objs=file_lock.o gec_lock.o
-util-lock-objs+=android.o
diff --git a/util/lock/file_lock.c b/util/lock/file_lock.c
deleted file mode 100644
index 36b420d287..0000000000
--- a/util/lock/file_lock.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * file_lock.c: Implementation for a binary semaphore using a file lock.
- *
- * Warning: This relies on flock() which is known to be broken on NFS.
- *
- * The file will remain persistent once the lock has been used. Unfortunately,
- * unlinking the file can introduce a race condition so we leave the file
- * in place.
- *
- * The current process's PID will be written to the file for debug purposes.
- */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "android.h"
-#include "ipc_lock.h"
-#include "locks.h"
-
-#define SLEEP_INTERVAL_MS 50
-
-static void msecs_to_timespec(int msecs, struct timespec *tmspec)
-{
- tmspec->tv_sec = msecs / 1000;
- tmspec->tv_nsec = (msecs % 1000) * 1000 * 1000;
-}
-
-static int lock_is_held(struct ipc_lock *lock)
-{
- return lock->is_held;
-}
-
-static int test_dir(const char *path)
-{
- struct stat s;
-
- if (lstat(path, &s) < 0) {
- fprintf(stderr, "Cannot stat %s.\n", path);
- return -1;
- }
-
- if (!S_ISDIR(s.st_mode)) {
- fprintf(stderr, "%s is not a directory.\n", path);
- return -1;
- }
-
- return 0;
-}
-
-static int file_lock_open_or_create(struct ipc_lock *lock)
-{
- char path[PATH_MAX];
-
- if (in_android()) {
- char *tmpdir;
-
- tmpdir = android_tmpdir_path();
- if (!tmpdir)
- return -1;
-
- if (snprintf(path, sizeof(path), "%s/%s",
- tmpdir, lock->filename) < 0) {
- return -1;
- }
- } else {
- const char *dir = SYSTEM_LOCKFILE_DIR;
- const char fallback[] = "/tmp";
-
- if (test_dir(dir)) {
- dir = fallback;
- fprintf(stderr, "Trying fallback directory: %s\n", dir);
- if (test_dir(dir))
- return -1;
- }
-
- if (snprintf(path, sizeof(path),
- "%s/%s", dir, lock->filename) < 0)
- return -1;
-
- }
-
- lock->fd = open(path, O_RDWR | O_CREAT, 0600);
- if (lock->fd < 0) {
- fprintf(stderr, "Cannot open lockfile %s", path);
- return -1;
- }
-
- return 0;
-}
-
-static int file_lock_get(struct ipc_lock *lock, int timeout_msecs)
-{
- int msecs_remaining = timeout_msecs;
- struct timespec sleep_interval, rem;
- int ret = -1;
-
- if (timeout_msecs == 0)
- return flock(lock->fd, LOCK_EX | LOCK_NB);
-
- msecs_to_timespec(SLEEP_INTERVAL_MS, &sleep_interval);
-
- while ((ret = flock(lock->fd, LOCK_EX | LOCK_NB)) != 0) {
- if (errno != EWOULDBLOCK) {
- fprintf(stderr, "Error obtaining lock");
- return -1;
- }
-
- if (msecs_remaining < SLEEP_INTERVAL_MS)
- msecs_to_timespec(msecs_remaining, &sleep_interval);
-
- while (nanosleep(&sleep_interval, &rem) != 0) {
- if (errno == EINTR) {
- sleep_interval = rem;
- continue;
- } else {
- fprintf(stderr, "nanosleep() failed");
- return ret;
- }
- }
-
- if (timeout_msecs < 0)
- continue;
-
- msecs_remaining -= SLEEP_INTERVAL_MS;
- if (msecs_remaining < 0)
- break;
- }
-
- if (ret != 0) {
- fprintf(stderr, "Timed out waiting for file lock.\n");
- return -1;
- }
-
- return 0;
-}
-
-static int file_lock_write_pid(struct ipc_lock *lock)
-{
- ssize_t len;
- /*
- * PIDs are usually 5 digits, but we'll reserve enough room for
- * a value of 2^32 (10 digits) out of paranoia.
- */
- char pid_str[11];
-
- if (ftruncate(lock->fd, 0) < 0) {
- fprintf(stderr, "Cannot truncate lockfile");
- return -1;
- }
-
- snprintf(pid_str, sizeof(pid_str), "%lu", (unsigned long)getpid());
- len = write(lock->fd, pid_str, strlen(pid_str));
- if (len < 0) {
- fprintf(stderr, "Cannot write PID to lockfile");
- return -1;
- }
-
- return 0;
-}
-
-static void file_lock_release(struct ipc_lock *lock)
-{
- if (flock(lock->fd, LOCK_UN) < 0)
- fprintf(stderr, "Cannot release lock");
-
- if (close(lock->fd) < 0)
- fprintf(stderr, "Cannot close lockfile");
-}
-
-/*
- * timeout <0 = no timeout (try forever)
- * timeout 0 = do not wait (return immediately)
- * timeout >0 = wait up to $timeout milliseconds
- *
- * returns 0 to indicate lock acquired
- * returns >0 to indicate lock was already held
- * returns <0 to indicate failed to acquire lock
- */
-int acquire_lock(struct ipc_lock *lock, int timeout_msecs)
-{
- /* check if it is already held */
- if (lock_is_held(lock))
- return 1;
-
- if (file_lock_open_or_create(lock))
- return -1;
-
- if (file_lock_get(lock, timeout_msecs)) {
- lock->is_held = 0;
- close(lock->fd);
- return -1;
- } else {
- lock->is_held = 1;
- }
-
- /*
- * Write PID to lockfile for debug purposes. Failure to write to
- * the file should not be considered fatal. There might be something
- * bad happening with the filesystem, but the lock has already been
- * obtained and we may need our tools for diagnostics and repairs
- * so we should continue anyway.
- */
- file_lock_write_pid(lock);
- return 0;
-}
-
-/*
- * returns 0 if lock was released successfully
- * returns -1 if lock had not been held before the call
- */
-int release_lock(struct ipc_lock *lock)
-{
- if (lock_is_held(lock)) {
- file_lock_release(lock);
- lock->is_held = 0;
- return 0;
- }
-
- return -1;
-}
diff --git a/util/lock/gec_lock.c b/util/lock/gec_lock.c
deleted file mode 100644
index d354ea08f3..0000000000
--- a/util/lock/gec_lock.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "gec_lock.h"
-#include "ipc_lock.h"
-#include "locks.h"
-
-static struct ipc_lock gec_lock = LOCKFILE_INIT(CROS_EC_LOCKFILE_NAME);
-
-int acquire_gec_lock(int timeout_secs)
-{
- return acquire_lock(&gec_lock, timeout_secs * 1000);
-}
-
-int release_gec_lock(void)
-{
- return release_lock(&gec_lock);
-}
diff --git a/util/lock/gec_lock.h b/util/lock/gec_lock.h
deleted file mode 100644
index 8480700ddd..0000000000
--- a/util/lock/gec_lock.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __UTIL_GEC_LOCK_H
-#define __UTIL_GEC_LOCK_H
-
-/*
- * acquire_gec_lock - acquire global lock
- *
- * returns 0 to indicate lock acquired
- * returns >0 to indicate lock was already held
- * returns <0 to indicate failed to acquire lock
- */
-extern int acquire_gec_lock(int timeout_secs);
-
-/*
- * release_gec_lock - release global lock
- *
- * returns 0 if lock was released successfully
- * returns -1 if lock had not been held before the call
- */
-extern int release_gec_lock(void);
-
-#endif /* __UTIL_GEC_LOCK_H */
diff --git a/util/lock/ipc_lock.h b/util/lock/ipc_lock.h
deleted file mode 100644
index 5d0d321af4..0000000000
--- a/util/lock/ipc_lock.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __UTIL_IPC_LOCK_H
-#define __UTIL_IPC_LOCK_H
-
-struct ipc_lock {
- int is_held; /* internal */
- const char *filename; /* provided by the developer */
- int fd; /* internal */
-};
-
-/* don't use C99 initializers here, so this can be used in C++ code */
-#define LOCKFILE_INIT(lockfile) \
- { \
- 0, /* is_held */ \
- lockfile, /* filename */ \
- -1, /* fd */ \
- }
-
-/*
- * acquire_lock: acquire a lock
- *
- * timeout <0 = no timeout (try forever)
- * timeout 0 = do not wait (return immediately)
- * timeout >0 = wait up to $timeout milliseconds (subject to kernel scheduling)
- *
- * return 0 = lock acquired
- * return >0 = lock was already held
- * return <0 = failed to acquire lock
- */
-extern int acquire_lock(struct ipc_lock *lock, int timeout_msecs);
-
-/*
- * release_lock: release a lock
- *
- * returns 0 if lock was released successfully
- * returns -1 if lock had not been held before the call
- */
-extern int release_lock(struct ipc_lock *lock);
-
-#endif /* __UTIL_IPC_LOCK_H */
diff --git a/util/lock/locks.h b/util/lock/locks.h
deleted file mode 100644
index 6875d91454..0000000000
--- a/util/lock/locks.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright 2012, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __UTIL_LOCKS_H
-#define __UTIL_LOCKS_H
-
-#define SYSTEM_LOCKFILE_DIR "/run/lock"
-#define LOCKFILE_NAME "firmware_utility_lock"
-#define CROS_EC_LOCKFILE_NAME "cros_ec_lock"
-
-#endif /* __UTIL_LOCKS_H */