From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15628 invoked by alias); 20 May 2009 16:56:36 -0000 Received: (qmail 15613 invoked by uid 22791); 20 May 2009 16:56:35 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from virtual.bogons.net (HELO virtual.bogons.net) (193.178.223.136) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 May 2009 16:56:29 +0000 Received: from jifvik.dyndns.org (jifvik.dyndns.org [85.158.45.40]) by virtual.bogons.net (8.10.2+Sun/8.11.2) with ESMTP id n4KGuP411046 for ; Wed, 20 May 2009 17:56:25 +0100 (BST) Received: from [172.31.1.2] (unknown [172.31.1.2]) by jifvik.dyndns.org (Postfix) with ESMTP id D196C3FEB; Wed, 20 May 2009 17:56:23 +0100 (BST) Message-ID: <4A143637.5010909@jifvik.org> Date: Wed, 20 May 2009 16:56:00 -0000 From: Jonathan Larmour User-Agent: Mozilla Thunderbird 1.0.8-1.1.fc3.4.legacy (X11/20060515) MIME-Version: 1.0 To: Bart Veer Cc: Ross Younger , ecos-devel@ecos.sourceware.org Subject: Re: Should hard links to directories work? References: <4A13F762.4050006@ecoscentric.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2009-05/txt/msg00065.txt.bz2 Bart Veer wrote: >>>>>>"Ross" == Ross Younger writes: > > > Ross> The Unix world traditionally shuns such things as an > Ross> abomination. The eCos docs are quiet on the subject, as is > Ross> the code in ramfs and jffs2. Should they work? Does anybody > Ross> use them? > > Ross> (By the way: I started this discussion with a bugzilla > Ross> ticket, which as Andrew points out is probably the wrong > Ross> place. > Ross> http://bugzilla.ecoscentric.com/show_bug.cgi?id=1000775 ) > > From http://www.opengroup.org/onlinepubs/7990989775/xsh/link.html: > > "The link() function creates a new link (directory entry) for the > existing file, path1. > > The path1 argument points to a pathname naming an existing file. The > path2 argument points to a pathname naming the new directory entry > to be created. The link() function will atomically create a new link > for the existing file and the link count of the file is incremented > by one. > > If path1 names a directory, link() will fail unless the process has > appropriate privileges and the implementation supports using link() > on directories." > > So creating links to directories is not completely disallowed, but > from my reading it is certainly discouraged. I would be happy with > changes to ramfs and jffs2 to prevent new links to directories. > jffs2 should probably continue to support such links in an existing > filesystem, in case they are created in another OS. JFFS2's other OS is linux which does not support hard linked directories. Presumably at the VFS layer. Since hard linking directories can cause infinite recursion in directory tree searches, I think they should be discouraged if at all possible. For JFFS2, something like this in jffs2's fs-ecos.c:jffs2_ops_link() before the handling of dir2 should bring it into line with linux: if (S_ISDIR(ds1.node->i_mode)) { jffs2_iput(ds1.dir); jffs2_iput(ds1.node); return EPERM; } [Untested, and someone else would have to do that, sorry.] I would not be surprised if hard-linked directories caused JFFS2's filesystem rebuild phase to blow up. Jifl -- ------["The best things in life aren't things."]------ Opinions==mine