From: zab Date: Tue, 25 Feb 2003 01:09:36 +0000 (+0000) Subject: - bring b_devel changes into b_io in preparation for file size fixes X-Git-Tag: v1_7_100~1^100~62 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7004af3c90420a5ff03ae468bd3d1437f976f1e2;p=fs%2Flustre-release.git - bring b_devel changes into b_io in preparation for file size fixes --- diff --git a/lustre/liblustre/.cvsignore b/lustre/liblustre/.cvsignore new file mode 100644 index 0000000..fb1a186 --- /dev/null +++ b/lustre/liblustre/.cvsignore @@ -0,0 +1,9 @@ +.Xrefs +config.log +config.status +configure +Makefile +Makefile.in +.deps +TAGS +libtest diff --git a/lustre/liblustre/Makefile.am b/lustre/liblustre/Makefile.am new file mode 100644 index 0000000..2f2ec6b --- /dev/null +++ b/lustre/liblustre/Makefile.am @@ -0,0 +1,18 @@ +# Administration utilities Makefile +DEFS= + +CFLAGS:=-g -O2 -I$(top_srcdir)/utils -I$(PORTALS)/include -I$(srcdir)/../include -Wall -L$(PORTALSLIB) + +KFLAGS:= +CPPFLAGS = $(HAVE_LIBREADLINE) +LIBS= + +libtest_LDADD := $(LIBREADLINE) ../obdecho/libobdecho.a ../osc/libosc.a ../ldlm/libldlm.a \ + ../ptlrpc/libptlrpc.a ../obdclass/liblustreclass.a \ + $(PORTALS)/user/procbridge/libprocbridge.a $(PORTALS)/user/tcpnal/libtcpnal.a \ + $(PORTALS)/user/util/libtcpnalutil.a $(PORTALS)/user/$(PORTALS)/api/libptlapi.a \ + $(PORTALS)/lib/libptllib.a -lptlctl -lpthread -lefence +bin_PROGRAMS = libtest +libtest_SOURCES = libtest.c + +include $(top_srcdir)/Rules diff --git a/lustre/liblustre/libtest.c b/lustre/liblustre/libtest.c new file mode 100644 index 0000000..0f66a24 --- /dev/null +++ b/lustre/liblustre/libtest.c @@ -0,0 +1,102 @@ +#include + +#include /* needed for ptpctl.h */ +#include /* needed for parse_dump */ + +#include +#include <../user/procbridge/procbridge.h> + +ptl_handle_ni_t tcpnal_ni; + +struct pingcli_args { + ptl_nid_t mynid; + ptl_nid_t nid; + ptl_pid_t port; + int count; + int size; +}; + +struct task_struct *current; + +/* portals interfaces */ +inline const ptl_handle_ni_t * +kportal_get_ni (int nal) +{ + return &tcpnal_ni; +} + +inline void +kportal_put_ni (int nal) +{ + return; +} + +void init_current(int argc, char **argv) +{ + current = malloc(sizeof(*current)); + strncpy(current->comm, argv[0], sizeof(current->comm)); + current->pid = getpid(); + +} + +int init_lib_portals(struct pingcli_args *args) +{ + int rc; + + PtlInit(); + + rc = PtlNIInit(procbridge_interface, 0, 0, args->mynid, &tcpnal_ni); + if (rc != 0) { + CERROR("ksocknal: PtlNIInit failed: error %d\n", rc); + PtlFini(); + RETURN (rc); + } + PtlNIDebug(tcpnal_ni, ~0); + return rc; +} + +int lib_ioctl(int dev_id, int opc, void * ptr) +{ + if (dev_id == OBD_DEV_ID) { + struct obd_ioctl_data *ioc = ptr; + /* call class_obd_ioctl function here */ + /* class_obd_ioctl(inode, filp, opc, (unsigned long) ioc); */ + + /* you _may_ need to call obd_ioctl_unpack or some + other verification function if you want to use ioc + directly here */ + printf ("processing ioctl cmd: %x buf len: %d\n", + opc, ioc->ioc_len); + } + return (0); +} + +int main(int arc, char **argv) +{ + struct pingcli_args *args; + args= malloc(sizeof(*args)); + if (!args) { + printf("Malloc error\n"); + exit(1); + } + + args->mynid = atoi(argv[1]); + args->nid = atoi(argv[2]); + args->port = 9999; + args->count = atoi(argv[3]); + args->size = atoi(argv[4]); + + init_obdclass(); + init_lib_portals(args); + ptlrpc_init(); + ldlm_init(); + osc_init(); + echo_client_init(); + /* XXX lov and mdc are next */ + + parse_dump("DUMP_FILE", lib_ioctl); + + printf("Hello\n"); + return 0; +} + diff --git a/lustre/tests/compile.sh b/lustre/tests/compile.sh new file mode 100644 index 0000000..13c142e --- /dev/null +++ b/lustre/tests/compile.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -evx + +MNT=${MNT:-/mnt/lustre} +DIR=${DIR:-$MNT} +SRC=${SRC:-`dirname $0`/../..} +while date; do + for i in portals lustre; do + TGT=$DIR/$i + [ -d $TGT ] || cp -av $SRC/$i/ $TGT + make -C $TGT clean + make -C $TGT -j2 + make -C $TGT clean + done +done diff --git a/lustre/tests/mlink.c b/lustre/tests/mlink.c new file mode 100755 index 0000000..5688b9f --- /dev/null +++ b/lustre/tests/mlink.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char ** argv) +{ + int rc; + + if (argc < 3) { + printf("Usage: %s file link\n", argv[0]); + return 1; + } + + rc = link(argv[1], argv[2]); + if (rc) { + printf("link(%s, %s) error: %s\n", argv[1], argv[2], + strerror(errno)); + return errno; + } + return 0; +}