Unverified Commit 58ecde96 authored by Christian Brauner's avatar Christian Brauner
Browse files

Merge patch series "exportfs: Some kernel-doc fixes"

André Almeida <andrealmeid@igalia.com> says:

This short series removes some duplicated documentation and address some
kernel-doc issues.

* patches from https://patch.msgid.link/20260112-tonyk-fs_uuid-v1-0-acc1889de772@igalia.com:
  docs: exportfs: Use source code struct documentation
  exportfs: Complete kernel-doc for struct export_operations
  exportfs: Mark struct export_operations functions at kernel-doc
  exportfs: Fix kernel-doc output for get_name()

Link: https://patch.msgid.link/20260112-tonyk-fs_uuid-v1-0-acc1889de772@igalia.com


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parents 589cff49 f9a6a3fe
Loading
Loading
Loading
Loading
+5 −37
Original line number Diff line number Diff line
@@ -119,43 +119,11 @@ For a filesystem to be exportable it must:

A file system implementation declares that instances of the filesystem
are exportable by setting the s_export_op field in the struct
super_block.  This field must point to a "struct export_operations"
struct which has the following members:

  encode_fh (mandatory)
    Takes a dentry and creates a filehandle fragment which may later be used
    to find or create a dentry for the same object.

  fh_to_dentry (mandatory)
    Given a filehandle fragment, this should find the implied object and
    create a dentry for it (possibly with d_obtain_alias).

  fh_to_parent (optional but strongly recommended)
    Given a filehandle fragment, this should find the parent of the
    implied object and create a dentry for it (possibly with
    d_obtain_alias).  May fail if the filehandle fragment is too small.

  get_parent (optional but strongly recommended)
    When given a dentry for a directory, this should return  a dentry for
    the parent.  Quite possibly the parent dentry will have been allocated
    by d_alloc_anon.  The default get_parent function just returns an error
    so any filehandle lookup that requires finding a parent will fail.
    ->lookup("..") is *not* used as a default as it can leave ".." entries
    in the dcache which are too messy to work with.

  get_name (optional)
    When given a parent dentry and a child dentry, this should find a name
    in the directory identified by the parent dentry, which leads to the
    object identified by the child dentry.  If no get_name function is
    supplied, a default implementation is provided which uses vfs_readdir
    to find potential names, and matches inode numbers to find the correct
    match.

  flags
    Some filesystems may need to be handled differently than others. The
    export_operations struct also includes a flags field that allows the
    filesystem to communicate such information to nfsd. See the Export
    Operations Flags section below for more explanation.
super_block.  This field must point to a struct export_operations
which has the following members:

.. kernel-doc:: include/linux/exportfs.h
   :identifiers: struct export_operations

A filehandle fragment consists of an array of 1 or more 4byte words,
together with a one byte "type".
+23 −10
Original line number Diff line number Diff line
@@ -201,9 +201,9 @@ struct handle_to_path_ctx {
 * @commit_metadata: commit metadata changes to stable storage
 *
 * See Documentation/filesystems/nfs/exporting.rst for details on how to use
 * this interface correctly.
 * this interface correctly and the definition of the flags.
 *
 * encode_fh:
 * @encode_fh:
 *    @encode_fh should store in the file handle fragment @fh (using at most
 *    @max_len bytes) information that can be used by @decode_fh to recover the
 *    file referred to by the &struct dentry @de.  If @flag has CONNECTABLE bit
@@ -215,7 +215,7 @@ struct handle_to_path_ctx {
 *    greater than @max_len*4 bytes). On error @max_len contains the minimum
 *    size(in 4 byte unit) needed to encode the file handle.
 *
 * fh_to_dentry:
 * @fh_to_dentry:
 *    @fh_to_dentry is given a &struct super_block (@sb) and a file handle
 *    fragment (@fh, @fh_len). It should return a &struct dentry which refers
 *    to the same file that the file handle fragment refers to.  If it cannot,
@@ -227,31 +227,44 @@ struct handle_to_path_ctx {
 *    created with d_alloc_root.  The caller can then find any other extant
 *    dentries by following the d_alias links.
 *
 * fh_to_parent:
 * @fh_to_parent:
 *    Same as @fh_to_dentry, except that it returns a pointer to the parent
 *    dentry if it was encoded into the filehandle fragment by @encode_fh.
 *
 * get_name:
 * @get_name:
 *    @get_name should find a name for the given @child in the given @parent
 *    directory.  The name should be stored in the @name (with the
 *    understanding that it is already pointing to a %NAME_MAX + 1 sized
 *    buffer.   get_name() should return %0 on success, a negative error code
 *    or error.  @get_name will be called without @parent->i_rwsem held.
 *
 * get_parent:
 * @get_parent:
 *    @get_parent should find the parent directory for the given @child which
 *    is also a directory.  In the event that it cannot be found, or storage
 *    space cannot be allocated, a %ERR_PTR should be returned.
 *
 * permission:
 * @permission:
 *    Allow filesystems to specify a custom permission function.
 *
 * open:
 * @open:
 *    Allow filesystems to specify a custom open function.
 *
 * commit_metadata:
 * @commit_metadata:
 *    @commit_metadata should commit metadata changes to stable storage.
 *
 * @get_uuid:
 *    Get a filesystem unique signature exposed to clients.
 *
 * @map_blocks:
 *    Map and, if necessary, allocate blocks for a layout.
 *
 * @commit_blocks:
 *    Commit blocks in a layout once the client is done with them.
 *
 * @flags:
 *    Allows the filesystem to communicate to nfsd that it may want to do things
 *    differently when dealing with it.
 *
 * Locking rules:
 *    get_parent is called with child->d_inode->i_rwsem down
 *    get_name is not (which is possibly inconsistent)