hsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget)/translations/zh_CN/filesystems/mount_apimodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/zh_TW/filesystems/mount_apimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/it_IT/filesystems/mount_apimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/ja_JP/filesystems/mount_apimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/ko_KR/filesystems/mount_apimodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget)/translations/sp_SP/filesystems/mount_apimodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhC/var/lib/git/docbuild/linux/Documentation/filesystems/mount_api.rsthKubhsection)}(hhh](htitle)}(hFilesystem Mount APIh]hFilesystem Mount API}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hCONTENTS (1) Overview. (2) The filesystem context. (3) The filesystem context operations. (4) Filesystem context security. (5) VFS filesystem context API. (6) Superblock creation helpers. (7) Parameter description. (8) Parameter helper functions.h]hCONTENTS (1) Overview. (2) The filesystem context. (3) The filesystem context operations. (4) Filesystem context security. (5) VFS filesystem context API. (6) Superblock creation helpers. (7) Parameter description. (8) Parameter helper functions.}hhsbah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubh)}(hhh](h)}(hOverviewh]hOverview}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hDThe creation of new mounts is now to be done in a multistep process:h]hDThe creation of new mounts is now to be done in a multistep process:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh block_quote)}(hX(1) Create a filesystem context. (2) Parse the parameters and attach them to the context. Parameters are expected to be passed individually from userspace, though legacy binary parameters can also be handled. (3) Validate and pre-process the context. (4) Get or create a superblock and mountable root. (5) Perform the mount. (6) Return an error message attached to the context. (7) Destroy the context. h]henumerated_list)}(hhh](h list_item)}(hCreate a filesystem context. h]h)}(hCreate a filesystem context.h]hCreate a filesystem context.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hParse the parameters and attach them to the context. Parameters are expected to be passed individually from userspace, though legacy binary parameters can also be handled. h]h)}(hParse the parameters and attach them to the context. Parameters are expected to be passed individually from userspace, though legacy binary parameters can also be handled.h]hParse the parameters and attach them to the context. Parameters are expected to be passed individually from userspace, though legacy binary parameters can also be handled.}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h&Validate and pre-process the context. h]h)}(h%Validate and pre-process the context.h]h%Validate and pre-process the context.}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hj5ubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h/Get or create a superblock and mountable root. h]h)}(h.Get or create a superblock and mountable root.h]h.Get or create a superblock and mountable root.}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hjMubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hPerform the mount. h]h)}(hPerform the mount.h]hPerform the mount.}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK)hjeubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h1Return an error message attached to the context. h]h)}(h0Return an error message attached to the context.h]h0Return an error message attached to the context.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK+hj}ubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hDestroy the context. h]h)}(hDestroy the context.h]hDestroy the context.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]enumtypearabicprefix(suffix)uh1hhhubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hCTo support this, the file_system_type struct gains two new fields::h]hBTo support this, the file_system_type struct gains two new fields:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hhhhubh literal_block)}(haint (*init_fs_context)(struct fs_context *fc); const struct fs_parameter_description *parameters;h]haint (*init_fs_context)(struct fs_context *fc); const struct fs_parameter_description *parameters;}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK1hhhhubh)}(hThe first is invoked to set up the filesystem-specific parts of a filesystem context, including the additional space, and the second points to the parameter description for validation at registration time and querying by a future system call.h]hThe first is invoked to set up the filesystem-specific parts of a filesystem context, including the additional space, and the second points to the parameter description for validation at registration time and querying by a future system call.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hhhhubh)}(hxNote that security initialisation is done *after* the filesystem is called so that the namespaces may be adjusted first.h](h*Note that security initialisation is done }(hjhhhNhNubhemphasis)}(h*after*h]hafter}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhG the filesystem is called so that the namespaces may be adjusted first.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK9hhhhubeh}(h]overviewah ]h"]overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hThe Filesystem contexth]hThe Filesystem context}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK>ubh)}(hThe creation and reconfiguration of a superblock is governed by a filesystem context. This is represented by the fs_context structure::h]hThe creation and reconfiguration of a superblock is governed by a filesystem context. This is represented by the fs_context structure:}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK@hjhhubj)}(hXstruct fs_context { const struct fs_context_operations *ops; struct file_system_type *fs_type; void *fs_private; struct dentry *root; struct user_namespace *user_ns; struct net *net_ns; const struct cred *cred; char *source; char *subtype; void *security; void *s_fs_info; unsigned int sb_flags; unsigned int sb_flags_mask; unsigned int s_iflags; enum fs_context_purpose purpose:8; ... };h]hXstruct fs_context { const struct fs_context_operations *ops; struct file_system_type *fs_type; void *fs_private; struct dentry *root; struct user_namespace *user_ns; struct net *net_ns; const struct cred *cred; char *source; char *subtype; void *security; void *s_fs_info; unsigned int sb_flags; unsigned int sb_flags_mask; unsigned int s_iflags; enum fs_context_purpose purpose:8; ... };}hj4sbah}(h]h ]h"]h$]h&]hhuh1jhhhKChjhhubh)}(h%The fs_context fields are as follows:h]h%The fs_context fields are as follows:}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhjhhubh)}(hX? * :: const struct fs_context_operations *ops These are operations that can be done on a filesystem context (see below). This must be set by the ->init_fs_context() file_system_type operation. * :: struct file_system_type *fs_type A pointer to the file_system_type of the filesystem that is being constructed or reconfigured. This retains a reference on the type owner. * :: void *fs_private A pointer to the file system's private data. This is where the filesystem will need to store any options it parses. * :: struct dentry *root A pointer to the root of the mountable tree (and indirectly, the superblock thereof). This is filled in by the ->get_tree() op. If this is set, an active reference on root->d_sb must also be held. * :: struct user_namespace *user_ns struct net *net_ns There are a subset of the namespaces in use by the invoking process. They retain references on each namespace. The subscribed namespaces may be replaced by the filesystem to reflect other sources, such as the parent mount superblock on an automount. * :: const struct cred *cred The mounter's credentials. This retains a reference on the credentials. * :: char *source This specifies the source. It may be a block device (e.g. /dev/sda1) or something more exotic, such as the "host:/path" that NFS desires. * :: char *subtype This is a string to be added to the type displayed in /proc/mounts to qualify it (used by FUSE). This is available for the filesystem to set if desired. * :: void *security A place for the LSMs to hang their security data for the superblock. The relevant security operations are described below. * :: void *s_fs_info The proposed s_fs_info for a new superblock, set in the superblock by sget_fc(). This can be used to distinguish superblocks. * :: unsigned int sb_flags unsigned int sb_flags_mask Which bits SB_* flags are to be set/cleared in super_block::s_flags. * :: unsigned int s_iflags These will be bitwise-OR'd with s->s_iflags when a superblock is created. * :: enum fs_context_purpose This indicates the purpose for which the context is intended. The available values are: ========================== ====================================== FS_CONTEXT_FOR_MOUNT, New superblock for explicit mount FS_CONTEXT_FOR_SUBMOUNT New automatic submount of extant mount FS_CONTEXT_FOR_RECONFIGURE Change an existing mount ========================== ====================================== h]h bullet_list)}(hhh](j)}(h:: const struct fs_context_operations *ops These are operations that can be done on a filesystem context (see below). This must be set by the ->init_fs_context() file_system_type operation. h](j)}(h'const struct fs_context_operations *opsh]h'const struct fs_context_operations *ops}hj]sbah}(h]h ]h"]h$]h&]hhuh1jhhhKZhjYubh)}(hThese are operations that can be done on a filesystem context (see below). This must be set by the ->init_fs_context() file_system_type operation.h]hThese are operations that can be done on a filesystem context (see below). This must be set by the ->init_fs_context() file_system_type operation.}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hjYubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(h:: struct file_system_type *fs_type A pointer to the file_system_type of the filesystem that is being constructed or reconfigured. This retains a reference on the type owner. h](j)}(h struct file_system_type *fs_typeh]h struct file_system_type *fs_type}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKbhjubh)}(hA pointer to the file_system_type of the filesystem that is being constructed or reconfigured. This retains a reference on the type owner.h]hA pointer to the file_system_type of the filesystem that is being constructed or reconfigured. This retains a reference on the type owner.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKdhjubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(h:: void *fs_private A pointer to the file system's private data. This is where the filesystem will need to store any options it parses. h](j)}(hvoid *fs_privateh]hvoid *fs_private}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKihjubh)}(htA pointer to the file system's private data. This is where the filesystem will need to store any options it parses.h]hvA pointer to the file system’s private data. This is where the filesystem will need to store any options it parses.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKkhjubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(h:: struct dentry *root A pointer to the root of the mountable tree (and indirectly, the superblock thereof). This is filled in by the ->get_tree() op. If this is set, an active reference on root->d_sb must also be held. h](j)}(hstruct dentry *rooth]hstruct dentry *root}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKphjubh)}(hA pointer to the root of the mountable tree (and indirectly, the superblock thereof). This is filled in by the ->get_tree() op. If this is set, an active reference on root->d_sb must also be held.h]hA pointer to the root of the mountable tree (and indirectly, the superblock thereof). This is filled in by the ->get_tree() op. If this is set, an active reference on root->d_sb must also be held.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKrhjubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(hX7:: struct user_namespace *user_ns struct net *net_ns There are a subset of the namespaces in use by the invoking process. They retain references on each namespace. The subscribed namespaces may be replaced by the filesystem to reflect other sources, such as the parent mount superblock on an automount. h](j)}(h1struct user_namespace *user_ns struct net *net_nsh]h1struct user_namespace *user_ns struct net *net_ns}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKxhjubh)}(hThere are a subset of the namespaces in use by the invoking process. They retain references on each namespace. The subscribed namespaces may be replaced by the filesystem to reflect other sources, such as the parent mount superblock on an automount.h]hThere are a subset of the namespaces in use by the invoking process. They retain references on each namespace. The subscribed namespaces may be replaced by the filesystem to reflect other sources, such as the parent mount superblock on an automount.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK{hjubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(hh:: const struct cred *cred The mounter's credentials. This retains a reference on the credentials. h](j)}(hconst struct cred *credh]hconst struct cred *cred}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(hHThe mounter's credentials. This retains a reference on the credentials.h]hJThe mounter’s credentials. This retains a reference on the credentials.}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(h:: char *source This specifies the source. It may be a block device (e.g. /dev/sda1) or something more exotic, such as the "host:/path" that NFS desires. h](j)}(h char *sourceh]h char *source}hjAsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj=ubh)}(hThis specifies the source. It may be a block device (e.g. /dev/sda1) or something more exotic, such as the "host:/path" that NFS desires.h]hThis specifies the source. It may be a block device (e.g. /dev/sda1) or something more exotic, such as the “host:/path” that NFS desires.}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj=ubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(h:: char *subtype This is a string to be added to the type displayed in /proc/mounts to qualify it (used by FUSE). This is available for the filesystem to set if desired. h](j)}(h char *subtypeh]h char *subtype}hjgsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjcubh)}(hThis is a string to be added to the type displayed in /proc/mounts to qualify it (used by FUSE). This is available for the filesystem to set if desired.h]hThis is a string to be added to the type displayed in /proc/mounts to qualify it (used by FUSE). This is available for the filesystem to set if desired.}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjcubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(h:: void *security A place for the LSMs to hang their security data for the superblock. The relevant security operations are described below. h](j)}(hvoid *securityh]hvoid *security}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(h{A place for the LSMs to hang their security data for the superblock. The relevant security operations are described below.h]h{A place for the LSMs to hang their security data for the superblock. The relevant security operations are described below.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(h:: void *s_fs_info The proposed s_fs_info for a new superblock, set in the superblock by sget_fc(). This can be used to distinguish superblocks. h](j)}(hvoid *s_fs_infoh]hvoid *s_fs_info}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(h~The proposed s_fs_info for a new superblock, set in the superblock by sget_fc(). This can be used to distinguish superblocks.h]h~The proposed s_fs_info for a new superblock, set in the superblock by sget_fc(). This can be used to distinguish superblocks.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(h:: unsigned int sb_flags unsigned int sb_flags_mask Which bits SB_* flags are to be set/cleared in super_block::s_flags. h](j)}(h0unsigned int sb_flags unsigned int sb_flags_maskh]h0unsigned int sb_flags unsigned int sb_flags_mask}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(hDWhich bits SB_* flags are to be set/cleared in super_block::s_flags.h]hDWhich bits SB_* flags are to be set/cleared in super_block::s_flags.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(hg:: unsigned int s_iflags These will be bitwise-OR'd with s->s_iflags when a superblock is created. h](j)}(hunsigned int s_iflagsh]hunsigned int s_iflags}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(hIThese will be bitwise-OR'd with s->s_iflags when a superblock is created.h]hKThese will be bitwise-OR’d with s->s_iflags when a superblock is created.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjVubj)}(hX:: enum fs_context_purpose This indicates the purpose for which the context is intended. The available values are: ========================== ====================================== FS_CONTEXT_FOR_MOUNT, New superblock for explicit mount FS_CONTEXT_FOR_SUBMOUNT New automatic submount of extant mount FS_CONTEXT_FOR_RECONFIGURE Change an existing mount ========================== ====================================== h](j)}(henum fs_context_purposeh]henum fs_context_purpose}hj%sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj!ubh)}(hXThis indicates the purpose for which the context is intended. The available values are:h]hXThis indicates the purpose for which the context is intended. The available values are:}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj!ubh)}(hXP========================== ====================================== FS_CONTEXT_FOR_MOUNT, New superblock for explicit mount FS_CONTEXT_FOR_SUBMOUNT New automatic submount of extant mount FS_CONTEXT_FOR_RECONFIGURE Change an existing mount ========================== ====================================== h]htable)}(hhh]htgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jOhjLubjP)}(hhh]h}(h]h ]h"]h$]h&]colwidthK&uh1jOhjLubhtbody)}(hhh](hrow)}(hhh](hentry)}(hhh]h)}(hFS_CONTEXT_FOR_MOUNT,h]hFS_CONTEXT_FOR_MOUNT,}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjqubah}(h]h ]h"]h$]h&]uh1johjlubjp)}(hhh]h)}(h!New superblock for explicit mounth]h!New superblock for explicit mount}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1johjlubeh}(h]h ]h"]h$]h&]uh1jjhjgubjk)}(hhh](jp)}(hhh]h)}(hFS_CONTEXT_FOR_SUBMOUNTh]hFS_CONTEXT_FOR_SUBMOUNT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h&New automatic submount of extant mounth]h&New automatic submount of extant mount}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjgubjk)}(hhh](jp)}(hhh]h)}(hFS_CONTEXT_FOR_RECONFIGUREh]hFS_CONTEXT_FOR_RECONFIGURE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hChange an existing mounth]hChange an existing mount}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjgubeh}(h]h ]h"]h$]h&]uh1jehjLubeh}(h]h ]h"]h$]h&]colsKuh1jJhjGubah}(h]h ]h"]h$]h&]uh1jEhjAubah}(h]h ]h"]h$]h&]uh1hhhhKhj!ubeh}(h]h ]h"]h$]h&]uh1jhjVubeh}(h]h ]h"]h$]h&]bullet*uh1jThhhKXhjPubah}(h]h ]h"]h$]h&]uh1hhhhKXhjhhubh)}(hThe mount context is created by calling vfs_new_fs_context() or vfs_dup_fs_context() and is destroyed with put_fs_context(). Note that the structure is not refcounted.h]hThe mount context is created by calling vfs_new_fs_context() or vfs_dup_fs_context() and is destroyed with put_fs_context(). Note that the structure is not refcounted.}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hVFS, security and filesystem mount options are set individually with vfs_parse_mount_option(). Options provided by the old mount(2) system call as a page of data can be parsed with generic_parse_monolithic().h]hVFS, security and filesystem mount options are set individually with vfs_parse_mount_option(). Options provided by the old mount(2) system call as a page of data can be parsed with generic_parse_monolithic().}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hWhen mounting, the filesystem is allowed to take data from any of the pointers and attach it to the superblock (or whatever), provided it clears the pointer in the mount context.h]hWhen mounting, the filesystem is allowed to take data from any of the pointers and attach it to the superblock (or whatever), provided it clears the pointer in the mount context.}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hThe filesystem is also allowed to allocate resources and pin them with the mount context. For instance, NFS might pin the appropriate protocol version module.h]hThe filesystem is also allowed to allocate resources and pin them with the mount context. For instance, NFS might pin the appropriate protocol version module.}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]the-filesystem-contextah ]h"]the filesystem contextah$]h&]uh1hhhhhhhhK>ubh)}(hhh](h)}(h!The Filesystem Context Operationsh]h!The Filesystem Context Operations}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(h8The filesystem context points to a table of operations::h]h7The filesystem context points to a table of operations:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hXstruct fs_context_operations { void (*free)(struct fs_context *fc); int (*dup)(struct fs_context *fc, struct fs_context *src_fc); int (*parse_param)(struct fs_context *fc, struct fs_parameter *param); int (*parse_monolithic)(struct fs_context *fc, void *data); int (*get_tree)(struct fs_context *fc); int (*reconfigure)(struct fs_context *fc); };h]hXstruct fs_context_operations { void (*free)(struct fs_context *fc); int (*dup)(struct fs_context *fc, struct fs_context *src_fc); int (*parse_param)(struct fs_context *fc, struct fs_parameter *param); int (*parse_monolithic)(struct fs_context *fc, void *data); int (*get_tree)(struct fs_context *fc); int (*reconfigure)(struct fs_context *fc); };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hThese operations are invoked by the various stages of the mount procedure to manage the filesystem context. They are as follows:h]hThese operations are invoked by the various stages of the mount procedure to manage the filesystem context. They are as follows:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXI * :: void (*free)(struct fs_context *fc); Called to clean up the filesystem-specific part of the filesystem context when the context is destroyed. It should be aware that parts of the context may have been removed and NULL'd out by ->get_tree(). * :: int (*dup)(struct fs_context *fc, struct fs_context *src_fc); Called when a filesystem context has been duplicated to duplicate the filesystem-private data. An error may be returned to indicate failure to do this. .. Warning:: Note that even if this fails, put_fs_context() will be called immediately thereafter, so ->dup() *must* make the filesystem-private data safe for ->free(). * :: int (*parse_param)(struct fs_context *fc, struct fs_parameter *param); Called when a parameter is being added to the filesystem context. param points to the key name and maybe a value object. VFS-specific options will have been weeded out and fc->sb_flags updated in the context. Security options will also have been weeded out and fc->security updated. The parameter can be parsed with fs_parse() and fs_lookup_param(). Note that the source(s) are presented as parameters named "source". If successful, 0 should be returned or a negative error code otherwise. * :: int (*parse_monolithic)(struct fs_context *fc, void *data); Called when the mount(2) system call is invoked to pass the entire data page in one go. If this is expected to be just a list of "key[=val]" items separated by commas, then this may be set to NULL. The return value is as for ->parse_param(). If the filesystem (e.g. NFS) needs to examine the data first and then finds it's the standard key-val list then it may pass it off to generic_parse_monolithic(). * :: int (*get_tree)(struct fs_context *fc); Called to get or create the mountable root and superblock, using the information stored in the filesystem context (reconfiguration goes via a different vector). It may detach any resources it desires from the filesystem context and transfer them to the superblock it creates. On success it should set fc->root to the mountable root and return 0. In the case of an error, it should return a negative error code. The phase on a userspace-driven context will be set to only allow this to be called once on any particular context. * :: int (*reconfigure)(struct fs_context *fc); Called to effect reconfiguration of a superblock using information stored in the filesystem context. It may detach any resources it desires from the filesystem context and transfer them to the superblock. The superblock can be found from fc->root->d_sb. On success it should return 0. In the case of an error, it should return a negative error code. .. Note:: reconfigure is intended as a replacement for remount_fs. h]jU)}(hhh](j)}(h:: void (*free)(struct fs_context *fc); Called to clean up the filesystem-specific part of the filesystem context when the context is destroyed. It should be aware that parts of the context may have been removed and NULL'd out by ->get_tree(). h](j)}(h$void (*free)(struct fs_context *fc);h]h$void (*free)(struct fs_context *fc);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(hCalled to clean up the filesystem-specific part of the filesystem context when the context is destroyed. It should be aware that parts of the context may have been removed and NULL'd out by ->get_tree().h]hCalled to clean up the filesystem-specific part of the filesystem context when the context is destroyed. It should be aware that parts of the context may have been removed and NULL’d out by ->get_tree().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX:: int (*dup)(struct fs_context *fc, struct fs_context *src_fc); Called when a filesystem context has been duplicated to duplicate the filesystem-private data. An error may be returned to indicate failure to do this. .. Warning:: Note that even if this fails, put_fs_context() will be called immediately thereafter, so ->dup() *must* make the filesystem-private data safe for ->free(). h](j)}(h=int (*dup)(struct fs_context *fc, struct fs_context *src_fc);h]h=int (*dup)(struct fs_context *fc, struct fs_context *src_fc);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubh)}(hCalled when a filesystem context has been duplicated to duplicate the filesystem-private data. An error may be returned to indicate failure to do this.h]hCalled when a filesystem context has been duplicated to duplicate the filesystem-private data. An error may be returned to indicate failure to do this.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubhwarning)}(hNote that even if this fails, put_fs_context() will be called immediately thereafter, so ->dup() *must* make the filesystem-private data safe for ->free().h]h)}(hNote that even if this fails, put_fs_context() will be called immediately thereafter, so ->dup() *must* make the filesystem-private data safe for ->free().h](haNote that even if this fails, put_fs_context() will be called immediately thereafter, so ->dup() }(hjhhhNhNubj)}(h*must*h]hmust}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh4 make the filesystem-private data safe for ->free().}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hXT:: int (*parse_param)(struct fs_context *fc, struct fs_parameter *param); Called when a parameter is being added to the filesystem context. param points to the key name and maybe a value object. VFS-specific options will have been weeded out and fc->sb_flags updated in the context. Security options will also have been weeded out and fc->security updated. The parameter can be parsed with fs_parse() and fs_lookup_param(). Note that the source(s) are presented as parameters named "source". If successful, 0 should be returned or a negative error code otherwise. h](j)}(hYint (*parse_param)(struct fs_context *fc, struct fs_parameter *param);h]hYint (*parse_param)(struct fs_context *fc, struct fs_parameter *param);}hj>sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj:ubh)}(hXCalled when a parameter is being added to the filesystem context. param points to the key name and maybe a value object. VFS-specific options will have been weeded out and fc->sb_flags updated in the context. Security options will also have been weeded out and fc->security updated.h]hXCalled when a parameter is being added to the filesystem context. param points to the key name and maybe a value object. VFS-specific options will have been weeded out and fc->sb_flags updated in the context. Security options will also have been weeded out and fc->security updated.}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:ubh)}(hThe parameter can be parsed with fs_parse() and fs_lookup_param(). Note that the source(s) are presented as parameters named "source".h]hThe parameter can be parsed with fs_parse() and fs_lookup_param(). Note that the source(s) are presented as parameters named “source”.}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj:ubh)}(hGIf successful, 0 should be returned or a negative error code otherwise.h]hGIf successful, 0 should be returned or a negative error code otherwise.}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj:ubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX:: int (*parse_monolithic)(struct fs_context *fc, void *data); Called when the mount(2) system call is invoked to pass the entire data page in one go. If this is expected to be just a list of "key[=val]" items separated by commas, then this may be set to NULL. The return value is as for ->parse_param(). If the filesystem (e.g. NFS) needs to examine the data first and then finds it's the standard key-val list then it may pass it off to generic_parse_monolithic(). h](j)}(h;int (*parse_monolithic)(struct fs_context *fc, void *data);h]h;int (*parse_monolithic)(struct fs_context *fc, void *data);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj|ubh)}(hCalled when the mount(2) system call is invoked to pass the entire data page in one go. If this is expected to be just a list of "key[=val]" items separated by commas, then this may be set to NULL.h]hCalled when the mount(2) system call is invoked to pass the entire data page in one go. If this is expected to be just a list of “key[=val]” items separated by commas, then this may be set to NULL.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj|ubh)}(h+The return value is as for ->parse_param().h]h+The return value is as for ->parse_param().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj|ubh)}(hIf the filesystem (e.g. NFS) needs to examine the data first and then finds it's the standard key-val list then it may pass it off to generic_parse_monolithic().h]hIf the filesystem (e.g. NFS) needs to examine the data first and then finds it’s the standard key-val list then it may pass it off to generic_parse_monolithic().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj|ubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hXC:: int (*get_tree)(struct fs_context *fc); Called to get or create the mountable root and superblock, using the information stored in the filesystem context (reconfiguration goes via a different vector). It may detach any resources it desires from the filesystem context and transfer them to the superblock it creates. On success it should set fc->root to the mountable root and return 0. In the case of an error, it should return a negative error code. The phase on a userspace-driven context will be set to only allow this to be called once on any particular context. h](j)}(h'int (*get_tree)(struct fs_context *fc);h]h'int (*get_tree)(struct fs_context *fc);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(hXCalled to get or create the mountable root and superblock, using the information stored in the filesystem context (reconfiguration goes via a different vector). It may detach any resources it desires from the filesystem context and transfer them to the superblock it creates.h]hXCalled to get or create the mountable root and superblock, using the information stored in the filesystem context (reconfiguration goes via a different vector). It may detach any resources it desires from the filesystem context and transfer them to the superblock it creates.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hOn success it should set fc->root to the mountable root and return 0. In the case of an error, it should return a negative error code.h]hOn success it should set fc->root to the mountable root and return 0. In the case of an error, it should return a negative error code.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hsThe phase on a userspace-driven context will be set to only allow this to be called once on any particular context.h]hsThe phase on a userspace-driven context will be set to only allow this to be called once on any particular context.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX:: int (*reconfigure)(struct fs_context *fc); Called to effect reconfiguration of a superblock using information stored in the filesystem context. It may detach any resources it desires from the filesystem context and transfer them to the superblock. The superblock can be found from fc->root->d_sb. On success it should return 0. In the case of an error, it should return a negative error code. .. Note:: reconfigure is intended as a replacement for remount_fs. h](j)}(h*int (*reconfigure)(struct fs_context *fc);h]h*int (*reconfigure)(struct fs_context *fc);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM$hjubh)}(hCalled to effect reconfiguration of a superblock using information stored in the filesystem context. It may detach any resources it desires from the filesystem context and transfer them to the superblock. The superblock can be found from fc->root->d_sb.h]hCalled to effect reconfiguration of a superblock using information stored in the filesystem context. It may detach any resources it desires from the filesystem context and transfer them to the superblock. The superblock can be found from fc->root->d_sb.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM&hjubh)}(h`On success it should return 0. In the case of an error, it should return a negative error code.h]h`On success it should return 0. In the case of an error, it should return a negative error code.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM+hjubhnote)}(h8reconfigure is intended as a replacement for remount_fs.h]h)}(hj2h]h8reconfigure is intended as a replacement for remount_fs.}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hj0ubah}(h]h ]h"]h$]h&]uh1j.hjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]j8j9uh1jThhhKhjubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]!the-filesystem-context-operationsah ]h"]!the filesystem context operationsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hFilesystem context Securityh]hFilesystem context Security}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjahhhhhM2ubh)}(hThe filesystem context contains a security pointer that the LSMs can use for building up a security context for the superblock to be mounted. There are a number of operations used by the new mount code for this purpose:h]hThe filesystem context contains a security pointer that the LSMs can use for building up a security context for the superblock to be mounted. There are a number of operations used by the new mount code for this purpose:}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hjahhubh)}(hX * :: int security_fs_context_alloc(struct fs_context *fc, struct dentry *reference); Called to initialise fc->security (which is preset to NULL) and allocate any resources needed. It should return 0 on success or a negative error code on failure. reference will be non-NULL if the context is being created for superblock reconfiguration (FS_CONTEXT_FOR_RECONFIGURE) in which case it indicates the root dentry of the superblock to be reconfigured. It will also be non-NULL in the case of a submount (FS_CONTEXT_FOR_SUBMOUNT) in which case it indicates the automount point. * :: int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc); Called to initialise fc->security (which is preset to NULL) and allocate any resources needed. The original filesystem context is pointed to by src_fc and may be used for reference. It should return 0 on success or a negative error code on failure. * :: void security_fs_context_free(struct fs_context *fc); Called to clean up anything attached to fc->security. Note that the contents may have been transferred to a superblock and the pointer cleared during get_tree. * :: int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param); Called for each mount parameter, including the source. The arguments are as for the ->parse_param() method. It should return 0 to indicate that the parameter should be passed on to the filesystem, 1 to indicate that the parameter should be discarded or an error to indicate that the parameter should be rejected. The value pointed to by param may be modified (if a string) or stolen (provided the value pointer is NULL'd out). If it is stolen, 1 must be returned to prevent it being passed to the filesystem. * :: int security_fs_context_validate(struct fs_context *fc); Called after all the options have been parsed to validate the collection as a whole and to do any necessary allocation so that security_sb_get_tree() and security_sb_reconfigure() are less likely to fail. It should return 0 or a negative error code. In the case of reconfiguration, the target superblock will be accessible via fc->root. * :: int security_sb_get_tree(struct fs_context *fc); Called during the mount procedure to verify that the specified superblock is allowed to be mounted and to transfer the security data there. It should return 0 or a negative error code. * :: void security_sb_reconfigure(struct fs_context *fc); Called to apply any reconfiguration to an LSM's context. It must not fail. Error checking and resource allocation must be done in advance by the parameter parsing and validation hooks. * :: int security_sb_mountpoint(struct fs_context *fc, struct path *mountpoint, unsigned int mnt_flags); Called during the mount procedure to verify that the root dentry attached to the context is permitted to be attached to the specified mountpoint. It should return 0 on success or a negative error code on failure. h]jU)}(hhh](j)}(hXc:: int security_fs_context_alloc(struct fs_context *fc, struct dentry *reference); Called to initialise fc->security (which is preset to NULL) and allocate any resources needed. It should return 0 on success or a negative error code on failure. reference will be non-NULL if the context is being created for superblock reconfiguration (FS_CONTEXT_FOR_RECONFIGURE) in which case it indicates the root dentry of the superblock to be reconfigured. It will also be non-NULL in the case of a submount (FS_CONTEXT_FOR_SUBMOUNT) in which case it indicates the automount point. h](j)}(hmint security_fs_context_alloc(struct fs_context *fc, struct dentry *reference);h]hmint security_fs_context_alloc(struct fs_context *fc, struct dentry *reference);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM:hjubh)}(hCalled to initialise fc->security (which is preset to NULL) and allocate any resources needed. It should return 0 on success or a negative error code on failure.h]hCalled to initialise fc->security (which is preset to NULL) and allocate any resources needed. It should return 0 on success or a negative error code on failure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM=hjubh)}(hXEreference will be non-NULL if the context is being created for superblock reconfiguration (FS_CONTEXT_FOR_RECONFIGURE) in which case it indicates the root dentry of the superblock to be reconfigured. It will also be non-NULL in the case of a submount (FS_CONTEXT_FOR_SUBMOUNT) in which case it indicates the automount point.h]hXEreference will be non-NULL if the context is being created for superblock reconfiguration (FS_CONTEXT_FOR_RECONFIGURE) in which case it indicates the root dentry of the superblock to be reconfigured. It will also be non-NULL in the case of a submount (FS_CONTEXT_FOR_SUBMOUNT) in which case it indicates the automount point.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hXq:: int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc); Called to initialise fc->security (which is preset to NULL) and allocate any resources needed. The original filesystem context is pointed to by src_fc and may be used for reference. It should return 0 on success or a negative error code on failure. h](j)}(hjint security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc);h]hjint security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMIhjubh)}(hCalled to initialise fc->security (which is preset to NULL) and allocate any resources needed. The original filesystem context is pointed to by src_fc and may be used for reference. It should return 0 on success or a negative error code on failure.h]hCalled to initialise fc->security (which is preset to NULL) and allocate any resources needed. The original filesystem context is pointed to by src_fc and may be used for reference. It should return 0 on success or a negative error code on failure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMLhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(h:: void security_fs_context_free(struct fs_context *fc); Called to clean up anything attached to fc->security. Note that the contents may have been transferred to a superblock and the pointer cleared during get_tree. h](j)}(h5void security_fs_context_free(struct fs_context *fc);h]h5void security_fs_context_free(struct fs_context *fc);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMShjubh)}(hCalled to clean up anything attached to fc->security. Note that the contents may have been transferred to a superblock and the pointer cleared during get_tree.h]hCalled to clean up anything attached to fc->security. Note that the contents may have been transferred to a superblock and the pointer cleared during get_tree.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMUhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX:: int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param); Called for each mount parameter, including the source. The arguments are as for the ->parse_param() method. It should return 0 to indicate that the parameter should be passed on to the filesystem, 1 to indicate that the parameter should be discarded or an error to indicate that the parameter should be rejected. The value pointed to by param may be modified (if a string) or stolen (provided the value pointer is NULL'd out). If it is stolen, 1 must be returned to prevent it being passed to the filesystem. h](j)}(h{int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param);h]h{int security_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param);}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhM[hjubh)}(hX:Called for each mount parameter, including the source. The arguments are as for the ->parse_param() method. It should return 0 to indicate that the parameter should be passed on to the filesystem, 1 to indicate that the parameter should be discarded or an error to indicate that the parameter should be rejected.h]hX:Called for each mount parameter, including the source. The arguments are as for the ->parse_param() method. It should return 0 to indicate that the parameter should be passed on to the filesystem, 1 to indicate that the parameter should be discarded or an error to indicate that the parameter should be rejected.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM^hjubh)}(hThe value pointed to by param may be modified (if a string) or stolen (provided the value pointer is NULL'd out). If it is stolen, 1 must be returned to prevent it being passed to the filesystem.h]hThe value pointed to by param may be modified (if a string) or stolen (provided the value pointer is NULL’d out). If it is stolen, 1 must be returned to prevent it being passed to the filesystem.}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMdhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX:: int security_fs_context_validate(struct fs_context *fc); Called after all the options have been parsed to validate the collection as a whole and to do any necessary allocation so that security_sb_get_tree() and security_sb_reconfigure() are less likely to fail. It should return 0 or a negative error code. In the case of reconfiguration, the target superblock will be accessible via fc->root. h](j)}(h8int security_fs_context_validate(struct fs_context *fc);h]h8int security_fs_context_validate(struct fs_context *fc);}hj?sbah}(h]h ]h"]h$]h&]hhuh1jhhhMjhj;ubh)}(hCalled after all the options have been parsed to validate the collection as a whole and to do any necessary allocation so that security_sb_get_tree() and security_sb_reconfigure() are less likely to fail. It should return 0 or a negative error code.h]hCalled after all the options have been parsed to validate the collection as a whole and to do any necessary allocation so that security_sb_get_tree() and security_sb_reconfigure() are less likely to fail. It should return 0 or a negative error code.}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMlhj;ubh)}(hVIn the case of reconfiguration, the target superblock will be accessible via fc->root.h]hVIn the case of reconfiguration, the target superblock will be accessible via fc->root.}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMqhj;ubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(h:: int security_sb_get_tree(struct fs_context *fc); Called during the mount procedure to verify that the specified superblock is allowed to be mounted and to transfer the security data there. It should return 0 or a negative error code. h](j)}(h0int security_sb_get_tree(struct fs_context *fc);h]h0int security_sb_get_tree(struct fs_context *fc);}hjssbah}(h]h ]h"]h$]h&]hhuh1jhhhMvhjoubh)}(hCalled during the mount procedure to verify that the specified superblock is allowed to be mounted and to transfer the security data there. It should return 0 or a negative error code.h]hCalled during the mount procedure to verify that the specified superblock is allowed to be mounted and to transfer the security data there. It should return 0 or a negative error code.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMxhjoubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(h:: void security_sb_reconfigure(struct fs_context *fc); Called to apply any reconfiguration to an LSM's context. It must not fail. Error checking and resource allocation must be done in advance by the parameter parsing and validation hooks. h](j)}(h4void security_sb_reconfigure(struct fs_context *fc);h]h4void security_sb_reconfigure(struct fs_context *fc);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM~hjubh)}(hCalled to apply any reconfiguration to an LSM's context. It must not fail. Error checking and resource allocation must be done in advance by the parameter parsing and validation hooks.h]hCalled to apply any reconfiguration to an LSM’s context. It must not fail. Error checking and resource allocation must be done in advance by the parameter parsing and validation hooks.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX~:: int security_sb_mountpoint(struct fs_context *fc, struct path *mountpoint, unsigned int mnt_flags); Called during the mount procedure to verify that the root dentry attached to the context is permitted to be attached to the specified mountpoint. It should return 0 on success or a negative error code on failure. h](j)}(hint security_sb_mountpoint(struct fs_context *fc, struct path *mountpoint, unsigned int mnt_flags);h]hint security_sb_mountpoint(struct fs_context *fc, struct path *mountpoint, unsigned int mnt_flags);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(hCalled during the mount procedure to verify that the root dentry attached to the context is permitted to be attached to the specified mountpoint. It should return 0 on success or a negative error code on failure.h]hCalled during the mount procedure to verify that the root dentry attached to the context is permitted to be attached to the specified mountpoint. It should return 0 on success or a negative error code on failure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]j8j9uh1jThhhM8hjubah}(h]h ]h"]h$]h&]uh1hhhhM8hjahhubeh}(h]filesystem-context-securityah ]h"]filesystem context securityah$]h&]uh1hhhhhhhhM2ubh)}(hhh](h)}(hVFS Filesystem context APIh]hVFS Filesystem context API}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(h]There are four operations for creating a filesystem context and one for destroying a context:h]h]There are four operations for creating a filesystem context and one for destroying a context:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXa * :: struct fs_context *fs_context_for_mount(struct file_system_type *fs_type, unsigned int sb_flags); Allocate a filesystem context for the purpose of setting up a new mount, whether that be with a new superblock or sharing an existing one. This sets the superblock flags, initialises the security and calls fs_type->init_fs_context() to initialise the filesystem private data. fs_type specifies the filesystem type that will manage the context and sb_flags presets the superblock flags stored therein. * :: struct fs_context *fs_context_for_reconfigure( struct dentry *dentry, unsigned int sb_flags, unsigned int sb_flags_mask); Allocate a filesystem context for the purpose of reconfiguring an existing superblock. dentry provides a reference to the superblock to be configured. sb_flags and sb_flags_mask indicate which superblock flags need changing and to what. * :: struct fs_context *fs_context_for_submount( struct file_system_type *fs_type, struct dentry *reference); Allocate a filesystem context for the purpose of creating a new mount for an automount point or other derived superblock. fs_type specifies the filesystem type that will manage the context and the reference dentry supplies the parameters. Namespaces are propagated from the reference dentry's superblock also. Note that it's not a requirement that the reference dentry be of the same filesystem type as fs_type. * :: struct fs_context *vfs_dup_fs_context(struct fs_context *src_fc); Duplicate a filesystem context, copying any options noted and duplicating or additionally referencing any resources held therein. This is available for use where a filesystem has to get a mount within a mount, such as NFS4 does by internally mounting the root of the target server and then doing a private pathwalk to the target directory. The purpose in the new context is inherited from the old one. * :: void put_fs_context(struct fs_context *fc); Destroy a filesystem context, releasing any resources it holds. This calls the ->free() operation. This is intended to be called by anyone who created a filesystem context. .. Warning:: filesystem contexts are not refcounted, so this causes unconditional destruction. h]jU)}(hhh](j)}(hX&:: struct fs_context *fs_context_for_mount(struct file_system_type *fs_type, unsigned int sb_flags); Allocate a filesystem context for the purpose of setting up a new mount, whether that be with a new superblock or sharing an existing one. This sets the superblock flags, initialises the security and calls fs_type->init_fs_context() to initialise the filesystem private data. fs_type specifies the filesystem type that will manage the context and sb_flags presets the superblock flags stored therein. h](j)}(hstruct fs_context *fs_context_for_mount(struct file_system_type *fs_type, unsigned int sb_flags);h]hstruct fs_context *fs_context_for_mount(struct file_system_type *fs_type, unsigned int sb_flags);}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubh)}(hXAllocate a filesystem context for the purpose of setting up a new mount, whether that be with a new superblock or sharing an existing one. This sets the superblock flags, initialises the security and calls fs_type->init_fs_context() to initialise the filesystem private data.h]hXAllocate a filesystem context for the purpose of setting up a new mount, whether that be with a new superblock or sharing an existing one. This sets the superblock flags, initialises the security and calls fs_type->init_fs_context() to initialise the filesystem private data.}(hj- hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(h|fs_type specifies the filesystem type that will manage the context and sb_flags presets the superblock flags stored therein.h]h|fs_type specifies the filesystem type that will manage the context and sb_flags presets the superblock flags stored therein.}(hj; hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubeh}(h]h ]h"]h$]h&]uh1jhj ubj)}(hX:: struct fs_context *fs_context_for_reconfigure( struct dentry *dentry, unsigned int sb_flags, unsigned int sb_flags_mask); Allocate a filesystem context for the purpose of reconfiguring an existing superblock. dentry provides a reference to the superblock to be configured. sb_flags and sb_flags_mask indicate which superblock flags need changing and to what. h](j)}(hstruct fs_context *fs_context_for_reconfigure( struct dentry *dentry, unsigned int sb_flags, unsigned int sb_flags_mask);h]hstruct fs_context *fs_context_for_reconfigure( struct dentry *dentry, unsigned int sb_flags, unsigned int sb_flags_mask);}hjS sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjO ubh)}(hAllocate a filesystem context for the purpose of reconfiguring an existing superblock. dentry provides a reference to the superblock to be configured. sb_flags and sb_flags_mask indicate which superblock flags need changing and to what.h]hAllocate a filesystem context for the purpose of reconfiguring an existing superblock. dentry provides a reference to the superblock to be configured. sb_flags and sb_flags_mask indicate which superblock flags need changing and to what.}(hja hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjO ubeh}(h]h ]h"]h$]h&]uh1jhj ubj)}(hX%:: struct fs_context *fs_context_for_submount( struct file_system_type *fs_type, struct dentry *reference); Allocate a filesystem context for the purpose of creating a new mount for an automount point or other derived superblock. fs_type specifies the filesystem type that will manage the context and the reference dentry supplies the parameters. Namespaces are propagated from the reference dentry's superblock also. Note that it's not a requirement that the reference dentry be of the same filesystem type as fs_type. h](j)}(hzstruct fs_context *fs_context_for_submount( struct file_system_type *fs_type, struct dentry *reference);h]hzstruct fs_context *fs_context_for_submount( struct file_system_type *fs_type, struct dentry *reference);}hjy sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhju ubh)}(hX7Allocate a filesystem context for the purpose of creating a new mount for an automount point or other derived superblock. fs_type specifies the filesystem type that will manage the context and the reference dentry supplies the parameters. Namespaces are propagated from the reference dentry's superblock also.h]hX9Allocate a filesystem context for the purpose of creating a new mount for an automount point or other derived superblock. fs_type specifies the filesystem type that will manage the context and the reference dentry supplies the parameters. Namespaces are propagated from the reference dentry’s superblock also.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhju ubh)}(heNote that it's not a requirement that the reference dentry be of the same filesystem type as fs_type.h]hgNote that it’s not a requirement that the reference dentry be of the same filesystem type as fs_type.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhju ubeh}(h]h ]h"]h$]h&]uh1jhj ubj)}(hX:: struct fs_context *vfs_dup_fs_context(struct fs_context *src_fc); Duplicate a filesystem context, copying any options noted and duplicating or additionally referencing any resources held therein. This is available for use where a filesystem has to get a mount within a mount, such as NFS4 does by internally mounting the root of the target server and then doing a private pathwalk to the target directory. The purpose in the new context is inherited from the old one. h](j)}(hAstruct fs_context *vfs_dup_fs_context(struct fs_context *src_fc);h]hAstruct fs_context *vfs_dup_fs_context(struct fs_context *src_fc);}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubh)}(hXTDuplicate a filesystem context, copying any options noted and duplicating or additionally referencing any resources held therein. This is available for use where a filesystem has to get a mount within a mount, such as NFS4 does by internally mounting the root of the target server and then doing a private pathwalk to the target directory.h]hXTDuplicate a filesystem context, copying any options noted and duplicating or additionally referencing any resources held therein. This is available for use where a filesystem has to get a mount within a mount, such as NFS4 does by internally mounting the root of the target server and then doing a private pathwalk to the target directory.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(h=The purpose in the new context is inherited from the old one.h]h=The purpose in the new context is inherited from the old one.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubeh}(h]h ]h"]h$]h&]uh1jhj ubj)}(hXI:: void put_fs_context(struct fs_context *fc); Destroy a filesystem context, releasing any resources it holds. This calls the ->free() operation. This is intended to be called by anyone who created a filesystem context. .. Warning:: filesystem contexts are not refcounted, so this causes unconditional destruction. h](j)}(h+void put_fs_context(struct fs_context *fc);h]h+void put_fs_context(struct fs_context *fc);}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubh)}(hDestroy a filesystem context, releasing any resources it holds. This calls the ->free() operation. This is intended to be called by anyone who created a filesystem context.h]hDestroy a filesystem context, releasing any resources it holds. This calls the ->free() operation. This is intended to be called by anyone who created a filesystem context.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubj )}(hQfilesystem contexts are not refcounted, so this causes unconditional destruction.h]h)}(hQfilesystem contexts are not refcounted, so this causes unconditional destruction.h]hQfilesystem contexts are not refcounted, so this causes unconditional destruction.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]j8j9uh1jThhhMhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hsIn all the above operations, apart from the put op, the return is a mount context pointer or a negative error code.h]hsIn all the above operations, apart from the put op, the return is a mount context pointer or a negative error code.}(hj' hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hYFor the remaining operations, if an error occurs, a negative error code will be returned.h]hYFor the remaining operations, if an error occurs, a negative error code will be returned.}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXJ * :: int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param); Supply a single mount parameter to the filesystem context. This includes the specification of the source/device which is specified as the "source" parameter (which may be specified multiple times if the filesystem supports that). param specifies the parameter key name and the value. The parameter is first checked to see if it corresponds to a standard mount flag (in which case it is used to set an SB_xxx flag and consumed) or a security option (in which case the LSM consumes it) before it is passed on to the filesystem. The parameter value is typed and can be one of: ==================== ============================= fs_value_is_flag Parameter not given a value fs_value_is_string Value is a string fs_value_is_blob Value is a binary blob fs_value_is_filename Value is a filename* + dirfd fs_value_is_file Value is an open file (file*) ==================== ============================= If there is a value, that value is stored in a union in the struct in one of param->{string,blob,name,file}. Note that the function may steal and clear the pointer, but then becomes responsible for disposing of the object. * :: int vfs_parse_fs_string(struct fs_context *fc, const char *key, const char *value, size_t v_size); A wrapper around vfs_parse_fs_param() that copies the value string it is passed. * :: int generic_parse_monolithic(struct fs_context *fc, void *data); Parse a sys_mount() data page, assuming the form to be a text list consisting of key[=val] options separated by commas. Each item in the list is passed to vfs_mount_option(). This is the default when the ->parse_monolithic() method is NULL. * :: int vfs_get_tree(struct fs_context *fc); Get or create the mountable root and superblock, using the parameters in the filesystem context to select/configure the superblock. This invokes the ->get_tree() method. * :: struct vfsmount *vfs_create_mount(struct fs_context *fc); Create a mount given the parameters in the specified filesystem context. Note that this does not attach the mount to anything. h]jU)}(hhh](j)}(hXB:: int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param); Supply a single mount parameter to the filesystem context. This includes the specification of the source/device which is specified as the "source" parameter (which may be specified multiple times if the filesystem supports that). param specifies the parameter key name and the value. The parameter is first checked to see if it corresponds to a standard mount flag (in which case it is used to set an SB_xxx flag and consumed) or a security option (in which case the LSM consumes it) before it is passed on to the filesystem. The parameter value is typed and can be one of: ==================== ============================= fs_value_is_flag Parameter not given a value fs_value_is_string Value is a string fs_value_is_blob Value is a binary blob fs_value_is_filename Value is a filename* + dirfd fs_value_is_file Value is an open file (file*) ==================== ============================= If there is a value, that value is stored in a union in the struct in one of param->{string,blob,name,file}. Note that the function may steal and clear the pointer, but then becomes responsible for disposing of the object. h](j)}(haint vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param);h]haint vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param);}hjN sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjJ ubh)}(hSupply a single mount parameter to the filesystem context. This includes the specification of the source/device which is specified as the "source" parameter (which may be specified multiple times if the filesystem supports that).h]hSupply a single mount parameter to the filesystem context. This includes the specification of the source/device which is specified as the “source” parameter (which may be specified multiple times if the filesystem supports that).}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjJ ubh)}(hX(param specifies the parameter key name and the value. The parameter is first checked to see if it corresponds to a standard mount flag (in which case it is used to set an SB_xxx flag and consumed) or a security option (in which case the LSM consumes it) before it is passed on to the filesystem.h]hX(param specifies the parameter key name and the value. The parameter is first checked to see if it corresponds to a standard mount flag (in which case it is used to set an SB_xxx flag and consumed) or a security option (in which case the LSM consumes it) before it is passed on to the filesystem.}(hjj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjJ ubh)}(h/The parameter value is typed and can be one of:h]h/The parameter value is typed and can be one of:}(hjx hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjJ ubh)}(hX==================== ============================= fs_value_is_flag Parameter not given a value fs_value_is_string Value is a string fs_value_is_blob Value is a binary blob fs_value_is_filename Value is a filename* + dirfd fs_value_is_file Value is an open file (file*) ==================== ============================= h]jF)}(hhh]jK)}(hhh](jP)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jOhj ubjP)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jOhj ubjf)}(hhh](jk)}(hhh](jp)}(hhh]h)}(hfs_value_is_flagh]hfs_value_is_flag}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1johj ubjp)}(hhh]h)}(hParameter not given a valueh]hParameter not given a value}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1johj ubeh}(h]h ]h"]h$]h&]uh1jjhj ubjk)}(hhh](jp)}(hhh]h)}(hfs_value_is_stringh]hfs_value_is_string}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1johj ubjp)}(hhh]h)}(hValue is a stringh]hValue is a string}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1johj ubeh}(h]h ]h"]h$]h&]uh1jjhj ubjk)}(hhh](jp)}(hhh]h)}(hfs_value_is_blobh]hfs_value_is_blob}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1johj ubjp)}(hhh]h)}(hValue is a binary blobh]hValue is a binary blob}(hj2 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj/ ubah}(h]h ]h"]h$]h&]uh1johj ubeh}(h]h ]h"]h$]h&]uh1jjhj ubjk)}(hhh](jp)}(hhh]h)}(hfs_value_is_filenameh]hfs_value_is_filename}(hjR hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjO ubah}(h]h ]h"]h$]h&]uh1johjL ubjp)}(hhh]h)}(hValue is a filename* + dirfdh]hValue is a filename* + dirfd}(hji hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjf ubah}(h]h ]h"]h$]h&]uh1johjL ubeh}(h]h ]h"]h$]h&]uh1jjhj ubjk)}(hhh](jp)}(hhh]h)}(hfs_value_is_fileh]hfs_value_is_file}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1johj ubjp)}(hhh]h)}(hValue is an open file (file*)h]hValue is an open file (file*)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1johj ubeh}(h]h ]h"]h$]h&]uh1jjhj ubeh}(h]h ]h"]h$]h&]uh1jehj ubeh}(h]h ]h"]h$]h&]colsKuh1jJhj ubah}(h]h ]h"]h$]h&]uh1jEhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhjJ ubh)}(hIf there is a value, that value is stored in a union in the struct in one of param->{string,blob,name,file}. Note that the function may steal and clear the pointer, but then becomes responsible for disposing of the object.h]hIf there is a value, that value is stored in a union in the struct in one of param->{string,blob,name,file}. Note that the function may steal and clear the pointer, but then becomes responsible for disposing of the object.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjJ ubeh}(h]h ]h"]h$]h&]uh1jhjG ubj)}(h:: int vfs_parse_fs_string(struct fs_context *fc, const char *key, const char *value, size_t v_size); A wrapper around vfs_parse_fs_param() that copies the value string it is passed. h](j)}(hzint vfs_parse_fs_string(struct fs_context *fc, const char *key, const char *value, size_t v_size);h]hzint vfs_parse_fs_string(struct fs_context *fc, const char *key, const char *value, size_t v_size);}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubh)}(hPA wrapper around vfs_parse_fs_param() that copies the value string it is passed.h]hPA wrapper around vfs_parse_fs_param() that copies the value string it is passed.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubeh}(h]h ]h"]h$]h&]uh1jhjG ubj)}(hX;:: int generic_parse_monolithic(struct fs_context *fc, void *data); Parse a sys_mount() data page, assuming the form to be a text list consisting of key[=val] options separated by commas. Each item in the list is passed to vfs_mount_option(). This is the default when the ->parse_monolithic() method is NULL. h](j)}(h@int generic_parse_monolithic(struct fs_context *fc, void *data);h]h@int generic_parse_monolithic(struct fs_context *fc, void *data);}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubh)}(hParse a sys_mount() data page, assuming the form to be a text list consisting of key[=val] options separated by commas. Each item in the list is passed to vfs_mount_option(). This is the default when the ->parse_monolithic() method is NULL.h]hParse a sys_mount() data page, assuming the form to be a text list consisting of key[=val] options separated by commas. Each item in the list is passed to vfs_mount_option(). This is the default when the ->parse_monolithic() method is NULL.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubeh}(h]h ]h"]h$]h&]uh1jhjG ubj)}(h:: int vfs_get_tree(struct fs_context *fc); Get or create the mountable root and superblock, using the parameters in the filesystem context to select/configure the superblock. This invokes the ->get_tree() method. h](j)}(h(int vfs_get_tree(struct fs_context *fc);h]h(int vfs_get_tree(struct fs_context *fc);}hj7 sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj3 ubh)}(hGet or create the mountable root and superblock, using the parameters in the filesystem context to select/configure the superblock. This invokes the ->get_tree() method.h]hGet or create the mountable root and superblock, using the parameters in the filesystem context to select/configure the superblock. This invokes the ->get_tree() method.}(hjE hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj3 ubeh}(h]h ]h"]h$]h&]uh1jhjG ubj)}(h:: struct vfsmount *vfs_create_mount(struct fs_context *fc); Create a mount given the parameters in the specified filesystem context. Note that this does not attach the mount to anything. h](j)}(h9struct vfsmount *vfs_create_mount(struct fs_context *fc);h]h9struct vfsmount *vfs_create_mount(struct fs_context *fc);}hj] sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjY ubh)}(h~Create a mount given the parameters in the specified filesystem context. Note that this does not attach the mount to anything.h]h~Create a mount given the parameters in the specified filesystem context. Note that this does not attach the mount to anything.}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjY ubeh}(h]h ]h"]h$]h&]uh1jhjG ubeh}(h]h ]h"]h$]h&]j8j9uh1jThhhMhjC ubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]vfs-filesystem-context-apiah ]h"]vfs filesystem context apiah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hSuperblock Creation Helpersh]hSuperblock Creation Helpers}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hkA number of VFS helpers are available for use by filesystems for the creation or looking up of superblocks.h]hkA number of VFS helpers are available for use by filesystems for the creation or looking up of superblocks.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hX* :: struct super_block * sget_fc(struct fs_context *fc, int (*test)(struct super_block *sb, struct fs_context *fc), int (*set)(struct super_block *sb, struct fs_context *fc)); This is the core routine. If test is non-NULL, it searches for an existing superblock matching the criteria held in the fs_context, using the test function to match them. If no match is found, a new superblock is created and the set function is called to set it up. Prior to the set function being called, fc->s_fs_info will be transferred to sb->s_fs_info - and fc->s_fs_info will be cleared if set returns success (ie. 0). h]jU)}(hhh]j)}(hXu:: struct super_block * sget_fc(struct fs_context *fc, int (*test)(struct super_block *sb, struct fs_context *fc), int (*set)(struct super_block *sb, struct fs_context *fc)); This is the core routine. If test is non-NULL, it searches for an existing superblock matching the criteria held in the fs_context, using the test function to match them. If no match is found, a new superblock is created and the set function is called to set it up. Prior to the set function being called, fc->s_fs_info will be transferred to sb->s_fs_info - and fc->s_fs_info will be cleared if set returns success (ie. 0). h](j)}(hstruct super_block * sget_fc(struct fs_context *fc, int (*test)(struct super_block *sb, struct fs_context *fc), int (*set)(struct super_block *sb, struct fs_context *fc));h]hstruct super_block * sget_fc(struct fs_context *fc, int (*test)(struct super_block *sb, struct fs_context *fc), int (*set)(struct super_block *sb, struct fs_context *fc));}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhM$hj ubh)}(hX This is the core routine. If test is non-NULL, it searches for an existing superblock matching the criteria held in the fs_context, using the test function to match them. If no match is found, a new superblock is created and the set function is called to set it up.h]hX This is the core routine. If test is non-NULL, it searches for an existing superblock matching the criteria held in the fs_context, using the test function to match them. If no match is found, a new superblock is created and the set function is called to set it up.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM)hj ubh)}(hPrior to the set function being called, fc->s_fs_info will be transferred to sb->s_fs_info - and fc->s_fs_info will be cleared if set returns success (ie. 0).h]hPrior to the set function being called, fc->s_fs_info will be transferred to sb->s_fs_info - and fc->s_fs_info will be cleared if set returns success (ie. 0).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hj ubeh}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]j8j9uh1jThhhM"hj ubah}(h]h ]h"]h$]h&]uh1hhhhM"hj hhubh)}(h)The following helpers all wrap sget_fc():h]h)The following helpers all wrap sget_fc():}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM2hj hhubh)}(hX(1) vfs_get_single_super Only one such superblock may exist in the system. Any further attempt to get a new superblock gets this one (and any parameter differences are ignored). (2) vfs_get_keyed_super Multiple superblocks of this type may exist and they're keyed on their s_fs_info pointer (for example this may refer to a namespace). (3) vfs_get_independent_super Multiple independent superblocks of this type may exist. This function never matches an existing one and always creates a new one. h]h)}(hhh](j)}(hvfs_get_single_super Only one such superblock may exist in the system. Any further attempt to get a new superblock gets this one (and any parameter differences are ignored). h](h)}(hvfs_get_single_superh]hvfs_get_single_super}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hj ubh)}(hOnly one such superblock may exist in the system. Any further attempt to get a new superblock gets this one (and any parameter differences are ignored).h]hOnly one such superblock may exist in the system. Any further attempt to get a new superblock gets this one (and any parameter differences are ignored).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM6hj ubeh}(h]h ]h"]h$]h&]uh1jhj ubj)}(hvfs_get_keyed_super Multiple superblocks of this type may exist and they're keyed on their s_fs_info pointer (for example this may refer to a namespace). h](h)}(hvfs_get_keyed_superh]hvfs_get_keyed_super}(hj8 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM:hj4 ubh)}(hMultiple superblocks of this type may exist and they're keyed on their s_fs_info pointer (for example this may refer to a namespace).h]hMultiple superblocks of this type may exist and they’re keyed on their s_fs_info pointer (for example this may refer to a namespace).}(hjF hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM<hj4 ubeh}(h]h ]h"]h$]h&]uh1jhj ubj)}(hvfs_get_independent_super Multiple independent superblocks of this type may exist. This function never matches an existing one and always creates a new one. h](h)}(hvfs_get_independent_superh]hvfs_get_independent_super}(hj^ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM@hjZ ubh)}(hMultiple independent superblocks of this type may exist. This function never matches an existing one and always creates a new one.h]hMultiple independent superblocks of this type may exist. This function never matches an existing one and always creates a new one.}(hjl hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMBhjZ ubeh}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]jjjjjjuh1hhj ubah}(h]h ]h"]h$]h&]uh1hhhhM4hj hhubeh}(h]superblock-creation-helpersah ]h"]superblock creation helpersah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hParameter Descriptionh]hParameter Description}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMHubh)}(hParameters are described using structures defined in linux/fs_parser.h. There's a core description struct that links everything together::h]hParameters are described using structures defined in linux/fs_parser.h. There’s a core description struct that links everything together:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhj hhubj)}(hstruct fs_parameter_description { const struct fs_parameter_spec *specs; const struct fs_parameter_enum *enums; };h]hstruct fs_parameter_description { const struct fs_parameter_spec *specs; const struct fs_parameter_enum *enums; };}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMMhj hhubh)}(h For example::h]h For example:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMRhj hhubj)}(hXenum { Opt_autocell, Opt_bar, Opt_dyn, Opt_foo, Opt_source, }; static const struct fs_parameter_description afs_fs_parameters = { .specs = afs_param_specs, .enums = afs_param_enums, };h]hXenum { Opt_autocell, Opt_bar, Opt_dyn, Opt_foo, Opt_source, }; static const struct fs_parameter_description afs_fs_parameters = { .specs = afs_param_specs, .enums = afs_param_enums, };}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMThj hhubh)}(hThe members are as follows:h]hThe members are as follows:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMahj hhubh)}(hX(1) :: const struct fs_parameter_specification *specs; Table of parameter specifications, terminated with a null entry, where the entries are of type:: struct fs_parameter_spec { const char *name; u8 opt; enum fs_parameter_type type:8; unsigned short flags; }; The 'name' field is a string to match exactly to the parameter key (no wildcards, patterns and no case-independence) and 'opt' is the value that will be returned by the fs_parser() function in the case of a successful match. The 'type' field indicates the desired value type and must be one of: ======================= ======================= ===================== TYPE NAME EXPECTED VALUE RESULT IN ======================= ======================= ===================== fs_param_is_flag No value n/a fs_param_is_bool Boolean value result->boolean fs_param_is_u32 32-bit unsigned int result->uint_32 fs_param_is_u32_octal 32-bit octal int result->uint_32 fs_param_is_u32_hex 32-bit hex int result->uint_32 fs_param_is_s32 32-bit signed int result->int_32 fs_param_is_u64 64-bit unsigned int result->uint_64 fs_param_is_enum Enum value name result->uint_32 fs_param_is_string Arbitrary string param->string fs_param_is_blob Binary blob param->blob fs_param_is_blockdev Blockdev path * Needs lookup fs_param_is_path Path * Needs lookup fs_param_is_fd File descriptor result->int_32 fs_param_is_uid User ID (u32) result->uid fs_param_is_gid Group ID (u32) result->gid ======================= ======================= ===================== Note that if the value is of fs_param_is_bool type, fs_parse() will try to match any string value against "0", "1", "no", "yes", "false", "true". Each parameter can also be qualified with 'flags': ======================= ================================================ fs_param_v_optional The value is optional fs_param_neg_with_no result->negated set if key is prefixed with "no" fs_param_neg_with_empty result->negated set if value is "" fs_param_deprecated The parameter is deprecated. ======================= ================================================ These are wrapped with a number of convenience wrappers: ======================= =============================================== MACRO SPECIFIES ======================= =============================================== fsparam_flag() fs_param_is_flag fsparam_flag_no() fs_param_is_flag, fs_param_neg_with_no fsparam_bool() fs_param_is_bool fsparam_u32() fs_param_is_u32 fsparam_u32oct() fs_param_is_u32_octal fsparam_u32hex() fs_param_is_u32_hex fsparam_s32() fs_param_is_s32 fsparam_u64() fs_param_is_u64 fsparam_enum() fs_param_is_enum fsparam_string() fs_param_is_string fsparam_blob() fs_param_is_blob fsparam_bdev() fs_param_is_blockdev fsparam_path() fs_param_is_path fsparam_fd() fs_param_is_fd fsparam_uid() fs_param_is_uid fsparam_gid() fs_param_is_gid ======================= =============================================== all of which take two arguments, name string and option number - for example:: static const struct fs_parameter_spec afs_param_specs[] = { fsparam_flag ("autocell", Opt_autocell), fsparam_flag ("dyn", Opt_dyn), fsparam_string ("source", Opt_source), fsparam_flag_no ("foo", Opt_foo), {} }; An addition macro, __fsparam() is provided that takes an additional pair of arguments to specify the type and the flags for anything that doesn't match one of the above macros. (2) :: const struct fs_parameter_enum *enums; Table of enum value names to integer mappings, terminated with a null entry. This is of type:: struct fs_parameter_enum { u8 opt; char name[14]; u8 value; }; Where the array is an unsorted list of { parameter ID, name }-keyed elements that indicate the value to map to, e.g.:: static const struct fs_parameter_enum afs_param_enums[] = { { Opt_bar, "x", 1}, { Opt_bar, "y", 23}, { Opt_bar, "z", 42}, }; If a parameter of type fs_param_is_enum is encountered, fs_parse() will try to look the value up in the enum table and the result will be stored in the parse result. h]h)}(hhh](j)}(hX:: const struct fs_parameter_specification *specs; Table of parameter specifications, terminated with a null entry, where the entries are of type:: struct fs_parameter_spec { const char *name; u8 opt; enum fs_parameter_type type:8; unsigned short flags; }; The 'name' field is a string to match exactly to the parameter key (no wildcards, patterns and no case-independence) and 'opt' is the value that will be returned by the fs_parser() function in the case of a successful match. The 'type' field indicates the desired value type and must be one of: ======================= ======================= ===================== TYPE NAME EXPECTED VALUE RESULT IN ======================= ======================= ===================== fs_param_is_flag No value n/a fs_param_is_bool Boolean value result->boolean fs_param_is_u32 32-bit unsigned int result->uint_32 fs_param_is_u32_octal 32-bit octal int result->uint_32 fs_param_is_u32_hex 32-bit hex int result->uint_32 fs_param_is_s32 32-bit signed int result->int_32 fs_param_is_u64 64-bit unsigned int result->uint_64 fs_param_is_enum Enum value name result->uint_32 fs_param_is_string Arbitrary string param->string fs_param_is_blob Binary blob param->blob fs_param_is_blockdev Blockdev path * Needs lookup fs_param_is_path Path * Needs lookup fs_param_is_fd File descriptor result->int_32 fs_param_is_uid User ID (u32) result->uid fs_param_is_gid Group ID (u32) result->gid ======================= ======================= ===================== Note that if the value is of fs_param_is_bool type, fs_parse() will try to match any string value against "0", "1", "no", "yes", "false", "true". Each parameter can also be qualified with 'flags': ======================= ================================================ fs_param_v_optional The value is optional fs_param_neg_with_no result->negated set if key is prefixed with "no" fs_param_neg_with_empty result->negated set if value is "" fs_param_deprecated The parameter is deprecated. ======================= ================================================ These are wrapped with a number of convenience wrappers: ======================= =============================================== MACRO SPECIFIES ======================= =============================================== fsparam_flag() fs_param_is_flag fsparam_flag_no() fs_param_is_flag, fs_param_neg_with_no fsparam_bool() fs_param_is_bool fsparam_u32() fs_param_is_u32 fsparam_u32oct() fs_param_is_u32_octal fsparam_u32hex() fs_param_is_u32_hex fsparam_s32() fs_param_is_s32 fsparam_u64() fs_param_is_u64 fsparam_enum() fs_param_is_enum fsparam_string() fs_param_is_string fsparam_blob() fs_param_is_blob fsparam_bdev() fs_param_is_blockdev fsparam_path() fs_param_is_path fsparam_fd() fs_param_is_fd fsparam_uid() fs_param_is_uid fsparam_gid() fs_param_is_gid ======================= =============================================== all of which take two arguments, name string and option number - for example:: static const struct fs_parameter_spec afs_param_specs[] = { fsparam_flag ("autocell", Opt_autocell), fsparam_flag ("dyn", Opt_dyn), fsparam_string ("source", Opt_source), fsparam_flag_no ("foo", Opt_foo), {} }; An addition macro, __fsparam() is provided that takes an additional pair of arguments to specify the type and the flags for anything that doesn't match one of the above macros. h](j)}(h/const struct fs_parameter_specification *specs;h]h/const struct fs_parameter_specification *specs;}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMehj ubh)}(h`Table of parameter specifications, terminated with a null entry, where the entries are of type::h]h_Table of parameter specifications, terminated with a null entry, where the entries are of type:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMghj ubj)}(hstruct fs_parameter_spec { const char *name; u8 opt; enum fs_parameter_type type:8; unsigned short flags; };h]hstruct fs_parameter_spec { const char *name; u8 opt; enum fs_parameter_type type:8; unsigned short flags; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMjhj ubh)}(hThe 'name' field is a string to match exactly to the parameter key (no wildcards, patterns and no case-independence) and 'opt' is the value that will be returned by the fs_parser() function in the case of a successful match.h]hThe ‘name’ field is a string to match exactly to the parameter key (no wildcards, patterns and no case-independence) and ‘opt’ is the value that will be returned by the fs_parser() function in the case of a successful match.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMqhj ubh)}(hEThe 'type' field indicates the desired value type and must be one of:h]hIThe ‘type’ field indicates the desired value type and must be one of:}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMvhj ubh)}(hX======================= ======================= ===================== TYPE NAME EXPECTED VALUE RESULT IN ======================= ======================= ===================== fs_param_is_flag No value n/a fs_param_is_bool Boolean value result->boolean fs_param_is_u32 32-bit unsigned int result->uint_32 fs_param_is_u32_octal 32-bit octal int result->uint_32 fs_param_is_u32_hex 32-bit hex int result->uint_32 fs_param_is_s32 32-bit signed int result->int_32 fs_param_is_u64 64-bit unsigned int result->uint_64 fs_param_is_enum Enum value name result->uint_32 fs_param_is_string Arbitrary string param->string fs_param_is_blob Binary blob param->blob fs_param_is_blockdev Blockdev path * Needs lookup fs_param_is_path Path * Needs lookup fs_param_is_fd File descriptor result->int_32 fs_param_is_uid User ID (u32) result->uid fs_param_is_gid Group ID (u32) result->gid ======================= ======================= ===================== h]jF)}(hhh]jK)}(hhh](jP)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jOhjCubjP)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jOhjCubjP)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jOhjCubhthead)}(hhh]jk)}(hhh](jp)}(hhh]h)}(h TYPE NAMEh]h TYPE NAME}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMyhjlubah}(h]h ]h"]h$]h&]uh1johjiubjp)}(hhh]h)}(hEXPECTED VALUEh]hEXPECTED VALUE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMyhjubah}(h]h ]h"]h$]h&]uh1johjiubjp)}(hhh]h)}(h RESULT INh]h RESULT IN}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMyhjubah}(h]h ]h"]h$]h&]uh1johjiubeh}(h]h ]h"]h$]h&]uh1jjhjfubah}(h]h ]h"]h$]h&]uh1jdhjCubjf)}(hhh](jk)}(hhh](jp)}(hhh]h)}(hfs_param_is_flagh]hfs_param_is_flag}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM{hjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hNo valueh]hNo value}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM{hjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hn/ah]hn/a}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM{hjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_boolh]hfs_param_is_bool}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM|hjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h Boolean valueh]h Boolean value}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM|hj(ubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hresult->booleanh]hresult->boolean}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM|hj?ubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_u32h]hfs_param_is_u32}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM}hj_ubah}(h]h ]h"]h$]h&]uh1johj\ubjp)}(hhh]h)}(h32-bit unsigned inth]h32-bit unsigned int}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM}hjvubah}(h]h ]h"]h$]h&]uh1johj\ubjp)}(hhh]h)}(hresult->uint_32h]hresult->uint_32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM}hjubah}(h]h ]h"]h$]h&]uh1johj\ubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_u32_octalh]hfs_param_is_u32_octal}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM~hjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h32-bit octal inth]h32-bit octal int}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM~hjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hresult->uint_32h]hresult->uint_32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM~hjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_u32_hexh]hfs_param_is_u32_hex}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h32-bit hex inth]h32-bit hex int}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hresult->uint_32h]hresult->uint_32}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj)ubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_s32h]hfs_param_is_s32}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjIubah}(h]h ]h"]h$]h&]uh1johjFubjp)}(hhh]h)}(h32-bit signed inth]h32-bit signed int}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj`ubah}(h]h ]h"]h$]h&]uh1johjFubjp)}(hhh]h)}(hresult->int_32h]hresult->int_32}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjwubah}(h]h ]h"]h$]h&]uh1johjFubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_u64h]hfs_param_is_u64}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h64-bit unsigned inth]h64-bit unsigned int}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hresult->uint_64h]hresult->uint_64}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_enumh]hfs_param_is_enum}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hEnum value nameh]hEnum value name}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hresult->uint_32h]hresult->uint_32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_stringh]hfs_param_is_string}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj3ubah}(h]h ]h"]h$]h&]uh1johj0ubjp)}(hhh]h)}(hArbitrary stringh]hArbitrary string}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjJubah}(h]h ]h"]h$]h&]uh1johj0ubjp)}(hhh]h)}(h param->stringh]h param->string}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjaubah}(h]h ]h"]h$]h&]uh1johj0ubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_blobh]hfs_param_is_blob}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johj~ubjp)}(hhh]h)}(h Binary blobh]h Binary blob}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johj~ubjp)}(hhh]h)}(h param->blobh]h param->blob}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johj~ubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_blockdevh]hfs_param_is_blockdev}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h Blockdev pathh]h Blockdev path}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]jU)}(hhh]j)}(h Needs lookuph]h)}(hjh]h Needs lookup}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]j8j9uh1jThhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_pathh]hfs_param_is_path}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj/ubah}(h]h ]h"]h$]h&]uh1johj,ubjp)}(hhh]h)}(hPathh]hPath}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjFubah}(h]h ]h"]h$]h&]uh1johj,ubjp)}(hhh]jU)}(hhh]j)}(h Needs lookuph]h)}(hjeh]h Needs lookup}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjcubah}(h]h ]h"]h$]h&]uh1jhj`ubah}(h]h ]h"]h$]h&]j8j9uh1jThhhMhj]ubah}(h]h ]h"]h$]h&]uh1johj,ubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_fdh]hfs_param_is_fd}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hFile descriptorh]hFile descriptor}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hresult->int_32h]hresult->int_32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_uidh]hfs_param_is_uid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h User ID (u32)h]h User ID (u32)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h result->uidh]h result->uid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_is_gidh]hfs_param_is_gid}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj+ubah}(h]h ]h"]h$]h&]uh1johj(ubjp)}(hhh]h)}(hGroup ID (u32)h]hGroup ID (u32)}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjBubah}(h]h ]h"]h$]h&]uh1johj(ubjp)}(hhh]h)}(h result->gidh]h result->gid}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjYubah}(h]h ]h"]h$]h&]uh1johj(ubeh}(h]h ]h"]h$]h&]uh1jjhjubeh}(h]h ]h"]h$]h&]uh1jehjCubeh}(h]h ]h"]h$]h&]colsKuh1jJhj@ubah}(h]h ]h"]h$]h&]uh1jEhj<ubah}(h]h ]h"]h$]h&]uh1hhhhMxhj ubh)}(hNote that if the value is of fs_param_is_bool type, fs_parse() will try to match any string value against "0", "1", "no", "yes", "false", "true".h]hNote that if the value is of fs_param_is_bool type, fs_parse() will try to match any string value against “0”, “1”, “no”, “yes”, “false”, “true”.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(h2Each parameter can also be qualified with 'flags':h]h6Each parameter can also be qualified with ‘flags’:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(hXy======================= ================================================ fs_param_v_optional The value is optional fs_param_neg_with_no result->negated set if key is prefixed with "no" fs_param_neg_with_empty result->negated set if value is "" fs_param_deprecated The parameter is deprecated. ======================= ================================================ h]jF)}(hhh]jK)}(hhh](jP)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jOhjubjP)}(hhh]h}(h]h ]h"]h$]h&]colwidthK0uh1jOhjubjf)}(hhh](jk)}(hhh](jp)}(hhh]h)}(hfs_param_v_optionalh]hfs_param_v_optional}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hThe value is optionalh]hThe value is optional}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_neg_with_noh]hfs_param_neg_with_no}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h0result->negated set if key is prefixed with "no"h]h4result->negated set if key is prefixed with “no”}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_neg_with_emptyh]hfs_param_neg_with_empty}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj=ubah}(h]h ]h"]h$]h&]uh1johj:ubjp)}(hhh]h)}(h"result->negated set if value is ""h]h&result->negated set if value is “”}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjTubah}(h]h ]h"]h$]h&]uh1johj:ubeh}(h]h ]h"]h$]h&]uh1jjhjubjk)}(hhh](jp)}(hhh]h)}(hfs_param_deprecatedh]hfs_param_deprecated}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjtubah}(h]h ]h"]h$]h&]uh1johjqubjp)}(hhh]h)}(hThe parameter is deprecated.h]hThe parameter is deprecated.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjqubeh}(h]h ]h"]h$]h&]uh1jjhjubeh}(h]h ]h"]h$]h&]uh1jehjubeh}(h]h ]h"]h$]h&]colsKuh1jJhjubah}(h]h ]h"]h$]h&]uh1jEhjubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(h8These are wrapped with a number of convenience wrappers:h]h8These are wrapped with a number of convenience wrappers:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(hX======================= =============================================== MACRO SPECIFIES ======================= =============================================== fsparam_flag() fs_param_is_flag fsparam_flag_no() fs_param_is_flag, fs_param_neg_with_no fsparam_bool() fs_param_is_bool fsparam_u32() fs_param_is_u32 fsparam_u32oct() fs_param_is_u32_octal fsparam_u32hex() fs_param_is_u32_hex fsparam_s32() fs_param_is_s32 fsparam_u64() fs_param_is_u64 fsparam_enum() fs_param_is_enum fsparam_string() fs_param_is_string fsparam_blob() fs_param_is_blob fsparam_bdev() fs_param_is_blockdev fsparam_path() fs_param_is_path fsparam_fd() fs_param_is_fd fsparam_uid() fs_param_is_uid fsparam_gid() fs_param_is_gid ======================= =============================================== h]jF)}(hhh]jK)}(hhh](jP)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jOhjubjP)}(hhh]h}(h]h ]h"]h$]h&]colwidthK/uh1jOhjubje)}(hhh]jk)}(hhh](jp)}(hhh]h)}(hMACROh]hMACRO}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(h SPECIFIESh]h SPECIFIES}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhjubah}(h]h ]h"]h$]h&]uh1jdhjubjf)}(hhh](jk)}(hhh](jp)}(hhh]h)}(hfsparam_flag()h]hfsparam_flag()}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj3ubah}(h]h ]h"]h$]h&]uh1johj0ubjp)}(hhh]h)}(hfs_param_is_flagh]hfs_param_is_flag}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjJubah}(h]h ]h"]h$]h&]uh1johj0ubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(hfsparam_flag_no()h]hfsparam_flag_no()}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjjubah}(h]h ]h"]h$]h&]uh1johjgubjp)}(hhh]h)}(h&fs_param_is_flag, fs_param_neg_with_noh]h&fs_param_is_flag, fs_param_neg_with_no}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjgubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(hfsparam_bool()h]hfsparam_bool()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hfs_param_is_boolh]hfs_param_is_bool}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(h fsparam_u32()h]h fsparam_u32()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hfs_param_is_u32h]hfs_param_is_u32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(hfsparam_u32oct()h]hfsparam_u32oct()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johj ubjp)}(hhh]h)}(hfs_param_is_u32_octalh]hfs_param_is_u32_octal}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj&ubah}(h]h ]h"]h$]h&]uh1johj ubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(hfsparam_u32hex()h]hfsparam_u32hex()}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjFubah}(h]h ]h"]h$]h&]uh1johjCubjp)}(hhh]h)}(hfs_param_is_u32_hexh]hfs_param_is_u32_hex}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj]ubah}(h]h ]h"]h$]h&]uh1johjCubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(h fsparam_s32()h]h fsparam_s32()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj}ubah}(h]h ]h"]h$]h&]uh1johjzubjp)}(hhh]h)}(hfs_param_is_s32h]hfs_param_is_s32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjzubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(h fsparam_u64()h]h fsparam_u64()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hfs_param_is_u64h]hfs_param_is_u64}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(hfsparam_enum()h]hfsparam_enum()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hfs_param_is_enumh]hfs_param_is_enum}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(hfsparam_string()h]hfsparam_string()}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj"ubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hfs_param_is_stringh]hfs_param_is_string}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj9ubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(hfsparam_blob()h]hfsparam_blob()}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjYubah}(h]h ]h"]h$]h&]uh1johjVubjp)}(hhh]h)}(hfs_param_is_blobh]hfs_param_is_blob}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjpubah}(h]h ]h"]h$]h&]uh1johjVubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(hfsparam_bdev()h]hfsparam_bdev()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hfs_param_is_blockdevh]hfs_param_is_blockdev}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(hfsparam_path()h]hfsparam_path()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hfs_param_is_pathh]hfs_param_is_path}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(h fsparam_fd()h]h fsparam_fd()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubjp)}(hhh]h)}(hfs_param_is_fdh]hfs_param_is_fd}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(h fsparam_uid()h]h fsparam_uid()}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj5ubah}(h]h ]h"]h$]h&]uh1johj2ubjp)}(hhh]h)}(hfs_param_is_uidh]hfs_param_is_uid}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLubah}(h]h ]h"]h$]h&]uh1johj2ubeh}(h]h ]h"]h$]h&]uh1jjhj-ubjk)}(hhh](jp)}(hhh]h)}(h fsparam_gid()h]h fsparam_gid()}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjlubah}(h]h ]h"]h$]h&]uh1johjiubjp)}(hhh]h)}(hfs_param_is_gidh]hfs_param_is_gid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1johjiubeh}(h]h ]h"]h$]h&]uh1jjhj-ubeh}(h]h ]h"]h$]h&]uh1jehjubeh}(h]h ]h"]h$]h&]colsKuh1jJhjubah}(h]h ]h"]h$]h&]uh1jEhjubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(hNall of which take two arguments, name string and option number - for example::h]hMall of which take two arguments, name string and option number - for example:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubj)}(hXstatic const struct fs_parameter_spec afs_param_specs[] = { fsparam_flag ("autocell", Opt_autocell), fsparam_flag ("dyn", Opt_dyn), fsparam_string ("source", Opt_source), fsparam_flag_no ("foo", Opt_foo), {} };h]hXstatic const struct fs_parameter_spec afs_param_specs[] = { fsparam_flag ("autocell", Opt_autocell), fsparam_flag ("dyn", Opt_dyn), fsparam_string ("source", Opt_source), fsparam_flag_no ("foo", Opt_foo), {} };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubh)}(hAn addition macro, __fsparam() is provided that takes an additional pair of arguments to specify the type and the flags for anything that doesn't match one of the above macros.h]hAn addition macro, __fsparam() is provided that takes an additional pair of arguments to specify the type and the flags for anything that doesn’t match one of the above macros.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubeh}(h]h ]h"]h$]h&]uh1jhj ubj)}(hX:: const struct fs_parameter_enum *enums; Table of enum value names to integer mappings, terminated with a null entry. This is of type:: struct fs_parameter_enum { u8 opt; char name[14]; u8 value; }; Where the array is an unsorted list of { parameter ID, name }-keyed elements that indicate the value to map to, e.g.:: static const struct fs_parameter_enum afs_param_enums[] = { { Opt_bar, "x", 1}, { Opt_bar, "y", 23}, { Opt_bar, "z", 42}, }; If a parameter of type fs_param_is_enum is encountered, fs_parse() will try to look the value up in the enum table and the result will be stored in the parse result. h](j)}(h&const struct fs_parameter_enum *enums;h]h&const struct fs_parameter_enum *enums;}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(h_Table of enum value names to integer mappings, terminated with a null entry. This is of type::h]h^Table of enum value names to integer mappings, terminated with a null entry. This is of type:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj)}(h{struct fs_parameter_enum { u8 opt; char name[14]; u8 value; };h]h{struct fs_parameter_enum { u8 opt; char name[14]; u8 value; };}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(hvWhere the array is an unsorted list of { parameter ID, name }-keyed elements that indicate the value to map to, e.g.::h]huWhere the array is an unsorted list of { parameter ID, name }-keyed elements that indicate the value to map to, e.g.:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj)}(hstatic const struct fs_parameter_enum afs_param_enums[] = { { Opt_bar, "x", 1}, { Opt_bar, "y", 23}, { Opt_bar, "z", 42}, };Jh]hstatic const struct fs_parameter_enum afs_param_enums[] = { { Opt_bar, "x", 1}, { Opt_bar, "y", 23}, { Opt_bar, "z", 42}, };}hj%sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(hIf a parameter of type fs_param_is_enum is encountered, fs_parse() will try to look the value up in the enum table and the result will be stored in the parse result.h]hIf a parameter of type fs_param_is_enum is encountered, fs_parse() will try to look the value up in the enum table and the result will be stored in the parse result.}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]jjjjjjuh1hhj ubah}(h]h ]h"]h$]h&]uh1hhhhMchj hhubh)}(hThe parser should be pointed to by the parser pointer in the file_system_type struct as this will provide validation on registration (if CONFIG_VALIDATE_FS_PARSER=y) and will allow the description to be queried from userspace using the fsinfo() syscall.h]hThe parser should be pointed to by the parser pointer in the file_system_type struct as this will provide validation on registration (if CONFIG_VALIDATE_FS_PARSER=y) and will allow the description to be queried from userspace using the fsinfo() syscall.}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubeh}(h]parameter-descriptionah ]h"]parameter descriptionah$]h&]uh1hhhhhhhhMHubh)}(hhh](h)}(hParameter Helper Functionsh]hParameter Helper Functions}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjihhhhhMubh)}(hlA number of helper functions are provided to help a filesystem or an LSM process the parameters it is given.h]hlA number of helper functions are provided to help a filesystem or an LSM process the parameters it is given.}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjihhubh)}(hX~ * :: int lookup_constant(const struct constant_table tbl[], const char *name, int not_found); Look up a constant by name in a table of name -> integer mappings. The table is an array of elements of the following type:: struct constant_table { const char *name; int value; }; If a match is found, the corresponding value is returned. If a match isn't found, the not_found value is returned instead. * :: bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size, int low, int high, int special); Validate a constant table. Checks that all the elements are appropriately ordered, that there are no duplicates and that the values are between low and high inclusive, though provision is made for one allowable special value outside of that range. If no special value is required, special should just be set to lie inside the low-to-high range. If all is good, true is returned. If the table is invalid, errors are logged to the kernel log buffer and false is returned. * :: bool fs_validate_description(const char *name, const struct fs_parameter_description *desc); This performs some validation checks on a parameter description. It returns true if the description is good and false if it is not. It will log errors to the kernel log buffer if validation fails. * :: int fs_parse(struct fs_context *fc, const struct fs_parameter_description *desc, struct fs_parameter *param, struct fs_parse_result *result); This is the main interpreter of parameters. It uses the parameter description to look up a parameter by key name and to convert that to an option number (which it returns). If successful, and if the parameter type indicates the result is a boolean, integer, enum, uid, or gid type, the value is converted by this function and the result stored in result->{boolean,int_32,uint_32,uint_64,uid,gid}. If a match isn't initially made, the key is prefixed with "no" and no value is present then an attempt will be made to look up the key with the prefix removed. If this matches a parameter for which the type has flag fs_param_neg_with_no set, then a match will be made and result->negated will be set to true. If the parameter isn't matched, -ENOPARAM will be returned; if the parameter is matched, but the value is erroneous, -EINVAL will be returned; otherwise the parameter's option number will be returned. * :: int fs_lookup_param(struct fs_context *fc, struct fs_parameter *value, bool want_bdev, unsigned int flags, struct path *_path); This takes a parameter that carries a string or filename type and attempts to do a path lookup on it. If the parameter expects a blockdev, a check is made that the inode actually represents one. Returns 0 if successful and ``*_path`` will be set; returns a negative error code if not.h]jU)}(hhh](j)}(hX:: int lookup_constant(const struct constant_table tbl[], const char *name, int not_found); Look up a constant by name in a table of name -> integer mappings. The table is an array of elements of the following type:: struct constant_table { const char *name; int value; }; If a match is found, the corresponding value is returned. If a match isn't found, the not_found value is returned instead. h](j)}(hlint lookup_constant(const struct constant_table tbl[], const char *name, int not_found);h]hlint lookup_constant(const struct constant_table tbl[], const char *name, int not_found);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(h}Look up a constant by name in a table of name -> integer mappings. The table is an array of elements of the following type::h]h|Look up a constant by name in a table of name -> integer mappings. The table is an array of elements of the following type:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj)}(hXstruct constant_table { const char *name; int value; };h]hXstruct constant_table { const char *name; int value; };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(h{If a match is found, the corresponding value is returned. If a match isn't found, the not_found value is returned instead.h]h}If a match is found, the corresponding value is returned. If a match isn’t found, the not_found value is returned instead.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX:: bool validate_constant_table(const struct constant_table *tbl, size_t tbl_size, int low, int high, int special); Validate a constant table. Checks that all the elements are appropriately ordered, that there are no duplicates and that the values are between low and high inclusive, though provision is made for one allowable special value outside of that range. If no special value is required, special should just be set to lie inside the low-to-high range. If all is good, true is returned. If the table is invalid, errors are logged to the kernel log buffer and false is returned. h](j)}(hbool validate_constant_table(const struct constant_table *tbl, size_t tbl_size, int low, int high, int special);h]hbool validate_constant_table(const struct constant_table *tbl, size_t tbl_size, int low, int high, int special);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(hXZValidate a constant table. Checks that all the elements are appropriately ordered, that there are no duplicates and that the values are between low and high inclusive, though provision is made for one allowable special value outside of that range. If no special value is required, special should just be set to lie inside the low-to-high range.h]hXZValidate a constant table. Checks that all the elements are appropriately ordered, that there are no duplicates and that the values are between low and high inclusive, though provision is made for one allowable special value outside of that range. If no special value is required, special should just be set to lie inside the low-to-high range.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(h}If all is good, true is returned. If the table is invalid, errors are logged to the kernel log buffer and false is returned.h]h}If all is good, true is returned. If the table is invalid, errors are logged to the kernel log buffer and false is returned.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hXJ:: bool fs_validate_description(const char *name, const struct fs_parameter_description *desc); This performs some validation checks on a parameter description. It returns true if the description is good and false if it is not. It will log errors to the kernel log buffer if validation fails. h](j)}(hybool fs_validate_description(const char *name, const struct fs_parameter_description *desc);h]hybool fs_validate_description(const char *name, const struct fs_parameter_description *desc);}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubh)}(hThis performs some validation checks on a parameter description. It returns true if the description is good and false if it is not. It will log errors to the kernel log buffer if validation fails.h]hThis performs some validation checks on a parameter description. It returns true if the description is good and false if it is not. It will log errors to the kernel log buffer if validation fails.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hXV:: int fs_parse(struct fs_context *fc, const struct fs_parameter_description *desc, struct fs_parameter *param, struct fs_parse_result *result); This is the main interpreter of parameters. It uses the parameter description to look up a parameter by key name and to convert that to an option number (which it returns). If successful, and if the parameter type indicates the result is a boolean, integer, enum, uid, or gid type, the value is converted by this function and the result stored in result->{boolean,int_32,uint_32,uint_64,uid,gid}. If a match isn't initially made, the key is prefixed with "no" and no value is present then an attempt will be made to look up the key with the prefix removed. If this matches a parameter for which the type has flag fs_param_neg_with_no set, then a match will be made and result->negated will be set to true. If the parameter isn't matched, -ENOPARAM will be returned; if the parameter is matched, but the value is erroneous, -EINVAL will be returned; otherwise the parameter's option number will be returned. h](j)}(hint fs_parse(struct fs_context *fc, const struct fs_parameter_description *desc, struct fs_parameter *param, struct fs_parse_result *result);h]hint fs_parse(struct fs_context *fc, const struct fs_parameter_description *desc, struct fs_parameter *param, struct fs_parse_result *result);}hj/sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj+ubh)}(hThis is the main interpreter of parameters. It uses the parameter description to look up a parameter by key name and to convert that to an option number (which it returns).h]hThis is the main interpreter of parameters. It uses the parameter description to look up a parameter by key name and to convert that to an option number (which it returns).}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj+ubh)}(hIf successful, and if the parameter type indicates the result is a boolean, integer, enum, uid, or gid type, the value is converted by this function and the result stored in result->{boolean,int_32,uint_32,uint_64,uid,gid}.h]hIf successful, and if the parameter type indicates the result is a boolean, integer, enum, uid, or gid type, the value is converted by this function and the result stored in result->{boolean,int_32,uint_32,uint_64,uid,gid}.}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj+ubh)}(hX5If a match isn't initially made, the key is prefixed with "no" and no value is present then an attempt will be made to look up the key with the prefix removed. If this matches a parameter for which the type has flag fs_param_neg_with_no set, then a match will be made and result->negated will be set to true.h]hX;If a match isn’t initially made, the key is prefixed with “no” and no value is present then an attempt will be made to look up the key with the prefix removed. If this matches a parameter for which the type has flag fs_param_neg_with_no set, then a match will be made and result->negated will be set to true.}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj+ubh)}(hIf the parameter isn't matched, -ENOPARAM will be returned; if the parameter is matched, but the value is erroneous, -EINVAL will be returned; otherwise the parameter's option number will be returned.h]hIf the parameter isn’t matched, -ENOPARAM will be returned; if the parameter is matched, but the value is erroneous, -EINVAL will be returned; otherwise the parameter’s option number will be returned.}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM"hj+ubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hX:: int fs_lookup_param(struct fs_context *fc, struct fs_parameter *value, bool want_bdev, unsigned int flags, struct path *_path); This takes a parameter that carries a string or filename type and attempts to do a path lookup on it. If the parameter expects a blockdev, a check is made that the inode actually represents one. Returns 0 if successful and ``*_path`` will be set; returns a negative error code if not.h](j)}(hint fs_lookup_param(struct fs_context *fc, struct fs_parameter *value, bool want_bdev, unsigned int flags, struct path *_path);h]hint fs_lookup_param(struct fs_context *fc, struct fs_parameter *value, bool want_bdev, unsigned int flags, struct path *_path);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM(hj{ubh)}(hThis takes a parameter that carries a string or filename type and attempts to do a path lookup on it. If the parameter expects a blockdev, a check is made that the inode actually represents one.h]hThis takes a parameter that carries a string or filename type and attempts to do a path lookup on it. If the parameter expects a blockdev, a check is made that the inode actually represents one.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hj{ubh)}(hYReturns 0 if successful and ``*_path`` will be set; returns a negative error code if not.h](hReturns 0 if successful and }(hjhhhNhNubhliteral)}(h ``*_path``h]h*_path}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh3 will be set; returns a negative error code if not.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM2hj{ubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]j8j9uh1jThhhMhjubah}(h]h ]h"]h$]h&]uh1hhhhMhjihhubeh}(h]parameter-helper-functionsah ]h"]parameter helper functionsah$]h&]uh1hhhhhhhhMubeh}(h]filesystem-mount-apiah ]h"]filesystem mount apiah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksjofootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjjjj}jzj^j[jjj j j j jfjcjju nametypes}(jjj}j^jj j jfjuh}(jhjhjzjj[jjjaj jj j jcj jjiu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.