[Top][All Lists]

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

Re: [PATCH] pkl: Remove global state from IOS

From: Jose E. Marchesi
Subject: Re: [PATCH] pkl: Remove global state from IOS
Date: Mon, 20 Dec 2021 23:01:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> Hi, Jose.
>> On Mon, Dec 20, 2021 at 10:12:16PM +0100, Jose E. Marchesi wrote:
>>> > This patch removes global state from IOS by introducing a new struct
>>> > `ios_meta`.
>>> I would much prefer to use the name `ios_context' for this type, or
>>> `ios_ctx' if you want it shorter.
>> OK.
>>> > I changed `open` function pointer of `struct pk_iod_if` to be compatible
>>> > with the rest of world. But user doesn't need (and should not care about
>>> > this new first parameter). I don't like this new unused parameter here.
>>> > WDYT?
>>> Huh, why would you want to pass the ios context to the IOD implementations?
>> TBH I don't want :)
>> I think I can solve this problem by adding new field to `struct ios_dev_if`:
>>   void *userdata;
>> And changing the `open` signature to have a new `void *userdata` param.
>> Based on that I can call the right `open` function (specified by the user).
>> WDYT?
> Oh, so this is because the sub IOD uses calls like ios_search_by_id?  If
> that is the only IOD that needs such operations, it seems to me that it
> may be better to handle it in a special way rather than "polluting" the
> interface...

No, scratch that.

Now I realize that having an user data payload associated with the IOD
and passed to `open' may be also very useful for foreign IO devices.
That was a very good idea, thanks :)

The struct pk_iod_if in libpoke.h would have to be expanded accordingly.

If you agree with this change, can you please split the patch in two,
one with the addition of the user data pointer, then with the removal of
the global state?


reply via email to

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