|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 17/18] mini-os: use function vectors instead of switch for file operations
Andrew Cooper, le mar. 11 janv. 2022 18:08:27 +0000, a ecrit:
> On 11/01/2022 14:58, Juergen Gross wrote:
> > +typedef int file_read_func(int fd, void *buf, size_t nbytes);
> > +typedef int file_write_func(int fd, const void *buf, size_t nbytes);
> > +typedef off_t file_lseek_func(int fd, off_t offset, int whence);
> > +typedef int file_close_func(int fd);
> > +typedef int file_fstat_func(int fd, struct stat *buf);
> > +typedef int file_fcntl_func(int fd, int cmd, va_list args);
> > +typedef bool file_select_func(int fd);
>
> Are these typedef's useful? I don't see them used anywhere other than
> the file_ops structure.
>
> > +
> > +struct file_ops {
> > + const char *name;
> > + file_read_func *read;
> > + file_write_func *write;
> > + file_lseek_func *lseek;
> > + file_close_func *close;
> > + file_fstat_func *fstat;
> > + file_fcntl_func *fcntl;
> > + file_select_func *select_rd;
> > + file_select_func *select_wr;
> > };
I agree, I'd rather see the protoypes inside the struct itself.
Samuel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |