Hi Neale, here's my feedback on the implementation: - open() should return -EBUSY in case the device is INUSE, not -EACCES - release() should probably contain BUG_ON(!dev->flag & INUSE), it does only get called by VFS for open file descriptors - readv()/writev() don't look like it does the job actually...
The code looks pretty good overall, except for the coding style which does not fit the Linux Kernel. I would prefer a socket family instead of a filesystem for iucv, given that the thing is more like networking instead of hard disk. Any plans of merging this into the Linux Kernel? with kind regards Carsten Otte IBM Linux Technology Center / Boeblingen lab -- omnis enim res, quae dando non deficit, dum habetur et non datur, nondum habetur, quomodo habenda est Neale Ferguson <[EMAIL PROTECTED] .net> To Sent by: Linux on LINUX-390@VM.MARIST.EDU 390 Port cc <[EMAIL PROTECTED] IST.EDU> Subject IUCV device driver for Linux 2.6 08/17/05 04:11 PM Please respond to Linux on 390 Port <[EMAIL PROTECTED] IST.EDU> Just in time for SHARE... SNA has created an IUCV device driver that allows an application to use open/close/read/write semantics to manage IUCV connections. It's an early release, but we'd like feedback on utility and function of the package. You'll find the source for the package at: http://www.sinenomine.net/vm/fsiucv. Here's the HOW-TO: This device driver provides the user with the ability to write applications that use the open/close/read/write/ioctl APIs to drive IUCV connections between users and CP system services. The driver uses a dynamically allocated major number which is used by the hotplug agent iucv.agent (which needs to be placed in the /etc/hotplug directory) to define and delete the device nodes. The driver will check for the presence of VM when loaded and will return -EACCES if it's not detected. The driver accepts a parameter "maxconn" at load time. This will define how many IUCV device nodes are to be created. The default is 1. Building Device Driver ---------------------- Issue the following command to build the driver module: make -C /lib/modules/`uname -r`/build M=`pwd` SUBDIRS=`pwd` modules Note: There is a release dependent header file that is not in the include/asm-s390 portion of the kernel source tree. This file needs to be copied from: /usr/src/linux/drivers/s390/net/iucv.h In all probability the one I have used from the 2.6.8 kernel will be sufficient but until I can get this file placed in the "public" space there is a potential for release-to-release problems if the latest file is not used. Building Tools --------------- Issue the following command to build the commands like hcp: make tools Prop Jr Command (propjr) ------------------------ The Prop Jr. application simply connects to the *MSG system service and listens for incoming messages. It will display the message on the console as well as writing it to syslog(). To run it use "make tools" to build the application, load the device driver, and issue: echo "*MSG" >/sys/devices/iucv/iucv0/target_user sysfs Interaction ----------------- The device driver creates several entries in the sysfs tree. Under the directory /sys/devices/iucv there will be directories for every IUCV defined by the hotplug agent. Under the directory will be files: File Access Value Purpose ------------ ------ ----- -------------------------------- local r/w [0 | 1] Specifies whether only local connections are supported msglimit r/w 0-255 Specifies the message limit for the connection parmdata r/w [0 | 1] Specifies whether parameter data is supported path ro Numeric Path ID of the connection priority r/w [0 | 1] Specifies whether priority messages are supported target_node r/w AlphaNum Node name of IUCV destination (or blank) target_user r/w AlphaNum The target name of the user or service An example of a typical interaction with these files is when an application wishes to connect to a specific user. Prior to the application starting an entry is written to target_user: echo "*MSG" >/sys/devices/iucv/iucv0/target_user The device driver will retrieve this information when the application opens the iucv device and use it to connect to or accept connections from the target. IOCTL Options ------------- There are several IOCTL operations that may be performed: - Set target class - Get target class - Set source class - Get source class - Set message tag - Get message tag - Set one-way flag Files in this filesystem may only be written to by the superuser. ------------------------------------------------------------------------ ------------ The Prop Jr. application simply connects to the *MSG system service and listens for incoming messages. It will display the message on the console as well as writing it to SYSLOG. The output of both is listed here to give you a feel for things. To run it use "make tools" to build the application, load the device driver, and issue: echo "*MSG" >/sys/devices/iucv/iucv0/target_user Make sure you issue: #CP SET SMSG IUCV #CP SET MSG IUCV #CP SET WNG IUCV #CP SET EMSG IUCV #CP SET IMSG IUCV #CP SET VMCONIO IUCV #CP SET CPCONIO IUCV or any subset of these to get traffic to flow from CP to the application User ID Class Message ------- ----- -------------------------------- NEALE [1] TESTING NEALE [2] A WARNING NEALE [4] A Special Message D26TEST [3] HCPCFX6768I SECUSER of RSCS initiated for you by NEALE. RSCS [8] RSCS : 07:30:51 Location SNAVM5(NEALE) executing: Q VMSL932 D NEALE [8] RSCS : HCPCFX6768I Your SECUSER set to OPERATOR by NEALE. D26TEST [3] z/VM Version 4 Release 4.0, Service Level 0404 (32-bit), D26TEST [3] There is no logmsg data D26TEST [3] FILES: 0004 RDR, 0003 PRT, NO PUN D26TEST [3] RECONNECTED AT 07:31:13 CDT WEDNESDAY 08/17/05 D26TEST [5] w D26TEST [5] w D26TEST [5] 08:31:19 up 4 days, 23:21, 2 users, load average: 0.00, 0.00, 0.00 D26TEST [5] d26test:~# D26TEST [3] D26TEST [3] TIME IS 07:31:24 CDT WEDNESDAY 08/17/05 D26TEST [3] CONNECT= 99:59:59 VIRTCPU= 023:53.94 TOTCPU= 026:08.14 D26TEST [3] D26TEST [3] HCPCQU045E SCUM not logged on D26TEST [3] D26TEST [3] DISCONNECT AT 07:31:41 CDT WEDNESDAY 08/17/05 NEALE [4] STOP Aug 17 08:30:28 d26test propjr: [SMSG] NEALE A Special Message Aug 17 08:30:41 d26test propjr: [CPIO] D26TEST HCPCFX6768I SECUSER of RSCS initiated for you by NEALE. Aug 17 08:30:51 d26test propjr: [SCIF] RSCS RSCS : 07:30:51 Location SNAVM5(NEALE) executing: Q VMSL932 D Aug 17 08:30:56 d26test propjr: [SCIF] NEALE RSCS : HCPCFX6768I Your SECUSER set to OPERATOR by NEALE. Aug 17 08:31:13 d26test propjr: [CPIO] D26TEST z/VM Version 4 Release 4.0, Service Level 0404 (32-bit), Aug 17 08:31:13 d26test propjr: [CPIO] D26TEST There is no logmsg data Aug 17 08:31:13 d26test propjr: [CPIO] D26TEST FILES: 0004 RDR, 0003 PRT, NO PUN Aug 17 08:31:13 d26test propjr: [CPIO] D26TEST RECONNECTED AT 07:31:13 CDT WEDNESDAY 08/17/05 Aug 17 08:31:19 d26test propjr: [VMIO] D26TEST w Aug 17 08:31:19 d26test propjr: [VMIO] D26TEST w Aug 17 08:31:19 d26test propjr: [VMIO] D26TEST 08:31:19 up 4 days, 23:21, 2 users, load average: 0.00, 0.00, 0.00 Aug 17 08:31:20 d26test propjr: [VMIO] D26TEST d26test:~# Aug 17 08:31:24 d26test propjr: [CPIO] D26TEST Aug 17 08:31:24 d26test propjr: [CPIO] D26TEST TIME IS 07:31:24 CDT WEDNESDAY 08/17/05 Aug 17 08:31:24 d26test propjr: [CPIO] D26TEST CONNECT= 99:59:59 VIRTCPU= 023:53.94 TOTCPU= 026:08.14 Aug 17 08:31:30 d26test propjr: [CPIO] D26TEST Aug 17 08:31:30 d26test propjr: [CPIO] D26TEST HCPCQU045E SCUM not logged on Aug 17 08:31:41 d26test propjr: [CPIO] D26TEST Aug 17 08:31:41 d26test propjr: [CPIO] D26TEST DISCONNECT AT 07:31:41 CDT WEDNESDAY 08/17/05 Aug 17 08:31:55 d26test propjr: [SMSG] NEALE STOP ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390