Date: Thu, 18 Nov 1999 18:56:11 -0800 (PST) From: John Polstra <jdp@polstra.com> To: Garance A Drosihn <drosih@rpi.edu> Cc: hackers@FreeBSD.ORG Subject: Re: Portable way to compare struct stat's? Message-ID: <XFMail.991118185611.jdp@polstra.com> In-Reply-To: <v04210102b45a48b3b0aa@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
Garance A Drosihn wrote: > At 10:40 AM -0800 11/18/99, John Polstra wrote: >>I don't dispute that point, but it is worth mentioning that POSIX >>specifically guarantees that st_dev and st_ino "taken together >>uniquely identify the file within the system." So it is OK for >>applications to rely on that. > > Given how many people have files mounted from foreign file systems, > I would think that applications should not rely on that. Sure, it's > a nice guarantee for a completely stand-alone system, but a "general > purpose" application should consider that it may be dealing with > files in NFS, AFS, or some other file system, and plan accordingly. We must be interpreting the requirement differently, because it doesn't seem onerous at all to me. The st_dev value needn't be the same on two different hosts which both mount the same filesystem. I also doubt that the requirement has to hold across remounts. Under that interpretation, it's simple to meet the requirement. Just create a locally-unique st_dev value whenever you mount a filesystem, and if the filesystem is remote then record a mapping between (remote hostname, remote host's idea of the "device") and the local st_dev value. (I've never used AFS, so I may be missing something crucial here.) > If the program is only for you in your organization, then the > POSIX promise is helpful. If you're sending the code off to "the > world", then you should not rely on that posix promise. Just my own > opinion, of course. Well, the POSIX requirement isn't optional. If a system doesn't meet it then it is not POSIX-compliant. So any application that is targeted toward POSIX systems is perfectly within its rights to rely on the requirement. John --- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "No matter how cynical I get, I just can't keep up." -- Nora Ephron 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?XFMail.991118185611.jdp>