- /* Copyright (c) 2008, 2009, 2010 Nicira Networks
+ /* Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "util.h"
#include "vlog.h"
-VLOG_DEFINE_THIS_MODULE(lockfile)
+VLOG_DEFINE_THIS_MODULE(lockfile);
+
+COVERAGE_DEFINE(lockfile_lock);
+COVERAGE_DEFINE(lockfile_timeout);
+COVERAGE_DEFINE(lockfile_error);
+COVERAGE_DEFINE(lockfile_unlock);
struct lockfile {
struct hmap_node hmap_node;
}
} while (error == EINTR && (timeout == INT_MAX || elapsed < timeout));
- if (!error) {
- if (elapsed) {
- VLOG_WARN("%s: waited %lld ms for lock file",
- lock_name, elapsed);
- }
- } else if (error == EINTR) {
+ if (error == EINTR) {
COVERAGE_INC(lockfile_timeout);
VLOG_WARN("%s: giving up on lock file after %lld ms",
lock_name, elapsed);
error = ETIMEDOUT;
- } else {
+ } else if (error) {
COVERAGE_INC(lockfile_error);
if (error == EACCES) {
error = EAGAIN;
{
struct lockfile *lockfile;
- HMAP_FOR_EACH (lockfile, struct lockfile, hmap_node, &lock_table) {
+ HMAP_FOR_EACH (lockfile, hmap_node, &lock_table) {
if (lockfile->fd >= 0) {
VLOG_WARN("%s: child does not inherit lock", lockfile->name);
lockfile_unhash(lockfile);
{
struct lockfile *lockfile;
- HMAP_FOR_EACH_WITH_HASH (lockfile, struct lockfile, hmap_node,
+ HMAP_FOR_EACH_WITH_HASH (lockfile, hmap_node,
lockfile_hash(device, inode), &lock_table) {
if (lockfile->device == device && lockfile->inode == inode) {
return lockfile;