From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 16 05:49:43 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 E306816A4DE for ; Wed, 16 Aug 2006 05:49:43 +0000 (UTC) (envelope-from roth@droopy.unibe.ch) Received: from mailhub03.unibe.ch (mailhub.unibe.ch [130.92.9.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id 66E0D43D46 for ; Wed, 16 Aug 2006 05:49:39 +0000 (GMT) (envelope-from roth@droopy.unibe.ch) Received: from localhost (scanhub03.unibe.ch [130.92.5.63]) by mailhub03.unibe.ch (Postfix) with ESMTP id 6E0FE4B4F2; Wed, 16 Aug 2006 07:49:32 +0200 (CEST) X-Virus-checked: by University of Berne Received: from mailhub03.unibe.ch ([130.92.9.70]) by localhost (scanhub03.unibe.ch [130.92.5.63]) (amavisd-new, port 10024) with LMTP id MTqD7KpSmAY4; Wed, 16 Aug 2006 07:49:30 +0200 (CEST) Received: from asterix.unibe.ch (asterix.unibe.ch [130.92.64.4]) by mailhub03.unibe.ch (Postfix) with ESMTP id F254B4BB89; Wed, 16 Aug 2006 07:49:30 +0200 (CEST) Received: from droopy.unibe.ch (droopy [130.92.64.20]) by asterix.unibe.ch (8.12.10+Sun/8.12.10) with ESMTP id k7G5nUdd012786; Wed, 16 Aug 2006 07:49:30 +0200 (MEST) Received: (from roth@localhost) by droopy.unibe.ch (8.12.10+Sun/8.12.9/Submit) id k7G5nPvM011665; Wed, 16 Aug 2006 07:49:25 +0200 (MEST) Date: Wed, 16 Aug 2006 07:49:25 +0200 From: Tobias Roth To: Eric Anderson Message-ID: <20060816054925.GA11651@droopy.unibe.ch> References: <44E29055.3080205@centtech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44E29055.3080205@centtech.com> User-Agent: Mutt/1.4i X-message-flag: Warning! Using Outlook is insecure and promotes virus distribution. Please use a different email client. Cc: FreeBSD Hackers 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 05:49:44 -0000 On Tue, Aug 15, 2006 at 10:26:13PM -0500, Eric Anderson wrote: > Does the ifdef in the struct dirent (pasted in below) make any sense? > Seems like regardless of whether the __BSD_VISIBLE is defined or not, > the d_name length will always be 255 + 1. > > Eric > > > struct dirent { > __uint32_t d_fileno; /* file number of entry */ > __uint16_t d_reclen; /* length of this record */ > __uint8_t d_type; /* file type, see below */ > __uint8_t d_namlen; /* length of string in d_name */ > #if __BSD_VISIBLE > #define MAXNAMLEN 255 > char d_name[MAXNAMLEN + 1]; /* name must be no longer than > this */ > #else > char d_name[255 + 1]; /* name must be no longer than > this */ > #endif > }; The difference is whether MAXNAMLEN is defined or not, the value of d_name is irrelevant. How far not defining MAXNAMLEN (in the case __BSD_VISIBLE= false) makes sense, I cannot tell. cheers, t.