From f4b377415b4b53722addedc10801db24ad4e6f23 Mon Sep 17 00:00:00 2001 From: behlendo Date: Sat, 1 Mar 2008 00:45:59 +0000 Subject: [PATCH] Reorganize /include/ to add a /sys/, this way we don't need to muck with #includes in existing Solaris style source to get it to find the right stuff. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@18 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c --- cmd/Makefile.am | 4 +- cmd/splat.h | 2 +- configure.ac | 3 +- include/Makefile.am | 10 ++-- include/spl.h | 19 ------- include/splat-ctl.h | 67 ------------------------ include/sys/Makefile.am | 5 ++ include/{spl-callb.h => sys/callb.h} | 2 +- include/sys/cmn_err.h | 4 ++ include/{spl-condvar.h => sys/condvar.h} | 0 include/{spl-cred.h => sys/cred.h} | 0 include/sys/debug.h | 4 ++ include/{spl-generic.h => sys/generic.h} | 0 include/{spl-kmem.h => sys/kmem.h} | 0 include/{spl-kstat.h => sys/kstat.h} | 4 +- include/{spl-mutex.h => sys/mutex.h} | 2 +- include/sys/param.h | 4 ++ include/{spl-random.h => sys/random.h} | 0 include/{spl-rwlock.h => sys/rwlock.h} | 2 +- include/sys/spl.h | 19 +++++++ include/{spl-taskq.h => sys/taskq.h} | 2 +- include/{spl-thread.h => sys/thread.h} | 4 +- include/{spl-time.h => sys/time.h} | 2 +- include/{spl-timer.h => sys/timer.h} | 0 include/{spl-types.h => sys/types.h} | 0 lib/Makefile.am | 6 ++- lib/list.c | 2 +- {include => lib}/list.h | 0 modules/spl/spl-generic.c | 2 +- modules/spl/spl-kmem.c | 2 +- modules/spl/spl-rwlock.c | 2 +- modules/spl/spl-taskq.c | 2 +- modules/spl/spl-thread.c | 2 +- modules/splat/splat-internal.h | 2 +- 34 files changed, 66 insertions(+), 113 deletions(-) delete mode 100644 include/spl.h delete mode 100644 include/splat-ctl.h create mode 100644 include/sys/Makefile.am rename include/{spl-callb.h => sys/callb.h} (97%) create mode 100644 include/sys/cmn_err.h rename include/{spl-condvar.h => sys/condvar.h} (100%) rename include/{spl-cred.h => sys/cred.h} (100%) create mode 100644 include/sys/debug.h rename include/{spl-generic.h => sys/generic.h} (100%) rename include/{spl-kmem.h => sys/kmem.h} (100%) rename include/{spl-kstat.h => sys/kstat.h} (99%) rename include/{spl-mutex.h => sys/mutex.h} (99%) create mode 100644 include/sys/param.h rename include/{spl-random.h => sys/random.h} (100%) rename include/{spl-rwlock.h => sys/rwlock.h} (99%) create mode 100644 include/sys/spl.h rename include/{spl-taskq.h => sys/taskq.h} (99%) rename include/{spl-thread.h => sys/thread.h} (96%) rename include/{spl-time.h => sys/time.h} (98%) rename include/{spl-timer.h => sys/timer.h} (100%) rename include/{spl-types.h => sys/types.h} (100%) rename {include => lib}/list.h (100%) diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 1a10fa8081..d3d7477974 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -1,6 +1,8 @@ +DEFAULT_INCLUDES = -I. -I.. -I../lib AM_CFLAGS = -g -O2 -W -Wall -Wstrict-prototypes -Wshadow -INCLUDES = -I$(top_srcdir)/include + sbin_PROGRAMS = splat splat_SOURCES = splat.c splat_LDFLAGS = $(top_builddir)/lib/libcommon.la + EXTRA_DIST = splat.h diff --git a/cmd/splat.h b/cmd/splat.h index 8698057231..e4419def53 100644 --- a/cmd/splat.h +++ b/cmd/splat.h @@ -2,7 +2,7 @@ #define _SPLAT_H #include "list.h" -#include "splat-ctl.h" +#include "../include/splat-ctl.h" #define DEV_NAME "/dev/splatctl" #define COLOR_BLACK "\033[0;30m" diff --git a/configure.ac b/configure.ac index 6b8dd7d36b..9a7b103d0c 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_INIT AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(spl, 0.0.1) -AC_CONFIG_HEADERS([include/config.h]) +AC_CONFIG_HEADERS([config.h]) AC_PROG_INSTALL AC_PROG_CC @@ -115,6 +115,7 @@ AC_CONFIG_FILES([ Makefile modules/spl/Makefile modules/splat/Makefile include/Makefile + include/sys/Makefile scripts/Makefile scripts/spl.spec ]) diff --git a/include/Makefile.am b/include/Makefile.am index b84da9a8ee..161a93a8dc 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,7 +1,3 @@ -EXTRA_DIST = spl.h -EXTRA_DIST += spl-condvar.h spl-kmem.h spl-random.h spl-thread.h -EXTRA_DIST += spl-types.h spl-cred.h spl-kstat.h spl-rwlock.h -EXTRA_DIST += spl-time.h spl-callb.h spl-generic.h spl-mutex.h -EXTRA_DIST += spl-taskq.h spl-timer.h -EXTRA_DIST += splat-ctl.h -EXTRA_DIST += list.h +SUBDIRS = sys + +EXTRA_DIST = splat-ctl.h diff --git a/include/spl.h b/include/spl.h deleted file mode 100644 index d069fd94dd..0000000000 --- a/include/spl.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _SPL_H -#define _SPL_H - -#include "spl-callb.h" -#include "spl-condvar.h" -#include "spl-cred.h" -#include "spl-generic.h" -#include "spl-kmem.h" -#include "spl-kstat.h" -#include "spl-mutex.h" -#include "spl-random.h" -#include "spl-rwlock.h" -#include "spl-taskq.h" -#include "spl-thread.h" -#include "spl-time.h" -#include "spl-timer.h" -#include "spl-types.h" - -#endif /* _SPL_H */ diff --git a/include/splat-ctl.h b/include/splat-ctl.h deleted file mode 100644 index d905340fb5..0000000000 --- a/include/splat-ctl.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _SPLAT_CTL_H -#define _SPLAT_CTL_H - -/* Contains shared definitions which both the userspace - * and kernelspace portions of splat must agree on. - */ - -#define SPLAT_MAJOR 229 /* XXX - Arbitrary */ -#define SPLAT_MINORS 1 -#define SPLAT_DEV "/dev/splatctl" - -#define SPLAT_NAME_SIZE 12 -#define SPLAT_DESC_SIZE 60 - -typedef struct splat_user { - char name[SPLAT_NAME_SIZE]; /* short name */ - char desc[SPLAT_DESC_SIZE]; /* short description */ - int id; /* unique numeric id */ -} splat_user_t; - -#define SPLAT_CFG_MAGIC 0x15263748U -typedef struct splat_cfg { - unsigned int cfg_magic; /* Unique magic */ - int cfg_cmd; /* Config command */ - int cfg_arg1; /* Config command arg 1 */ - int cfg_rc1; /* Config response 1 */ - union { - struct { - int size; - splat_user_t descs[0]; - } splat_subsystems; - struct { - int size; - splat_user_t descs[0]; - } splat_tests; - } cfg_data; -} splat_cfg_t; - -#define SPLAT_CMD_MAGIC 0x9daebfc0U -typedef struct splat_cmd { - unsigned int cmd_magic; /* Unique magic */ - int cmd_subsystem; /* Target subsystem */ - int cmd_test; /* Subsystem test */ - int cmd_data_size; /* Extra opaque data */ - char cmd_data_str[0]; /* Opaque data region */ -} splat_cmd_t; - -/* Valid ioctls */ -#define SPLAT_CFG _IOWR('f', 101, long) -#define SPLAT_CMD _IOWR('f', 102, long) - -/* Valid configuration commands */ -#define SPLAT_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */ -#define SPLAT_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */ -#define SPLAT_CFG_SUBSYSTEM_COUNT 0x101 /* Number of subsystem */ -#define SPLAT_CFG_SUBSYSTEM_LIST 0x102 /* List of N subsystems */ -#define SPLAT_CFG_TEST_COUNT 0x201 /* Number of tests */ -#define SPLAT_CFG_TEST_LIST 0x202 /* List of N tests */ - -/* Valid subsystem and test commands defined in each subsystem, we do - * need to be careful to avoid colisions. That alone may argue to define - * them all here, for now we just define the global error codes. - */ -#define SPLAT_SUBSYSTEM_UNKNOWN 0xF00 -#define SPLAT_TEST_UNKNOWN 0xFFF - -#endif /* _SPLAT_CTL_H */ diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am new file mode 100644 index 0000000000..c44748e027 --- /dev/null +++ b/include/sys/Makefile.am @@ -0,0 +1,5 @@ +EXTRA_DIST = callb.h cmn_err.h condvar.h cred.h +EXTRA_DIST += debug.h generic.h kmem.h kstat.h +EXTRA_DIST += mutex.h param.h random.h rwlock.h +EXTRA_DIST += spl.h taskq.h thread.h time.h +EXTRA_DIST += timer.h types.h diff --git a/include/spl-callb.h b/include/sys/callb.h similarity index 97% rename from include/spl-callb.h rename to include/sys/callb.h index 98b966778f..053ddf5009 100644 --- a/include/spl-callb.h +++ b/include/sys/callb.h @@ -6,7 +6,7 @@ extern "C" { #endif #include -#include "spl-mutex.h" +#include #define DEBUG_CALLB diff --git a/include/sys/cmn_err.h b/include/sys/cmn_err.h new file mode 100644 index 0000000000..44ccefc9f1 --- /dev/null +++ b/include/sys/cmn_err.h @@ -0,0 +1,4 @@ +#ifndef _SPL_CMN_ERR_H +#define _SPL_CMN_ERR_H + +#endif /* SPL_CMN_ERR_H */ diff --git a/include/spl-condvar.h b/include/sys/condvar.h similarity index 100% rename from include/spl-condvar.h rename to include/sys/condvar.h diff --git a/include/spl-cred.h b/include/sys/cred.h similarity index 100% rename from include/spl-cred.h rename to include/sys/cred.h diff --git a/include/sys/debug.h b/include/sys/debug.h new file mode 100644 index 0000000000..02f64c2cf9 --- /dev/null +++ b/include/sys/debug.h @@ -0,0 +1,4 @@ +#ifndef _SPL_DEBUG_H +#define _SPL_DEBUG_H + +#endif /* SPL_DEBUG_H */ diff --git a/include/spl-generic.h b/include/sys/generic.h similarity index 100% rename from include/spl-generic.h rename to include/sys/generic.h diff --git a/include/spl-kmem.h b/include/sys/kmem.h similarity index 100% rename from include/spl-kmem.h rename to include/sys/kmem.h diff --git a/include/spl-kstat.h b/include/sys/kstat.h similarity index 99% rename from include/spl-kstat.h rename to include/sys/kstat.h index cbef067d57..0b79a41c04 100644 --- a/include/spl-kstat.h +++ b/include/sys/kstat.h @@ -6,8 +6,8 @@ extern "C" { #endif #include -#include "spl-types.h" -#include "spl-time.h" +#include +#include /* XXX - The minimum functionality here is stubbed out but nothing works. */ diff --git a/include/spl-mutex.h b/include/sys/mutex.h similarity index 99% rename from include/spl-mutex.h rename to include/sys/mutex.h index dec5dd7de1..2db4a7f96d 100644 --- a/include/spl-mutex.h +++ b/include/sys/mutex.h @@ -6,7 +6,7 @@ extern "C" { #endif #include -#include "spl-types.h" +#include /* See the "Big Theory Statement" in solaris mutex.c. * diff --git a/include/sys/param.h b/include/sys/param.h new file mode 100644 index 0000000000..f924006efa --- /dev/null +++ b/include/sys/param.h @@ -0,0 +1,4 @@ +#ifndef _SPL_PARAM_H +#define _SPL_PARAM_H + +#endif /* SPL_PARAM_H */ diff --git a/include/spl-random.h b/include/sys/random.h similarity index 100% rename from include/spl-random.h rename to include/sys/random.h diff --git a/include/spl-rwlock.h b/include/sys/rwlock.h similarity index 99% rename from include/spl-rwlock.h rename to include/sys/rwlock.h index b04a4f0dbd..6c55ced98a 100644 --- a/include/spl-rwlock.h +++ b/include/sys/rwlock.h @@ -5,7 +5,7 @@ #include #include #include -#include "spl-types.h" +#include #ifdef __cplusplus extern "C" { diff --git a/include/sys/spl.h b/include/sys/spl.h new file mode 100644 index 0000000000..7cc1cab583 --- /dev/null +++ b/include/sys/spl.h @@ -0,0 +1,19 @@ +#ifndef _SPL_H +#define _SPL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* _SPL_H */ diff --git a/include/spl-taskq.h b/include/sys/taskq.h similarity index 99% rename from include/spl-taskq.h rename to include/sys/taskq.h index 3723a6d47c..2d7583daf0 100644 --- a/include/spl-taskq.h +++ b/include/sys/taskq.h @@ -24,7 +24,7 @@ extern "C" { #include #include #include -#include "spl-types.h" +#include #undef DEBUG_TASKQ_UNIMPLEMENTED diff --git a/include/spl-thread.h b/include/sys/thread.h similarity index 96% rename from include/spl-thread.h rename to include/sys/thread.h index 8833846e91..e7f99c96d4 100644 --- a/include/spl-thread.h +++ b/include/sys/thread.h @@ -8,8 +8,8 @@ extern "C" { #include #include #include -#include "spl-types.h" -#include "spl-generic.h" +#include +#include /* * Thread interfaces diff --git a/include/spl-time.h b/include/sys/time.h similarity index 98% rename from include/spl-time.h rename to include/sys/time.h index 576fd191c1..726bd5f8a0 100644 --- a/include/spl-time.h +++ b/include/sys/time.h @@ -12,7 +12,7 @@ extern "C" { #include #include -#include "spl-types.h" +#include extern unsigned long long monotonic_clock(void); typedef struct timespec timestruc_t; /* definition per SVr4 */ diff --git a/include/spl-timer.h b/include/sys/timer.h similarity index 100% rename from include/spl-timer.h rename to include/sys/timer.h diff --git a/include/spl-types.h b/include/sys/types.h similarity index 100% rename from include/spl-types.h rename to include/sys/types.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 91c228fb0c..24ba729131 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,3 +1,7 @@ -INCLUDES = -I$(top_srcdir)/include +DEFAULT_INCLUDES = -I. -I.. +AM_CFLAGS = -g -O2 -W -Wall -Wstrict-prototypes -Wshadow + noinst_LTLIBRARIES = libcommon.la libcommon_la_SOURCES = list.c + +EXTRA_DIST = list.h diff --git a/lib/list.c b/lib/list.c index 6548cacbca..88af47c402 100644 --- a/lib/list.c +++ b/lib/list.c @@ -776,7 +776,7 @@ list_alloc_aux (int size, void *pfreelist) void **plast; assert(sizeof(char) == 1); - assert(size >= sizeof(void *)); + assert(size >= (int)sizeof(void *)); assert(pfreelist != NULL); assert(LIST_ALLOC > 0); list_mutex_lock(&list_free_lock); diff --git a/include/list.h b/lib/list.h similarity index 100% rename from include/list.h rename to lib/list.h diff --git a/modules/spl/spl-generic.c b/modules/spl/spl-generic.c index 8a84356940..653b8cd1f7 100644 --- a/modules/spl/spl-generic.c +++ b/modules/spl/spl-generic.c @@ -1,4 +1,4 @@ -#include "spl-generic.h" +#include #include "config.h" /* diff --git a/modules/spl/spl-kmem.c b/modules/spl/spl-kmem.c index 9b8ba26a7e..6442d5824b 100644 --- a/modules/spl/spl-kmem.c +++ b/modules/spl/spl-kmem.c @@ -1,4 +1,4 @@ -#include "spl-kmem.h" +#include /* * Memory allocation interfaces diff --git a/modules/spl/spl-rwlock.c b/modules/spl/spl-rwlock.c index cafdd9b1c1..d74d89e24f 100644 --- a/modules/spl/spl-rwlock.c +++ b/modules/spl/spl-rwlock.c @@ -1,4 +1,4 @@ -#include +#include int rw_lock_held(krwlock_t *rwlp) diff --git a/modules/spl/spl-taskq.c b/modules/spl/spl-taskq.c index d20ae59bdd..0bfae54526 100644 --- a/modules/spl/spl-taskq.c +++ b/modules/spl/spl-taskq.c @@ -1,4 +1,4 @@ -#include +#include /* * Task queue interface diff --git a/modules/spl/spl-thread.c b/modules/spl/spl-thread.c index b55f8c6af1..40b1b316f6 100644 --- a/modules/spl/spl-thread.c +++ b/modules/spl/spl-thread.c @@ -1,4 +1,4 @@ -#include +#include /* * Thread interfaces diff --git a/modules/splat/splat-internal.h b/modules/splat/splat-internal.h index a64b711fed..d44c324632 100644 --- a/modules/splat/splat-internal.h +++ b/modules/splat/splat-internal.h @@ -18,7 +18,7 @@ #include #include -#include "spl.h" +#include #include "splat-ctl.h" #define SPLAT_SUBSYSTEM_INIT(type) \