From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 23 22:03:45 2003 Return-Path: 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 F2D5116A4BF for ; Sat, 23 Aug 2003 22:03:44 -0700 (PDT) Received: from HAL9000.homeunix.com (12-233-57-131.client.attbi.com [12.233.57.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6907243FDF for ; Sat, 23 Aug 2003 22:03:44 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.9/8.12.9) with ESMTP id h7O53ptT013802; Sat, 23 Aug 2003 22:03:51 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.9/8.12.9/Submit) id h7O53pwO013801; Sat, 23 Aug 2003 22:03:51 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Date: Sat, 23 Aug 2003 22:03:51 -0700 From: David Schultz To: Tim Kientzle Message-ID: <20030824050351.GA13726@HAL9000.homeunix.com> Mail-Followup-To: Tim Kientzle , freebsd-hackers@freebsd.org References: <3F4828F5.8090207@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F4828F5.8090207@acm.org> cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Inode Operations X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Aug 2003 05:03:45 -0000 On Sat, Aug 23, 2003, Tim Kientzle wrote: > Right now, I'm storing the full pathname of each such > file, but that is taking up a lot of memory, so I'm looking > for a more compact approach. It occurred to me that > the device number/inode (as returned by stat(2)) is another > way to uniquely identify a file. As it turns out, I need to > stat() everything anyway, so collecting such identifiers is easy. > But, I can't find any system calls that actually use this information. > > Question: Are there any system calls that allow you to > access/modify a file based only on the device number/inode number? You can't do that, and if you could, you would be able to subvert access permissions on directories that otherwise prevented you from accessing a file. Also keep in mind that it is possible to have a virtually limitless number of hard links to a file, so this isn't something that can be easily changed. Have you considered a more compact representation for your massive list of files? With a clever data structure, you should only need to store a given pathname component once.