Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logic of name_to_handle_at()

I am not getting much information on the new system call name_to_handle_at() and open_to_handle_at(). Can anyone help me out here.

Thanks

An Edit. I just have this

http://comments.gmane.org/gmane.linux.man/2158

like image 343
Lipika Deka Avatar asked Sep 01 '25 01:09

Lipika Deka


1 Answers

These functions are useful for writing user space servers.

For example, when implementing the NFS protocol, which does not have the 'open' concept, or a file descriptor, but instead relies on a persistent file identifier, the name_to_handle_at function can be used to generate this persistent handle in a portable way.

It then gets sent to the client, which will return it back to the server at a later point. The server can then use open_to_handle_at to perform the operation.

One could ask how this is better than simply sending the full path name between client and server. A number of options:

  • The file system can use internal (more compact) representations instead of the file name (for example based on inode).
  • When going from the handle to file descriptor, potentially less work needs to be done. (no more path traversal)
  • In the scenario given above, resource consumption on the server is reduced (no need to keep track of open file descriptors on the server side)
like image 68
Dries K. Avatar answered Sep 02 '25 15:09

Dries K.