Whamcloud - gitweb
LU-13019 tests: replace usleep in test scripts
[fs/lustre-release.git] / lustre / tests / mpi / lp_utils.h
index 52aca75..fc67ba5 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
 #ifndef __LP_UTILS_H__
 #define __LP_UTILS_H__
 
-#include "lustre/lustre_user.h"
+#include <linux/lustre/lustre_user.h>
 
-#define FAIL(msg) \
- \
+#define FAILF(fmt, ...) \
 do { \
-        printf("%s: Process %d (%s)\n", timestamp(), rank, hostname); \
-        if (debug) \
-                printf("\tFAILED in %s:%d:%s()\n", __FILE__, __LINE__, __func__); \
-        else \
-                printf("\tFAILED in %s()\n", __func__); \
-        printf("%s", msg); \
-        fflush(stdout); \
-        MPI_Abort(MPI_COMM_WORLD, 1); \
-} while(0)
+       printf("%s: Process %d (%s)\n", timestamp(), rank, hostname); \
+       if (debug) \
+               printf("\tFAILED in %s:%d:%s()\n", \
+                      __FILE__, __LINE__, __func__); \
+       else \
+               printf("\tFAILED in %s()\n", __func__); \
+       printf(fmt, ##__VA_ARGS__); \
+       fflush(stdout); \
+       MPI_Abort(MPI_COMM_WORLD, 1); \
+} while (0)
+
+#define FAIL(msg)      FAILF("%s", (msg))
+
+#ifndef MAX
+#define MAX(a, b)      ((a) > (b) ? (b) : (a))
+#endif
 
 #define FILEMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH
 #define MAX_FILENAME_LEN 512
@@ -69,8 +69,8 @@ extern char hostname[];
 extern char *timestamp();
 extern char *testdir;
 
-extern inline void begin(char *str);
-extern inline void end(char *str);
+extern void begin(char *str);
+extern void end(char *str);
 
 extern void dump_diff(char *orig_buf, char *buf, int len, long off);
 extern void lp_gethostname(void);