lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 27 Apr 2012 15:51:43 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	"Chen, Bo" <Bo.Chen@...el.com>
Cc:	"alan@...ux.intel.com" <alan@...ux.intel.com>,
	"rick@....org" <rick@....org>,
	"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
	"linux-arm-kernel@...ts.arm.linux.org.uk" 
	<linux-arm-kernel@...ts.arm.linux.org.uk>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [Query] serial: AT91:  Add SIM Driver

On Fri, 27 Apr 2012 11:19:18 +0000
"Chen, Bo" <Bo.Chen@...el.com> wrote:

> Hi Alan,
> 
> > One way would be to make ISO7816 a line discipline (the layer which sits about the tty).
> 
> >Your user space interface would then be
> 
> >	int ldisc = N_ISO7816;
> >	ioctl(tty_fd, TIOCSETD, &ldisc);
> 
> Make ISO7816 a line discipline would register it in driver(atmel_serial.c or a new named driver) via tty_register_ldisc(N_ISO7816, &tty_ldisc_ops)

Yes

> If I use ioctl(tty_fd, TIOCSETD, &ldisc), it will close current line discipline and open a new line discipline related to ISO7816 (tty_register_ldisc(N_ISO7816, &tty_ldisc_ops))?

Yes

> > at which point the read/write/ioctl etc calls on your tty will also be    > routed via your ldisc so you can manage them and provide ISO7816 sensible > interfaces
> 
> Does it mean when I call read/write/ioctl in user space, it will call tty_ldisc_ops functions (ISO7816 line discipline has been opened) such as gsmld_read/gsmld_write/gsmld_ioctl in N_gsm.c? What I need to do is to implement the interface in tty_ldisc_ops?

Yes. The read and write methods get called with the user buffer and size
requested being passed. The ioctl handler is called as well as part of the
standard tty handlers so that a line discipline can implement its own
ioctls.

> What is the reasonable way to add this line discipline, in atmel_serial.c or create a new driver (build as a module and dynamically load)? Would it be accepted by kernel mainline?

Probably as a separate driver. That makes it easier to test and to review.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ