CVSROOT:        /cvs/cluster
Module name:    cluster
Changes by:     [EMAIL PROTECTED]       2008-02-21 17:49:16

Modified files:
        dlm/tests/usertest: dlmtest2.c 

Log message:
        updates

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/tests/usertest/dlmtest2.c.diff?cvsroot=cluster&r1=1.11&r2=1.12

--- cluster/dlm/tests/usertest/dlmtest2.c       2008/01/17 21:49:00     1.11
+++ cluster/dlm/tests/usertest/dlmtest2.c       2008/02/21 17:49:15     1.12
@@ -61,18 +61,37 @@
 static unsigned int sts_eunlock, sts_ecancel, sts_etimedout, sts_edeadlk, 
sts_eagain, sts_other, sts_zero;
 static unsigned int bast_unlock, bast_skip;
 
+
 #define log_print(fmt, args...) \
 do { \
        if (!quiet) \
                printf(fmt , ##args); \
 } while (0)
 
-#define log_verbose(fmt, args...) \
+#define log_op(fmt, args...) \
+do { \
+       if (!quiet) \
+               printf(fmt , ##args); \
+} while (0)
+
+#define log_ast(fmt, args...) \
 do { \
        if (verbose) \
                printf(fmt , ##args); \
 } while (0)
 
+#define log_bast(fmt, args...) \
+do { \
+       if (verbose > 1) \
+               printf(fmt , ##args); \
+} while (0)
+
+#define log_verbose(fmt, args...) \
+do { \
+       if (verbose > 2) \
+               printf(fmt , ##args); \
+} while (0)
+
 struct client {
        int fd;
        char type[32];
@@ -220,10 +239,10 @@
 
        if (skip) {
                bast_skip++;
-               printf("    bast: skip    %3d\t%x\n", lk->id, lk->lksb.sb_lkid);
+               log_bast("    bast: skip    %3d\t%x\n", lk->id, 
lk->lksb.sb_lkid);
        } else {
                bast_unlock++;
-               printf("    bast: unlockf %3d\t%x\n", lk->id, lk->lksb.sb_lkid);
+               log_bast("    bast: unlockf %3d\t%x\n", lk->id, 
lk->lksb.sb_lkid);
                unlockf(lk->id);
        }
        lk->bast = 0;
@@ -261,8 +280,8 @@
                       op_str(lk->lastop), status_str(lk->last_status));
        }
 
-       log_print("     ast: %s %3d\t%x\n",
-                 status_str(lk->lksb.sb_status), i, lk->lksb.sb_lkid);
+       log_ast("     ast: %s %3d\t%x\n",
+               status_str(lk->lksb.sb_status), i, lk->lksb.sb_lkid);
 
        lk->last_status = lk->lksb.sb_status;
 
@@ -845,7 +864,7 @@
 
                        lock(i, rand_int(0, 5));
                        lock_ops++;
-                       printf("%8x: lock    %3d\t%x\n", n, i, 
lk->lksb.sb_lkid);
+                       log_op("%8x: lock    %3d\t%x\n", n, i, 
lk->lksb.sb_lkid);
                        break;
 
                case Op_unlock:
@@ -864,7 +883,7 @@
 
                        unlock(i);
                        unlock_ops++;
-                       printf("%8x: unlock  %3d\t%x\n", n, i, 
lk->lksb.sb_lkid);
+                       log_op("%8x: unlock  %3d\t%x\n", n, i, 
lk->lksb.sb_lkid);
                        break;
 
                case Op_unlockf:
@@ -879,7 +898,7 @@
 
                        unlockf(i);
                        unlockf_ops++;
-                       printf("%8x: unlockf %3d\t%x\n", n, i, 
lk->lksb.sb_lkid);
+                       log_op("%8x: unlockf %3d\t%x\n", n, i, 
lk->lksb.sb_lkid);
                        break;
 
                case Op_cancel:
@@ -894,7 +913,7 @@
 
                        cancel(i);
                        cancel_ops++;
-                       printf("%8x: cancel  %3d\t%x\n", n, i, 
lk->lksb.sb_lkid);
+                       log_op("%8x: cancel  %3d\t%x\n", n, i, 
lk->lksb.sb_lkid);
                        break;
                }
 
@@ -1253,7 +1272,7 @@
        int optchar;
 
        while (cont) {
-               optchar = getopt(argc, argv, "n:r:c:i:thVo");
+               optchar = getopt(argc, argv, "n:r:c:i:thVoq:v:");
 
                switch (optchar) {
 
@@ -1282,6 +1301,14 @@
                        openclose_ls = 1;
                        break;
 
+               case 'q':
+                       quiet = atoi(optarg);
+                       break;
+
+               case 'v':
+                       verbose = atoi(optarg);
+                       break;
+
                case 'h':
                        print_usage();
                        exit(EXIT_SUCCESS);
@@ -1398,7 +1425,7 @@
 
        client_add(libdlm_fd, &maxi);
 
-       if (opt_cmd) {
+       if (cmd) {
                process_command(&quit);
                goto out;
        }

Reply via email to