diff options
Diffstat (limited to 'libmachdev/block.c')
-rw-r--r-- | libmachdev/block.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libmachdev/block.c b/libmachdev/block.c index 4aa07672..b239ecff 100644 --- a/libmachdev/block.c +++ b/libmachdev/block.c @@ -118,9 +118,14 @@ device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type, char *dev_name = NULL; int dev_err; + // TODO I need to check whether the device has been opened before. + // if it has been opened with the same `flag', return the same port, + // otherwise, return a different port. + // I need to have a reference to count the number of open. dev_name = translate_name (name, &slice, &part); + if (dev_name == NULL) + return D_NO_SUCH_DEVICE; - // TODO when the port isn't used by clients, it should be destroyed. err = create_device_port (sizeof (*bd), &bd); if (err) { |