Replace zpool_events_next() "block" parm w/ "flags"

zpool_events_next() can be called in blocking mode by specifying a
non-zero value for the "block" parameter.  However, the design of
the ZFS Event Daemon (zed) requires additional functionality from
zpool_events_next().  Instead of adding additional arguments to the
function, it makes more sense to use flags that can be bitwise-or'd
together.

This commit replaces the zpool_events_next() int "block" parameter with
an unsigned bitwise "flags" parameter.  It also defines ZEVENT_NONE
to specify the default behavior.  Since non-blocking mode can be
specified with the existing ZEVENT_NONBLOCK flag, the default behavior
becomes blocking mode.  This, in effect, inverts the previous use
of the "block" parameter.  Existing callers of zpool_events_next()
have been modified to check for the ZEVENT_NONBLOCK flag.

Signed-off-by: Chris Dunlap <cdunlap@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2
This commit is contained in:
Chris Dunlap
2014-02-12 10:30:18 -08:00
committed by Brian Behlendorf
parent 07917db990
commit 8c7aa0cfc4
4 changed files with 10 additions and 6 deletions
+2 -1
View File
@@ -49,6 +49,7 @@
#include <sys/stat.h>
#include <sys/fm/util.h>
#include <sys/fm/protocol.h>
#include <sys/zfs_ioctl.h>
#include <libzfs.h>
@@ -5465,7 +5466,7 @@ zpool_do_events_next(ev_opts_t *opts)
while (1) {
ret = zpool_events_next(g_zfs, &nvl, &dropped,
!!opts->follow, zevent_fd);
(opts->follow ? ZEVENT_NONE : ZEVENT_NONBLOCK), zevent_fd);
if (ret || nvl == NULL)
break;