Hey Petro,

The CODE is used on function pointers, so I think it is ok in the FS code.

BR,

Alan

On 1/26/22, Petro Karashchenko <petro.karashche...@gmail.com> wrote:
> Hello Alan,
>
> Yeah, I see that. But since CODE is missing for the most of the
> pointers to functions in common code I just wonder how that platform
> works.
> None of FS operations in include/nuttx/fs/fs.h have CODE. Does this
> mean that Z80, Z180 and Z16/ZNEO do not use FS as all?
>
> And another question is: Should we add CODE to function pointers in common
> code?
>
> Best regards,
> Petro
>
> ср, 26 січ. 2022 р. о 15:21 Alan Carvalho de Assis <acas...@gmail.com>
> пише:
>>
>> Hi Petro,
>>
>> It is used by Z80, Z180 and Z16/ZNEO, see include/nuttx/compiler.h for
>> reference.
>>
>> BR,
>>
>> Alan
>>
>> On 1/26/22, Petro Karashchenko <petro.karashche...@gmail.com> wrote:
>> > Hello team,
>> >
>> > Recently I noticed that some structures in common code use CODE
>> > keyword for pointers to functions and some do not, so I have the
>> > question: is CODE keyword still supported?
>> > Here are few examples:
>> > struct automount_lower_s
>> > {
>> > ...
>> >   CODE int (*attach)(FAR const struct automount_lower_s *lower,
>> >                       automount_handler_t isr, FAR void *arg);
>> >   CODE void (*enable)(FAR const struct automount_lower_s *lower,
>> >                       bool enable);
>> >   CODE bool (*inserted)(FAR const struct automount_lower_s *lower);
>> > };
>> > vs
>> > struct file_operations
>> > {
>> >   int     (*open)(FAR struct file *filep);
>> >   int     (*close)(FAR struct file *filep);
>> >   ssize_t (*read)(FAR struct file *filep, FAR char *buffer, size_t
>> > buflen);
>> >   ssize_t (*write)(FAR struct file *filep, FAR const char *buffer,
>> >                    size_t buflen);
>> >   off_t   (*seek)(FAR struct file *filep, off_t offset, int whence);
>> >   int     (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
>> >
>> >   /* The two structures need not be common after this point */
>> >
>> >   int     (*poll)(FAR struct file *filep, struct pollfd *fds, bool
>> > setup);
>> > #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
>> >   int     (*unlink)(FAR struct inode *inode);
>> > #endif
>> > };
>> >
>> > Will appreciate your feedback.
>> >
>> > Best regards,
>> > Petro
>> >
>

Reply via email to