lnet-subdirs += lnet
lnet-subdirs += klnds
-lnet-subdirs += tests
subdir-m += $(lnet-subdirs)
@INCLUDE_RULES@
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-SUBDIRS = libcfs lnet klnds ulnds tests doc utils include \
+SUBDIRS = libcfs lnet klnds ulnds doc utils include \
autoconf
sources:
lnet/libcfs/linux/Makefile
lnet/lnet/Makefile
lnet/lnet/autoMakefile
-lnet/tests/Makefile
-lnet/tests/autoMakefile
lnet/ulnds/Makefile
lnet/ulnds/autoMakefile
lnet/ulnds/socklnd/Makefile
+++ /dev/null
-Makefile
-.deps
-.*.cmd
-autoMakefile.in
-autoMakefile
-*.ko
-*.mod.c
-.*.flags
-.tmp_versions
-.depend
+++ /dev/null
-MODULES := pingsrv pingcli
-#utcli utsrv
-pingsrv-objs := ping_srv.o
-
-ifeq ($(PATCHLEVEL),6)
-pingcli-objs := ping_cli.o
-#utcli-objs := ut_cli.o
-#utsrv-objs := ut_srv.o
-else
-ping%.c: ping_%.c
- ln -sf $< $@
-endif
-
-@INCLUDE_RULES@
+++ /dev/null
-#ifndef __LINUX_PING_H__
-#define __LINUX_PING_H__
-
-#include <linux/module.h>
-#include <linux/proc_fs.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-#include <linux/workqueue.h>
-#else
-#include <linux/tqueue.h>
-#endif
-#include <linux/wait.h>
-#include <linux/smp_lock.h>
-#include <linux/poll.h>
-
-#include <asm/unistd.h>
-#include <asm/semaphore.h>
-
-#endif
+++ /dev/null
-#ifndef __XNU_PING_H__
-#define __XNU_PING_H__
-
-#include <mach/mach_types.h>
-#include <arch-xnu/cfs_lock.h>
-#include <arch-xnu/cfs_prim.h>
-
-#endif
+++ /dev/null
-# Copyright (C) 2001 Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
-
-if MODULES
-if TESTS
-
-if LINUX
-noinst_DATA := pingsrv$(KMODEXT) pingcli$(KMODEXT)
-#noinst_DATA += utsrv$(KMODEXT) utcli$(KMODEXT)
-endif
-
-if DARWIN
-macos_PROGRAMS := pingcli
-#macos_PROGRAMS := pingsrv
-
-pingcli_SOURCES := ping_cli.c
-
-pingcli_CFLAGS := $(EXTRA_KCFLAGS)
-pingcli_LDFLAGS := $(EXTRA_KLDFLAGS)
-pingcli_LDADD := $(EXTRA_KLIBS)
-
-#pingsrv_SOURCES := ping_srv.c
-
-#pingsrv_CFLAGS := $(EXTRA_KCFLAGS)
-#pingsrv_LDFLAGS := $(EXTRA_KLDFLAGS)
-#pingsrv_LDADD := $(EXTRA_KLIBS)
-
-plist_DATA := ping_cli/Info.plist
-#plist_DATA := ping_srv/Info.plist
-
-install_data_hook := fix-kext-ownership
-endif # Darwin
-
-endif # TEST
-endif # MODULE
-install-data-hook: $(install_data_hook)
-
-MOSTLYCLEANFILES = @MOSTLYCLEANFILES@ pingsrv.c pingcli.c
-DIST_SOURCES = ping_srv.c ping_cli.c ping.h
-#ut_cli.c ut_srv.c ut.h
+++ /dev/null
-#! /bin/sh
-
-if false ;then
- OPTVAL=`getopt -o cb:l:s:k:L:v -n 'build-all' -- "$@"`
-else
- # XNU/BSD getopt is special...
- OPTVAL=$(getopt cb:l:s:k:L:v "$@")
-fi
-
-if [ $? != 0 ]
-then
- echo 'Usage: see source...'
- exit 2
-fi
-
-eval set -- "$OPTVAL"
-
-cd $(dirname $0)
-
-#set -x
-
-b=$PWD # base directory
-l=$b/build.log # where to log operations
-s=$b/build.seq # build sequence
-k=$b/kext.stage # where to place kexts after build
-
-load='' # list of kexts to load
-clean=0
-verbose=0
-
-while true ;do
- case "$1" in
- -c)
- clean=1
- shift 1
- ;;
- -v)
- verbose=$(($verbose + 1))
- shift 1
- ;;
- -b)
- b=$2
- shift 2
- ;;
- -l)
- l=$2
- shift 2
- ;;
- -s)
- s=$2
- shift 2
- ;;
- -k)
- k=$2
- shift 2
- ;;
- -L)
- load=$2
- shift 2
- ;;
- --)
- shift
- break
- ;;
- *)
- echo "Internal error!"
- exit 1
- ;;
- esac
-done
-
-echo > $l
-
-function message ()
-{
- local msg
-
- msg="$1"
- echo $msg
- echo $msg >> $l
-}
-
-function abort ()
-{
- local msg
-
- msg=$1
-
- message "$1"
- exit 1
-}
-
-function configure_xcode ()
-{
- local path
- local pfile
- local module
-
- path=$PWD
- module=$(basename $path)
- pfile=$path/$module.xcode/project.pbxproj
- if [ -r $pfile.template ] ;then
- cpp \
- -P \
- -include $b/build-config \
- $pfile.template | \
- tail +2 > $pfile
- else
- abort "missing $pfile.template"
- fi
-}
-
-if [ x$clean != x0 ] ;then
- echo "Removing..."
- find $b/ -type d -name build
- rm -fr $(find $b/ -type d -name build)
- find $b/ -print0 | xargs -0 touch
-fi
-
-cat $s | while read ;do
- d=$REPLY
- if [ x$d = x ] ;then
- : # empty line. Do nothing
- elif [ ${d:0:1} = '#' ] ;then
- : # comment. Skip
- else
- cd $d || abort "Cannot cd to $d"
- message "________ Building in $d __________"
- #configure_xcode
- if [ $verbose -gt 0 ] ;then
- xcodebuild 2>&1 | tee -a $l
- else
- xcodebuild >> $l 2>&1 || abort "Build failure in $d. See $l"
- fi
- # tail -2 $l
- cd $b
- fi
-done
-
-# copy all built kexts into $k
-# sudo is used, because extensions are later chowned to root.
-sudo rm -f ../include/arch
-ln -s ../include/arch-xnu ../include/arch
-sudo rm -fr $k || abort "Cannot clean $k"
-mkdir $k || abort "Cannot create $k"
-cp -R $(find ../ -name \*.kext -type d) $k || abort "Cannot stage kexts"
-cd $k || abort "Cannot chdir to $k"
-sudo chown -R root:wheel * || abort "Cannot chown kexts to root:wheel"
-
-if [ x$load != x ] ;then
- cd $k
- sudo kextload -r $k $load
-else
- sudo chown -R root:wheel *
-fi
-cd $b
-
-sync;sync;sync
-
+++ /dev/null
-../libcfs
-../portals
-../knals/socknal
-./ping_cli
-./ping_srv
+++ /dev/null
-#ifndef _KPING_INCLUDED
-#define _KPING_INCLUDED
-
-#include <libcfs/portals_utils.h>
-#include <lnet/lnet.h>
-
-
-#define PTL_PING_IN_SIZE 256 // n packets per buffer
-#define PTL_PING_IN_BUFFERS 2 // n fallback buffers
-
-#define PTL_PING_CLIENT 4
-#define PTL_PING_SERVER 5
-
-#define PING_HEADER_MAGIC 0xDEADBEEF
-#define PING_BULK_MAGIC 0xCAFEBABE
-
-#define PING_HEAD_BITS 0x00000001
-#define PING_BULK_BITS 0x00000002
-#define PING_IGNORE_BITS 0xFFFFFFFC
-
-#define PTL_PING_ACK 0x01
-#define PTL_PING_VERBOSE 0x02
-#define PTL_PING_VERIFY 0x04
-#define PTL_PING_PREALLOC 0x08
-
-
-#define NEXT_PRIMARY_BUFFER(index) \
- (((index + 1) >= PTL_PING_IN_BUFFERS) ? 0 : (index + 1))
-
-#define PDEBUG(str, err) \
- CERROR ("%s: error=(%d)\n", str, err)
-
-
-/* Ping data to be passed via the ioctl to kernel space */
-
-#if __KERNEL__
-
-struct pingsrv_data {
- lnet_handle_me_t me;
- lnet_handle_eq_t eq;
- void *in_buf;
- lnet_process_id_t my_id;
- lnet_process_id_t id_local;
- lnet_md_t mdin;
- lnet_md_t mdout;
- lnet_handle_md_t mdin_h;
- lnet_handle_md_t mdout_h;
- lnet_event_t evnt;
- cfs_task_t *tsk;
-}; /* struct pingsrv_data */
-
-struct pingcli_data {
-
- int count;
- int size;
- lnet_nid_t nid;
- int timeout;
- lnet_handle_me_t me;
- lnet_handle_eq_t eq;
- char *inbuf;
- char *outbuf;
- lnet_process_id_t myid;
- lnet_process_id_t id_local;
- lnet_process_id_t id_remote;
- lnet_md_t md_in_head;
- lnet_md_t md_out_head;
- lnet_handle_md_t md_in_head_h;
- lnet_handle_md_t md_out_head_h;
- lnet_event_t ev;
- cfs_task_t *tsk;
-}; /* struct pingcli_data */
-
-
-#endif /* __KERNEL__ */
-
-#endif /* _KPING_INCLUDED */
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2002, Lawrence Livermore National Labs (LLNL)
- * Author: Brian Behlendorf <behlendorf1@llnl.gov>
- * Kedar Sovani (kedar@calsoftinc.com)
- * Amey Inamdar (amey@calsoftinc.com)
- *
- * This file is part of Portals, http://www.sf.net/projects/lustre/
- *
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * Portals is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Portals; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#define DEBUG_SUBSYSTEM S_PINGER
-
-#include <libcfs/kp30.h>
-#include <lnet/lnet.h>
-#include "ping.h"
-/* int libcfs_debug = D_PING_CLI; */
-
-
-#define STDSIZE (sizeof(int) + sizeof(int) + sizeof(struct timeval))
-
-#define MAX_TIME 100000
-
-/* This should be enclosed in a structure */
-
-static struct pingcli_data *client = NULL;
-
-static int count = 0;
-
-static void
-pingcli_shutdown(int err)
-{
- int rc;
-
- /* Yes, we are intentionally allowing us to fall through each
- * case in to the next. This allows us to pass an error
- * code to just clean up the right stuff.
- */
- switch (err) {
- case 1:
- /* Unlink any memory descriptors we may have used */
- if ((rc = LNetMDUnlink (client->md_out_head_h)))
- PDEBUG ("LNetMDUnlink", rc);
- case 2:
- if ((rc = LNetMDUnlink (client->md_in_head_h)))
- PDEBUG ("LNetMDUnlink", rc);
-
- /* Free the event queue */
- if ((rc = LNetEQFree (client->eq)))
- PDEBUG ("LNetEQFree", rc);
-
- if ((rc = LNetMEUnlink (client->me)))
- PDEBUG ("LNetMEUnlink", rc);
- case 3:
- LNetNIFini();
-
- case 4:
- /* Free our buffers */
- if (client->outbuf != NULL)
- LIBCFS_FREE (client->outbuf, STDSIZE + client->size);
-
- if (client->inbuf != NULL)
- LIBCFS_FREE (client->inbuf,
- (client->size + STDSIZE) * client->count);
-
- if (client != NULL)
- LIBCFS_FREE (client,
- sizeof(struct pingcli_data));
- }
-
-
- CDEBUG (D_OTHER, "ping client released resources\n");
-} /* pingcli_shutdown() */
-
-static void pingcli_callback(lnet_event_t *ev)
-{
- int i;
- unsigned magic;
- i = __le32_to_cpu(*(int *)((char *)ev->md.start + ev->offset + sizeof(unsigned)));
- magic = __le32_to_cpu(*(int *)((char *)ev->md.start + ev->offset));
-
- if(magic != 0xcafebabe) {
- CERROR("Unexpected response %x\n", magic);
- }
-
- if((i == count) || !count)
- wake_up_process (client->tsk);
- else
- CERROR("Received response after timeout for %d\n",i);
-}
-
-
-static void
-pingcli_start(struct libcfs_ioctl_data *args)
-{
- unsigned ping_head_magic = __cpu_to_le32(PING_HEADER_MAGIC);
- int rc;
- struct timeval tv1, tv2;
-
- client->tsk = cfs_current();
- client->nid = args->ioc_nid;
- client->count = args->ioc_count;
- client->size = args->ioc_u32[0];
- client->timeout = args->ioc_u32[1];
-
- CDEBUG (D_OTHER, "pingcli_setup args: nid %s (%s), \
- size %u, count: %u, timeout: %u\n",
- libcfs_nid2str(client->nid),
- libcfs_nid2str(client->nid),
- client->size, client->count, client->timeout);
-
-
- LIBCFS_ALLOC (client->outbuf, STDSIZE + client->size) ;
- if (client->outbuf == NULL)
- {
- CERROR ("Unable to allocate out_buf ("LPSZ" bytes)\n", STDSIZE);
- pingcli_shutdown (4);
- return;
- }
-
- LIBCFS_ALLOC (client->inbuf,
- (client->size + STDSIZE) * client->count);
- if (client->inbuf == NULL)
- {
- CERROR ("Unable to allocate out_buf ("LPSZ" bytes)\n", STDSIZE);
- pingcli_shutdown (4);
- return;
- }
-
- rc = LNetNIInit(0);
- if (rc != 0 && rc != 1)
- {
- CERROR ("LNetNIInit: error %d\n", rc);
- pingcli_shutdown (4);
- return;
- }
-
- /* Based on the initialization aquire our unique portal ID. */
- if ((rc = LNetGetId (1, &client->myid)))
- {
- CERROR ("LNetGetId error %d\n", rc);
- pingcli_shutdown (2);
- return;
- }
-
- /* Setup the local match entries */
- client->id_local.nid = LNET_NID_ANY;
- client->id_local.pid = LNET_PID_ANY;
-
- /* Setup the remote match entries */
- client->id_remote.nid = client->nid;
- client->id_remote.pid = 0;
-
- if ((rc = LNetMEAttach (PTL_PING_CLIENT,
- client->id_local, 0, ~0, LNET_RETAIN,
- LNET_INS_AFTER, &client->me)))
- {
- CERROR ("LNetMEAttach error %d\n", rc);
- pingcli_shutdown (2);
- return;
- }
-
- /* Allocate the event queue for this network interface */
- if ((rc = LNetEQAlloc (64, pingcli_callback, &client->eq)))
- {
- CERROR ("LNetEQAlloc error %d\n", rc);
- pingcli_shutdown (2);
- return;
- }
-
- count = client->count;
-
- client->md_in_head.start = client->inbuf;
- client->md_in_head.length = (client->size + STDSIZE) * count;
- client->md_in_head.threshold = LNET_MD_THRESH_INF;
- client->md_in_head.options = LNET_MD_OP_PUT;
- client->md_in_head.user_ptr = NULL;
- client->md_in_head.eq_handle = client->eq;
- memset (client->inbuf, 0, (client->size + STDSIZE) * count);
-
- /* Attach the incoming buffer */
- if ((rc = LNetMDAttach (client->me, client->md_in_head,
- LNET_UNLINK, &client->md_in_head_h))) {
- CERROR ("LNetMDAttach error %d\n", rc);
- pingcli_shutdown (1);
- return;
- }
- /* Setup the outgoing ping header */
- client->md_out_head.start = client->outbuf;
- client->md_out_head.length = STDSIZE + client->size;
- client->md_out_head.threshold = client->count;
- client->md_out_head.options = LNET_MD_OP_PUT;
- client->md_out_head.user_ptr = NULL;
- client->md_out_head.eq_handle = LNET_EQ_NONE;
-
- memcpy (client->outbuf, &ping_head_magic, sizeof(ping_head_magic));
-
- count = 0;
-
- /* Bind the outgoing ping header */
- if ((rc=LNetMDBind (client->md_out_head,
- LNET_UNLINK, &client->md_out_head_h))) {
- CERROR ("LNetMDBind error %d\n", rc);
- pingcli_shutdown (1);
- return;
- }
- while ((client->count - count)) {
- unsigned __count;
- __count = __cpu_to_le32(count);
-
- memcpy (client->outbuf + sizeof(unsigned),
- &(__count), sizeof(unsigned));
- /* Put the ping packet */
- cfs_fs_timeval (&tv1);
-
- memcpy(client->outbuf+sizeof(unsigned)+sizeof(unsigned),&tv1,
- sizeof(struct timeval));
-
- if((rc = LNetPut (LNET_NID_ANY, client->md_out_head_h,
- LNET_NOACK_REQ,
- client->id_remote, PTL_PING_SERVER,
- 0, 0, 0))) {
- PDEBUG ("LNetPut (header)", rc);
- pingcli_shutdown (1);
- return;
- }
- CWARN ("Lustre: sent msg no %d.\n", count);
-
- set_current_state (CFS_TASK_INTERRUPTIBLE);
- rc = cfs_schedule_timeout (CFS_TASK_INTERRUPTIBLE,
- cfs_time_seconds(client->timeout));
- if (rc == 0) {
- CERROR ("timeout .....\n");
- } else {
- cfs_fs_timeval (&tv2);
- CWARN("Reply in %u usec\n",
- (unsigned)((tv2.tv_sec - tv1.tv_sec)
- * 1000000 + (tv2.tv_usec - tv1.tv_usec)));
- }
- count++;
- }
-
- pingcli_shutdown (2);
-
-} /* pingcli_setup() */
-
-
-
-/* called by the portals_ioctl for ping requests */
-int kping_client(struct libcfs_ioctl_data *args)
-{
- LIBCFS_ALLOC (client, sizeof(struct pingcli_data));
- if (client == NULL)
- {
- CERROR ("Unable to allocate client structure\n");
- return (0);
- }
- memset (client, 0, sizeof(struct pingcli_data));
- pingcli_start (args);
-
- return 0;
-} /* kping_client() */
-
-
-static int __init pingcli_init(void)
-{
- PORTAL_SYMBOL_REGISTER(kping_client);
- return 0;
-} /* pingcli_init() */
-
-
-static void /*__exit*/ pingcli_cleanup(void)
-{
- PORTAL_SYMBOL_UNREGISTER (kping_client);
-} /* pingcli_cleanup() */
-
-
-MODULE_AUTHOR("Brian Behlendorf (LLNL)");
-MODULE_DESCRIPTION("A simple kernel space ping client for portals testing");
-MODULE_LICENSE("GPL");
-
-cfs_module(ping_cli, "1.0.0", pingcli_init, pingcli_cleanup);
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
-EXPORT_SYMBOL (kping_client);
-#endif
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>pingcli</string>
- <key>CFBundleIconFile</key>
- <string></string>
- <key>CFBundleIdentifier</key>
- <string>com.clusterfs.lustre.pingcli</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundlePackageType</key>
- <string>KEXT</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0.1</string>
- <key>OSBundleCompatibleVersion</key>
- <string>1.0.0</string>
- <key>OSBundleLibraries</key>
- <dict>
- <key>com.apple.kpi.bsd</key>
- <string>8.0.0b1</string>
- <key>com.apple.kpi.libkern</key>
- <string>8.0.0b1</string>
- <key>com.apple.kpi.mach</key>
- <string>8.0.0b1</string>
- <key>com.apple.kpi.unsupported</key>
- <string>8.0.0b1</string>
- <key>com.clusterfs.lustre.libcfs</key>
- <string>1.0.0</string>
- <key>com.clusterfs.lustre.lnet</key>
- <string>1.0.0</string>
- </dict>
-</dict>
-</plist>
+++ /dev/null
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 39;
- objects = {
- 06AA1262FFB20DD611CA28AA = {
- buildRules = (
- );
- buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- OPTIMIZATION_CFLAGS = "-O0";
- ZERO_LINK = YES;
- };
- isa = PBXBuildStyle;
- name = Development;
- };
- 06AA1263FFB20DD611CA28AA = {
- buildRules = (
- );
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- ZERO_LINK = NO;
- };
- isa = PBXBuildStyle;
- name = Deployment;
- };
-//060
-//061
-//062
-//063
-//064
-//080
-//081
-//082
-//083
-//084
- 089C1669FE841209C02AAC07 = {
- buildSettings = {
- };
- buildStyles = (
- 06AA1262FFB20DD611CA28AA,
- 06AA1263FFB20DD611CA28AA,
- );
- hasScannedForEncodings = 1;
- isa = PBXProject;
- mainGroup = 089C166AFE841209C02AAC07;
- projectDirPath = "";
- targets = (
- 32A4FEB80562C75700D090E7,
- );
- };
- 089C166AFE841209C02AAC07 = {
- children = (
- 247142CAFF3F8F9811CA285C,
- 089C167CFE841241C02AAC07,
- 19C28FB6FE9D52B211CA2CBB,
- );
- isa = PBXGroup;
- name = ping_cli;
- refType = 4;
- sourceTree = "<group>";
- };
- 089C167CFE841241C02AAC07 = {
- children = (
- 32A4FEC30562C75700D090E7,
- );
- isa = PBXGroup;
- name = Resources;
- refType = 4;
- sourceTree = "<group>";
- };
-//080
-//081
-//082
-//083
-//084
-//190
-//191
-//192
-//193
-//194
- 1949BA72073A08F100E4167C = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.c;
- name = ping_cli.c;
- path = ../ping_cli.c;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 1949BA73073A08F100E4167C = {
- fileRef = 1949BA72073A08F100E4167C;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 19C28FB6FE9D52B211CA2CBB = {
- children = (
- 32A4FEC40562C75800D090E7,
- );
- isa = PBXGroup;
- name = Products;
- refType = 4;
- sourceTree = "<group>";
- };
-//190
-//191
-//192
-//193
-//194
-//240
-//241
-//242
-//243
-//244
- 247142CAFF3F8F9811CA285C = {
- children = (
- 1949BA72073A08F100E4167C,
- );
- isa = PBXGroup;
- name = Source;
- path = "";
- refType = 4;
- sourceTree = "<group>";
- };
-//240
-//241
-//242
-//243
-//244
-//320
-//321
-//322
-//323
-//324
- 32A4FEB80562C75700D090E7 = {
- buildPhases = (
- 32A4FEB90562C75700D090E7,
- 32A4FEBA0562C75700D090E7,
- 32A4FEBB0562C75700D090E7,
- 32A4FEBD0562C75700D090E7,
- 32A4FEBF0562C75700D090E7,
- 32A4FEC00562C75700D090E7,
- 32A4FEC10562C75700D090E7,
- );
- buildRules = (
- );
- buildSettings = {
- FRAMEWORK_SEARCH_PATHS = "";
- GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
- GCC_WARN_UNKNOWN_PRAGMAS = NO;
- HEADER_SEARCH_PATHS = "../../include ../";
- INFOPLIST_FILE = Info.plist;
- INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
- LIBRARY_SEARCH_PATHS = "";
- MODULE_NAME = com.clusterfs.lustre.portals.tests.ping_cli;
- MODULE_START = ping_cli_start;
- MODULE_STOP = ping_cli_stop;
- MODULE_VERSION = 1.0.0d1;
- OTHER_CFLAGS = "-D__KERNEL__ -D__DARWIN__";
- OTHER_LDFLAGS = "";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = ping_cli;
- SECTORDER_FLAGS = "";
- WARNING_CFLAGS = "-Wmost";
- WRAPPER_EXTENSION = kext;
- };
- dependencies = (
- );
- isa = PBXNativeTarget;
- name = ping_cli;
- productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions";
- productName = ping_cli;
- productReference = 32A4FEC40562C75800D090E7;
- productType = "com.apple.product-type.kernel-extension";
- };
- 32A4FEB90562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXShellScriptBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "script=\"${SYSTEM_DEVELOPER_DIR}/ProjectBuilder Extras/Kernel Extension Support/KEXTPreprocess\";\nif [ -x \"$script\" ]; then\n . \"$script\"\nfi";
- };
- 32A4FEBA0562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEBB0562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXResourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEBD0562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- 1949BA73073A08F100E4167C,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEBF0562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEC00562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEC10562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXShellScriptBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "script=\"${SYSTEM_DEVELOPER_DIR}/ProjectBuilder Extras/Kernel Extension Support/KEXTPostprocess\";\nif [ -x \"$script\" ]; then\n . \"$script\"\nfi";
- };
- 32A4FEC30562C75700D090E7 = {
- isa = PBXFileReference;
- lastKnownFileType = text.plist.xml;
- path = Info.plist;
- refType = 4;
- sourceTree = "<group>";
- };
- 32A4FEC40562C75800D090E7 = {
- explicitFileType = wrapper.cfbundle;
- includeInIndex = 0;
- isa = PBXFileReference;
- path = ping_cli.kext;
- refType = 3;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- };
- rootObject = 089C1669FE841209C02AAC07;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=4:tabstop=4:
- *
- * Copyright (C) 2002 Cluster File Systems, Inc.
- * Author: Matt Wu <mattwu@clusterfs.com>
- *
- * This file is part of Lustre, http://www.lustre.org.
- *
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * Lustre is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define DEBUG_SUBSYSTEM S_LNET
-
-/*
- * Included Headers
- */
-
-
-#include <libcfs/libcfs.h>
-
-
-/* libcfs module init/exit routines */
-DECLARE_INIT(init_libcfs_module);
-DECLARE_EXIT(exit_libcfs_module);
-
-/* portal module init/exit routines */
-DECLARE_INIT(init_lnet);
-DECLARE_EXIT(fini_lnet);
-
-/* tdinal module init/exit routines */
-DECLARE_INIT(ksocknal_module_init);
-DECLARE_EXIT(ksocknal_module_fini);
-
-/* pingcli module init/exit routines */
-DECLARE_INIT(pingcli_init);
-DECLARE_EXIT(pingcli_cleanup);
-
-
-/* pingsrv module init/exit routines */
-DECLARE_INIT(pingsrv_init);
-DECLARE_EXIT(pingsrv_cleanup);
-
-/*
- * structure definitions
- */
-
-
-#define LUSTRE_PING_VERSION 0x00010000 /* ping srv/cli version: 0001.0000 */
-
-#define LUSTRE_PING_DEVICE L"\\Device\\LNET" /* device object name */
-#define LUSTRE_PING_SYMLNK L"\\DosDevices\\LNET" /* user-visible name for the device*/
-
-typedef struct _DEVICE_EXTENSION
-{
- BOOLEAN bProcFS;
-
-} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
-
-
-/*
- * global definitions
- */
-
-PDEVICE_OBJECT PingObject = NULL; /* ping device object */
-PDEVICE_OBJECT ProcObject = NULL; /* procfs emulator device */
-
-
-/*
- * common routines
- */
-
-
-//
-// complete Irp request ...
-//
-
-NTSTATUS
-UTCompleteIrp(
- PIRP Irp,
- NTSTATUS Status,
- ULONG Info
- )
-{
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = Info;
- IoCompleteRequest(Irp,IO_NO_INCREMENT);
-
- return Status;
-}
-
-//
-// Open/Create Device ...
-//
-
-NTSTATUS
-UTCreate(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- KdPrint(("UTCreate: DeviceCreate ...\n"));
-
- return UTCompleteIrp(Irp,STATUS_SUCCESS,0);
-}
-
-//
-// Close Devcie ...
-//
-
-NTSTATUS
-UTClose(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
-{
- KdPrint(("UTClose: Device Closed.\n"));
-
- return UTCompleteIrp(Irp, STATUS_SUCCESS, 0);
-
- UNREFERENCED_PARAMETER(DeviceObject);
-}
-
-
-
-NTSTATUS
-UTShutdown(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- KdPrint(("UTShutdown: shuting TdiSock ...\n"));
-
- return UTCompleteIrp(Irp, STATUS_SUCCESS, 0);
-
- UNREFERENCED_PARAMETER(DeviceObject);
-}
-
-//
-// driver frame Routines ...
-//
-
-
-NTSTATUS
-UTDeviceControl(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- NTSTATUS Status = STATUS_INVALID_DEVICE_REQUEST;
- PIO_STACK_LOCATION IrpSp;
-
- ULONG ControlCode;
- ULONG InputLength;
- ULONG OutputLength;
-
- PVOID lpvInBuffer;
-
- KdPrint(("UTDeviceControl: Device Ioctl ...\n"));
-
- Irp->IoStatus.Information = 0;
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
-
- ControlCode = IrpSp->Parameters.DeviceIoControl.IoControlCode;
- InputLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
- OutputLength = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
- lpvInBuffer = Irp->AssociatedIrp.SystemBuffer;
-
- ASSERT (IrpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL);
-
- switch (ControlCode)
- {
- case IOCTL_LIBCFS_VERSION:
-
- *((ULONG *)lpvInBuffer) = (ULONG)(LUSTRE_PING_VERSION);
- Irp->IoStatus.Information = sizeof(ULONG);
- Status = STATUS_SUCCESS;
- break;
-
- default:
- break;
- }
-
- Irp->IoStatus.Status = Status;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- KdPrint(("UTDeviceControl: Device Ioctl returned.\n"));
-
- return Status;
-}
-
-NTSTATUS
-ProcCreate(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- NTSTATUS Status;
- PIO_STACK_LOCATION IrpSp;
-
- FILE_FULL_EA_INFORMATION * ea;
- cfs_file_t * fp;
-
- KdPrint(("ProcCreate: Proc device is being opened ...\n"));
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
- ea = (PFILE_FULL_EA_INFORMATION) Irp->AssociatedIrp.SystemBuffer;
-
- if (!ea) {
- Status = STATUS_INVALID_PARAMETER;
- } else {
- fp = lustre_open_file(&ea->EaName[0]);
- if (!fp) {
- Status = STATUS_OBJECT_NAME_NOT_FOUND;
- } else {
- IrpSp->FileObject->FsContext = fp;
- IrpSp->FileObject->FsContext2 = fp->private_data;
- Status = STATUS_SUCCESS;
- }
- }
-
- return UTCompleteIrp(Irp, Status, 0);
-}
-
-//
-// Close Devcie ...
-//
-
-NTSTATUS
-ProcClose(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
-{
- PIO_STACK_LOCATION IrpSp;
-
- cfs_file_t * fp;
-
- KdPrint(("ProcClose: Proc device object is to be closed.\n"));
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
-
- fp = (cfs_file_t *) IrpSp->FileObject->FsContext;
-
- ASSERT(fp != NULL);
- ASSERT(IrpSp->FileObject->FsContext2 == fp->private_data);
-
- lustre_close_file(fp);
-
- return UTCompleteIrp(Irp, STATUS_SUCCESS, 0);
-
- UNREFERENCED_PARAMETER(DeviceObject);
-}
-
-/*
- * proc frame routines
- */
-
-NTSTATUS
-ProcDeviceControl(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- NTSTATUS Status = STATUS_INVALID_DEVICE_REQUEST;
- PIO_STACK_LOCATION IrpSp;
-
- ULONG ControlCode;
- ULONG InputLength;
- ULONG OutputLength;
-
- PVOID lpvInBuffer;
-
- KdPrint(("ProcDeviceControl: Proc device ioctling ...\n"));
-
- Irp->IoStatus.Information = 0;
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
-
- ControlCode = IrpSp->Parameters.DeviceIoControl.IoControlCode;
- InputLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
- OutputLength = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
- lpvInBuffer = Irp->AssociatedIrp.SystemBuffer;
-
- ASSERT (IrpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL);
-
- switch (ControlCode)
- {
- case IOCTL_LIBCFS_VERSION:
-
- *((ULONG *)lpvInBuffer) = (ULONG)(LUSTRE_PING_VERSION);
- Irp->IoStatus.Information = sizeof(ULONG);
-
- Status = STATUS_SUCCESS;
-
- break;
-
- case IOCTL_LIBCFS_ENTRY:
- {
- int rc = 0;
- cfs_file_t * fp;
-
- fp = (cfs_file_t *) IrpSp->FileObject->FsContext;
-
- if (!fp) {
- rc = -EINVAL;
- } else {
- rc = lustre_ioctl_file(fp, (PCFS_PROC_IOCTL) (lpvInBuffer));
- }
-
- if (rc == 0) {
- Irp->IoStatus.Information = InputLength;
- Status = STATUS_SUCCESS;
- }
- }
- }
-
- Irp->IoStatus.Status = Status;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- KdPrint(("ProcDeviceControl: Proc device ioctl returned with status = %xh.\n", Status));
-
- return Status;
-}
-
-
-
-NTSTATUS
-ProcReadWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
- PIO_STACK_LOCATION IrpSp;
- NTSTATUS Status;
-
- cfs_file_t * fp;
- int rc;
- PCHAR buf;
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
- if (Irp->MdlAddress) {
- buf = MmGetSystemAddressForMdlSafe(
- Irp->MdlAddress,
- NormalPagePriority);
- } else {
- buf = Irp->AssociatedIrp.SystemBuffer;
- }
-
- if (buf == NULL) {
- Status = STATUS_SUCCESS;
- rc = 0;
- } else {
- fp = (cfs_file_t *) IrpSp->FileObject->FsContext;
-
- if (!fp) {
- Status = STATUS_INVALID_PARAMETER;
- goto errorout;
- }
-
- if (IrpSp->MajorFunction == IRP_MJ_READ) {
- rc = lustre_read_file(
- fp, IrpSp->Parameters.Read.ByteOffset.LowPart,
- IrpSp->Parameters.Read.Length, buf);
- } else {
- rc = lustre_write_file(
- fp, IrpSp->Parameters.Write.ByteOffset.LowPart,
- IrpSp->Parameters.Write.Length, buf);
- }
- if (rc < 0) {
- cfs_enter_debugger();
- Status = STATUS_UNSUCCESSFUL;
- } else {
- Status = STATUS_SUCCESS;
- }
- }
-
-
-errorout:
- return UTCompleteIrp(Irp, Status, rc);
-}
-
-
-//
-// common dispatch routines
-//
-
-NTSTATUS
-UTDispatchRequest(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- NTSTATUS Status;
- PIO_STACK_LOCATION IrpSp;
-
- Status = STATUS_INVALID_DEVICE_REQUEST;
-
- __try {
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
-
- switch (IrpSp->MajorFunction) {
-
- case IRP_MJ_CREATE:
- if (DeviceObject == PingObject) {
- Status = UTCreate(DeviceObject, Irp);
- } else if (DeviceObject == ProcObject) {
- Status = ProcCreate(DeviceObject, Irp);
- }
- break;
-
- case IRP_MJ_CLOSE:
- if (DeviceObject == PingObject) {
- Status = UTClose(DeviceObject, Irp);
- } else if (DeviceObject == ProcObject) {
- Status = ProcClose(DeviceObject, Irp);
- }
- break;
-
- case IRP_MJ_READ:
- case IRP_MJ_WRITE:
- if (DeviceObject == ProcObject) {
- Status = ProcReadWrite(DeviceObject, Irp);
- }
- break;
-
- case IRP_MJ_DEVICE_CONTROL:
- if (DeviceObject == PingObject) {
- Status = UTDeviceControl(DeviceObject, Irp);
- } else if (DeviceObject == ProcObject) {
- Status = ProcDeviceControl(DeviceObject, Irp);
- }
- break;
-
- case IRP_MJ_SHUTDOWN:
- Status = UTShutdown(DeviceObject, Irp);
- break;
-
- default:
-
- KdPrint(("UTDispatchRequest: Major Function: %xh is not supported.\n",
- IrpSp->MajorFunction));
- UTCompleteIrp(Irp, Status, 0);
- break;
- }
- }
-
- __finally {
- }
-
- return Status;
-}
-
-//
-// create a device object and a dosdevice symbol link
-//
-
-PDEVICE_OBJECT
-CreateDevice(
- IN PDRIVER_OBJECT DriverObject,
- IN PWCHAR DeviceName,
- IN PWCHAR SymlnkName,
- IN BOOLEAN bProcFS
- )
-{
- NTSTATUS Status;
-
- UNICODE_STRING NtDevName;
- UNICODE_STRING Win32DevName;
-
- PDEVICE_EXTENSION DeviceExtension;
- PDEVICE_OBJECT DeviceObject;
-
- /* create the device object with the specified name */
-
- RtlInitUnicodeString(&NtDevName, DeviceName);
-
- Status = IoCreateDevice(
- DriverObject,
- sizeof(DEVICE_EXTENSION),
- &NtDevName,
- FILE_DEVICE_UNKNOWN,
- 0,
- FALSE,
- &DeviceObject );
-
- if (!NT_SUCCESS(Status)) {
-
- cfs_enter_debugger();
- return NULL;
- }
-
- /* create the symlink to make the device visible to user */
-
- RtlInitUnicodeString(&Win32DevName, SymlnkName);
-
- Status = IoCreateSymbolicLink(&Win32DevName, &NtDevName);
-
- if (!NT_SUCCESS(Status)) {
-
- IoDeleteDevice(DeviceObject);
- return NULL;
- }
-
- DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceObjectExtension;
- DeviceExtension->bProcFS = bProcFS;
-
- DeviceObject->Flags |= DO_BUFFERED_IO;
- DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
-
- return DeviceObject;
-}
-
-
-//
-// DriverEntry
-//
-
-NTSTATUS DriverEntry(
- IN PDRIVER_OBJECT DriverObject,
- IN PUNICODE_STRING RegistryPath
- )
-{
- KdPrint(("Lustre ping test: Build Time: " __DATE__ " " __TIME__ "\n"));
- KdPrint(("Lustre ping test: DriverEntry ... \n"));
-
- /* initialize libcfs module */
- if (module_init_libcfs_module() != 0) {
- KdPrint(("ping: error initialize module: libcfs ...\n"));
- goto errorout;
- }
-
- /* initialize lnet module */
- if (module_init_lnet() != 0) {
- module_exit_libcfs_module();
- KdPrint(("ping: error initialize module: lnet ...\n"));
- goto errorout;
- }
-
- /* initialize tdinal module */
- if (module_ksocknal_module_init() != 0) {
- module_fini_lnet();
- module_exit_libcfs_module();
- KdPrint(("ping: error initialize module: tdilnd ...\n"));
- goto errorout;
- }
-
-#if defined(LUSTRE_PING_CLI)
- /* initialize pingcli module */
- if (module_pingcli_init() != 0) {
- module_ksocknal_module_fini();
- module_fini_lnet();
- module_exit_libcfs_module();
- KdPrint(("ping: error initialize module: pingcli ...\n"));
- goto errorout;
- }
-#endif
-
-#if defined(LUSTRE_PING_SRV)
- /* initialize pingsrv module */
- if (module_pingsrv_init() != 0) {
- module_ksocknal_module_fini();
- module_fini_lnet();
- module_exit_libcfs_module();
- KdPrint(("ping: error initialize module: pingsrv ...\n"));
- goto errorout;
- }
-#endif
-
- /* create the ping device object */
- PingObject = CreateDevice(
- DriverObject,
- LUSTRE_PING_DEVICE,
- LUSTRE_PING_SYMLNK,
- FALSE );
- if (!PingObject) {
-#if defined(LUSTRE_PING_CLI)
- module_pingcli_cleanup();
-#endif
-#if defined(LUSTRE_PING_SRV)
- module_pingsrv_cleanup();
-#endif
- module_ksocknal_module_fini();
- module_fini_lnet();
- module_exit_libcfs_module();
-
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- /* create the libcfs proc fs emultor device object */
- ProcObject = CreateDevice(
- DriverObject,
- LUSTRE_PROC_DEVICE,
- LUSTRE_PROC_SYMLNK,
- TRUE );
- if (!ProcObject) {
-
- IoDeleteDevice(PingObject);
-#if defined(LUSTRE_PING_CLI)
- module_pingcli_cleanup();
-#endif
-#if defined(LUSTRE_PING_SRV)
- module_pingsrv_cleanup();
-#endif
- module_ksocknal_module_fini();
- module_fini_lnet();
- module_exit_libcfs_module();
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- /* initialize the driver callback routines */
-
- DriverObject->MajorFunction[IRP_MJ_CREATE] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_CLOSE] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_READ] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_WRITE] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = UTDispatchRequest;
-
- return STATUS_SUCCESS;
-
-errorout:
-
- cfs_enter_debugger();
-
- return STATUS_UNSUCCESSFUL;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2002, Lawrence Livermore National Labs (LLNL)
- * Author: Brian Behlendorf <behlendorf1@llnl.gov>
- * Amey Inamdar <amey@calsoftinc.com>
- * Kedar Sovani <kedar@calsoftinc.com>
- *
- *
- * This file is part of Portals, http://www.sf.net/projects/lustre/
- *
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * Portals is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Portals; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define DEBUG_SUBSYSTEM S_PINGER
-
-#include <libcfs/kp30.h>
-#include <lnet/lnet.h>
-#include "ping.h"
-
-#define STDSIZE (sizeof(int) + sizeof(int) + sizeof(struct timeval))
-#define MAXSIZE (16*1024)
-
-static unsigned ping_head_magic;
-static unsigned ping_bulk_magic;
-static unsigned long packets_valid = 0; // Valid packets
-static int running = 1;
-atomic_t pkt;
-
-static struct pingsrv_data *server=NULL; // Our ping server
-
-static void *pingsrv_shutdown(int err)
-{
- int rc;
-
- /* Yes, we are intentionally allowing us to fall through each
- * case in to the next. This allows us to pass an error
- * code to just clean up the right stuff.
- */
- switch (err) {
- case 1:
- /* Unlink any memory descriptors we may have used */
- if ((rc = LNetMDUnlink (server->mdin_h)))
- PDEBUG ("LNetMDUnlink (out head buffer)", rc);
- case 2:
- /* Free the event queue */
- if ((rc = LNetEQFree (server->eq)))
- PDEBUG ("LNetEQFree", rc);
-
- /* Unlink the client portal from the ME list */
- if ((rc = LNetMEUnlink (server->me)))
- PDEBUG ("LNetMEUnlink", rc);
-
- case 3:
- LNetNIFini ();
-
- case 4:
-
- case 5:
- if (server->in_buf != NULL)
- LIBCFS_FREE (server->in_buf, MAXSIZE);
-
- if (server != NULL)
- LIBCFS_FREE (server,
- sizeof (struct pingsrv_data));
-
- }
-
- CDEBUG (D_OTHER, "ping sever resources released\n");
- return NULL;
-} /* pingsrv_shutdown() */
-
-
-int pingsrv_thread(void *arg)
-{
- int rc;
- unsigned long magic;
- unsigned long ping_bulk_magic = __cpu_to_le32(0xcafebabe);
-
- cfs_daemonize ("pingsrv");
- server->tsk = cfs_current();
-
- while (running) {
- set_current_state (CFS_TASK_INTERRUPTIBLE);
- if (atomic_read (&pkt) == 0) {
- cfs_schedule_timeout (CFS_TASK_INTERRUPTIBLE,
- MAX_SCHEDULE_TIMEOUT);
- continue;
- }
-
- magic = __le32_to_cpu(*((int *)((char *)server->evnt.md.start
- + server->evnt.offset)));
-
-
- if(magic != 0xdeadbeef) {
- CERROR("Unexpected Packet to the server, magic: %lx %d\n", magic, server->evnt.offset);
-
- }
- memcpy (server->in_buf, &ping_bulk_magic, sizeof(ping_bulk_magic));
-
- server->mdout.length = server->evnt.rlength;
- server->mdout.start = server->in_buf;
- server->mdout.threshold = 1;
- server->mdout.options = LNET_MD_OP_PUT;
- server->mdout.user_ptr = NULL;
- server->mdout.eq_handle = LNET_EQ_NONE;
-
- /* Bind the outgoing buffer */
- if ((rc = LNetMDBind (server->mdout,
- LNET_UNLINK, &server->mdout_h))) {
- PDEBUG ("LNetMDBind", rc);
- pingsrv_shutdown (1);
- return 1;
- }
-
-
- server->mdin.start = server->in_buf;
- server->mdin.length = MAXSIZE;
- server->mdin.threshold = 1;
- server->mdin.options = LNET_MD_OP_PUT;
- server->mdin.user_ptr = NULL;
- server->mdin.eq_handle = server->eq;
-
- if ((rc = LNetMDAttach (server->me, server->mdin,
- LNET_UNLINK, &server->mdin_h))) {
- PDEBUG ("LNetMDAttach (bulk)", rc);
- CDEBUG (D_OTHER, "ping server resources allocated\n");
- }
-
- if ((rc = LNetPut (server->evnt.target.nid, server->mdout_h,
- LNET_NOACK_REQ,
- server->evnt.initiator, PTL_PING_CLIENT,
- 0, 0, 0)))
- PDEBUG ("LNetPut", rc);
-
- atomic_dec (&pkt);
-
- }
- pingsrv_shutdown (1);
- running = 1;
- return 0;
-}
-
-static void pingsrv_packet(lnet_event_t *ev)
-{
- atomic_inc (&pkt);
- wake_up_process (server->tsk);
-} /* pingsrv_head() */
-
-static void pingsrv_callback(lnet_event_t *ev)
-{
-
- if (ev == NULL) {
- CERROR ("null in callback, ev=%p\n", ev);
- return;
- }
- server->evnt = *ev;
-
- CWARN ("received ping from nid %s "
- "(off=%u rlen=%u mlen=%u head=%x seq=%d size=%d)\n",
- libcfs_nid2str(ev->initiator.nid),
- ev->offset, ev->rlength, ev->mlength,
- __le32_to_cpu(*((int *)((char *)ev->md.start + ev->offset))),
- __le32_to_cpu(*((int *)((char *)ev->md.start + ev->offset + sizeof(unsigned)))),
- __le32_to_cpu(*((int *)((char *)ev->md.start + ev->offset + 2 *
- sizeof(unsigned)))));
-
- packets_valid++;
-
- pingsrv_packet(ev);
-
-} /* pingsrv_callback() */
-
-
-static struct pingsrv_data *pingsrv_setup(void)
-{
- int rc;
-
- /* Aquire and initialize the proper nal for portals. */
- rc = LNetNIInit(0);
- if (!(rc == 0 || rc == 1)) {
- CDEBUG (D_OTHER, "LNetNIInit: error %d\n", rc);
- return pingsrv_shutdown (4);
- }
-
-
- /* Based on the initialization aquire our unique portal ID. */
- if ((rc = LNetGetId (1, &server->my_id))) {
- PDEBUG ("LNetGetId", rc);
- return pingsrv_shutdown (2);
- }
-
- server->id_local.nid = LNET_NID_ANY;
- server->id_local.pid = LNET_PID_ANY;
-
- /* Attach a match entries for header packets */
- if ((rc = LNetMEAttach (PTL_PING_SERVER,
- server->id_local,0, ~0,
- LNET_RETAIN, LNET_INS_AFTER, &server->me))) {
- PDEBUG ("LNetMEAttach", rc);
- return pingsrv_shutdown (2);
- }
-
-
- if ((rc = LNetEQAlloc (1024, &pingsrv_callback, &server->eq))) {
- PDEBUG ("LNetEQAlloc (callback)", rc);
- return pingsrv_shutdown (2);
- }
-
- LIBCFS_ALLOC (server->in_buf, MAXSIZE);
- if(!server->in_buf){
- CDEBUG (D_OTHER,"Allocation error\n");
- return pingsrv_shutdown(2);
- }
-
- /* Setup the incoming buffer */
- server->mdin.start = server->in_buf;
- server->mdin.length = MAXSIZE;
- server->mdin.threshold = 1;
- server->mdin.options = LNET_MD_OP_PUT;
- server->mdin.user_ptr = NULL;
- server->mdin.eq_handle = server->eq;
- memset (server->in_buf, 0, STDSIZE);
-
- if ((rc = LNetMDAttach (server->me, server->mdin,
- LNET_UNLINK, &server->mdin_h))) {
- PDEBUG ("LNetMDAttach (bulk)", rc);
- CDEBUG (D_OTHER, "ping server resources allocated\n");
- }
-
- /* Success! */
- return server;
-} /* pingsrv_setup() */
-
-static int pingsrv_start(void)
-{
- long pid;
-
- /* Setup our server */
- if (!pingsrv_setup()) {
- CDEBUG (D_OTHER, "pingsrv_setup() failed, server stopped\n");
- return -ENOMEM;
- }
- pid = cfs_kernel_thread (pingsrv_thread,NULL,0);
- if (pid < 0) {
- CERROR("Can't start pingsrv thread: rc = %ld\n", pid);
- return (int)pid;
- }
-
- return 0;
-} /* pingsrv_start() */
-
-static int __init pingsrv_init(void)
-{
- ping_head_magic = __cpu_to_le32(PING_HEADER_MAGIC);
- ping_bulk_magic = __cpu_to_le32(PING_BULK_MAGIC);
- LIBCFS_ALLOC (server, sizeof(struct pingsrv_data));
- atomic_set(&pkt, 0);
- return pingsrv_start ();
-} /* pingsrv_init() */
-
-static void /*__exit*/ pingsrv_cleanup(void)
-{
- cfs_remove_proc_entry ("net/pingsrv", NULL);
-
- running = 0;
- wake_up_process (server->tsk);
- while (running != 1) {
- set_current_state (CFS_TASK_UNINT);
- cfs_schedule_timeout (CFS_TASK_UNINT, cfs_time_seconds(1));
- }
-
-} /* pingsrv_cleanup() */
-
-
-MODULE_AUTHOR("Brian Behlendorf (LLNL)");
-MODULE_DESCRIPTION("A kernel space ping server for portals testing");
-MODULE_LICENSE("GPL");
-
-cfs_module(ping_srv, "1.0.0", pingsrv_init, pingsrv_cleanup);
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>pingsrv</string>
- <key>CFBundleIconFile</key>
- <string></string>
- <key>CFBundleIdentifier</key>
- <string>com.clusterfs.lustre.pingsrv</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundlePackageType</key>
- <string>KEXT</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0.1</string>
- <key>OSBundleCompatibleVersion</key>
- <string>1.0.0</string>
- <key>OSBundleLibraries</key>
- <dict>
- <key>com.apple.kpi.bsd</key>
- <string>8.0.0b1</string>
- <key>com.apple.kpi.libkern</key>
- <string>8.0.0b1</string>
- <key>com.apple.kpi.mach</key>
- <string>8.0.0b1</string>
- <key>com.apple.kpi.unsupported</key>
- <string>8.0.0b1</string>
- <key>com.clusterfs.lustre.libcfs</key>
- <string>1.0.0</string>
- <key>com.clusterfs.lustre.lnet</key>
- <string>1.0.0</string>
- </dict>
-</dict>
-</plist>
-
+++ /dev/null
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 39;
- objects = {
- 06AA1262FFB20DD611CA28AA = {
- buildRules = (
- );
- buildSettings = {
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- OPTIMIZATION_CFLAGS = "-O0";
- ZERO_LINK = YES;
- };
- isa = PBXBuildStyle;
- name = Development;
- };
- 06AA1263FFB20DD611CA28AA = {
- buildRules = (
- );
- buildSettings = {
- COPY_PHASE_STRIP = YES;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- ZERO_LINK = NO;
- };
- isa = PBXBuildStyle;
- name = Deployment;
- };
-//060
-//061
-//062
-//063
-//064
-//080
-//081
-//082
-//083
-//084
- 089C1669FE841209C02AAC07 = {
- buildSettings = {
- };
- buildStyles = (
- 06AA1262FFB20DD611CA28AA,
- 06AA1263FFB20DD611CA28AA,
- );
- hasScannedForEncodings = 1;
- isa = PBXProject;
- mainGroup = 089C166AFE841209C02AAC07;
- projectDirPath = "";
- targets = (
- 32A4FEB80562C75700D090E7,
- );
- };
- 089C166AFE841209C02AAC07 = {
- children = (
- 247142CAFF3F8F9811CA285C,
- 089C167CFE841241C02AAC07,
- 19C28FB6FE9D52B211CA2CBB,
- );
- isa = PBXGroup;
- name = ping_srv;
- refType = 4;
- sourceTree = "<group>";
- };
- 089C167CFE841241C02AAC07 = {
- children = (
- 32A4FEC30562C75700D090E7,
- );
- isa = PBXGroup;
- name = Resources;
- refType = 4;
- sourceTree = "<group>";
- };
-//080
-//081
-//082
-//083
-//084
-//190
-//191
-//192
-//193
-//194
- 1987212D0739090900338926 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.c;
- name = ping_srv.c;
- path = ../ping_srv.c;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 1987212E0739090900338926 = {
- fileRef = 1987212D0739090900338926;
- isa = PBXBuildFile;
- settings = {
- };
- };
- 19C28FB6FE9D52B211CA2CBB = {
- children = (
- 32A4FEC40562C75800D090E7,
- );
- isa = PBXGroup;
- name = Products;
- refType = 4;
- sourceTree = "<group>";
- };
-//190
-//191
-//192
-//193
-//194
-//240
-//241
-//242
-//243
-//244
- 247142CAFF3F8F9811CA285C = {
- children = (
- 1987212D0739090900338926,
- );
- isa = PBXGroup;
- name = Source;
- path = "";
- refType = 4;
- sourceTree = "<group>";
- };
-//240
-//241
-//242
-//243
-//244
-//320
-//321
-//322
-//323
-//324
- 32A4FEB80562C75700D090E7 = {
- buildPhases = (
- 32A4FEB90562C75700D090E7,
- 32A4FEBA0562C75700D090E7,
- 32A4FEBB0562C75700D090E7,
- 32A4FEBD0562C75700D090E7,
- 32A4FEBF0562C75700D090E7,
- 32A4FEC00562C75700D090E7,
- 32A4FEC10562C75700D090E7,
- );
- buildRules = (
- );
- buildSettings = {
- FRAMEWORK_SEARCH_PATHS = "";
- GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
- GCC_WARN_UNKNOWN_PRAGMAS = NO;
- HEADER_SEARCH_PATHS = "../../include ../";
- INFOPLIST_FILE = Info.plist;
- INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
- LIBRARY_SEARCH_PATHS = "";
- MODULE_NAME = com.clusterfs.lustre.portals.tests.ping_srv;
- MODULE_START = ping_srv_start;
- MODULE_STOP = ping_srv_stop;
- MODULE_VERSION = 1.0.0d1;
- OTHER_CFLAGS = "-D__KERNEL__ -D__DARWIN__";
- OTHER_LDFLAGS = "";
- OTHER_REZFLAGS = "";
- PRODUCT_NAME = ping_srv;
- SECTORDER_FLAGS = "";
- WARNING_CFLAGS = "-Wmost";
- WRAPPER_EXTENSION = kext;
- };
- dependencies = (
- );
- isa = PBXNativeTarget;
- name = ping_srv;
- productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions";
- productName = ping_srv;
- productReference = 32A4FEC40562C75800D090E7;
- productType = "com.apple.product-type.kernel-extension";
- };
- 32A4FEB90562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXShellScriptBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "script=\"${SYSTEM_DEVELOPER_DIR}/ProjectBuilder Extras/Kernel Extension Support/KEXTPreprocess\";\nif [ -x \"$script\" ]; then\n . \"$script\"\nfi";
- };
- 32A4FEBA0562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXHeadersBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEBB0562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXResourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEBD0562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- 1987212E0739090900338926,
- );
- isa = PBXSourcesBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEBF0562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXFrameworksBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEC00562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXRezBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- };
- 32A4FEC10562C75700D090E7 = {
- buildActionMask = 2147483647;
- files = (
- );
- isa = PBXShellScriptBuildPhase;
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "script=\"${SYSTEM_DEVELOPER_DIR}/ProjectBuilder Extras/Kernel Extension Support/KEXTPostprocess\";\nif [ -x \"$script\" ]; then\n . \"$script\"\nfi";
- };
- 32A4FEC30562C75700D090E7 = {
- isa = PBXFileReference;
- lastKnownFileType = text.plist.xml;
- path = Info.plist;
- refType = 4;
- sourceTree = "<group>";
- };
- 32A4FEC40562C75800D090E7 = {
- explicitFileType = wrapper.cfbundle;
- includeInIndex = 0;
- isa = PBXFileReference;
- path = ping_srv.kext;
- refType = 3;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- };
- rootObject = 089C1669FE841209C02AAC07;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=4:tabstop=4:
- *
- * Copyright (C) 2002 Cluster File Systems, Inc.
- * Author: Matt Wu <mattwu@clusterfs.com>
- *
- * This file is part of Lustre, http://www.lustre.org.
- *
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * Lustre is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define DEBUG_SUBSYSTEM S_LNET
-
-/*
- * Included Headers
- */
-
-
-#include <libcfs/libcfs.h>
-
-
-/* libcfs module init/exit routines */
-DECLARE_INIT(init_libcfs_module);
-DECLARE_EXIT(exit_libcfs_module);
-
-/* portal module init/exit routines */
-DECLARE_INIT(init_lnet);
-DECLARE_EXIT(fini_lnet);
-
-/* tdinal module init/exit routines */
-DECLARE_INIT(ksocknal_module_init);
-DECLARE_EXIT(ksocknal_module_fini);
-
-/* pingcli module init/exit routines */
-DECLARE_INIT(pingcli_init);
-DECLARE_EXIT(pingcli_cleanup);
-
-
-/* pingsrv module init/exit routines */
-DECLARE_INIT(pingsrv_init);
-DECLARE_EXIT(pingsrv_cleanup);
-
-/*
- * structure definitions
- */
-
-
-#define LUSTRE_PING_VERSION 0x00010000 /* ping srv/cli version: 0001.0000 */
-
-#define LUSTRE_PING_DEVICE L"\\Device\\LNET" /* device object name */
-#define LUSTRE_PING_SYMLNK L"\\DosDevices\\LNET" /* user-visible name for the device*/
-
-typedef struct _DEVICE_EXTENSION
-{
- BOOLEAN bProcFS;
-
-} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
-
-
-/*
- * global definitions
- */
-
-PDEVICE_OBJECT PingObject = NULL; /* ping device object */
-PDEVICE_OBJECT ProcObject = NULL; /* procfs emulator device */
-
-
-/*
- * common routines
- */
-
-
-//
-// complete Irp request ...
-//
-
-NTSTATUS
-UTCompleteIrp(
- PIRP Irp,
- NTSTATUS Status,
- ULONG Info
- )
-{
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = Info;
- IoCompleteRequest(Irp,IO_NO_INCREMENT);
-
- return Status;
-}
-
-//
-// Open/Create Device ...
-//
-
-NTSTATUS
-UTCreate(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- KdPrint(("UTCreate: DeviceCreate ...\n"));
-
- return UTCompleteIrp(Irp,STATUS_SUCCESS,0);
-}
-
-//
-// Close Devcie ...
-//
-
-NTSTATUS
-UTClose(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
-{
- KdPrint(("UTClose: Device Closed.\n"));
-
- return UTCompleteIrp(Irp, STATUS_SUCCESS, 0);
-
- UNREFERENCED_PARAMETER(DeviceObject);
-}
-
-
-
-NTSTATUS
-UTShutdown(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- KdPrint(("UTShutdown: shuting TdiSock ...\n"));
-
- return UTCompleteIrp(Irp, STATUS_SUCCESS, 0);
-
- UNREFERENCED_PARAMETER(DeviceObject);
-}
-
-//
-// driver frame Routines ...
-//
-
-
-NTSTATUS
-UTDeviceControl(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- NTSTATUS Status = STATUS_INVALID_DEVICE_REQUEST;
- PIO_STACK_LOCATION IrpSp;
-
- ULONG ControlCode;
- ULONG InputLength;
- ULONG OutputLength;
-
- PVOID lpvInBuffer;
-
- KdPrint(("UTDeviceControl: Device Ioctl ...\n"));
-
- Irp->IoStatus.Information = 0;
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
-
- ControlCode = IrpSp->Parameters.DeviceIoControl.IoControlCode;
- InputLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
- OutputLength = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
- lpvInBuffer = Irp->AssociatedIrp.SystemBuffer;
-
- ASSERT (IrpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL);
-
- switch (ControlCode)
- {
- case IOCTL_LIBCFS_VERSION:
-
- *((ULONG *)lpvInBuffer) = (ULONG)(LUSTRE_PING_VERSION);
- Irp->IoStatus.Information = sizeof(ULONG);
- Status = STATUS_SUCCESS;
- break;
-
- default:
- break;
- }
-
- Irp->IoStatus.Status = Status;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- KdPrint(("UTDeviceControl: Device Ioctl returned.\n"));
-
- return Status;
-}
-
-NTSTATUS
-ProcCreate(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- NTSTATUS Status;
- PIO_STACK_LOCATION IrpSp;
-
- FILE_FULL_EA_INFORMATION * ea;
- cfs_file_t * fp;
-
- KdPrint(("ProcCreate: Proc device is being opened ...\n"));
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
- ea = (PFILE_FULL_EA_INFORMATION) Irp->AssociatedIrp.SystemBuffer;
-
- if (!ea) {
- Status = STATUS_INVALID_PARAMETER;
- } else {
- fp = lustre_open_file(&ea->EaName[0]);
- if (!fp) {
- Status = STATUS_OBJECT_NAME_NOT_FOUND;
- } else {
- IrpSp->FileObject->FsContext = fp;
- IrpSp->FileObject->FsContext2 = fp->private_data;
- Status = STATUS_SUCCESS;
- }
- }
-
- return UTCompleteIrp(Irp, Status, 0);
-}
-
-//
-// Close Devcie ...
-//
-
-NTSTATUS
-ProcClose(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
-{
- PIO_STACK_LOCATION IrpSp;
-
- cfs_file_t * fp;
-
- KdPrint(("ProcClose: Proc device object is to be closed.\n"));
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
-
- fp = (cfs_file_t *) IrpSp->FileObject->FsContext;
-
- ASSERT(fp != NULL);
- ASSERT(IrpSp->FileObject->FsContext2 == fp->private_data);
-
- lustre_close_file(fp);
-
- return UTCompleteIrp(Irp, STATUS_SUCCESS, 0);
-
- UNREFERENCED_PARAMETER(DeviceObject);
-}
-
-/*
- * proc frame routines
- */
-
-NTSTATUS
-ProcDeviceControl(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- NTSTATUS Status = STATUS_INVALID_DEVICE_REQUEST;
- PIO_STACK_LOCATION IrpSp;
-
- ULONG ControlCode;
- ULONG InputLength;
- ULONG OutputLength;
-
- PVOID lpvInBuffer;
-
- KdPrint(("ProcDeviceControl: Proc device ioctling ...\n"));
-
- Irp->IoStatus.Information = 0;
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
-
- ControlCode = IrpSp->Parameters.DeviceIoControl.IoControlCode;
- InputLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
- OutputLength = IrpSp->Parameters.DeviceIoControl.OutputBufferLength;
- lpvInBuffer = Irp->AssociatedIrp.SystemBuffer;
-
- ASSERT (IrpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL);
-
- switch (ControlCode)
- {
- case IOCTL_LIBCFS_VERSION:
-
- *((ULONG *)lpvInBuffer) = (ULONG)(LUSTRE_PING_VERSION);
- Irp->IoStatus.Information = sizeof(ULONG);
-
- Status = STATUS_SUCCESS;
-
- break;
-
- case IOCTL_LIBCFS_ENTRY:
- {
- int rc = 0;
- cfs_file_t * fp;
-
- fp = (cfs_file_t *) IrpSp->FileObject->FsContext;
-
- if (!fp) {
- rc = -EINVAL;
- } else {
- rc = lustre_ioctl_file(fp, (PCFS_PROC_IOCTL) (lpvInBuffer));
- }
-
- if (rc == 0) {
- Irp->IoStatus.Information = InputLength;
- Status = STATUS_SUCCESS;
- }
- }
- }
-
- Irp->IoStatus.Status = Status;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- KdPrint(("ProcDeviceControl: Proc device ioctl returned with status = %xh.\n", Status));
-
- return Status;
-}
-
-
-
-NTSTATUS
-ProcReadWrite (PDEVICE_OBJECT DeviceObject, PIRP Irp)
-{
- PIO_STACK_LOCATION IrpSp;
- NTSTATUS Status;
-
- cfs_file_t * fp;
- int rc;
- PCHAR buf;
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
- if (Irp->MdlAddress) {
- buf = MmGetSystemAddressForMdlSafe(
- Irp->MdlAddress,
- NormalPagePriority);
- } else {
- buf = Irp->AssociatedIrp.SystemBuffer;
- }
-
- if (buf == NULL) {
- Status = STATUS_SUCCESS;
- rc = 0;
- } else {
- fp = (cfs_file_t *) IrpSp->FileObject->FsContext;
-
- if (!fp) {
- Status = STATUS_INVALID_PARAMETER;
- goto errorout;
- }
-
- if (IrpSp->MajorFunction == IRP_MJ_READ) {
- rc = lustre_read_file(
- fp, IrpSp->Parameters.Read.ByteOffset.LowPart,
- IrpSp->Parameters.Read.Length, buf);
- } else {
- rc = lustre_write_file(
- fp, IrpSp->Parameters.Write.ByteOffset.LowPart,
- IrpSp->Parameters.Write.Length, buf);
- }
- if (rc < 0) {
- cfs_enter_debugger();
- Status = STATUS_UNSUCCESSFUL;
- } else {
- Status = STATUS_SUCCESS;
- }
- }
-
-
-errorout:
- return UTCompleteIrp(Irp, Status, rc);
-}
-
-
-//
-// common dispatch routines
-//
-
-NTSTATUS
-UTDispatchRequest(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
-{
- NTSTATUS Status;
- PIO_STACK_LOCATION IrpSp;
-
- Status = STATUS_INVALID_DEVICE_REQUEST;
-
- __try {
-
- IrpSp = IoGetCurrentIrpStackLocation(Irp);
-
- switch (IrpSp->MajorFunction) {
-
- case IRP_MJ_CREATE:
- if (DeviceObject == PingObject) {
- Status = UTCreate(DeviceObject, Irp);
- } else if (DeviceObject == ProcObject) {
- Status = ProcCreate(DeviceObject, Irp);
- }
- break;
-
- case IRP_MJ_CLOSE:
- if (DeviceObject == PingObject) {
- Status = UTClose(DeviceObject, Irp);
- } else if (DeviceObject == ProcObject) {
- Status = ProcClose(DeviceObject, Irp);
- }
- break;
-
- case IRP_MJ_READ:
- case IRP_MJ_WRITE:
- if (DeviceObject == ProcObject) {
- Status = ProcReadWrite(DeviceObject, Irp);
- }
- break;
-
- case IRP_MJ_DEVICE_CONTROL:
- if (DeviceObject == PingObject) {
- Status = UTDeviceControl(DeviceObject, Irp);
- } else if (DeviceObject == ProcObject) {
- Status = ProcDeviceControl(DeviceObject, Irp);
- }
- break;
-
- case IRP_MJ_SHUTDOWN:
- Status = UTShutdown(DeviceObject, Irp);
- break;
-
- default:
-
- KdPrint(("UTDispatchRequest: Major Function: %xh is not supported.\n",
- IrpSp->MajorFunction));
- UTCompleteIrp(Irp, Status, 0);
- break;
- }
- }
-
- __finally {
- }
-
- return Status;
-}
-
-//
-// create a device object and a dosdevice symbol link
-//
-
-PDEVICE_OBJECT
-CreateDevice(
- IN PDRIVER_OBJECT DriverObject,
- IN PWCHAR DeviceName,
- IN PWCHAR SymlnkName,
- IN BOOLEAN bProcFS
- )
-{
- NTSTATUS Status;
-
- UNICODE_STRING NtDevName;
- UNICODE_STRING Win32DevName;
-
- PDEVICE_EXTENSION DeviceExtension;
- PDEVICE_OBJECT DeviceObject;
-
- /* create the device object with the specified name */
-
- RtlInitUnicodeString(&NtDevName, DeviceName);
-
- Status = IoCreateDevice(
- DriverObject,
- sizeof(DEVICE_EXTENSION),
- &NtDevName,
- FILE_DEVICE_UNKNOWN,
- 0,
- FALSE,
- &DeviceObject );
-
- if (!NT_SUCCESS(Status)) {
-
- cfs_enter_debugger();
- return NULL;
- }
-
- /* create the symlink to make the device visible to user */
-
- RtlInitUnicodeString(&Win32DevName, SymlnkName);
-
- Status = IoCreateSymbolicLink(&Win32DevName, &NtDevName);
-
- if (!NT_SUCCESS(Status)) {
-
- IoDeleteDevice(DeviceObject);
- return NULL;
- }
-
- DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceObjectExtension;
- DeviceExtension->bProcFS = bProcFS;
-
- DeviceObject->Flags |= DO_BUFFERED_IO;
- DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
-
- return DeviceObject;
-}
-
-
-//
-// DriverEntry
-//
-
-NTSTATUS DriverEntry(
- IN PDRIVER_OBJECT DriverObject,
- IN PUNICODE_STRING RegistryPath
- )
-{
- KdPrint(("Lustre ping test: Build Time: " __DATE__ " " __TIME__ "\n"));
- KdPrint(("Lustre ping test: DriverEntry ... \n"));
-
- /* initialize libcfs module */
- if (module_init_libcfs_module() != 0) {
- KdPrint(("ping: error initialize module: libcfs ...\n"));
- goto errorout;
- }
-
- /* initialize lnet module */
- if (module_init_lnet() != 0) {
- module_exit_libcfs_module();
- KdPrint(("ping: error initialize module: lnet ...\n"));
- goto errorout;
- }
-
- /* initialize tdinal module */
- if (module_ksocknal_module_init() != 0) {
- module_fini_lnet();
- module_exit_libcfs_module();
- KdPrint(("ping: error initialize module: tdilnd ...\n"));
- goto errorout;
- }
-
-#if defined(LUSTRE_PING_CLI)
- /* initialize pingcli module */
- if (module_pingcli_init() != 0) {
- module_ksocknal_module_fini();
- module_fini_lnet();
- module_exit_libcfs_module();
- KdPrint(("ping: error initialize module: pingcli ...\n"));
- goto errorout;
- }
-#endif
-
-#if defined(LUSTRE_PING_SRV)
- /* initialize pingsrv module */
- if (module_pingsrv_init() != 0) {
- module_ksocknal_module_fini();
- module_fini_lnet();
- module_exit_libcfs_module();
- KdPrint(("ping: error initialize module: pingsrv ...\n"));
- goto errorout;
- }
-#endif
-
- /* create the ping device object */
- PingObject = CreateDevice(
- DriverObject,
- LUSTRE_PING_DEVICE,
- LUSTRE_PING_SYMLNK,
- FALSE );
- if (!PingObject) {
-#if defined(LUSTRE_PING_CLI)
- module_pingcli_cleanup();
-#endif
-#if defined(LUSTRE_PING_SRV)
- module_pingsrv_cleanup();
-#endif
- module_ksocknal_module_fini();
- module_fini_lnet();
- module_exit_libcfs_module();
-
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- /* create the libcfs proc fs emultor device object */
- ProcObject = CreateDevice(
- DriverObject,
- LUSTRE_PROC_DEVICE,
- LUSTRE_PROC_SYMLNK,
- TRUE );
- if (!ProcObject) {
-
- IoDeleteDevice(PingObject);
-#if defined(LUSTRE_PING_CLI)
- module_pingcli_cleanup();
-#endif
-#if defined(LUSTRE_PING_SRV)
- module_pingsrv_cleanup();
-#endif
- module_ksocknal_module_fini();
- module_fini_lnet();
- module_exit_libcfs_module();
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- /* initialize the driver callback routines */
-
- DriverObject->MajorFunction[IRP_MJ_CREATE] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_CLOSE] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_READ] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_WRITE] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = UTDispatchRequest;
- DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = UTDispatchRequest;
-
- return STATUS_SUCCESS;
-
-errorout:
-
- cfs_enter_debugger();
-
- return STATUS_UNSUCCESSFUL;
-}
+++ /dev/null
-#!/bin/sh
-
-case `uname -r` in
- 2.6.*) ext=.ko;;
- 2.4.*) ext=.o;;
- *) echo unknown OS version; return 1;;
-esac
-
-insmod pingcli$ext
-
+++ /dev/null
-#!/bin/sh
-
-case `uname -r` in
- 2.6.*) ext=.ko;;
- 2.4.*) ext=.o;;
- *) echo unknown OS version; return 1;;
-esac
-
-insmod pingsrv$ext
+++ /dev/null
-#!/bin/sh
-
-rmmod pingcli
+++ /dev/null
-#!/bin/sh
-
-rmmod pingsrv
+++ /dev/null
-The utcli (unit test client) and utsrv (unit test server) are very simple
-unit test tools, for sending and receiving single get's/put's of a specific
-size, using the LNET API set.
-
-Test Setup
-uml1 ip=192.168.2.1
-uml2 ip=192.168.2.2
-
---------------------------------------------------------------------------------
-Example Test #1 - small get operation
-
-1) Setup server for listening
-uml2 $ insmod utsvr.ko
-
-2) Do the get operation NID must be specified but all other are default
-paramters which causes a 300 byte get op
-uml1 $ insmod utcli.ko nid=192.168.2.2@tcp
-
-3) Unload the utsvr because currently it only supports a single operation
-buffers are not reposted after they are consumed
-*** FIX THIS LIMITATION ***
-uml2 $ rmmod utsvr
-
---------------------------------------------------------------------------------
-Example Test #2 - small put operation
-(The setup and cleanup of the server are left out, because they are the
-same as above)
-
-1) The adition of the "put=1" paramter causes a put rather than a get. The
-default size of 300 is still used.
-uml1 $ insmod utcli.ko nid=192.168.2.2@tcp put=1
-
---------------------------------------------------------------------------------
-Example Test #3 - large get operation
-
-1) Setup server for listening. The size must be specified on the server or else
-the default of 300 bytes will be used.
-uml2 $ insmod utsvr.ko pkt_size=5000
-
-2) Do the large get operation pkt_size=5000. put=0 is a get operation,
-it is equivlenet to just not having that parameter.
-uml1 $ insmod utcli.ko nid=192.168.2.2@tcp put=0 pkt_size=5000
-
+++ /dev/null
-#define DEBUG_SUBSYSTEM S_PINGER
-
-#include <libcfs/kp30.h>
-#include <lnet/lnet.h>
-
-#define UT_PORTAL 42
-
-#define PJK_UT_MSG(fmt...) do{printk("<1>" UT_MSG_MODULE_NAME ":%-30s:",__FUNCTION__);printk(fmt);}while(0)
-
-#define DO_TYPE(x) case x: return #x;
-
-const char *get_ev_type_string(int evtype)
-{
- switch(evtype)
- {
- DO_TYPE(LNET_EVENT_GET);
- DO_TYPE(LNET_EVENT_PUT);
- DO_TYPE(LNET_EVENT_REPLY);
- DO_TYPE(LNET_EVENT_ACK);
- DO_TYPE(LNET_EVENT_SEND);
- DO_TYPE(LNET_EVENT_UNLINK);
- default:
- return "";
- }
-}
-
-static volatile int seen = 0;
-static volatile int seen_unlink = 0;
-
-static inline void handler(lnet_event_t *ev)
-{
- PJK_UT_MSG("-------- EVENT START ------------\n");
- PJK_UT_MSG("type=%d %s\n",ev->type,get_ev_type_string(ev->type));
- PJK_UT_MSG("portal=%d\n",ev->pt_index);
- PJK_UT_MSG("matchbits="LPX64"\n",ev->match_bits);
- PJK_UT_MSG("request length=%d\n",ev->rlength);
- PJK_UT_MSG("manipulated length=%d\n",ev->mlength);
- PJK_UT_MSG("offset=%d\n",ev->offset);
- PJK_UT_MSG("status=%d\n",ev->status);
- PJK_UT_MSG("unlinked=%d\n",ev->unlinked);
- PJK_UT_MSG("md.user_ptr=%p\n",ev->md.user_ptr);
- PJK_UT_MSG("-------- EVENT END --------------\n");
- ++seen;
- if(ev->unlinked)++seen_unlink;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- */
-
- #define UT_MSG_MODULE_NAME "utcli "
- #include "ut.h"
-
-int pkt_size = 300;
-module_param(pkt_size,int,S_IRUGO);
-int get=0;
-module_param(get,int,S_IRUGO);
-int put=0;
-module_param(put,int,S_IRUGO);
-int auto_unlink=1;
-module_param(auto_unlink,int,S_IRUGO);
-char* nid=0;
-module_param(nid,charp,S_IRUGO);
-
-static int __init utcli_init(void)
-{
- lnet_handle_md_t mdh;
- lnet_process_id_t target;
- lnet_process_id_t mypid;
- lnet_handle_eq_t eqh;
- lnet_md_t md;
- int rc,i;
- char* buffer = 0;
- /*
- * Put and get really control the same thing
- */
- if(put)get=0;
- /* Default to get */
- if(!put && !get)get=1;
-
- PJK_UT_MSG("utcli_init %s\n",get==0?"PUT":"GET");
- PJK_UT_MSG("pkt_size=%d\n",pkt_size);
- PJK_UT_MSG("auto_unlink=%d\n",auto_unlink);
- PJK_UT_MSG("nid=%s\n",nid);
- if(nid == 0)
- {
- CERROR("NID Must be specified\n");
- return -EINVAL;
- }
-
- PJK_UT_MSG("LIBCFS_ALLOC\n");
- LIBCFS_ALLOC (buffer, pkt_size);
- if (buffer == NULL)
- {
- CERROR ("Unable to allocate out_buf (%d bytes)\n", pkt_size);
- return -ENOMEM;
- }
-
- PJK_UT_MSG("LNetNiInit()\n");
- rc = LNetNIInit(0);
- if (rc < 0)
- {
- CERROR ("LNetNIInit: error %d\n", rc);
- goto exit0;
- }
-
-
- LNetGetId(0,&mypid);
- PJK_UT_MSG("my.nid="LPX64"\n",mypid.nid);
- PJK_UT_MSG("my.pid=0x%x\n",mypid.pid);
-
-
- PJK_UT_MSG("LNetEQAlloc\n");
- rc = LNetEQAlloc(
- 64, /* max number of envents why 64? */
- handler, /* handler callback */
- &eqh); /* output handle */
- if(rc != 0) {
- CERROR("LNetEQAlloc failed %d\n",rc);
- goto exit1;
- }
-
- md.start = buffer;
- md.length = pkt_size;
- md.threshold = auto_unlink ? (get ? 2 : 1) : 15;
- md.max_size = 0;
- md.options = 0;
- if(get){
- md.options |= LNET_MD_OP_GET;
- }else{
- md.options |= LNET_MD_OP_PUT;
- md.options |= LNET_MD_ACK_DISABLE;
- }
- md.user_ptr = 0;
- md.eq_handle = eqh;
-
- PJK_UT_MSG("LNetMDBind()\n");
- if ((rc=LNetMDBind (
- md,
- LNET_UNLINK,
- &mdh))) /* out handle */
- {
- CERROR ("LNetMDBind error %d\n", rc);
- goto exit4;
- }
-
- target.pid = 0;
- target.nid = libcfs_str2nid(nid);
-
- PJK_UT_MSG("target.nid="LPX64"\n",target.nid);
-
- for(i=0;i<1;i++)
- {
- if(get){
- PJK_UT_MSG("LNetGet()\n");
- if((rc = LNetGet (
- LNET_ID_ANY,
- mdh,
- target, /* peer "address" */
- UT_PORTAL, /* portal */
- i, /* match bits */
- 0))) /* header data */
- {
- CERROR("LNetGet %d error %d\n",i, rc);
- goto exit5;
- }
- }else{
-
- PJK_UT_MSG("LNetPut()\n");
- if((rc = LNetPut (
- LNET_ID_ANY,
- mdh,
- LNET_ACK_REQ, /* we want ack */
- target, /* peer "address" */
- UT_PORTAL, /* portal */
- i, /* match bits */
- 0, /* offset */
- 0))) /* header data */
- {
- CERROR("LNetPut %d error %d\n",i, rc);
- goto exit5;
- }
- }
- }
-
-
- PJK_UT_MSG("------------Waiting for SEND_END()------------\n");
- i=0;
- while(i++ < 10 && seen == 0)
- cfs_pause(cfs_time_seconds(1));
- if(seen == 0)
- PJK_UT_MSG("------------------TIMEDOUT--------------------\n");
- else{
- int good;
- if(get){
- PJK_UT_MSG("------------Waiting for REPLY()------------\n");
- i=0;
- while(i++ < 10 && seen == 1)
- cfs_pause(cfs_time_seconds(1));
- good = (seen != 1);
- }else{
- good = 1;
- }
-
- if(good)
- PJK_UT_MSG("------------------COMPLETE--------------------\n");
- else
- PJK_UT_MSG("------------------TIMEDOUT--------------------\n");
- }
-
-
-
- /*
- PJK_UT_MSG("LNetEQWait()\n");
- rc = LNetEQWait(eqh,&ev);
- if(rc != 0)
- goto exit5;
- */
-
-exit5:
- PJK_UT_MSG("LNetMDUnlink()\n");
- LNetMDUnlink(mdh);
-
- if(!seen_unlink){
- PJK_UT_MSG("------------Waiting for UNLINK ------------\n");
- i=0;
- while(i++ < 120 && seen_unlink == 0)
- cfs_pause(cfs_time_seconds(1));
- }
-
- cfs_pause(cfs_time_seconds(1));
-exit4:
- PJK_UT_MSG("LNetEQFree()\n");
- LNetEQFree(eqh);
-exit1:
- PJK_UT_MSG("LNetNiFini()\n");
- LNetNIFini();
-exit0:
- if(buffer)
- LIBCFS_FREE(buffer,pkt_size);
-
- return -1;
-} /* utcli_init() */
-
-
-static void /*__exit*/ utcli_cleanup(void)
-{
- PJK_UT_MSG(">>>\n");
- PJK_UT_MSG("<<<\n");
-} /* utcli_cleanup() */
-
-
-MODULE_AUTHOR("PJ Kirner (CFS)");
-MODULE_DESCRIPTION("A simple LNET Unit Test module");
-MODULE_LICENSE("GPL");
-
-cfs_module(ut_cli, "1.0.0", utcli_init, utcli_cleanup);
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- */
-
-
-#define UT_MSG_MODULE_NAME "utsrv "
-#include "ut.h"
-
-
-int pkt_size = 300;
-module_param(pkt_size,int,S_IRUGO);
-int auto_unlink=1;
-module_param(auto_unlink,int,S_IRUGO);
-
-char *buffer = 0;
-lnet_handle_eq_t eqh;
-lnet_handle_me_t meh;
-lnet_handle_md_t mdh;
-
-static int __init utsrv_init(void)
-{
- int rc;
- lnet_process_id_t anypid;
- lnet_process_id_t mypid;
- lnet_md_t md;
-
- PJK_UT_MSG(">>>\n");
- PJK_UT_MSG("pkt_size=%d\n",pkt_size);
- PJK_UT_MSG("auto_unlink=%d\n",auto_unlink);
-
- PJK_UT_MSG("LIBCFS_ALLOC\n");
- LIBCFS_ALLOC (buffer, pkt_size);
- if (buffer == NULL)
- {
- CERROR ("Unable to allocate out_buf (%d bytes)\n", pkt_size);
- rc = -ENOMEM;
- goto exit0;
- }
-
- PJK_UT_MSG("LNetNiInit()\n");
- rc = LNetNIInit(0);
- if (rc < 0)
- {
- CERROR ("LNetNIInit: error %d\n", rc);
- goto exit1;
- }
-
- LNetGetId(0,&mypid);
- PJK_UT_MSG("my.nid="LPX64"\n",mypid.nid);
- PJK_UT_MSG("my.pid=0x%x\n",mypid.pid);
-
- PJK_UT_MSG("LNetEQAlloc\n");
- rc = LNetEQAlloc(
- 64, /* max number of envents why 64? */
- handler, /* handler callback */
- &eqh); /* output handle */
- if(rc != 0) {
- CERROR("LNetEQAlloc failed %d\n",rc);
- goto exit2;
- }
-
- anypid.nid = LNET_NID_ANY;
- anypid.pid = LNET_PID_ANY;
-
-
- PJK_UT_MSG("LNetMEAttach\n");
- rc = LNetMEAttach(
- UT_PORTAL, /* ptl index*/
- anypid, /* pid - in this case allow any*/
- 0, /*matchbits*/
- 0x0FFFF, /*ignorebits - ignore botton 16-bits*/
- LNET_UNLINK, /* unlik vs LNET_RETAIN*/
- LNET_INS_BEFORE,
- &meh);
- if(rc != 0) {
- CERROR("LNetMeAttach failed %d\n",rc);
- goto exit3;
- }
-
- md.start = buffer;
- md.length = pkt_size;
- md.threshold = auto_unlink ? 1 : 100;
- md.max_size = 0;
- md.options = 0;
- md.options |= LNET_MD_OP_GET;
- md.options |= LNET_MD_OP_PUT;
- md.options |= LNET_MD_ACK_DISABLE;
- md.user_ptr= 0;
- md.eq_handle = eqh;
-
- PJK_UT_MSG("LNetMDAttach\n");
- rc = LNetMDAttach(
- meh,
- md,
- LNET_UNLINK,
- &mdh);
- if(rc != 0){
- CERROR("LNetMDAttach failed %d\n",rc);
- goto exit4;
- }
-
- rc = 0;
- goto exit0;
-
-exit4:
- PJK_UT_MSG("LNetMEUnlink()\n");
- LNetMEUnlink(meh);
-exit3:
- PJK_UT_MSG("LNetEQFree()\n");
- LNetEQFree(eqh);
-exit2:
- PJK_UT_MSG("LNetNiFini()\n");
- LNetNIFini();
-exit1:
- LIBCFS_FREE(buffer,pkt_size);
-exit0:
- PJK_UT_MSG("<<< rc=%d\n",rc);
- return rc;
-
-} /* utsrv_init() */
-
-
-static void /*__exit*/ utsrv_cleanup(void)
-{
- PJK_UT_MSG(">>>\n");
- PJK_UT_MSG("LNetMDUnlink()\n");
- LNetMDUnlink(mdh);
- PJK_UT_MSG("LNetMEUnlink()\n");
- LNetMEUnlink(meh);
- PJK_UT_MSG("LNetEQFree()\n");
- LNetEQFree(eqh);
- PJK_UT_MSG("LNetNiFini()\n");
- LNetNIFini();
- LIBCFS_FREE(buffer,pkt_size);
- PJK_UT_MSG("<<<\n");
-} /* utsrv_cleanup() */
-
-
-MODULE_AUTHOR("PJ Kirner (CFS)");
-MODULE_DESCRIPTION("A simple LNET Unit Test module");
-MODULE_LICENSE("GPL");
-
-cfs_module(utsvr, "1.0.0", utsrv_init, utsrv_cleanup);
-