🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.git
4 messages
4 total messages Started by "Mark C. Chu-Carroll" Tue, 27 Oct 2026 14:47
Re: [PATCH 02/12] rerere: convert flags into an enum
#1632
Author: "Mark C. Chu-Carroll"
Date: Tue, 27 Oct 2026 14:47
21 lines
13388 bytes
On Tue, 27 Oct 2026 11:46:45 +0100, Patrick Steinhardt <ps@pks.im> wrote:
> Our modern coding guidelines say that flags should typically be passed
> around as enums so that it becomes trivial to see what kind of flags are
> expected. Adapt the rerere flags accordingly.
> 
>   <snip>
> +enum rerere_flags {
> +	RERERE_AUTOUPDATE = (1 << 0),
> +	RERERE_NOAUTOUPDATE = (1 << 1),
> +	RERERE_READONLY = (1 << 2),
> +	/* If MERGE_RR.lock is taken, return -1 as if rerere were disabled */
> +	RERERE_NOWAIT = (1 << 3),
> +};

If we're moving to using enum flags, then wouldn't it be better to
explicitly add a "RERE_MERGE_LOCK_TOKEN" to the enum for that case, 
rather than have this value only documented by a comment?

  -Mark
Re: [PATCH 02/12] rerere: convert flags into an enum
#1674
Author: Junio C Hamano
Date: Tue, 27 Oct 2026 19:40
25 lines
13576 bytes
"Mark C. Chu-Carroll" <markchucarroll@fastmail.com> writes:

> On Tue, 27 Oct 2026 11:46:45 +0100, Patrick Steinhardt <ps@pks.im> wrote:
>> Our modern coding guidelines say that flags should typically be passed
>> around as enums so that it becomes trivial to see what kind of flags are
>> expected. Adapt the rerere flags accordingly.
>> 
>>   <snip>
>> +enum rerere_flags {
>> +	RERERE_AUTOUPDATE = (1 << 0),
>> +	RERERE_NOAUTOUPDATE = (1 << 1),
>> +	RERERE_READONLY = (1 << 2),
>> +	/* If MERGE_RR.lock is taken, return -1 as if rerere were disabled */
>> +	RERERE_NOWAIT = (1 << 3),
>> +};
>
> If we're moving to using enum flags, then wouldn't it be better to
> explicitly add a "RERE_MERGE_LOCK_TOKEN" to the enum for that case, 
> rather than have this value only documented by a comment?

Perhaps you misunderstand what the comment says.  It is an
explanation for the next line, i.e., it tells the API users "If you
want the 'immediate failure when locked' behaviour, pass the _NOWAIT
bit".
Re: [PATCH 02/12] rerere: convert flags into an enum
#1733
Author: "Mark C. Chu-Carroll"
Date: Wed, 28 Oct 2026 14:11
36 lines
14161 bytes
On Wed, 28 Oct 2026 09:33:25 +0100, Patrick Steinhardt <ps@pks.im> wrote:
> On Tue, Oct 27, 2026 at 12:40:45PM -0700, Junio C Hamano wrote:
> > "Mark C. Chu-Carroll" <markchucarroll@fastmail.com> writes:
> > 
> > > On Tue, 27 Oct 2026 11:46:45 +0100, Patrick Steinhardt <ps@pks.im> wrote:
> > >> Our modern coding guidelines say that flags should typically be passed
> > >> around as enums so that it becomes trivial to see what kind of flags are
> > >> expected. Adapt the rerere flags accordingly.
> > >> 
> > >>   <snip>
> > >> +enum rerere_flags {
> > >> +	RERERE_AUTOUPDATE = (1 << 0),
> > >> +	RERERE_NOAUTOUPDATE = (1 << 1),
> > >> +	RERERE_READONLY = (1 << 2),
> > >> +	/* If MERGE_RR.lock is taken, return -1 as if rerere were disabled */
> > >> +	RERERE_NOWAIT = (1 << 3),
> > >> +};
> > >
> > > If we're moving to using enum flags, then wouldn't it be better to
> > > explicitly add a "RERE_MERGE_LOCK_TOKEN" to the enum for that case, 
> > > rather than have this value only documented by a comment?
> > 
> > Perhaps you misunderstand what the comment says.  It is an
> > explanation for the next line, i.e., it tells the API users "If you
> > want the 'immediate failure when locked' behaviour, pass the _NOWAIT
> > bit".
> 
> Yeah, this. I guess we can help that though by documenting all of the
> flags while at it.

Ah, yeah. I misunderstood that. Obvious in retrospect, but I was
puzzling over that for a while. 

    -Mark
Re: [PATCH 02/12] rerere: convert flags into an enum
#1750
Author: Junio C Hamano
Date: Wed, 28 Oct 2026 16:25
33 lines
13916 bytes
Patrick Steinhardt <ps@pks.im> writes:

> On Tue, Oct 27, 2026 at 12:40:45PM -0700, Junio C Hamano wrote:
>> "Mark C. Chu-Carroll" <markchucarroll@fastmail.com> writes:
>> 
>> > On Tue, 27 Oct 2026 11:46:45 +0100, Patrick Steinhardt <ps@pks.im> wrote:
>> >> Our modern coding guidelines say that flags should typically be passed
>> >> around as enums so that it becomes trivial to see what kind of flags are
>> >> expected. Adapt the rerere flags accordingly.
>> >> 
>> >>   <snip>
>> >> +enum rerere_flags {
>> >> +	RERERE_AUTOUPDATE = (1 << 0),
>> >> +	RERERE_NOAUTOUPDATE = (1 << 1),
>> >> +	RERERE_READONLY = (1 << 2),
>> >> +	/* If MERGE_RR.lock is taken, return -1 as if rerere were disabled */
>> >> +	RERERE_NOWAIT = (1 << 3),
>> >> +};
>> >
>> > If we're moving to using enum flags, then wouldn't it be better to
>> > explicitly add a "RERE_MERGE_LOCK_TOKEN" to the enum for that case, 
>> > rather than have this value only documented by a comment?
>> 
>> Perhaps you misunderstand what the comment says.  It is an
>> explanation for the next line, i.e., it tells the API users "If you
>> want the 'immediate failure when locked' behaviour, pass the _NOWAIT
>> bit".
>
> Yeah, this. I guess we can help that though by documenting all of the
> flags while at it.

Great.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads