[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Look up device file name on device_open
From: |
rekado |
Subject: |
Re: [PATCH] Look up device file name on device_open |
Date: |
Tue, 10 Sep 2013 11:10:47 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 |
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