Hi Samuel, thank you for your comments.
On 09/10/2013 03:03 AM, Samuel Thibault wrote: > - it should only reopen the master device if master_file is not NULL ; I assumed that master_file is always non-NULL when master_device is used, but I was wrong: I overlooked the call to get_privileged_ports() that manipulates master_device without depending on master_file. > - it should close the previous master device before opening another > one, otherwise you get a port leak on each ds_device_open call. It ds_device_close() only returns D_INVALID_OPERATION. How should the master device be closed? Is it enough to deallocate the port? > then actually becomes useless to call file_name_lookup in parse_opt(), > and instead call it from ds_device_open itself, and free the port > there (but only when master_file is not NULL of course). The check for Well, the call in parse_opt() ensures that devnode fails immediately when an invalid parameter for device_file is provided. That's why I decided to leave it there. Is it desirable to fail early in this case or should it only fail when the device is actually accessed in ds_device_open()? > master_device == MACH_PORT_NULL in main should of course be turned into > master_file == NULL. > > Samuel > Rekado