Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!gatech!udel!princeton!phoenix.Princeton.EDU!subbarao From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Newsgroups: comp.unix.shell Subject: Re: NFS File identity resolution? Message-ID: <7169@idunno.Princeton.EDU> Date: 14 Mar 91 16:22:41 GMT References: <21078@shlump.nac.dec.com> Sender: news@idunno.Princeton.EDU Lines: 29 In article <21078@shlump.nac.dec.com> prakash@aiag.enet.dec.com writes: >-- > >Given a set of NFS servers and clients on the same network, and two >processes A and B on possibly different nodes, which can communicate >using sockets. How can the two processes determine if a file referred to >as "/a/b/c/file" by process A is really the file referred to as "/A/B/file" >by the process B? In other words, on the node of the process A, "/a/c/b" >could be mounted on X:/server/dir, and on the node of process B, "/A/B" >could be mounted on X:/server/dir. It is therefore not enough to compare >the directory parts alone. One must be able to determine which server >the file is coming from. [Essentially what the define command does, but >I want to do it from C]. You can stat() both files, and compare the inodes and see if they're the same. This would only be a problem, I would guess, if the two files had the exact same inode number but in fact came from two different disks. Of course, you could do a simple popen() to df, chop out the right field, and make sure that they're the same. This would confirm that they were mounted on the same place. -Kartik -- internet# find . -name core -exec cat {} \; |& tee /dev/tty* subbarao@phoenix.Princeton.EDU -| Internet kartik@silvertone.Princeton.EDU (NeXT mail) SUBBARAO@PUCC.BITNET - Bitnet