[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 03/12] mini-os: use alloc_file_type() and get_file_from_fd() in xs
On 11/01/2022 20:11, Samuel Thibault wrote: > Samuel Thibault, le mar. 11 janv. 2022 21:06:15 +0100, a ecrit: >> Juergen Gross, le mar. 11 janv. 2022 16:12:06 +0100, a ecrit: >>> diff --git a/lib/xs.c b/lib/xs.c >>> index 4af0f96..ac830d2 100644 >>> --- a/lib/xs.c >>> +++ b/lib/xs.c >>> @@ -18,23 +18,55 @@ static inline int _xs_fileno(struct xs_handle *h) { >>> return (intptr_t) h; >>> } >>> >>> +static int xs_close_fd(int fd) >>> +{ >>> + struct xenbus_event *event, *next; >>> + struct file *file = get_file_from_fd(fd); > This... > >>> + for (event = file->dev; event; event = next) >>> + { >>> + next = event->next; >>> + free(event); >>> + } >>> + >>> + return 0; >>> +} >>> + >>> +static bool xs_can_read(int fd) >>> +{ >>> + struct file *file = get_file_from_fd(fd); > ... and that would be simplified by directly getting the file* from the > parameters. I actually make exactly the same suggestion for close() in libxenevtchn. The callback hooks don't need the same API as the libc functions. ~Andrew
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |