Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Dec 1999 21:13:56 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Wes Peters <wes@softweyr.com>, Randell Jesup <rjesup@wgate.com>
Cc:        Robert Watson <robert@cyrus.watson.org>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Portable way to compare struct stat's?
Message-ID:  <v04210100b46cd2f23ff6@[128.113.24.47]>
In-Reply-To: <3845712D.F4D51A70@softweyr.com>
References:  <ybu4se3lomv.fsf@jesup.eng.tvol.net.jesup.eng.tvol.net> <3845712D.F4D51A70@softweyr.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?v04210100b46cd2f23ff6>