From 2a4eb08d4d47984a654c96eff08c34804a24f265 Mon Sep 17 00:00:00 2001 From: rread Date: Fri, 21 Feb 2003 18:24:42 +0000 Subject: [PATCH] fill in some sample code in libtest.c to demonstrate how to use the ioctl dumps created by lctl. --- lustre/liblustre/Makefile.am | 6 +++++- lustre/liblustre/libtest.c | 22 ++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lustre/liblustre/Makefile.am b/lustre/liblustre/Makefile.am index b192a49..2f2ec6b 100644 --- a/lustre/liblustre/Makefile.am +++ b/lustre/liblustre/Makefile.am @@ -7,7 +7,11 @@ 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 -lpthread -lefence +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 diff --git a/lustre/liblustre/libtest.c b/lustre/liblustre/libtest.c index aeb3b91..0f66a24 100644 --- a/lustre/liblustre/libtest.c +++ b/lustre/liblustre/libtest.c @@ -1,5 +1,8 @@ #include +#include /* needed for ptpctl.h */ +#include /* needed for parse_dump */ + #include #include <../user/procbridge/procbridge.h> @@ -52,6 +55,22 @@ int init_lib_portals(struct pingcli_args *args) 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; @@ -75,8 +94,7 @@ int main(int arc, char **argv) echo_client_init(); /* XXX lov and mdc are next */ - /* XXX RR parse an lctl dump file here */ - /* XXX RR parse dumpfile here with obdclass/class_obd.c ioct command */ + parse_dump("DUMP_FILE", lib_ioctl); printf("Hello\n"); return 0; -- 1.8.3.1