From owner-freebsd-fs@freebsd.org Sat Jul 27 16:39:57 2019 Return-Path: Delivered-To: freebsd-fs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76029BD5A9 for ; Sat, 27 Jul 2019 16:39:57 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670057.outbound.protection.outlook.com [40.107.67.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D950E8C6C1; Sat, 27 Jul 2019 16:39:55 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FDxHTOLYHVl2dNVX8UTkHmoQ0xis7D1zIOHxRPBZcnEmYGTrIDeZbGRSt8nyBk9vlaWoEiPj8/JVT1Vv3l8WZpu4BxcAEVA/aYkoCkkjaHo8TyhavrP2icnwqW+QBH1hDNwcfCQPDQ+F3J7MPFHiJqOqjyKUvre8lrZ9mGCOGrwFxg+U5AG8VPCHXxwOE/KVxt61yE7NtcvXAmG/iq8UuHe2CtYEDA+tkYGQTvIuFhiQ+DHvM/IRK8QgmfsAFdcggj1BIy2bF2RXgB3hwIw3YaJxKfhn8zkt+OGtNvsxJBreVXFUU8Q9Ol4498deX5/3Ag3xQ9pAG45A+Q/zl9i79g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m12aO7gGeSktlCKh/L2aStY+Sl80CP86EOzjhztpDhc=; b=mzJSDlql1Ub5nyRiO+u/PuTKHgN3EnZEGFbKCHsnjtOHqKFCxueQ8f3jHAJYkOtLxIiu5N2MI9JOLh4hRbzwZGVnVWJtSCnnkE6vHTzufAr6qtMt9v9ZzKqzs+v+arMpO26vnWBVGKw5Tn8BH316MkUe1gbfG9cie89XM+LC8X3set7wwMBDPWKXV8ahM+UNNvDndDnoFNdNLG0uhYimGMcGhqnR6D18WvUaVEB0PpGg644Octl8JD75d0OfB+J09I5kL1UoDuQ+br6E2BktVnPtRewvFzw9YkVRKB7FtY8GjvCWKys/XBL+fInlnNifjd+LBtOBsXxz9zOb3TEe7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=uoguelph.ca;dmarc=pass action=none header.from=uoguelph.ca;dkim=pass header.d=uoguelph.ca;arc=none Received: from YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM (10.255.13.158) by YTBPR01MB3646.CANPRD01.PROD.OUTLOOK.COM (10.255.12.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.14; Sat, 27 Jul 2019 16:39:54 +0000 Received: from YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM ([fe80::70d6:627b:b391:3977]) by YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM ([fe80::70d6:627b:b391:3977%7]) with mapi id 15.20.2115.005; Sat, 27 Jul 2019 16:39:53 +0000 From: Rick Macklem To: "freebsd-fs@freebsd.org" CC: "kib@freebsd.org" Subject: RFC: should copy_file_range(2) use size_t or off_t for length argument Thread-Topic: RFC: should copy_file_range(2) use size_t or off_t for length argument Thread-Index: AQHVRJjy4L2Al+2Bt0mzzLUcIw9tbQ== Date: Sat, 27 Jul 2019 16:39:53 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2648cc19-ee4a-48a2-b6a7-08d712b10d65 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:YTBPR01MB3646; x-ms-traffictypediagnostic: YTBPR01MB3646: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 01110342A5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(366004)(376002)(346002)(136003)(78114003)(199004)(189003)(6436002)(74316002)(305945005)(4326008)(2906002)(316002)(786003)(450100002)(6916009)(478600001)(6506007)(71190400001)(71200400001)(7696005)(33656002)(256004)(14454004)(102836004)(186003)(25786009)(53936002)(9686003)(46003)(55016002)(66556008)(64756008)(66446008)(81166006)(81156014)(8936002)(8676002)(66946007)(476003)(486006)(2501003)(2351001)(99286004)(52536014)(86362001)(68736007)(76116006)(66476007)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:YTBPR01MB3646; H:YTBPR01MB3312.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 60h+oKAd+pV3Pd18G9Gog7/LNgsSdfJz4Sj4Om25zxAFH0HaekxwUviywH5o88lJE5ZEacMgXTwn/LN9WwUOZzR4SaZYWG6t75BHSIae3JoVQUAfzLQGIlpL/Ono1xU2zi5Am5irpqht+u6gTpNHCkFThYproyNPC+EJ4wNE9futaSkuQAVz4WlsR+2QcJ7ECDMDRCHknQcw5hB4fbsn3Ec57dY9gX1HoOkk6vUXY/JS7ic6yVf4rY9UtWYpWLBMIEVAF8CqoeBZl5xne8pgSNRcnDdgLd8dPkRktqDPUKHPygOW69/JnnI2dbZhQRKUqf4Nj+lB3citReEDC6QmW/9UMLe43zpHYwwny5UCFuN48yNB2MV9NX55lYkJybPq5QYKdEQuBrOjyx0BCZU6itNKbMooGxKcipnEDuIpnaM= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 2648cc19-ee4a-48a2-b6a7-08d712b10d65 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jul 2019 16:39:53.7726 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rmacklem@uoguelph.ca X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTBPR01MB3646 X-Rspamd-Queue-Id: D950E8C6C1 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.67.57 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-5.22 / 15.00]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[uoguelph.ca]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.09)[ipnet: 40.64.0.0/10(-3.06), asn: 8075(-2.33), country: US(-0.05)]; MX_GOOD(-0.01)[mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[57.67.107.40.list.dnswl.org : 127.0.3.0]; NEURAL_HAM_SHORT(-0.82)[-0.824,0]; TO_DN_EQ_ADDR_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8075, ipnet:40.64.0.0/10, country:US]; ARC_ALLOW(-1.00)[i=1] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jul 2019 16:39:57 -0000 Hi, r350315 implemented a Linux compatible copy_file_range(2) syscall. Since Linux used a length argument of size_t and a return argument type of ssize_t, I did the same. Kostik has suggested that making these off_t would allow a full 64bit copy be done on 32bit arches. Here is the snippet of discussion we have had: Kostik Belousov wrote: > >Kostik Belousov wrote: >> >I sat to write the compat32 shims, and only then noted that len has siz= e_t >> >type. Why is it size_t and not off_t ? > I wrote: >> Well, that's what Linux did. >>=20 >> Also, since it returns ssize_t, it can't do more than SSIZE_MAX >> (generally 1/2 of SIZE_T_MAX). Returning ssize_t is also what Linux >> does and is consistent with read(2)/write(2). > >If changing the length argument type to off_t, it is reasonable to change >the return type to off_t as well. We already have the lseek(2) syscall th= at >requires two return registers on 32bit. > >Note that it is reasonable for read(2) to take length as size_t-typed >parameter, because size_t is the type for object sizes. There is no >object in user address space for copy_file_range(2) API, so potentially >wider off_t is acceptable and is in fact useful there. It is useful on >32bit machines where FreeBSD size_t is 32bit, while off_t is 64bit. So, what do others think? (My only concern w.r.t. changing the arguments to off_t is Linux compatibil= ity.) rick