Re: [PATCH 2/2] Use enum types for remote fileio flags

Tom Tromey
2026-02-27T14:15:47Z

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> + proc->stat.tag_fd = target_fileio_open (NULL, cl_name,
>> + FILEIO_O_RDWR | FILEIO_O_EXCL,
>> + FILEIO_S_IRWXU, 0, &target_errno);

Simon> Perhaps change that 0 to false (the `bool warn_if_slow` param).

I added a patch to fix up the warn_if_slow stuff.

Simon> So the flags here goes from "false" (obviously wrong) to FILEIO_S_IRWXU.
Simon> Since we don't pass the _CREATE flag, I think that the value for mode
Simon> is irrelevant. If so, it might be clearer to pass 0, otherwise it makes
Simon> it seem like the value we pass is meaningful, which can be confusing.

I fixed this.

Simon> But I also noticed the enum type is not actually used. It could be used
Simon> in remote_fileio_seek_flag_to_host, although it wouldn't be terribly
Simon> useful. So perhaps this enum could be anonymous actually.

Yeah I did this, thanks.

>>
>> /* errno values */
>> enum fileio_error
>> @@ -146,12 +159,12 @@ extern int fileio_error_to_host (fileio_error errnum);
>> /* Convert File-I/O open flags FFLAGS to host format, storing
>> the result in *FLAGS. Return 0 on success, -1 on error. */
>>
>> -extern int fileio_to_host_openflags (int fflags, int *flags);
>> +extern int fileio_to_host_openflags (fileio_open_flags fflags, int *flags);

Simon> In the implementation, the second parameter is named open_flags_p. You
Simon> could maybe rename it here. That would free up "flags" for the first
Simon> parameter, if you want.

I made them use the same names. I didn't change it to 'flags' though.

Tom