Hi,
On Mon, Oct 18, 2021 at 02:57:29PM +0200, Takashi Iwai wrote:
On Mon, 18 Oct 2021 14:46:54 +0200, Takashi Sakamoto wrote:
Hi,
On Mon, Oct 18, 2021 at 10:05:32AM +0200, Takashi Iwai wrote:
On Sun, 17 Oct 2021 11:25:37 +0200, Takashi Sakamoto wrote:
Would I ask you opinion about my concern about firewire UAPI header? Is it allowed to use float type instead of __u32 type?
I guess the safest way would be like include/uapi/linux/acct.h. The ifdef KERNEL will be omitted at installation, so user-space would see only float type while the kernel sees only __u32.
Yes. I've already found the header and it would be the safest, However, conditional macro sometimes confuses userspace developers...
I believe that the ifdef will be dropped automagically during installing the files, so that user-space will see only float.
You can try to patch and run make headers_install.
Oh, I thought that the headers are simply copied when installing... Indeed, I can find 'scripts/headers_install.sh' does the work in 'headers' make target invoked by the 'headers_install' target.
``` $ tail -n10 include/uapi/sound/firewire.h */ struct snd_firewire_motu_command_dsp_meter { #ifdef __KERNEL__ __u32 data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT]; #else float data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT]; #endif };
#endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */ $ make headers $ tail -n5 usr/include/sound/firewire.h */ struct snd_firewire_motu_command_dsp_meter { float data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT]; };
#endif /* _SOUND_FIREWIRE_H_INCLUDED */ ```
It would be achieved to use different type with the same storage size between kernel and userspace. After writing some userspace test applications, I'll post the patch. Thanks for your advice.
Takashi
Regards
Takashi Sakamoto