Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Mar 2017 20:49:53 +0000
From:      Anindya Mukherjee <anindya49@hotmail.com>
To:        "freebsd-drivers@freebsd.org" <freebsd-drivers@freebsd.org>
Subject:   uiomove question
Message-ID:  <MWHPR2201MB1389E09A18BCBEEB53ADCD96B6210@MWHPR2201MB1389.namprd22.prod.outlook.com>

index | next in thread | raw e-mail

Hi, I have been reading Joseph Kong's book: "FreeBSD Device Drivers - A Guide for the Intrepid". I have a confusion about the way uiomove() is being used in the code examples, such as the xxx_read() and xxx_write() routines.

As I understand, from reading /usr/src/sys/kern/subr_uio.c around line 248, uiomove() does not offset the kernel buffer automatically. The programmer has to add the offset from the uio structure. In the xxx_read() code in the book, this offset is applied correctly.

However, in all the xxx_write() examples, the amount to be written is calculated assuming the write is going to happen at a certain offset in the buffer, but in the actual call to uiomove() the offset is not applied. Is this a typo or am I missing something here?

Thanks for reading!

help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MWHPR2201MB1389E09A18BCBEEB53ADCD96B6210>