From owner-freebsd-hackers Fri Aug 17 12: 0:43 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from goose.mail.pas.earthlink.net (goose.mail.pas.earthlink.net [207.217.120.18]) by hub.freebsd.org (Postfix) with ESMTP id 3ADE437B403 for ; Fri, 17 Aug 2001 12:00:38 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from mindspring.com (dialup-209.247.143.184.Dial1.SanJose1.Level3.net [209.247.143.184]) by goose.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id MAA09106; Fri, 17 Aug 2001 12:00:18 -0700 (PDT) Message-ID: <3B7D69EB.85E7D950@mindspring.com> Date: Fri, 17 Aug 2001 12:00:59 -0700 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Julian Elischer Cc: "Eugene L. Vorokov" , Sansonetti Laurent , freebsd-hackers@FreeBSD.ORG Subject: Re: Getting filename from descriptor or vnode struct References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Julian Elischer wrote: > > you are going to have to examine the name cache and find the inode of the > directories in the full path. Most open directories will have their full > path in the caches.. For the problem he is trying to solve, he should: 1) Precompute the path to the configuration file, and save the ino_t and dev_t for the thing. 2) Compare this tuple against the result of VOP_LOOKUP or VOP_READDIR operations, and hide the results if it matches. NB: Life would be easier for multiple configuration files if you picked a configuration directory, instead, and hid that, rather than individual files, making it an O(1), not an O(n) operation. In other words, look it up forwards once, instead of looking it up reverse many times. You should also be aware that the "hiding" you are doing will not "save you" from mounts overlaying your names, so, if you care about consistancy, you should probably open the target file/directory at the start, and cache a reference to it for the duration, so that it can't cache out from under the kernel code you are writing (e.g. if you use the directory approach, you need to to do exactly what a process does when it gets a current working directory, so look at that code in the kernel and copy it). There are other issues of data folding (e.g. you can treat the directory variantly as a file or directory, in order to flod it out from the FS, which would then let you reuse the directory name from user space, and be none the wiser), but that's a topic for later, after you get your initial code working. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message