From owner-freebsd-fs@FreeBSD.ORG Sun May 1 16:44:53 2011 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8B3C1065675; Sun, 1 May 2011 16:44:53 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 7E62F8FC12; Sun, 1 May 2011 16:44:53 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEAPiMvU2DaFvO/2dsb2JhbACEUaJCsmGPVoEqg1WBAQSOeY4+ X-IronPort-AV: E=Sophos;i="4.64,298,1301889600"; d="scan'208";a="119237914" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 01 May 2011 12:44:52 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id AE643B4163; Sun, 1 May 2011 12:44:52 -0400 (EDT) Date: Sun, 1 May 2011 12:44:52 -0400 (EDT) From: Rick Macklem To: Bruce Evans Message-ID: <1211771823.830180.1304268292625.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20110502015700.Q2013@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.202] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: rmacklem@freebsd.org, fs@freebsd.org Subject: Re: newnfs client and statfs X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 May 2011 16:44:53 -0000 > > >> - except there isn't a UINT64_MAX, INT64_MAX defined in sys/*.h as > >> far as I can see. How do I express these constants? Do I have to > >> convert 0x7ffffffffffffff to decimal and use that? > > UINT64_MAX, etc., are defined in , which doesn't even > need > to be included explicitly, since it is (bogusly) standard namespace > pollution in . This namespace pollution gives the bizarre > situation that you have to include to get the limits > for > basic types, but you get the limits for the fix-with types whether you > want them or not, except in rare cases where is not > needed > for other reasons. > Ok, now I see them (in machine/include/_stdint.h). Appologies for the noise. I grep'd sys/sys and couldn't find anything called (U)INT64_MAX. Now, remembering that sf_abytes is uint64_t per the RFCs, what do people think of either of these? if (sfp->sf_abytes > INT64_MAX) sbp->f_bavail = INT64_MAX; else sbp->f_bavail = sfp->sf_abytes / NFS_FABLKSIZE; Or should I try and do the division to see if the large value in sf_abytes will fit in INT64_MAX after the division? Something like: int64_t tmp; tmp = sfp->sf_abytes; tmp /= NFS_FABLKSIZE; if (tmp < 0) sbp->f_bavail = INT64_MAX; else sbp->f_bavail = tmp; Neither tested, of course, rick