Subject: [nfsv4] Follow-up on SEEK

From: "Haynes, Tom" <[email-masked]>
Date: Thu, 29 Dec 2011 18:32:48 +0000

Given the XDR at the end of this message, the following examples show SEEK in use:

1) Find the next hole starting at location 24k:

SEEK(s, 24k, 2)

2) Find the next data starting at location 35k:

SEEK(s, 35k, 0)

The resulting hole or ADB must be returned in the entirety, so if the hole in
example 2 started at 32k, then the result would reflect that.

If the server could not find a corresponding sa_what, then the status
would still be NFS4_OK, but sr_eof would be TRUE. The sr_contents
would contain a zero-ed out content of the appropriate type.

   /// /*
   ///  * Use an enum such that we can extend new types.
   ///  */
   /// enum data_content4 {
   ///         NFS4_CONTENT_DATA = 0,
   ///         NFS4_CONTENT_APP_BLOCK = 1,
   ///         NFS4_CONTENT_HOLE = 2
   /// };

...

   /// struct SEEK4args {
   ///         /* CURRENT_FH: file */
   ///         stateid4        sa_stateid;
   ///         offset4         sa_offset;
   ///         data_content4   sa_what;
   /// };
   ///
   /// union seek_content switch (data_content4 content) {
   /// case NFS4_CONTENT_DATA:
   ///         data_info4      sc_data;
   /// case NFS4_CONTENT_APP_BLOCK:
   ///         app_data_block4 sc_block;
   /// case NFS4_CONTENT_HOLE:
   ///         data_info4      sc_hole;
   /// default:
   ///         void;
   /// };
   ///
   /// struct seek_res4 {
   ///         bool                    sr_eof;
   ///         seek_content            sr_contents;
   /// };
   ///
   /// union SEEK4res switch (nfsstat4 status) {
   /// case NFS4_OK:
   ///         seek_res4       resok4;
   /// default:
   ///         void;
   /// };