The read member of struct file should be bool.
In order to have the device specific part at the end of the structure
move "read" ahead of that.
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
int fd = dev->fd;
if (fd != -1)
- files[fd].read = 1;
+ files[fd].read = true;
#endif
wake_up(&blkfront_queue);
}
moretodo:
#ifdef HAVE_LIBC
if (dev->fd != -1) {
- files[dev->fd].read = 0;
+ files[dev->fd].read = false;
mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
}
#endif
int fd = dev ? dev->fd : -1;
if (fd != -1)
- files[fd].read = 1;
+ files[fd].read = true;
wake_up(&console_queue);
#else
int fd = dev->fd;
if (fd != -1)
- files[fd].read = 1;
+ files[fd].read = true;
#endif
wake_up(&kbdfront_queue);
}
#ifdef HAVE_LIBC
if (dev->fd != -1) {
- files[dev->fd].read = 0;
+ files[dev->fd].read = false;
mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
}
#endif
#ifdef HAVE_LIBC
if (cons != prod && dev->fd != -1)
/* still some events to read */
- files[dev->fd].read = 1;
+ files[dev->fd].read = true;
#endif
return i;
int fd = dev->fd;
if (fd != -1)
- files[fd].read = 1;
+ files[fd].read = true;
#endif
wake_up(&fbfront_queue);
}
#ifdef HAVE_LIBC
if (dev->fd != -1) {
- files[dev->fd].read = 0;
+ files[dev->fd].read = false;
mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
}
#endif
#ifdef HAVE_LIBC
if (cons != prod && dev->fd != -1)
/* still some events to read */
- files[dev->fd].read = 1;
+ files[dev->fd].read = true;
#endif
return i;
#define _LIB_H_
#include <stdarg.h>
+#include <stdbool.h>
#include <stddef.h>
#include <xen/xen.h>
#include <xen/event_channel.h>
struct file {
enum fd_type type;
+ bool read; /* maybe available for read */
union {
struct {
/* lwIP fd */
} xenbus;
#endif
};
- int read; /* maybe available for read */
};
extern struct file files[];
local_irq_restore(flags);
if (fd != -1)
- files[fd].read = 1;
+ files[fd].read = true;
wake_up(&netfront_queue);
}
#endif
network_rx(dev);
if (!dev->rlen && fd != -1)
/* No data for us, make select stop returning */
- files[fd].read = 0;
+ files[fd].read = false;
/* Before re-enabling the interrupts, in case a packet just arrived in the
* meanwhile. */
local_irq_restore(flags);
}
#ifdef HAVE_LIBC
if(tpm->fd >= 0) {
- files[tpm->fd].read = 0;
+ files[tpm->fd].read = false;
files[tpm->fd].tpm_tis.respgot = 0;
files[tpm->fd].tpm_tis.offset = 0;
}
dev->waiting = 0;
#ifdef HAVE_LIBC
if(dev->fd >= 0) {
- files[dev->fd].read = 1;
+ files[dev->fd].read = true;
}
#endif
wake_up(&dev->waitq);
dev->resplen = 0;
#ifdef HAVE_LIBC
if(dev->fd >= 0) {
- files[dev->fd].read = 0;
+ files[dev->fd].read = false;
files[dev->fd].tpmfront.respgot = 0;
files[dev->fd].tpmfront.offset = 0;
}
/* If we have a response waiting, then read it now from the backend
* so we can get its length*/
- if(dev->waiting || (files[dev->fd].read == 1 && !files[dev->fd].tpmfront.respgot)) {
+ if(dev->waiting || (files[dev->fd].read && !files[dev->fd].tpmfront.respgot)) {
if ((rc = tpmfront_recv(dev, &dummybuf, &dummysz)) != 0) {
errno = EIO;
return -1;