From owner-freebsd-hackers Thu Dec 2 18: 9:15 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.100.7]) by hub.freebsd.org (Postfix) with ESMTP id EFE0114CF4 for ; Thu, 2 Dec 1999 18:09:10 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.9.3/8.9.3) with ESMTP id VAA34700; Thu, 2 Dec 1999 21:08:14 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <3845712D.F4D51A70@softweyr.com> References: <3845712D.F4D51A70@softweyr.com> Date: Thu, 2 Dec 1999 21:13:56 -0500 To: Wes Peters , Randell Jesup From: Garance A Drosihn Subject: Re: Portable way to compare struct stat's? Cc: Robert Watson , freebsd-hackers@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 12:04 PM -0700 12/1/99, Wes Peters wrote: > > >> On a single system, if st_dev and st_ino are equal, you must be > > >> referring to the same object. If not, I'd like to hear about it. > > > > > >This assumption has always caused lots of pain and suffering for > > >distributed file system people -- in a distributed file system, the > > >requirement that you can generate a unique 32 bit number for each file > > >or directory visible in the FS is a fairly arduous one. Either... > >Perhaps we simply need to expand the size of ino_t and carefully convert >smaller types to it in the stat call? In the case of AFS, I think you'd want to expand the size of st_dev. All files in an AFS volume are "one device", I would think. If the "device" is gone (ie, the volume is not mounted), then all files in that "device" (volume) will not be available. I don't know what would be best for other distributed file systems, though. Maybe both variables would have to increase in size. Maybe we should start by creating an "fcompare()" routine, which you'd pass two file descriptors to and it would say if they're the same file. Initially that routine could just do two fstat()'s, and compare st_dev and st_ino. We could then expand it to do better comparisons for other file-systems. That's only a partial solution, of course, but I imagine it would be pretty tricky to change the field-sizes for st_dev and st_ino in the stat structure without breaking lots of things... --- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or drosih@rpi.edu Rensselaer Polytechnic Institute To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message