From owner-freebsd-drivers@freebsd.org Thu Mar 9 20:50:02 2017 Return-Path: Delivered-To: freebsd-drivers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A741D05883 for ; Thu, 9 Mar 2017 20:50:02 +0000 (UTC) (envelope-from anindya49@hotmail.com) Received: from COL004-OMC3S16.hotmail.com (col004-omc3s16.hotmail.com [65.55.34.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "*.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 147E38BC for ; Thu, 9 Mar 2017 20:50:01 +0000 (UTC) (envelope-from anindya49@hotmail.com) Received: from NAM04-BN3-obe.outbound.protection.outlook.com ([65.55.34.137]) by COL004-OMC3S16.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Thu, 9 Mar 2017 12:49:55 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mbu7/abV6kAHLXY45FXtIS6IuIir/AxflU8LO9eIIZ0=; b=R4xfbsBZErLB+rsYIPfyk3x1cYMj7VLBds5cixw1wzMH1ekudsKh5C/HWa8FCoz1D2Fe+u+8CPOSy5UXrKPME7x9iRUFUYDNbbgzc+m99/lfOO3xHzY6/c2dET+wyZd/+gyGE/hLc7El6WszULJGkzaa7CS9Wz8vh95vpv8GDabjYT+9TPcmiVpLt3uIIreBSmFOSjkwoi0Oi6DxjenbL7P91IG5Ihhu+k3/HtN9w+Miz6CgXySaJY6pp36pB5xmzFi4mCc/MGOHDs+C4kIU4IoJB4hfgfPw9ajkunBt5YRJ4WVrkoJ/F7OwZU8IQ65VJD175jCNJ8m4jIPz3U9OiQ== Received: from SN1NAM04FT011.eop-NAM04.prod.protection.outlook.com (10.152.88.54) by SN1NAM04HT160.eop-NAM04.prod.protection.outlook.com (10.152.89.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.7; Thu, 9 Mar 2017 20:49:53 +0000 Received: from MWHPR2201MB1389.namprd22.prod.outlook.com (10.152.88.54) by SN1NAM04FT011.mail.protection.outlook.com (10.152.88.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.7 via Frontend Transport; Thu, 9 Mar 2017 20:49:53 +0000 Received: from MWHPR2201MB1389.namprd22.prod.outlook.com ([10.172.63.7]) by MWHPR2201MB1389.namprd22.prod.outlook.com ([10.172.63.7]) with mapi id 15.01.0947.020; Thu, 9 Mar 2017 20:49:53 +0000 From: Anindya Mukherjee To: "freebsd-drivers@freebsd.org" Subject: uiomove question Thread-Topic: uiomove question Thread-Index: AQHSmRaz97BbjjTePUWUIWXrakMIPA== Date: Thu, 9 Mar 2017 20:49:53 +0000 Message-ID: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: freebsd.org; dkim=none (message not signed) header.d=none;freebsd.org; dmarc=none action=none header.from=hotmail.com; x-incomingtopheadermarker: OriginalChecksum:5E72ACB1481BD16BD87426F8C096BEF1D06A3A1EC66D4C74CFAB4A1728EF6E15; UpperCasedChecksum:EFFD16B3844282D88F298ED8FB17657CAD474FF0C942049198F889CAEF60055D; SizeAsReceived:7548; Count:36 x-tmn: [F2SbqQErnEtX+F+1bfa4vPp2AEcMBbm4] x-incomingheadercount: 36 x-eopattributedmessage: 0 x-microsoft-exchange-diagnostics: 1; SN1NAM04HT160; 5:RG/xpi4c/ktVEI8AiIDt8kLs7H3SOqz/imD63MZD09VYBEOLzTm2NVbvIChsn+InE85GQzngTJPAQUmvp7RvrMwj7PsBSO7untuPGti7uiU2lN6nE0O/yknanbq1EAXF0kDE2zCJAg1qP6Fvu5cJHA==; 24:72gZwHpO32E3HmrITzy+7cUMhtz2ZhJKFJg18e9kJkrzL7HoacP0SLf4neN96cOPDxHwoRe6CaA7Ngjzs7mPLEmOmohxAq5vrMf4VysSyQ4=; 7:WTb2xvYzmNTGN0hbuleASaoBVTO+4m2dszbLqSL/l92/9qOaJhVdSq9ilzgJnIembggT5sOg1rtMKHQkL1YlibtSa+qj372ZZBDQHlwCbCYGjlMaIi2Fv+LEXrxMV6W3JNcXU2YPucfRqxamyQ0LkGIz5wmsahDB+TVfTuGpvGUOvQYG5bIrRFm7eVcZ/NruVdRo8ee53G+jeE4dwx0RMU1h+b7ztyegxIxXuWY0O2c0znpRSBUCVyuwIlqnAzmXCPVags/NLUKMfaHHnX2Oi52gG7QQrgVrEmuU/d8iwanmGtqKg1d+KO3AVOGgjDoV x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(10019020)(98900016); DIR:OUT; SFP:1102; SCL:1; SRVR:SN1NAM04HT160; H:MWHPR2201MB1389.namprd22.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: 16d9ce99-0c75-41a5-7c33-08d4672dd67b x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(1601125254)(1603101448)(1701031045); SRVR:SN1NAM04HT160; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(432015087)(444000031); SRVR:SN1NAM04HT160; BCL:0; PCL:0; RULEID:; SRVR:SN1NAM04HT160; x-forefront-prvs: 0241D5F98C spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Mar 2017 20:49:53.5220 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM04HT160 X-OriginalArrivalTime: 09 Mar 2017 20:49:55.0115 (UTC) FILETIME=[B4F067B0:01D29916] X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Mar 2017 20:50:02 -0000 Hi, I have been reading Joseph Kong's book: "FreeBSD Device Drivers - A Gui= de for the Intrepid". I have a confusion about the way uiomove() is being u= sed 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 calcu= lated assuming the write is going to happen at a certain offset in the buff= er, 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!=