+++ /dev/null
-#
-# Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
-#
-# This Software is licensed under one of the following licenses:
-#
-# 1) under the terms of the "Common Public License 1.0" a copy of which is
-# in the file LICENSE.txt in the root directory. The license is also
-# available from the Open Source Initiative, see
-# http://www.opensource.org/licenses/cpl.php.
-#
-# 2) under the terms of the "The BSD License" a copy of which is in the file
-# LICENSE2.txt in the root directory. The license is also available from
-# the Open Source Initiative, see
-# http://www.opensource.org/licenses/bsd-license.php.
-#
-# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
-# copy of which is in the file LICENSE3.txt in the root directory. The
-# license is also available from the Open Source Initiative, see
-# http://www.opensource.org/licenses/gpl-license.php.
-#
-# Licensee has the right to choose one of the above licenses.
-#
-# Redistributions of source code must retain the above copyright
-# notice and one of the license notices.
-#
-# Redistributions in binary form must reproduce both the above copyright
-# notice, one of the license notices in the documentation
-# and/or other materials provided with the distribution.
-#
-
-#
-# This makefile is intended to be:
-# - read directly as the result of a user typing "make"
-# - read by the kernel build system, kbuild
-#
-
-#--------------------------------------------------------------------------
-# if KERNELRELEASE is not defined, assume the file is being read directly
-#--------------------------------------------------------------------------
-ifeq ($(origin KERNELRELEASE), undefined)
-
-KDAPLTEST_ROOT = `pwd` # directory that contains this makefile
-KERNEL_ROOT = /lib/modules/`uname -r`/build # root of kernel sources
-
-# Tools
-ECHO = /bin/echo
-RM = /bin/rm
-
-all :
- @$(ECHO) "--- Compiling kdapltest module ---"
- $(MAKE) -C $(KERNEL_ROOT) M=$(KDAPLTEST_ROOT) V=1 modules
-
-clean :
- $(RM) -rf \
- *.o .*.cmd \
- ../test/*.o ../test/.*.cmd \
- ../common/*.o ../common/.*.cmd \
- ../kdapl/*.o ../kdapl/.*.cmd \
- ../mdep/linux/*.o ../mdep/linux/.*.cmd \
- .*.d .*.o.tmp *.mod.* *.ko .tmp_versions
-
-#--------------------------------------------------------------------------
-# else the file is being read by kbuild
-#--------------------------------------------------------------------------
-else
-
-#need to define flag hard-float in i686 arch only
-IS_i686 = $(shell uname -m)
-ifeq (${IS_i686},i686)
-# Override -msoft-float in arch/i386/Makefile
-EXTRA_CFLAGS += -mhard-float
-endif
-
-EXTRA_CFLAGS += \
- -I$(src)/../../../dat/include \
- -I$(src)/../include \
- -I$(src)/../mdep/linux \
- -I$(src)/../kdapl \
- -I$(src)/../common \
- -I$(src)/../test
-
-EXTRA_CFLAGS += \
- -D__KERNEL__ \
- -D__KDAPL__ \
- -D__KDAPLTEST__ \
- -D__LINUX__ \
- -D__PENTIUM__
-
-
-ifeq (1,$(KDAPL_DEBUG))
- EXTRA_CFLAGS += -O0 -g $(CPPFLAGS)
-endif
-
-
-obj-m += kdapltest_module.o
-
-kdapltest_module-objs := \
- ../test/dapl_bpool.o \
- ../test/dapl_client.o \
- ../test/dapl_client_info.o \
- ../test/dapl_cnxn.o \
- ../test/dapl_execute.o \
- ../test/dapl_memlist.o \
- ../test/dapl_server.o \
- ../test/dapl_server_info.o \
- ../test/dapl_test_data.o \
- ../test/dapl_test_util.o \
- ../test/dapl_thread.o \
- ../test/dapl_transaction_stats.o \
- ../test/dapl_transaction_test.o \
- ../test/dapl_transaction_util.o \
- ../test/dapl_util.o \
- ../test/dapl_quit_util.o \
- ../test/dapl_limit.o \
- ../test/dapl_performance_client.o \
- ../test/dapl_performance_server.o \
- ../test/dapl_performance_stats.o \
- ../test/dapl_performance_util.o \
- ../test/dapl_fft_connmgt.o \
- ../test/dapl_fft_endpoint.o \
- ../test/dapl_fft_hwconn.o \
- ../test/dapl_fft_mem.o \
- ../test/dapl_fft_pz.o \
- ../test/dapl_fft_queryinfo.o \
- ../test/dapl_fft_test.o \
- ../test/dapl_fft_util.o \
- ../common/dapl_endian.o \
- ../common/dapl_global.o \
- ../common/dapl_performance_cmd_util.o \
- ../common/dapl_quit_cmd_util.o \
- ../common/dapl_transaction_cmd_util.o \
- ../kdapl/kdapl_tdep_evd.o \
- ../kdapl/kdapl_tdep_lmr.o \
- ../kdapl/kdapl_tdep_print.o \
- ../kdapl/kdapl_module.o \
- ../mdep/linux/dapl_mdep_kernel.o
-
-endif # if !kbuild
+++ /dev/null
-#
-# Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
-#
-# This Software is licensed under one of the following licenses:
-#
-# 1) under the terms of the "Common Public License 1.0" a copy of which is
-# in the file LICENSE.txt in the root directory. The license is also
-# available from the Open Source Initiative, see
-# http://www.opensource.org/licenses/cpl.php.
-#
-# 2) under the terms of the "The BSD License" a copy of which is in the file
-# LICENSE2.txt in the root directory. The license is also available from
-# the Open Source Initiative, see
-# http://www.opensource.org/licenses/bsd-license.php.
-#
-# 3) under the terms of the "GNU General Public License (GPL) Version 2" a
-# copy of which is in the file LICENSE3.txt in the root directory. The
-# license is also available from the Open Source Initiative, see
-# http://www.opensource.org/licenses/gpl-license.php.
-#
-# Licensee has the right to choose one of the above licenses.
-#
-# Redistributions of source code must retain the above copyright
-# notice and one of the license notices.
-#
-# Redistributions in binary form must reproduce both the above copyright
-# notice, one of the license notices in the documentation
-# and/or other materials provided with the distribution.
-#
-
-# -----------------------------------------------------
-#
-# Description : Makefile for dapltest
-#
-# -----------------------------------------------------
-
-#
-# Variables
-#
-
-TOPDIR = .
-DAPL_ROOT = $(shell pwd)/../../..
-USER_OBJECT_DIR = $(TOPDIR)/Obj/User
-KERN_OBJECT_DIR = $(TOPDIR)/Obj/Kernel
-TARGET_DIR = $(TOPDIR)/Target
-USER_TARGET = $(TARGET_DIR)/kdapltest
-KERN_TARGET = $(TARGET_DIR)/kdapltest_module.o
-INCLUDE_DIR = $(TOPDIR)/../include
-CMD_DIR = $(TOPDIR)/../cmd
-COMMON_DIR = $(TOPDIR)/../common
-TEST_DIR = $(TOPDIR)/../test
-MDEP_DIR = $(TOPDIR)/../mdep/linux
-KDAPL_DIR = $(TOPDIR)/../kdapl
-ARCH = $(shell uname -m)
-
-USER_CMD_SRCS = \
- dapl_getopt.c \
- dapl_main.c \
- dapl_netaddr.c \
- dapl_params.c \
- dapl_qos_util.c \
- dapl_server_cmd.c \
- dapl_transaction_cmd.c \
- dapl_quit_cmd.c \
- dapl_limit_cmd.c \
- dapl_performance_cmd.c \
- dapl_fft_cmd.c
-
-USER_COMMON_SRCS = \
- dapl_endian.c \
- dapl_global.c \
- dapl_performance_cmd_util.c \
- dapl_quit_cmd_util.c \
- dapl_transaction_cmd_util.c
-
-USER_KDAPL_SRCS = \
- kdapl_tdep_user.c
-
-USER_MDEP_SRCS = \
- dapl_mdep_user.c
-
-USER_KDAPL_OBJS = $(USER_KDAPL_SRCS:%.c=$(USER_OBJECT_DIR)/%.o)
-USER_CMD_OBJS = $(USER_CMD_SRCS:%.c=$(USER_OBJECT_DIR)/%.o)
-USER_COMMON_OBJS = $(USER_COMMON_SRCS:%.c=$(USER_OBJECT_DIR)/%.o)
-USER_MDEP_OBJS = $(USER_MDEP_SRCS:%.c=$(USER_OBJECT_DIR)/%.o)
-
-USER_SRCS = \
- $(USER_CMD_SRCS) \
- $(USER_COMMON_SRCS) \
- $(USER_KDAPL_SRCS) \
- $(USER_MDEP_SRCS)
-
-USER_OBJS = \
- $(USER_CMD_OBJS) \
- $(USER_COMMON_OBJS) \
- $(USER_KDAPL_OBJS) \
- $(USER_MDEP_OBJS)
-
-###################
-
-KERN_TEST_SRCS = \
- dapl_bpool.c \
- dapl_client.c \
- dapl_client_info.c \
- dapl_cnxn.c \
- dapl_execute.c \
- dapl_memlist.c \
- dapl_server.c \
- dapl_server_info.c \
- dapl_test_data.c \
- dapl_test_util.c \
- dapl_thread.c \
- dapl_transaction_stats.c \
- dapl_transaction_test.c \
- dapl_transaction_util.c \
- dapl_util.c \
- dapl_quit_util.c \
- dapl_limit.c \
- dapl_performance_client.c \
- dapl_performance_server.c \
- dapl_performance_stats.c \
- dapl_performance_util.c \
- dapl_fft_connmgt.c \
- dapl_fft_endpoint.c \
- dapl_fft_hwconn.c \
- dapl_fft_mem.c \
- dapl_fft_pz.c \
- dapl_fft_queryinfo.c \
- dapl_fft_test.c \
- dapl_fft_util.c
-
-KERN_COMMON_SRCS = \
- dapl_endian.c \
- dapl_global.c \
- dapl_performance_cmd_util.c \
- dapl_quit_cmd_util.c \
- dapl_transaction_cmd_util.c
-
-KERN_KDAPL_SRCS = \
- kdapl_tdep_evd.c \
- kdapl_tdep_lmr.c \
- kdapl_tdep_print.c \
- kdapl_module.c
-
-KERN_MDEP_SRCS = \
- dapl_mdep_kernel.c
-
-KERN_KDAPL_OBJS = $(KERN_KDAPL_SRCS:%.c=$(KERN_OBJECT_DIR)/%.o)
-KERN_TEST_OBJS = $(KERN_TEST_SRCS:%.c=$(KERN_OBJECT_DIR)/%.o)
-KERN_COMMON_OBJS = $(KERN_COMMON_SRCS:%.c=$(KERN_OBJECT_DIR)/%.o)
-KERN_MDEP_OBJS = $(KERN_MDEP_SRCS:%.c=$(KERN_OBJECT_DIR)/%.o)
-
-KERN_SRCS = $(KERN_TEST_SRCS) \
- $(KERN_COMMON_SRCS) \
- $(KERN_KDAPL_SRCS) \
- $(KERN_MDEP_SRCS)
-
-KERN_OBJS = $(KERN_TEST_OBJS) \
- $(KERN_COMMON_OBJS) \
- $(KERN_KDAPL_OBJS) \
- $(KERN_MDEP_OBJS)
-
-# -----------------------------------------------------
-
-
-#
-# Tools
-#
-
-ECHO = echo
-INSTALL = /usr/bin/install
-MAKEDEPEND = makedepend
-RM = rm
-
-
-#
-# Compiler
-#
-
-CC = gcc
-
-# INCLUDE_DIRS = directories containing include files
-INCLUDE_DIRS = -I$(DAPL_ROOT)/dat/include/
-INCLUDE_DIRS += -I$(INCLUDE_DIR)/
-INCLUDE_DIRS += -I$(MDEP_DIR)/
-INCLUDE_DIRS += -I./
-
-USER_CC_FLAGS = -g3
-USER_CC_FLAGS += -Wall
-USER_CC_FLAGS += -Wmissing-prototypes
-USER_CC_FLAGS += -Wstrict-prototypes
-USER_CC_FLAGS += -Wmissing-declarations
-USER_CC_FLAGS += -Werror
-USER_CC_FLAGS += -pipe
-USER_CC_FLAGS += -D__KDAPLTEST__
-USER_CC_FLAGS += -D__LINUX__
-USER_CC_FLAGS += -D__PENTIUM__
-USER_CC_FLAGS += $(INCLUDE_DIRS)
-# -----------------------------------------------------
-# kernel defs
-# NOTE: on some Linux distributions, you may need to make a link
-# for .config to a file in the ./config/ directory
-#
-UNAME = $(strip $(shell /bin/uname -r))
-KERNEL_INCLUDE_DIR = /lib/modules/$(UNAME)/build/include
-KERNEL_DIR = /lib/modules/$(UNAME)/build
-include $(KERNEL_DIR)/.config
-INCLUDE_DIRS += -I$(KERNEL_INCLUDE_DIR)/
-
-KERN_CC_FLAGS = -O2 $(CPPFLAGS)
-KERN_CC_FLAGS += -D__KERNEL__
-KERN_CC_FLAGS += -D__KDAPLTEST__
-KERN_CC_FLAGS += -D__KDAPL__
-KERN_CC_FLAGS += -D__LINUX__
-KERN_CC_FLAGS += -D__PENTIUM__
-KERN_CC_FLAGS += -DMODULE
-
-KERN_CC_FLAGS += $(INCLUDE_DIRS)
-KERN_CC_FLAGS += -I../../../dat/include
-KERN_CC_FLAGS += -I$(KERNEL_INCLUDE_DIR)
-KERN_CC_FLAGS += -Wall
-KERN_CC_FLAGS += -Wstrict-prototypes
-KERN_CC_FLAGS += -Werror
-KERN_CC_FLAGS += -g3
-KERN_CC_FLAGS += -fomit-frame-pointer
-KERN_CC_FLAGS += -fno-strict-aliasing
-KERN_CC_FLAGS += -fno-common
-KERN_CC_FLAGS += -mpreferred-stack-boundary=2
-KERN_CC_FLAGS += -march=i686
-ifdef CONFIG_SMP
-KERN_CC_FLAGS += -D__SMP__
-KERN_CC_FLAGS += -DSMP
-endif
-
-# -----------------------------------------------------
-
-#
-# Linker
-#
-
-USER_LD = gcc
-KERNEL_LD = ld
-
-USER_LD_FLAGS += -L$(DAPL_ROOT)/dat/udat/Target/$(ARCH)
-USER_LD_FLAGS += -Wl,-R$(DAPL_ROOT)/dat/udat/Target/$(ARCH)
-USER_LD_FLAGS += -lpthread
-
-#
-# Rules
-#
-
-all: mkdirs $(USER_TARGET) $(KERN_TARGET)
-
-mkdirs:
- @[ -d $(TARGET_DIR) ] || /bin/mkdir -p $(TARGET_DIR)
- @[ -d $(USER_OBJECT_DIR) ] || /bin/mkdir -p $(USER_OBJECT_DIR)
- @[ -d $(KERN_OBJECT_DIR) ] || /bin/mkdir -p $(KERN_OBJECT_DIR)
-
-#
-# user portion
-#
-$(USER_TARGET): $(USER_OBJS)
- @$(ECHO) "--- Linking (u) $@ ---"
- $(USER_LD) $(USER_LD_FLAGS) $(USER_OBJS) -o $@
-
-$(USER_KDAPL_OBJS): $(USER_OBJECT_DIR)/%.o : $(KDAPL_DIR)/%.c
- @$(ECHO) "--- Compiling (u) $< ---"
- $(CC) $(USER_CC_FLAGS) -o $@ -c $<
-
-$(USER_CMD_OBJS): $(USER_OBJECT_DIR)/%.o : $(CMD_DIR)/%.c
- @$(ECHO) "--- Compiling (u) $< ---"
- $(CC) $(USER_CC_FLAGS) -o $@ -c $<
-
-$(USER_COMMON_OBJS): $(USER_OBJECT_DIR)/%.o : $(COMMON_DIR)/%.c
- @$(ECHO) "--- Compiling (u) $< ---"
- $(CC) $(USER_CC_FLAGS) -o $@ -c $<
-
-$(USER_MDEP_OBJS): $(USER_OBJECT_DIR)/%.o : $(MDEP_DIR)/%.c
- @$(ECHO) "--- Compiling (u) $< ---"
- $(CC) $(USER_CC_FLAGS) -o $@ -c $<
-
-#--------------------------------------------------------------------------
-# if we are compiling on Linux 2.4.X
-#--------------------------------------------------------------------------
-ifeq ($(shell uname -r | cut -d \. -f 2),4)
-
-#
-# kernel portion
-#
-$(KERN_TARGET): $(KERN_OBJS)
- @$(ECHO) "--- Linking (k) $@ ---"
- $(KERNEL_LD) -r $(LDFLAGS) $(KERN_LD_FLAGS) $(KERN_OBJS) -o $@
-
-$(KERN_KDAPL_OBJS): $(KERN_OBJECT_DIR)/%.o : $(KDAPL_DIR)/%.c
- @$(ECHO) "--- Compiling (k) $< ---"
- $(CC) $(KERN_CC_FLAGS) -o $@ -c $<
-
-$(KERN_TEST_OBJS): $(KERN_OBJECT_DIR)/%.o : $(TEST_DIR)/%.c
- @$(ECHO) "--- Compiling (k) $< ---"
- $(CC) $(KERN_CC_FLAGS) -o $@ -c $<
-
-$(KERN_COMMON_OBJS): $(KERN_OBJECT_DIR)/%.o : $(COMMON_DIR)/%.c
- @$(ECHO) "--- Compiling (k) $< ---"
- $(CC) $(KERN_CC_FLAGS) -o $@ -c $<
-
-$(KERN_MDEP_OBJS): $(KERN_OBJECT_DIR)/%.o : $(MDEP_DIR)/%.c
- @$(ECHO) "--- Compiling (k) $< ---"
- $(CC) $(KERN_CC_FLAGS) -o $@ -c $<
-
-clean:
- $(RM) -f $(USER_OBJS) $(USER_TARGET)
- $(RM) -f $(KERN_OBJS) $(KERN_TARGET)
-
-#--------------------------------------------------------------------------
-# else we are compiling on 2.6.X
-#--------------------------------------------------------------------------
-else
-
-#
-# kernel portion is handled by a seperate makefile
-#
-$(KERN_TARGET):
-
-endif # if 2.4.X
+++ /dev/null
-/*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- * in the file LICENSE.txt in the root directory. The license is also
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is in the file
- * LICENSE2.txt in the root directory. The license is also available from
- * the Open Source Initiative, see
- * http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- * copy of which is in the file LICENSE3.txt in the root directory. The
- * license is also available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-#ifndef _KDAPL_IOCTL_H_
-#define _KDAPL_IOCTL_H_
-
-#define KDAPL_IOCTL_BASE (0x2828)
-#define KDAPL_IOCTL_START_TEST (KDAPL_IOCTL_BASE + 0)
-#define KDAPL_IOCTL_GET_PRINTF (KDAPL_IOCTL_BASE + 1)
-
-#define PRINT_MAX 256
-typedef struct
-{
-int cookie;
-char *buffer;
-} DT_get_printf_ioctl;
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- * in the file LICENSE.txt in the root directory. The license is also
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is in the file
- * LICENSE2.txt in the root directory. The license is also available from
- * the Open Source Initiative, see
- * http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- * copy of which is in the file LICENSE3.txt in the root directory. The
- * license is also available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-#include "dapl_proto.h"
-#include "kdapl_ioctl.h"
-#include "kdapl_tdep.h"
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/fs.h>
-#include <asm/uaccess.h>
-
-MODULE_LICENSE ("BSD");
-MODULE_DESCRIPTION("kdapltest module");
-MODULE_AUTHOR("Network Appliance, Inc.");
-
-#define EXPORT_SYMTAB
-
-/* static data */
-static int kdapltest_major;/* device major number */
-static DT_Mdep_LockType kdapltest_lock; /* lock global test structs */
-static int kdapltest_num; /* unique test invocation number */
-
-static void
-DT_Tdep_Test_Thread (Params_t *user_params);
-
-static int kdapltest_open (struct inode *inode, struct file *file)
-{
- MOD_INC_USE_COUNT;
- return 0;
-}
-
-static int kdapltest_release (struct inode *inode, struct file *file)
-{
- MOD_DEC_USE_COUNT;
- return 0;
-}
-
-static int kdapltest_ioctl (struct inode *inode,
- struct file *file,
- unsigned int ioctl,
- unsigned long param)
-{
- char buffer[PRINT_MAX];
- DT_get_printf_ioctl print_ioctl;
- Params_t *local_params;
- int rval;
- int instance;
-
- rval = 0;
-
- switch (ioctl)
- {
- case KDAPL_IOCTL_START_TEST:
- {
-
- local_params = DT_Mdep_Malloc (sizeof (Params_t));
- if (!local_params)
- {
- rval = -ENOMEM;
- break;
- }
- if (copy_from_user (local_params,
- (void *)param,
- sizeof (Params_t)))
- {
- DT_Mdep_Free (local_params);
- rval = -EFAULT;
- break;
- }
-
- DT_Mdep_Lock (&kdapltest_lock);
- kdapltest_num++;
- instance = kdapltest_num;
- DT_Mdep_Unlock (&kdapltest_lock);
-
- local_params->phead = KDT_Print_Alloc (instance);
- if (!local_params->phead)
- {
- DT_Mdep_Free (local_params);
- rval = -ENOMEM;
- break;
- }
-
- kernel_thread ((void*)DT_Tdep_Test_Thread,
- (void*)local_params,
- 0);
- rval = instance;
- break;
- }
- case KDAPL_IOCTL_GET_PRINTF:
- {
- if (copy_from_user (&print_ioctl,
- (void *)param,
- sizeof (DT_get_printf_ioctl)))
- {
- rval = -EFAULT;
- break;
- }
- rval = KDT_Get_Print_Line (print_ioctl.cookie, &buffer[0]);
- if (copy_to_user (print_ioctl.buffer,
- &buffer[0],
- strlen (buffer)+1))
- {
- rval = -EFAULT;
- break;
- }
- break;
- }
- default:
- {
- printk ("<1> kdapltest IOCTL %x UNKNOWN\n", ioctl);
- rval = -EINVAL;
- break;
- }
- }
- return rval;
-}
-
-/* fops */
-static struct file_operations kdapltest_fops =
-{
- open: kdapltest_open,
- release: kdapltest_release,
- ioctl: kdapltest_ioctl,
-};
-
-static void
-DT_Tdep_Test_Thread (Params_t *user_params)
-{
- /* don't want the module to disappear while threads exist */
- MOD_INC_USE_COUNT;
- DT_Execute_Test (user_params);
- DT_Tdep_PT_Printf (user_params->phead, ""); /* indicate done */
- DT_Mdep_Free (user_params);
- MOD_DEC_USE_COUNT;
-}
-
-__init
-int kdapltest_init (void)
-{
-
- DT_Mdep_LockInit (&g_PerfTestLock); /* For uDAPL, this is done in Tdep_init() */
- kdapltest_major = register_chrdev (0, "kdapltest", &kdapltest_fops);
- DT_Mdep_LockInit (&kdapltest_lock);
- kdapltest_num = 0;
- KDT_Print_Init ();
- KDT_Evd_Init ();
- printk ("<1>Kdapltest Module Loaded - major %d\n", kdapltest_major);
- return (0);
-}
-
-__exit
-void kdapltest_exit (void)
-{
- unregister_chrdev (kdapltest_major, "kdapltest");
- printk ("<1>Kdapltest Module UnLoaded - major %d\n", kdapltest_major);
- KDT_Print_Destroy ();
- KDT_Evd_Destroy ();
- DT_Mdep_LockDestroy (&kdapltest_lock);
- DT_Mdep_LockDestroy (&g_PerfTestLock); /* For uDAPL, this is done in Tdep_end() */
-}
-
-module_init (kdapltest_init);
-module_exit (kdapltest_exit);
+++ /dev/null
-/* * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- * in the file LICENSE.txt in the root directory. The license is also
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is in the file
- * LICENSE2.txt in the root directory. The license is also available from
- * the Open Source Initiative, see
- * http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- * copy of which is in the file LICENSE3.txt in the root directory. The
- * license is also available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-#ifndef __KDAPL_TDEP_H__
-#define __KDAPL_TDEP_H__
-
-#include "dapl_proto.h"
-
-void
-KDT_Print_Init (void);
-
-void
-KDT_Print_Destroy (void);
-
-void
-KDT_Print_Free (DT_Tdep_Print_Head *phead);
-
-DT_Tdep_Print_Head *
-KDT_Print_Alloc (int instance);
-
-int
-KDT_Get_Print_Line (int cookie, char * buffer);
-
-void
-KDT_Evd_Init(void);
-
-void
-KDT_Evd_Destroy(void);
-#endif
+++ /dev/null
-/* * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- * in the file LICENSE.txt in the root directory. The license is also
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is in the file
- * LICENSE2.txt in the root directory. The license is also available from
- * the Open Source Initiative, see
- * http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- * copy of which is in the file LICENSE3.txt in the root directory. The
- * license is also available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-#include "dapl_proto.h"
-#include "kdapl_ioctl.h"
-#include "kdapl_tdep.h"
-#include <linux/sched.h>
-
-typedef struct Tdep_Event_Tag
-{
- DAT_EVENT dat_event;
- struct Tdep_Event_Tag *event_next;
-} Tdep_Event;
-
-typedef struct Tdep_Evd_Tag
-{
- struct Tdep_Evd_Tag *evd_next;
- struct Tdep_Event_Tag *event_next;
- struct Tdep_Event_Tag *event_last;
- DAT_EVD_HANDLE evd_handle;
- DT_WAIT_OBJECT wait_object;
-} Tdep_Evd;
-
-// static function prototypes
-static void DT_Tdep_Event_Callback (
- DAT_PVOID instance_data,
- const DAT_EVENT * dat_event,
- DAT_BOOLEAN bool_arg);
-
-// static data
-
-static Tdep_Evd *DT_Evd_List;
-static Tdep_Event *DT_Event_Free_List;
-static DT_Mdep_LockType DT_Evd_Lock; /* all lists protected by this lock */
-
-void
-KDT_Evd_Init(void)
-{
- DT_Evd_List = NULL;
- DT_Event_Free_List = NULL;
- DT_Mdep_LockInit (&DT_Evd_Lock);
-}
-
-void
-KDT_Evd_Destroy(void)
-{
- Tdep_Evd *evd_ptr;
- Tdep_Event *event;
-
- /* clean up the evd list */
- while (DT_Evd_List)
- {
- evd_ptr = DT_Evd_List;
- DT_Evd_List = evd_ptr->evd_next;
-
- while (evd_ptr->event_next)
- {
- event = evd_ptr->event_next;
- evd_ptr->event_next = event->event_next;
- DT_Mdep_Free (event);
- }
- DT_Mdep_wait_object_destroy (&evd_ptr->wait_object);
- DT_Mdep_Free (evd_ptr);
- }
- /* clean up the event free list */
- while (DT_Event_Free_List)
- {
- event = DT_Event_Free_List;
- DT_Event_Free_List = event->event_next;
- DT_Mdep_Free (event);
- }
- DT_Mdep_LockDestroy (&DT_Evd_Lock);
-}
-
-DAT_RETURN
-DT_Tdep_evd_create (DAT_IA_HANDLE ia_handle,
- DAT_COUNT evd_min_qlen,
- DAT_CNO_HANDLE cno_handle,
- DAT_EVD_FLAGS evd_flags,
- DAT_EVD_HANDLE *evd_handle_ptr)
-
-{
- DAT_RETURN dat_status;
- DAT_UPCALL_OBJECT upcall;
- Tdep_Evd *evd_ptr;
-
- evd_ptr = NULL;
- dat_status = DAT_SUCCESS;
-
- /* allocate tdep evd and fill it in */
- evd_ptr = DT_Mdep_Malloc (sizeof (Tdep_Evd));
- if (!evd_ptr)
- {
- dat_status = DAT_CLASS_ERROR |
- DAT_INSUFFICIENT_RESOURCES |
- DAT_RESOURCE_MEMORY;
- goto error;
- }
- upcall.upcall_func = DT_Tdep_Event_Callback;
- upcall.instance_data = evd_ptr;
-
- dat_status = dat_evd_kcreate (ia_handle,
- evd_min_qlen,
- DAT_UPCALL_SINGLE_INSTANCE,
- &upcall,
- evd_flags,
- evd_handle_ptr);
- if (dat_status != DAT_SUCCESS)
- {
- goto error;
- }
-
- /* initialize evd_ptr */
- evd_ptr->event_next = NULL;
- evd_ptr->event_last = NULL;
- evd_ptr->evd_handle = *evd_handle_ptr;
- DT_Mdep_wait_object_init (&evd_ptr->wait_object);
-
- /* add evd_ptr to front of evd list */
- DT_Mdep_Lock (&DT_Evd_Lock);
- evd_ptr->evd_next = DT_Evd_List;
- DT_Evd_List = evd_ptr;
- DT_Mdep_Unlock (&DT_Evd_Lock);
-
-error:
- if (dat_status != DAT_SUCCESS)
- {
- if (evd_ptr)
- {
- DT_Mdep_Free (evd_ptr);
- }
- }
- return (dat_status);
-}
-DAT_RETURN
-DT_Tdep_evd_dequeue (DAT_EVD_HANDLE evd_handle,
- DAT_EVENT *dat_event)
-{
- DAT_RETURN dat_status;
- Tdep_Evd *evd_ptr;
- Tdep_Event *event;
-
- dat_status = DAT_SUCCESS;
-
- /* find the evd_ptr associated with evd_handle */
- evd_ptr = DT_Evd_List;
- while (evd_ptr)
- {
- if (evd_ptr->evd_handle == evd_handle)
- {
- break;
- }
- evd_ptr = evd_ptr->evd_next;
- }
-
- if (!evd_ptr)
- {
- return DAT_CLASS_ERROR |
- DAT_INTERNAL_ERROR;
- }
- /* Get event */
- DT_Mdep_Lock (&DT_Evd_Lock);
- event = evd_ptr->event_next; /* event present in evd_ptr corresponding to the given evd_handle */
- if (event)
- {
- evd_ptr->event_next = event->event_next; /* point to next event */
- if (evd_ptr->event_next == NULL)
- {
- evd_ptr->event_last = NULL;
- }
- *dat_event = event->dat_event; /* extract event */
- /* put event on free list */
- if (DT_Event_Free_List == NULL)
- {
- DT_Event_Free_List = event;
- event->event_next = NULL;
- }
- else
- {
- event->event_next = DT_Event_Free_List;
- DT_Event_Free_List = event;
- }
- }
- else /* no event found */
- {
- dat_status = DAT_QUEUE_EMPTY;
- }
- DT_Mdep_Unlock (&DT_Evd_Lock);
-
- return dat_status;
-}
-
-DAT_RETURN
-DT_Tdep_evd_wait (DAT_EVD_HANDLE evd_handle,
- DAT_TIMEOUT timeout,
- DAT_EVENT *dat_event)
-{
- DAT_RETURN dat_status;
- Tdep_Evd *evd_ptr;
- Tdep_Event *event;
- int rc;
-
- dat_status = DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;
-
- /* find the evd_ptr associated with evd_handle */
- evd_ptr = DT_Evd_List;
- while (evd_ptr)
- {
- if (evd_ptr->evd_handle == evd_handle)
- {
- break;
- }
- evd_ptr = evd_ptr->evd_next;
- }
-
- if (!evd_ptr)
- {
- return dat_status;
- }
- /* wait for an event */
- if (timeout == DAT_TIMEOUT_INFINITE)
- {
- rc = wait_event_interruptible (evd_ptr->wait_object,
- evd_ptr->event_next != NULL);
- }
- else
- {
- rc = interruptible_sleep_on_timeout (&evd_ptr->wait_object, timeout*HZ/1000); /* time out in msec */
- if (rc == 0)
- {
- // assume timeout, unless an event is found below.
- dat_status = DAT_TIMEOUT_EXPIRED;
- }
- }
- if (rc == -ERESTARTSYS)
- {
- /* user hit ^C, just exit */
- return DAT_CLASS_ERROR | DAT_INTERRUPTED_CALL;
- }
-
- /* Got event */
- DT_Mdep_Lock (&DT_Evd_Lock);
- event = evd_ptr->event_next;
- if (event)
- {
- dat_status = DAT_SUCCESS;
- evd_ptr->event_next = event->event_next;
- if (evd_ptr->event_next == NULL)
- {
- evd_ptr->event_last = NULL;
- }
- *dat_event = event->dat_event;
-
- /* put event on free list */
- if (DT_Event_Free_List == NULL)
- {
- DT_Event_Free_List = event;
- event->event_next = NULL;
- }
- else
- {
- event->event_next = DT_Event_Free_List;
- DT_Event_Free_List = event;
- }
- }
-
- DT_Mdep_Unlock (&DT_Evd_Lock);
- return dat_status;
-}
-
-DAT_RETURN
-DT_Tdep_evd_free (DAT_EVD_HANDLE evd_handle)
-{
- Tdep_Evd *next;
- Tdep_Evd *last;
-
- last = NULL;
- DT_Mdep_Lock (&DT_Evd_Lock);
- next = DT_Evd_List;
- if (next->evd_handle == evd_handle)
- {
- DT_Evd_List = next->evd_next;
- }
- else
- {
- while (next && next->evd_handle != evd_handle)
- {
- last = next;
- next = next->evd_next;
- }
- if (next)
- {
- last->evd_next = next->evd_next;
- }
- }
- DT_Mdep_Unlock (&DT_Evd_Lock);
-
- DT_Mdep_Free (next);
- return dat_evd_free(evd_handle);
-}
-
-static void DT_Tdep_Event_Callback (
- DAT_PVOID instance_data,
- const DAT_EVENT * dat_event,
- DAT_BOOLEAN bool_arg)
-{
- Tdep_Event *event;
- Tdep_Evd *evd_ptr;
-
- evd_ptr = (Tdep_Evd *) instance_data;
-
- DT_Mdep_Lock (&DT_Evd_Lock);
- if (DT_Event_Free_List)
- {
- event = DT_Event_Free_List;
- DT_Event_Free_List = event->event_next;
- }
- else
- {
- event = DT_Mdep_Malloc (sizeof (Tdep_Event));
- }
- if (event)
- {
- event->dat_event = *dat_event;
- event->event_next = NULL;
- if (evd_ptr->event_next == NULL)
- {
- evd_ptr->event_next = event;
- evd_ptr->event_last = event;
- }
- else
- {
- evd_ptr->event_last->event_next = event;
- evd_ptr->event_last = event;
- }
- }
- DT_Mdep_Unlock (&DT_Evd_Lock);
- DT_Mdep_wait_object_wakeup (&evd_ptr->wait_object);
-}
+++ /dev/null
-/* * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- * in the file LICENSE.txt in the root directory. The license is also
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is in the file
- * LICENSE2.txt in the root directory. The license is also available from
- * the Open Source Initiative, see
- * http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- * copy of which is in the file LICENSE3.txt in the root directory. The
- * license is also available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-#include "dapl_proto.h"
-
-DAT_RETURN
-DT_Tdep_lmr_create (DAT_IA_HANDLE ia_handle,
- DAT_MEM_TYPE mem_type,
- DAT_REGION_DESCRIPTION region,
- DAT_VLEN len,
- DAT_PZ_HANDLE pz_handle,
- DAT_MEM_PRIV_FLAGS priv_flag,
- DAT_LMR_HANDLE *lmr_handle_ptr,
- DAT_LMR_CONTEXT *lmr_context_ptr,
- DAT_RMR_CONTEXT *rmr_context_ptr,
- DAT_VLEN *reg_size_ptr,
- DAT_VADDR *reg_addr_ptr)
-{
- return dat_lmr_kcreate (ia_handle,
- mem_type,
- region,
- len,
- pz_handle,
- priv_flag,
- DAT_MEM_OPTIMIZE_DONT_CARE,
- lmr_handle_ptr,
- lmr_context_ptr,
- rmr_context_ptr,
- reg_size_ptr,
- reg_addr_ptr);
-}
+++ /dev/null
-/* * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- * in the file LICENSE.txt in the root directory. The license is also
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is in the file
- * LICENSE2.txt in the root directory. The license is also available from
- * the Open Source Initiative, see
- * http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- * copy of which is in the file LICENSE3.txt in the root directory. The
- * license is also available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-#include "dapl_proto.h"
-#include "kdapl_ioctl.h"
-#include "kdapl_tdep.h"
-#include <linux/sched.h>
-
-static DT_Tdep_Print_Head *DT_Print_List;
-static DT_Mdep_LockType DT_Print_List_Lock;
-
-void
-KDT_Print_Init (void)
-{
- DT_Print_List = NULL;
- DT_Mdep_LockInit (&DT_Print_List_Lock);
-}
-
-void
-KDT_Print_Destroy (void)
-{
- /* TODO: Must free mem */
- DT_Mdep_LockDestroy (&DT_Print_List_Lock);
-}
-
-DT_Tdep_Print_Head *
-KDT_Print_Alloc (int instance)
-{
- DT_Tdep_Print_Head *phead;
-
- phead = DT_Mdep_Malloc (sizeof (DT_Tdep_Print_Head));
- if (phead)
- {
- phead->next = NULL;
- phead->instance = instance;
- phead->head = NULL;
- phead->tail = NULL;
- DT_Mdep_LockInit (&phead->lock);
- DT_Mdep_wait_object_init (&phead->wait_object);
-
- /* add new print phead to DT_Print_List */
- if (DT_Print_List == NULL)
- {
- DT_Print_List = phead;
- }
- else
- {
- phead->next = DT_Print_List;
- DT_Print_List = phead;
- }
- }
- return (phead);
-}
-
-void
-KDT_Print_Free (DT_Tdep_Print_Head *free_phead)
-{
- DT_Tdep_Print_Head *phead;
-
- if (free_phead == DT_Print_List)
- {
- DT_Print_List = DT_Print_List->next;
- DT_Mdep_Free (free_phead);
- }
- else
- {
- phead = DT_Print_List;
- while (phead)
- {
- if (phead->next == free_phead)
- {
- phead->next = free_phead->next;
- DT_Mdep_Free (free_phead);
- break;
- }
- phead = phead->next;
- }
- }
-}
-
-void
-DT_Tdep_PT_Printf (DT_Tdep_Print_Head * phead, const char * fmt, ...)
-{
- va_list args;
- int len;
- Tdep_Print_Entry *entry;
-
- entry = DT_Mdep_Malloc (sizeof (Tdep_Print_Entry));
-
- va_start (args, fmt);
- len = vsnprintf (entry->buffer, PRINT_MAX, fmt, args);
- va_end(args);
-
- if (len >= PRINT_MAX-1)
- {
- DT_Tdep_PT_Printf (phead,
- "WARNING: Possible truncation of print Line\n");
- }
- entry->next = NULL;
-
- DT_Mdep_Lock (&phead->lock);
-
- if (phead->head == NULL)
- {
- phead->head = entry;
- phead->tail = entry;
- }
- else
- {
- phead->tail->next = entry;
- phead->tail = entry;
- }
- DT_Mdep_wait_object_wakeup (&phead->wait_object);
- DT_Mdep_Unlock (&phead->lock);
-}
-
-int
-KDT_Get_Print_Line (int instance, char * buffer)
-{
- unsigned int len;
- DT_Tdep_Print_Head *phead;
- Tdep_Print_Entry *entry;
- int rc;
-
- buffer[0] = '\0';
-
- DT_Mdep_Lock (&DT_Print_List_Lock);
- phead = DT_Print_List;
- while (phead)
- {
- if (phead->instance == instance)
- {
- break;
- }
- phead = phead->next;
- }
- DT_Mdep_Unlock (&DT_Print_List_Lock);
-
- if (!phead)
- {
- printk ("<1> Kdapltest_module called with invalid instance\n");
- strncpy (buffer, "Invalid Cookie\n", PRINT_MAX);
- }
- else
- {
- rc = wait_event_interruptible (phead->wait_object, phead->head != NULL);
- if (rc == -ERESTARTSYS)
- {
- /* user hit ^C, just exit */
- return 0;
- }
-
- DT_Mdep_Lock (&phead->lock);
- entry = phead->head;
- if (entry)
- {
- phead->head = entry->next;
- if (phead->head == NULL)
- {
- phead->tail = NULL;
- }
- strncpy (buffer, entry->buffer, PRINT_MAX);
- DT_Mdep_Free (entry);
- }
- DT_Mdep_Unlock (&phead->lock);
- }
-
- len = strlen (buffer);
- if (len == 0)
- {
- KDT_Print_Free (phead);
- }
- return (len);
-}
+++ /dev/null
-/*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- * in the file LICENSE.txt in the root directory. The license is also
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is in the file
- * LICENSE2.txt in the root directory. The license is also available from
- * the Open Source Initiative, see
- * http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- * copy of which is in the file LICENSE3.txt in the root directory. The
- * license is also available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-#include "dapl_proto.h"
-#include "kdapl_ioctl.h"
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <errno.h>
-
-int fd = -1;
-
-void
-DT_Tdep_Init (void)
-{
- fd = open ("/dev/kdapltest", O_RDWR);
- if (fd == -1)
- {
- fprintf (stderr, "Cannot open device \"/dev/kdapltest\"\n");
- fprintf (stderr, "You must first insmod kdapltest_module.o\n");
- exit (1);
- }
-}
-
-void
-DT_Tdep_End (void)
-{
- close (fd);
-}
-
-void
-DT_Tdep_Execute_Test (Params_t *params_ptr)
-{
- DT_get_printf_ioctl print_ioctl;
- char buffer[PRINT_MAX];
-
- print_ioctl.buffer = &buffer[0];
- print_ioctl.cookie = ioctl (fd, KDAPL_IOCTL_START_TEST, params_ptr);
- if (print_ioctl.cookie < 0)
- {
- fprintf (stderr, "IOCTL failed: errno %d\n", errno);
- exit (1);
- }
- while (ioctl (fd, KDAPL_IOCTL_GET_PRINTF, &print_ioctl) > 0)
- {
- printf ("%s", &buffer[0]);
- }
- printf ("TEST INSTANCE %d\n", print_ioctl.cookie);
-}