From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 16 18:51:11 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 948E116A4DA for ; Wed, 16 Aug 2006 18:51:11 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from antivirus.uni-rostock.de (mailrelay1.uni-rostock.de [139.30.8.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B6FA43D7B for ; Wed, 16 Aug 2006 18:50:53 +0000 (GMT) (envelope-from joerg@britannica.bec.de) Received: from antivirus.exch.rz.uni-rostock.de ([127.0.0.1]) by antivirus.uni-rostock.de with Microsoft SMTPSVC(6.0.3790.1830); Wed, 16 Aug 2006 20:50:52 +0200 Received: from antivirus.uni-rostock.de (unverified) by antivirus.exch.rz.uni-rostock.de (Content Technologies SMTPRS 4.3.20) with ESMTP id for ; Wed, 16 Aug 2006 20:50:52 +0200 Received: from mail pickup service by antivirus.uni-rostock.de with Microsoft SMTPSVC; Wed, 16 Aug 2006 20:50:52 +0200 X-SCL: 2 53.38% Received: from mail.uni-rostock.de ([139.30.8.11]) by antivirus.uni-rostock.de with Microsoft SMTPSVC (6.0.3790.1830); Wed, 16 Aug 2006 20:50:51 +0200 Received: from conversion-daemon.mail2.uni-rostock.de by mail2.uni-rostock.de (iPlanet Messaging Server 5.2 HotFix 2.09 (built Nov 18 2005)) id <0J4300401TM4QM@mail.uni-rostock.de> (original mail from joerg@britannica.bec.de) for freebsd-hackers@freebsd.org; Wed, 16 Aug 2006 20:50:51 +0200 (MEST) Received: from britannica.bec.de (storm.stura.uni-rostock.de [139.30.252.72]) by mail2.uni-rostock.de (iPlanet Messaging Server 5.2 HotFix 2.09 (built Nov 18 2005)) with ESMTP id <0J4300F38TORB3@mail.uni-rostock.de> for freebsd-hackers@freebsd.org; Wed, 16 Aug 2006 20:50:51 +0200 (MEST) Received: by britannica.bec.de (Postfix, from userid 1000) id 2AAF06068; Wed, 16 Aug 2006 20:50:23 +0200 (CEST) Date: Wed, 16 Aug 2006 20:50:23 +0200 From: Joerg Sonnenberger In-reply-to: To: freebsd-hackers@freebsd.org Mail-followup-to: freebsd-hackers@freebsd.org Message-id: <20060816185023.GA23879@britannica.bec.de> MIME-version: 1.0 Content-type: text/plain; charset="us-ascii" Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: Mutt/1.5.12-2006-07-14 References: <44E29055.3080205@centtech.com> <20060816054925.GA11651@droopy.unibe.ch> <44E3484D.8090905@centtech.com> X-OriginalArrivalTime: 16 Aug 2006 18:50:51.0346 (UTC) FILETIME=[E53C4320:01C6C164] Subject: Re: struct dirent question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2006 18:51:11 -0000 On Wed, Aug 16, 2006 at 02:45:05PM -0400, Garance A Drosihn wrote: > At 11:31 AM -0500 8/16/06, Eric Anderson wrote: > > > >My point was, that either path you take (if BSD_VISIBLE is > >defined or not), you end up with d_name having a size of > >255 + 1, so what's the point the having it at all? > > To make it clear that d_name is tied to the exact value > of MAXNAMLEN (just in case that value ever changes), and > it does not just happen to be 255+1 bytes for some reason > that is completely unrelated to MAXNAMLEN. It should be noted that the standard doesn't say anything about MAXNAMLEN (which is historically a FS specific limit). It also allows two different defitions of d_name: (1) As char[] of arbitrary length. (2) As char[1]. So portable code should always allocate storage for size(struct dirent) + NAME_MAX of the current FS. In that sense the current definition is misleading. Joerg