On 5/12/26 05:11, Muchun Song wrote:
>
>
>> On May 11, 2026, at 21:23, Muchun Song <[email protected]> wrote:
>>
>>
>>
>>>
>>> On 5/11/26 13:18, Muchun Song wrote:
>>>
>>> Better mention some of the other changes here, like removing
>>> find_memory_block().
>>
>> Will do.
>>
>>>
>>> [...]
>>>
>>>
>>> While at it, please drop the "extern".
>>
>> OK.
>>
>>>
>>>
>>> Would guards come in handy here?
>>
>> You mean to introduce something like:
>>
>> scoped_guard(memory_block, id) {
>> }
>>
>> Right? If yes, I will give it a try.
>
> Hi David,
Hi,
>
> Did I get that right?
I assume so, but it's indeed rather ugly. ... in particular the CLASS and
scoped_class() thingies are pretty intuitive.
I thought we could use guard()/scoped_guard(), but reading the details, it's
mostly for locks only.
There is only one users of scoped_class in the tree (overlayfs).
Maybe, if we would do this properly, we would actually provide our own wrappers,
like
MEMORY_BLOCK
scoped_memory_block
not even providing "memory_block_get", as that would be implicit.
Like
MEMORY_BLOCK(mem)(block_id); // the second () is confusing
scoped_memory_block(mem, block_id) {
}
But that requires more thought, and I don't really know what the best practice
is there ...
So thanks for trying, but let's leave it as is for now.
--
Cheers,
David