diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-07-25 01:47:54 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-14 14:45:05 +0200 |
commit | 9e96c2b23bc8ec55ac4fa074414109183c3e1aa1 (patch) | |
tree | ceec1b2d06bffe73d74f3e97b92caf47cc94a9d1 /device/dev_hdr.h | |
parent | a5d69c13a0a034560b5eb78a16865fe854015571 (diff) |
device: use general lock for `mach_device'
* device/dev_hdr.h (struct mach_device): Turn lock into a general lock.
(device_lock_init): New macro.
(device_lock, device_unlock): Adapt accordingly.
* device/dev_lookup.c (device_lookup): Use `device_lock_init'.
* device/ds_routines.c (device_open): Adapt accordingly.
Diffstat (limited to 'device/dev_hdr.h')
-rw-r--r-- | device/dev_hdr.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/device/dev_hdr.h b/device/dev_hdr.h index ff7d2ef..5f80d4a 100644 --- a/device/dev_hdr.h +++ b/device/dev_hdr.h @@ -82,7 +82,7 @@ typedef struct device *device_t; struct mach_device { decl_simple_lock_data(,ref_lock)/* lock for reference count */ int ref_count; /* reference count */ - decl_simple_lock_data(, lock) /* lock for rest of state */ + struct lock lock; /* lock for rest of state */ short state; /* state: */ #define DEV_STATE_INIT 0 /* not open */ #define DEV_STATE_OPENING 1 /* being opened */ @@ -127,8 +127,9 @@ boolean_t dev_map(boolean_t (*)(), mach_port_t); /* * To lock and unlock state and open-count */ -#define device_lock(device) simple_lock(&(device)->lock) -#define device_unlock(device) simple_unlock(&(device)->lock) +#define device_lock_init(device) lock_init(&(device)->lock, FALSE) +#define device_lock(device) lock_write(&(device)->lock) +#define device_unlock(device) lock_write_done(&(device)->lock) /* * device name lookup |