summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
Diffstat (limited to 'nest')
-rw-r--r--nest/locks.c10
-rw-r--r--nest/locks.h5
2 files changed, 9 insertions, 6 deletions
diff --git a/nest/locks.c b/nest/locks.c
index 7044d6a9..c74f2f45 100644
--- a/nest/locks.c
+++ b/nest/locks.c
@@ -22,10 +22,11 @@
* or some other non-shareable resource, it asks the core to lock it and it doesn't
* use the resource until it's notified that it has acquired the lock.
*
- * Object locks are represented by &object_lock structures which are in turn a kind of
- * resource. Lockable resources are uniquely determined by resource type
+ * Object locks are represented by &object_lock structures which are in turn a
+ * kind of resource. Lockable resources are uniquely determined by resource type
* (%OBJLOCK_UDP for a UDP port etc.), IP address (usually a broadcast or
- * multicast address the port is bound to), port number and interface.
+ * multicast address the port is bound to), port number, interface and optional
+ * instance ID.
*/
#undef LOCAL_DEBUG
@@ -45,6 +46,7 @@ olock_same(struct object_lock *x, struct object_lock *y)
x->type == y->type &&
x->iface == y->iface &&
x->port == y->port &&
+ x->inst == y->inst &&
ipa_equal(x->addr, y->addr);
}
@@ -88,7 +90,7 @@ olock_dump(resource *r)
struct object_lock *l = (struct object_lock *) r;
static char *olock_states[] = { "free", "locked", "waiting", "event" };
- debug("(%d:%s:%I:%d) [%s]\n", l->type, (l->iface ? l->iface->name : "?"), l->addr, l->port, olock_states[l->state]);
+ debug("(%d:%s:%I:%d:%d) [%s]\n", l->type, (l->iface ? l->iface->name : "?"), l->addr, l->port, l->inst, olock_states[l->state]);
if (!EMPTY_LIST(l->waiters))
debug(" [wanted]\n");
}
diff --git a/nest/locks.h b/nest/locks.h
index 892d3c6b..3d58c8ed 100644
--- a/nest/locks.h
+++ b/nest/locks.h
@@ -26,9 +26,10 @@
struct object_lock {
resource r;
ip_addr addr; /* Identification of a object: IP address */
- unsigned int type; /* ... object type (OBJLOCK_xxx) */
+ uint type; /* ... object type (OBJLOCK_xxx) */
+ uint port; /* ... port number */
+ uint inst; /* ... instance ID */
struct iface *iface; /* ... interface */
- unsigned int port; /* ... port number */
void (*hook)(struct object_lock *); /* Called when the lock succeeds */
void *data; /* User data */
/* ... internal to lock manager, don't touch ... */