Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jx05y-00021D-RV for qemu-devel@nongnu.org; Fri, 16 May 2008 09:35:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jx05x-00020R-W5 for qemu-devel@nongnu.org; Fri, 16 May 2008 09:35:38 -0400 Received: from [199.232.76.173] (port=55212 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jx05x-00020G-NI for qemu-devel@nongnu.org; Fri, 16 May 2008 09:35:37 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:37328) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jx05x-0002gh-8f for qemu-devel@nongnu.org; Fri, 16 May 2008 09:35:37 -0400 Received: from mariner.uk.xensource.com ([10.80.2.22]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id m4GDZW4f025066 for ; Fri, 16 May 2008 06:35:34 -0700 Received: from iwj by mariner.uk.xensource.com with local (Exim 4.63) (envelope-from ) id 1Jx05r-0005Ea-4S for qemu-devel@nongnu.org; Fri, 16 May 2008 14:35:31 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18477.36259.30442.280531@mariner.uk.xensource.com> Date: Fri, 16 May 2008 14:35:31 +0100 From: Ian Jackson Subject: [Qemu-devel] Use of PATH_MAX Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org There are a couple of places where we use PATH_MAX. I don't think this is right. PATH_MAX is a #define specified by POSIX, SuSv3 etc. But it isn't guaranteed to be defined or necessarily very useful. In particular, it may be defined to a very large value (larger than a practical static buffer). Or on systems where the maximum pathname length varies (for example, it depends on the underlying filesystem) it may be not defined at all and applications which really need to know are supposed to use pathconf. I think it would be better to invent a new name for the maximum path length supported by qemu's statically-sized buffers. This would replace both the uses of PATH_MAX (in block.c, linux-user/path.c, and block-vvfat.c) but also direct use of (eg) 1024 in many places. Before I submit a patch, which will necessarily be very large (and before I store up future conflicts by pushing similar patches to the various Xen branches) I thought I would ask here: * Do we agree that this is a good idea ? * What should the new name be ? I propose QEMU_PATH_MAX as a nice simple change. The rune egrep -R 'char.*\[[0-9]' . gives a list of possible numerically-defined static buffers. Many of these aren't filenames but some of them are. Nearly all of the hits from egrep -R 'char.*1024' . are ripe for changing, so I would start with submitting a patch to change those (and existing uses of PATH_MAX). I'd appreciate a go-ahead from a qemu cvs committer before I prepare (and locally commit) this blanket change. Thanks, Ian.