Questions about exportfs
Hi Christoph,
Can you answer some questions about exportfs please?
(1) In linux/exportfs.h, the description of the encode_fh() op says that "encode_fh() should return the number of bytes stored or a negative error code such as %-ENOSPC".
This, however, contradicts export_encode_fh(), which returns a member of enum fid_type instead. I presume the docs are wrong, or at least, unclear.
(2) Why does exportfs_encode_fh() return the type of the FID? Why not embed it in the fid struct? It seems that the value has to be handed back to the decode routine.
(3) Is fat_encode_fh() allowed to return a value not in the fid_type enum?
David
Al Viro
maintainerQuoted 5 lines · David Howells
Hi Christoph,
Can you answer some questions about exportfs please?
Quoted 7 lines
(1) In
linux/exportfs.h, the description of theencode_fh()op says that "encode_fh()should return the number of bytes stored or a negative error code such as %-ENOSPC".This, however, contradicts
export_encode_fh(), which returns a member of enumfid_typeinstead. I presume the docs are wrong, or at least, unclear.
No negative error codes, just 255 (or anything that would give 255 when converted to u8, actually).
Quoted 3 lines
(2) Why does
exportfs_encode_fh()return the type of the FID? Why not embed it in the fid struct? It seems that the value has to be handed back to the decode routine.
Take a look at the struct nfs_fhbase_new in include/linux/nfsd/nfsfh.h; we have type information for all components in the beginning, packed together, instead of embedding each into its part of array.
Quoted 1 line
(3) Is
fat_encode_fh()allowed to return a value not in thefid_typeenum?
Yes. That enum is just a bunch of common encoding schemes. The values you are using are entirely[*] up to specific filesystem; these ones are just for common helper functions.
[*] other than "255 is reserved for encoding error"