[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: Look up device file name on device_open

From: Samuel Thibault
Subject: Re: RFC: Look up device file name on device_open
Date: Tue, 10 Sep 2013 08:44:43 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

rekado, le Tue 10 Sep 2013 11:10:47 +0800, a écrit :
> > - 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?

Yes, it is enough.  But don't do this on ds_device_close(), since you
have no assurance that it will be called once for each ds_device_open()
call.  Really do it simply after usage in ds_device_open().

> > 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()?

Mmm, good question.  Maybe it's better to do as you say indeed.

ds_device_open() could also reopen the master_file only when
device_open() returns a "translator died" error.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]