Allow print_event to mimick minimal hsm.
authorDean Roehrich <roehrich@sgi.com>
Mon, 6 May 2002 16:40:30 +0000 (16:40 +0000)
committerDean Roehrich <roehrich@sgi.com>
Mon, 6 May 2002 16:40:30 +0000 (16:40 +0000)
dmapi/src/suite1/cmd/print_event.c

index a6fc24b5ea1b5be3c990e524169a1282be4f411a..3e01e77f201bff10bd27589199ea6ec7ba4af8a4 100644 (file)
@@ -81,13 +81,14 @@ int          rwt_bit_clear = 1;  /* Clear read/write/trunc bit before
                                      * responding to event; reset all other
                                      * bits.
                                      */
+int             dmf_events = 0;     /* Use only those events that DMF uses */
 
 void
 usage(
       char *prog)
 {
   fprintf(stderr, "Usage: %s ", prog);
-  fprintf(stderr, " <-S oldsid> <-v> <-s sleep> <-R> <-N> ");
+  fprintf(stderr, " <-S oldsid> <-v> <-s sleep> <-R> <-N> <-D> ");
   fprintf(stderr, "filesystem \n");
 }
 
@@ -107,7 +108,7 @@ main(
 /*  Progname  = argv[0];*/ Progname = "print_event";
   fsname  = NULL;
 
-  while ((c = getopt(argc, argv, "vs:S:RN")) != EOF) {
+  while ((c = getopt(argc, argv, "vs:S:RND")) != EOF) {
     switch (c) {
     case 's':
       Sleep = atoi(optarg);
@@ -115,6 +116,9 @@ main(
     case 'R':
       register_new_mnts = 1;
       break;
+    case 'D':
+      dmf_events = 1;
+      break;
     case 'N':
       rwt_bit_clear = 0;
       break;
@@ -995,8 +999,15 @@ set_events(
        dm_eventset_t   eventlist;
 
        if (Verbose) {
-               err_msg("Setting event list to enable all events "
-                       "for this file system\n");
+               if (dmf_events) {
+                       err_msg("Setting event list to enable all "
+                               "DMF-supported events "
+                               "for this file system\n");
+               }
+               else {
+                       err_msg("Setting event list to enable all events "
+                               "for this file system\n");
+               }
        }
        DMEV_ZERO(eventlist);
 
@@ -1045,6 +1056,13 @@ set_events(
 #endif
        DMEV_SET(DM_EVENT_DESTROY, eventlist);
 
+       /* Did we want just the DMF events? */
+       if (dmf_events) {
+               DMEV_ZERO(eventlist);
+               DMEV_SET(DM_EVENT_UNMOUNT, eventlist);
+               DMEV_SET(DM_EVENT_DESTROY, eventlist);
+       }
+
        /* Pseudo-events. */
 
        /* DM_EVENT_USER - always enabled - causes EINVAL if specified */