aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--configure.in4
-rw-r--r--libmpio/Makefile.am4
-rw-r--r--libmpio/debug.c313
-rw-r--r--libmpio/debug.h110
-rw-r--r--libmpio/defs.h (renamed from libmpio/src/defs.h)2
-rw-r--r--libmpio/mpio.h (renamed from libmpio/src/mpio.h)2
7 files changed, 8 insertions, 429 deletions
diff --git a/Makefile.am b/Makefile.am
index b91b948..231d4fb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS=@MPLIB_SUBDIR@ kernel libmpio mpiosh etc tools
+SUBDIRS=kernel libmpio mpiosh etc tools
sbin_SCRIPTS=mkmpiodev
EXTRA_DIST=mpio.spec mkmpiodev
diff --git a/configure.in b/configure.in
index a2af5cc..62a9418 100644
--- a/configure.in
+++ b/configure.in
@@ -46,11 +46,13 @@ AC_CACHE_CHECK([whether to use mplib],
TEST_MPLIB
if test "$ac_cv_use_mplib" = yes; then
- AC_CONFIG_SUBDIRS(mplib)
MPLIB_INCLUDE=-Implib
MPLIB_CFLAGS=-DMPLIB
fi
+AC_SUBST(MPLIB_INCLUDE)
+AC_SUBST(MPLIB_CFLAGS)
+:
dnl --- check for kernel version
kernel_version=`uname -r 2>&1`
echo -n "checking for kernel version ... "
diff --git a/libmpio/Makefile.am b/libmpio/Makefile.am
index 1451b75..2adfa19 100644
--- a/libmpio/Makefile.am
+++ b/libmpio/Makefile.am
@@ -19,8 +19,8 @@ libmpio_la_SOURCES= \
mplib/xmalloc.c
pkginclude_HEADERS= \
- src/mpio.h \
- src/defs.h
+ mpio.h \
+ defs.h
noinst_HEADERS= \
src/io.h \
diff --git a/libmpio/debug.c b/libmpio/debug.c
deleted file mode 100644
index c1ead3e..0000000
--- a/libmpio/debug.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * debug.c
- *
- * Authors: Dirk Meyer <dmeyer@tzi.de>
- * Andreas Büsching <crunchy@tzi.de>
- *
- * $Id: debug.c,v 1.3 2003/03/20 13:34:05 crunchy Exp $
- */
-
-#include "debug.h"
-
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-
-#define DCOLOR "_color"
-#define DFILE "_file"
-#define DSUFFIX "_debug"
-#define LEVEL_HEXDUMP 5
-
-#define CHECK_FD if (__debug_fd == NULL) return;
-
-char *__debug_color = NULL;
-int __debug_level = 0;
-FILE *__debug_fd = NULL;
-
-void
-debug_init(void) {
- char *env_var = malloc(strlen(DPACKAGE) + strlen(DFILE) + 1);
- const char *env;
-
- /* check debug output file */
- strcpy(env_var, DPACKAGE);
- strcat(env_var, DFILE);
-
- if ((env = getenv(env_var))) {
- if (__debug_fd && fileno(__debug_fd) != -1) {
- fclose(__debug_fd);
- }
-
- __debug_fd = fopen(env, "a");
- if (!__debug_fd) {
- __debug_fd = stderr;
- }
- } else {
- __debug_fd = stderr;
- }
-
- free(env_var);
-
- /* check debug level */
- env_var = malloc(strlen(DPACKAGE) + strlen(DSUFFIX) + 1);
- strcpy(env_var, DPACKAGE);
- strcat(env_var, DSUFFIX);
-
- if ((env = getenv(env_var)))
- if (isdigit(env[0]))
- __debug_level = strtol(env, NULL, 10);
- else
- __debug_level = 1;
- else
- __debug_level = -1;
-
- free(env_var);
-
- /* check debug color */
- env_var = malloc(strlen(DPACKAGE) + strlen(DCOLOR) + 1);
-
- strcpy(env_var, DPACKAGE);
- strcat(env_var, DCOLOR);
-
- if (__debug_color) free(__debug_color);
- __debug_color = NULL;
-
- if ((env = getenv(env_var))) {
- if (env[0] != '\0') {
- __debug_color = malloc(4 + strlen(env));
- sprintf(__debug_color, "\033[%sm", env);
- } else
- __debug_color = malloc(6);
- strcpy(__debug_color, "\033[32m");
- } else {
- __debug_color = NULL;
- }
-
- free(env_var);
-}
-
-int
-debug_file(char *filename)
-{
- if (__debug_fd && fileno(__debug_fd) != -1) {
- fclose(__debug_fd);
- }
-
- __debug_fd = fopen(filename, "a");
- if (!__debug_fd) {
- perror("fopen:");
- __debug_fd = stderr;
- return 0;
- }
-
- return 1;
-}
-
-int
-debug_level(int level)
-{
- int tmp = __debug_level;
-
- __debug_level = level;
-
- return tmp;
-}
-
-int
-debug_level_get(void)
-{
- return __debug_level;
-}
-
-
-void
-_hexdump (const char *package, const char* file, int line,
- const char* function, const char* data, int len)
-{
- char buf[17];
- int i;
-
- CHECK_FD;
-
- if (_use_debug(LEVEL_HEXDUMP)) {
- fprintf (__debug_fd, "%s%s:\033[m %s(%d): %s: data=%p len=%d\n",
- __debug_color, package, file, line, function, data, len);
- for (i = 0; data != NULL && i < len; i++) {
- if (i % 16 == 0)
- fprintf(__debug_fd, "\033[30m%s:\033[m %04x: ", package, i);
- fprintf(__debug_fd, "%02x ", (unsigned int)(unsigned char)data[i]);
- buf[i % 16] = (data[i] >= 32 && data[i] <= 126) ? data[i] : '.';
- buf[i % 16 + 1] = '\0';
- if (i % 4 == 3) fprintf(__debug_fd, " ");
- if (i % 16 == 15) fprintf(__debug_fd, "%s\n", buf);
- }
- if (i % 16 != 0) {
- for (; i % 16 != 0; i++)
- fprintf (__debug_fd, (i % 4 == 3) ? " " : " ");
- fprintf(__debug_fd, "%s\n", buf);
- }
- }
-}
-
-void
-_hexdump_n (const char *package, const int n, const char* file, int line,
- const char* function, const char* data, int len)
-{
- char buf[17];
- int i;
-
- CHECK_FD;
-
- if (_use_debug(n)) {
- fprintf (__debug_fd, "%s%s:\033[m %s(%d): %s: data=%p len=%d\n",
- __debug_color, package, file, line, function, data, len);
- for (i = 0; data != NULL && i < len; i++) {
- if (i % 16 == 0)
- fprintf(__debug_fd, "\033[30m%s:\033[m %04x: ", package, i);
- fprintf(__debug_fd, "%02x ", (unsigned int)(unsigned char)data[i]);
- buf[i % 16] = (data[i] >= 32 && data[i] <= 126) ? data[i] : '.';
- buf[i % 16 + 1] = '\0';
- if (i % 4 == 3) fprintf(__debug_fd, " ");
- if (i % 16 == 15) fprintf(__debug_fd, "%s\n", buf);
- }
- if (i % 16 != 0) {
- for (; i % 16 != 0; i++)
- fprintf (__debug_fd, (i % 4 == 3) ? " " : " ");
- fprintf(__debug_fd, "%s\n", buf);
- }
- }
-}
-
-
-void
-_hexdump_text (const char *text,
- const char *package, const char *file, int line,
- const char *function, const char *data, int len)
-{
- CHECK_FD;
-
- if (_use_debug(LEVEL_HEXDUMP)) {
- fprintf(__debug_fd, "%s%s: %s(%d): %s: %s\033[m", __debug_color,
- package, file, line, function, text);
- _hexdump(package, file, line, function, data, len);
- }
-}
-
-
-
-void
-_error(const char *package, const char *file, int line,
- const char *function, int fatal, const char *format, ...)
-{
- char foo[2048];
- va_list ap;
-
- CHECK_FD;
-
- va_start(ap, format);
-
-
- vsnprintf(foo, sizeof(foo) - strlen(format) - 1, format, ap);
- if (_use_debug(0))
- fprintf(__debug_fd, "\033[31m%s: %s(%d): %s: %s\033[m",
- package, file, line, function, foo);
- else
- fprintf(__debug_fd, "%s: %s(%d): %s: %s",
- package, file, line, function, foo);
- fflush(__debug_fd);
-
- if (fatal) {
- fprintf(__debug_fd, "\033[31mfatal error -- exit programm\033[m\n");
- exit(1);
- }
-
- va_end(ap);
-}
-
-void
-_debug(const char *package, const char *file, int line,
- const char *function, const char *format, ...)
-{
- char foo[2048];
- va_list ap;
- va_start(ap, format);
-
- CHECK_FD;
-
- vsnprintf(foo, sizeof(foo) - strlen(format) - 1, format, ap);
-
- if (_use_debug(0)) {
- fprintf(__debug_fd, "%s%s: %s(%d): %s: %s\033[m",
- ( __debug_color ? __debug_color : ""),
- package, file, line, function, foo);
- fflush(__debug_fd);
- }
-
- va_end(ap);
-}
-
-void
-_debug_n(const char *package, const int n, const char *file,
- int line, const char *function, const char *format, ...)
-{
- char foo[2048];
- va_list ap;
- va_start(ap, format);
-
- CHECK_FD;
-
- vsnprintf(foo, sizeof(foo) - strlen(format) - 1, format, ap);
-
- if (_use_debug(n)) {
- fprintf(__debug_fd, "%s%s: %s(%d): %s: %s\033[m",
- ( __debug_color ? __debug_color : ""),
- package, file, line, function, foo);
- fflush(__debug_fd);
- }
-
- va_end(ap);
-}
-
-void
-_octetstr(const char *package, const char *file, int line,
- const char *function, const uint8_t *str,
- const unsigned int len, const char *what)
-{
- CHECK_FD;
-
- if (_use_debug(LEVEL_HEXDUMP)) {
- unsigned int i;
-
- fprintf(__debug_fd, "%s%s: %s(%d): %s: ",
- package, file, function, line, (what?what:""));
- for (i = 0; i < len; i++) {
- if (i < (len - 1))
- fprintf(__debug_fd, "%03d.", str [i]);
- else
- fprintf(__debug_fd, "%03d", str [i]);
- }
- }
-}
-
-int
-_use_debug(int level)
-{
- if (__debug_level == -1) return 0;
-
- CHECK_FD;
-
- if (level <= __debug_level) {
- return 1;
- }
-
- return 0;
-}
-
-/* end of debug.c */
-
-
-
-
-
diff --git a/libmpio/debug.h b/libmpio/debug.h
deleted file mode 100644
index 09ae078..0000000
--- a/libmpio/debug.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * debug.h
- *
- * Author: Dirk Meyer <dmeyer@tzi.de>
- * Andreas Büsching <crunchy@tzi.de>
- *
- * $Id: debug.h,v 1.2 2002/10/26 13:07:43 germeier Exp $
- */
-
-#ifndef _MPIO_DEBUG_H_
-#define _MPIO_DEBUG_H_
-
-// if DPACKAGE is not definied use PACKAGE or "unknown"
-
-#ifndef DPACKAGE
-
-#ifdef PACKAGE
-#define DPACKAGE PACKAGE
-#else
-#define DPACKAGE unknown
-#endif
-
-#endif
-
-#include <stdio.h>
-
-#ifdef sun
-#include <sys/int_types.h>
-#else
-#include <stdint.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef PBOOL
-#define PBOOL(x) (x)?"True":"False"
-#endif
-
-#define UNUSED(x) (x = x)
-
-#define debugn(n,args...) \
- _debug_n(DPACKAGE, n, __FILE__, __LINE__, __FUNCTION__, args)
-
-#define debug(args...) \
- _debug(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, args)
-
-#define debug_error(fatal,args...) \
- _error(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, fatal, args)
-
-#define hexdump(data,len) \
- _hexdump(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, data, len)
-
-#define hexdumpn(n,data,len) \
- _hexdump_n(DPACKAGE, n, __FILE__, __LINE__, __FUNCTION__, data, len)
-
-#define hexdump_text(text,data,len) \
- _hexdump_text(text, DPACKAGE, __FILE__, __LINE__, __FUNCTION__, data, len)
-
-#define octetstrdump(data,len) \
- _octetstr(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, data, len)
-
-#define ipadr_dump(data,len,text) \
- _octetstr(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, data, len, text)
-
-#define use_debug() \
- use_debug(DPACKAGE)
-
-
-#define with_special_debug(what) \
- _use_debug(DPACKAGE, what)
-
-void debug_init(void);
-int debug_file(char *filename);
-int debug_level(int level);
-int debug_level_get(void);
-
-void _debug(const char *package, const char* file, int line,
- const char* function, const char *format, ...);
-
-void _debug_n(const char *package, const int n, const char* file,
- int line, const char* function, const char *format, ...);
-
-void _hexdump (const char *package, const char* file, int line,
- const char* function, const char* data, int len);
-
-void _hexdump_n (const char *package, const int n, const char* file, int line,
- const char* function, const char* data, int len);
-
-void _hexdump_text (const char *text,
- const char *package, const char* file, int line,
- const char* function, const char* data, int len);
-
-void _error(const char *package, const char* file, int line,
- const char* function, int fatal, const char *format, ...);
-
-void _octetstr(const char *package, const char* file, int line,
- const char* function, const uint8_t *str,
- const unsigned int len, const char *what);
-
-int _use_debug(int level);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MPIO_DEBUG_H_ */
-
-/* end of debug.h */
diff --git a/libmpio/src/defs.h b/libmpio/defs.h
index f676e23..fa9483e 100644
--- a/libmpio/src/defs.h
+++ b/libmpio/defs.h
@@ -1,7 +1,7 @@
/* -*- linux-c -*- */
/*
- * $Id: defs.h,v 1.1 2003/04/23 08:34:14 crunchy Exp $
+ * $Id: defs.h,v 1.24 2003/04/23 08:53:23 crunchy Exp $
*
* Library for USB MPIO-*
*
diff --git a/libmpio/src/mpio.h b/libmpio/mpio.h
index 1d5ba3c..436ff85 100644
--- a/libmpio/src/mpio.h
+++ b/libmpio/mpio.h
@@ -1,7 +1,7 @@
#/* -*- linux-c -*- */
/*
- * $Id: mpio.h,v 1.1 2003/04/23 08:34:15 crunchy Exp $
+ * $Id: mpio.h,v 1.20 2003/04/23 08:53:24 crunchy Exp $
*
* Library for USB MPIO-*
*