Date: Thu, 14 Oct 2010 22:45:14 +0000 (UTC) From: Weongyo Jeong <weongyo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r213881 - user/weongyo/usb/sys/dev/usb Message-ID: <201010142245.o9EMjE9P040667@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: weongyo Date: Thu Oct 14 22:45:14 2010 New Revision: 213881 URL: http://svn.freebsd.org/changeset/base/213881 Log: Adds two ioctl interfaces, UIOCSRTIMEOUT and UIOCGRTIMEOUT to specify the read timeout. While I'm here fixes wrong group ids for other interfaces. Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c user/weongyo/usb/sys/dev/usb/usb_pf.h Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 22:14:55 2010 (r213880) +++ user/weongyo/usb/sys/dev/usb/usb_pf.c Thu Oct 14 22:45:14 2010 (r213881) @@ -1185,6 +1185,34 @@ usbpf_ioctl(struct cdev *dev, u_long cmd error = usbpf_setf(ud, (struct usbpf_program *)addr, cmd); break; + /* + * Set read timeout. + */ + case UIOCSRTIMEOUT: + { + struct timeval *tv = (struct timeval *)addr; + + /* + * Subtract 1 tick from tvtohz() since this isn't + * a one-shot timer. + */ + if ((error = itimerfix(tv)) == 0) + ud->ud_rtout = tvtohz(tv) - 1; + break; + } + + /* + * Get read timeout. + */ + case UIOCGRTIMEOUT: + { + struct timeval *tv = (struct timeval *)addr; + + tv->tv_sec = ud->ud_rtout / hz; + tv->tv_usec = (ud->ud_rtout % hz) * tick; + break; + } + case UIOCVERSION: { struct usbpf_version *uv = (struct usbpf_version *)addr; Modified: user/weongyo/usb/sys/dev/usb/usb_pf.h ============================================================================== --- user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 22:14:55 2010 (r213880) +++ user/weongyo/usb/sys/dev/usb/usb_pf.h Thu Oct 14 22:45:14 2010 (r213881) @@ -260,10 +260,12 @@ struct usbpf_program { #define UIOCGBLEN _IOR('U', 102, u_int) #define UIOCSBLEN _IOWR('U', 102, u_int) -#define UIOCSETF _IOW('B', 103, struct usbpf_program) +#define UIOCSETF _IOW('U', 103, struct usbpf_program) #define UIOCSETIF _IOW('U', 108, struct usbpf_ifreq) +#define UIOCSRTIMEOUT _IOW('U', 109, struct timeval) +#define UIOCGRTIMEOUT _IOR('U', 110, struct timeval) #define UIOCVERSION _IOR('U', 113, struct usbpf_version) -#define UIOCSETWF _IOW('B', 123, struct usbpf_program) +#define UIOCSETWF _IOW('U', 123, struct usbpf_program) #define USBPF_XFERTAP_SUBMIT 0 #define USBPF_XFERTAP_DONE 1
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010142245.o9EMjE9P040667>