2 .\" Copyright (c) 2004 Tom Rhodes
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 .Nd "functions provided as part of the kernel mount interface"
42 .Fn free_mntarg "struct mntarg *ma"
44 .Fn kernel_mount "struct mntarg *ma" "int flags"
46 .Fn kernel_vmount "int flags" ...
49 .Fa "struct mntarg *ma" "const char *name" "const void *val" "int len"
52 .Fn mount_argb "struct mntarg *ma" "int flag" "const char *name"
54 .Fn mount_argf "struct mntarg *ma" "const char *name" "const char *fmt" ...
57 .Fa "struct mntarg *ma" "const char *name" "const void *val" "int len"
62 family of functions are provided as an API for building a list
63 of mount arguments which will be used to mount file systems
64 from inside the kernel.
65 By accumulating a list of arguments, the API takes shape and
66 provides the information necessary for the kernel to control
70 When an error occurs, the process will stop.
74 The header of the structure is stored in
75 .Pa src/sys/kern/vfs_mount.c
76 which permits automatic structure creation to
77 ease the mount process.
78 Memory allocation must always be freed when the entire
79 process is complete, it is an error otherwise.
83 function is used to free or clear the
89 function pulls information from the structure to perform
90 the mount request on a given file system.
93 function always calls the
98 contains any error code generated during the construction,
99 that code will be called and the file system mount will
104 is a function similar to
106 which is used to mount a file system.
110 function takes a plain argument and crafts parts of
111 the structure with regards to various mount options.
112 If the length is a value less than 0,
115 This argument will be referenced until either
123 function is used to add boolean arguments to
127 is the boolean value and
131 otherwise a panic will occur.
137 style arguments to the current structure.
141 function will add arguments to the structure from a
149 msdosfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td)
151 struct msdosfs_args args;
156 error = copyin(data, &args, sizeof args);
160 ma = mount_argsu(ma, "from", args.fspec, MAXPATHLEN);
161 ma = mount_arg(ma, "export", &args.export, sizeof args.export);
162 ma = mount_argf(ma, "uid", "%d", args.uid);
163 ma = mount_argf(ma, "gid", "%d", args.gid);
164 ma = mount_argf(ma, "mask", "%d", args.mask);
165 ma = mount_argf(ma, "dirmask", "%d", args.dirmask);
167 ma = mount_argb(ma, args.flags & MSDOSFSMNT_SHORTNAME, "noshortname");
168 ma = mount_argb(ma, args.flags & MSDOSFSMNT_LONGNAME, "nolongname");
169 ma = mount_argb(ma, !(args.flags & MSDOSFSMNT_NOWIN95), "nowin95");
170 ma = mount_argb(ma, args.flags & MSDOSFSMNT_KICONV, "nokiconv");
172 ma = mount_argsu(ma, "cs_win", args.cs_win, MAXCSLEN);
173 ma = mount_argsu(ma, "cs_dos", args.cs_dos, MAXCSLEN);
174 ma = mount_argsu(ma, "cs_local", args.cs_local, MAXCSLEN);
176 error = kernel_mount(ma, flags);
185 must come in pairs, e.g.,
186 .Brq Va name , value .
188 error = kernel_vmount(
202 family of functions and this manual page first
209 family of functions and API was developed by
210 .An Poul-Henning Kamp Aq phk@FreeBSD.org .
211 This manual page was written by
212 .An Tom Rhodes Aq trhodes@FreeBSD.org .