uio.9 (223890) | uio.9 (230330) |
---|---|
1.\" 2.\" Copyright (c) 1997 Joerg Wunsch 3.\" 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 9 unchanged lines hidden (view full) --- 18.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" | 1.\" 2.\" Copyright (c) 1997 Joerg Wunsch 3.\" 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 9 unchanged lines hidden (view full) --- 18.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" |
26.\" $FreeBSD: head/share/man/man9/uio.9 223890 2011-07-09 15:24:12Z kib $ | 26.\" $FreeBSD: head/share/man/man9/uio.9 230330 2012-01-19 09:51:07Z ed $ |
27.\" | 27.\" |
28.Dd July 9, 2011 | 28.Dd January 19, 2012 |
29.Dt UIO 9 30.Os 31.Sh NAME 32.Nm uio , 33.Nm uiomove , 34.Nm uiomove_nofault 35.Nd device driver I/O routines 36.Sh SYNOPSIS --- 112 unchanged lines hidden (view full) --- 149#include <sys/param.h> 150 151#define BUFSIZE 512 152static char buffer[BUFSIZE]; 153 154static int data_available; /* amount of data that can be read */ 155 156static int | 29.Dt UIO 9 30.Os 31.Sh NAME 32.Nm uio , 33.Nm uiomove , 34.Nm uiomove_nofault 35.Nd device driver I/O routines 36.Sh SYNOPSIS --- 112 unchanged lines hidden (view full) --- 149#include <sys/param.h> 150 151#define BUFSIZE 512 152static char buffer[BUFSIZE]; 153 154static int data_available; /* amount of data that can be read */ 155 156static int |
157fooread(dev_t dev, struct uio *uio, int flag) | 157fooread(struct cdev *dev, struct uio *uio, int flag) |
158{ 159 int rv, amnt; 160 161 rv = 0; 162 while (uio->uio_resid > 0) { 163 if (data_available > 0) { 164 amnt = MIN(uio->uio_resid, data_available); 165 rv = uiomove(buffer, amnt, uio); --- 50 unchanged lines hidden --- | 158{ 159 int rv, amnt; 160 161 rv = 0; 162 while (uio->uio_resid > 0) { 163 if (data_available > 0) { 164 amnt = MIN(uio->uio_resid, data_available); 165 rv = uiomove(buffer, amnt, uio); --- 50 unchanged lines hidden --- |