Date: Sat, 11 Mar 2017 14:03:06 +0000 From: Anindya Mukherjee <anindya49@hotmail.com> To: "freebsd-drivers@freebsd.org" <freebsd-drivers@freebsd.org> Subject: RE: uiomove question Message-ID: <MWHPR2201MB13893C02D022695130ECF14EB6230@MWHPR2201MB1389.namprd22.prod.outlook.com> In-Reply-To: <MWHPR2201MB1389E09A18BCBEEB53ADCD96B6210@MWHPR2201MB1389.namprd22.prod.outlook.com> References: <MWHPR2201MB1389E09A18BCBEEB53ADCD96B6210@MWHPR2201MB1389.namprd22.prod.outlook.com>
next in thread | previous in thread | raw e-mail | index | archive | help
An example of the usage I am talking about: xxx_write(...) { ... amount =3D MIN(uio->uio_resid, // 0. This is the no of bytes in the uio le= ft to write (BUFFER_SIZE - 1 - uio->uio_offset > 0) ? BUFFER_SIZE - 1 - uio->uio_offset : 0); // 1. amount to write = is computed //assuming write will happen at uio_offset in sc_buffer if (amount =3D=3D 0) return (error); error =3D uiomove(sc->sc_buffer, amount, uio); // 2. sc_buffer is not offs= et ... } xxx_read(...) { ... amount =3D MIN(uio->uio_resid, (sc->sc_length - uio->uio_offset > 0) ? sc->sc_length - uio->uio_offset : 0); // 3. Same as comment 1 = above error =3D uiomove(sc->sc_buffer + uio->uio_offset, amount, uio); // 4. Here= buffer is offset ... } Anindya=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MWHPR2201MB13893C02D022695130ECF14EB6230>