From 7d392652bae52b76cb5fe907cc1e86e0e0c4ced9 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Thu, 17 Jun 2010 20:15:44 +0200 Subject: Add idle function This patch adds the mtdev_idle() function, which checks the kernel device for activity. Useful when implementing timing logic. Signed-off-by: Henrik Rydberg --- include/mtdev.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/mtdev.h') diff --git a/include/mtdev.h b/include/mtdev.h index 5f2f6a3..e2fdc9d 100644 --- a/include/mtdev.h +++ b/include/mtdev.h @@ -145,6 +145,17 @@ int mtdev_configure(struct mtdev *dev, int fd); */ int mtdev_open(struct mtdev *dev, int fd); +/** + * mtdev_idle - check state of kernel device + * @dev: the mtdev in use + * @fd: file descriptor of the kernel device + * @ms: number of milliseconds to wait for activity + * + * Returns true if the device is idle, i.e., there are no buffered + * events and there is nothing to fetch from the kernel device. + */ +int mtdev_idle(struct mtdev *dev, int fd, int ms); + /** * mtdev_fetch - fetch an event from the kernel device * @dev: the mtdev in use -- cgit v1.2.3