1

If I open a file in my C/C++/Java code using a pathname that goes to an nfs directory, how the does the read and write syntax work with NFS being stateless and all? I have tried but cant find an example code accessing NFS mounted files. My current understanding is that it is the job of the NFS client to keep state (like read and write pointer) and the application uses the same syntax.

A related question is regarding VFS and UFS. Are all files in a current unix machine accessed through their vnodes first and then (depending on local vs remote) inode or rnode structures?

intiha
  • 319
  • 1
  • 3
  • 13

1 Answers1

1

NFS (short of file locking) is no different than local storage to user-level applications. It might be slower, or it might drop out unexpectedly, but that can happen to local storage too. That's probably why you can't find specific NFS-centric example code.

user
  • 6,897
  • 8
  • 43
  • 79
  • that is what I thought, but I wanted to confirm. That means that the nfsclient is responsible for keeping state and making it look like we are accessing through a stateful system call. – intiha Feb 17 '11 at 05:31
  • Just as a note: NFS can have file locking with extensions. NFS 4.0 and 4.1 have of cource file locking. – dmeister Mar 25 '11 at 07:51