ultrix_fs.c revision 1.49 1 1.49 ad /* $NetBSD: ultrix_fs.c,v 1.49 2008/05/06 18:43:44 ad Exp $ */
2 1.1 jonathan
3 1.1 jonathan /*
4 1.12 jonathan * Copyright (c) 1995, 1997 Jonathan Stone
5 1.12 jonathan * All rights reserved.
6 1.1 jonathan *
7 1.1 jonathan * Redistribution and use in source and binary forms, with or without
8 1.1 jonathan * modification, are permitted provided that the following conditions
9 1.1 jonathan * are met:
10 1.1 jonathan * 1. Redistributions of source code must retain the above copyright
11 1.1 jonathan * notice, this list of conditions and the following disclaimer.
12 1.1 jonathan * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 jonathan * notice, this list of conditions and the following disclaimer in the
14 1.1 jonathan * documentation and/or other materials provided with the distribution.
15 1.7 jonathan * 3. All advertising materials mentioning features or use of this software
16 1.7 jonathan * must display the following acknowledgement:
17 1.8 jonathan * This product includes software developed by Jonathan Stone for
18 1.7 jonathan * the NetBSD Project.
19 1.7 jonathan * 4. The name of the author may not be used to endorse or promote products
20 1.1 jonathan * derived from this software without specific prior written permission.
21 1.1 jonathan *
22 1.1 jonathan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
23 1.1 jonathan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 1.1 jonathan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 1.1 jonathan * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
26 1.1 jonathan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 1.1 jonathan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 1.1 jonathan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 1.1 jonathan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 1.1 jonathan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 1.1 jonathan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 1.1 jonathan * SUCH DAMAGE.
33 1.1 jonathan */
34 1.21 lukem
35 1.21 lukem #include <sys/cdefs.h>
36 1.49 ad __KERNEL_RCSID(0, "$NetBSD: ultrix_fs.c,v 1.49 2008/05/06 18:43:44 ad Exp $");
37 1.1 jonathan
38 1.1 jonathan #include <sys/param.h>
39 1.1 jonathan #include <sys/systm.h>
40 1.1 jonathan #include <sys/malloc.h>
41 1.2 jonathan #include <sys/exec.h>
42 1.2 jonathan #include <sys/namei.h>
43 1.1 jonathan #include <sys/mount.h>
44 1.9 jonathan #include <sys/proc.h>
45 1.32 he #include <sys/vnode.h>
46 1.32 he #include <sys/vnode_if.h>
47 1.2 jonathan #include <net/if.h>
48 1.2 jonathan #include <netinet/in.h>
49 1.1 jonathan
50 1.3 pk #include <nfs/rpcv2.h>
51 1.3 pk #include <nfs/nfsproto.h>
52 1.3 pk #include <nfs/nfs.h>
53 1.15 thorpej #include <nfs/nfsmount.h>
54 1.15 thorpej
55 1.15 thorpej #include <ufs/ufs/quota.h>
56 1.15 thorpej #include <ufs/ufs/ufsmount.h>
57 1.2 jonathan
58 1.2 jonathan #include <sys/syscallargs.h>
59 1.1 jonathan #include <compat/ultrix/ultrix_syscallargs.h>
60 1.9 jonathan #include <compat/common/compat_util.h>
61 1.40 christos #include <compat/sys/mount.h>
62 1.2 jonathan
63 1.1 jonathan #define ULTRIX_MAXPATHLEN 1024
64 1.1 jonathan
65 1.1 jonathan /**
66 1.1 jonathan ** Ultrix filesystem operations: mount(), getmnt().
67 1.1 jonathan ** These are included purely so one can place an (ECOFF or ELF)
68 1.1 jonathan ** NetBSD/pmax kernel in an Ultrix root filesystem, boot it,
69 1.1 jonathan ** and over-write the Ultrix root parition with NetBSD binaries.
70 1.1 jonathan **/
71 1.1 jonathan
72 1.1 jonathan /*
73 1.1 jonathan * Ultrix file system data structure, as modified by
74 1.1 jonathan * Ultrix getmntent(). This structure is padded to 2560 bytes, for
75 1.24 wiz * compatibility with the size the Ultrix kernel and user apps expect.
76 1.1 jonathan */
77 1.1 jonathan struct ultrix_fs_data {
78 1.1 jonathan u_int32_t ufsd_flags; /* how mounted */
79 1.1 jonathan u_int32_t ufsd_mtsize; /* max transfer size in bytes */
80 1.1 jonathan u_int32_t ufsd_otsize; /* optimal transfer size in bytes */
81 1.1 jonathan u_int32_t ufsd_bsize; /* fs block size (bytes) for vm code */
82 1.1 jonathan u_int32_t ufsd_fstype; /* see ../h/fs_types.h */
83 1.1 jonathan u_int32_t ufsd_gtot; /* total number of gnodes */
84 1.1 jonathan u_int32_t ufsd_gfree; /* # of free gnodes */
85 1.1 jonathan u_int32_t ufsd_btot; /* total number of 1K blocks */
86 1.1 jonathan u_int32_t ufsd_bfree; /* # of free 1K blocks */
87 1.1 jonathan u_int32_t ufsd_bfreen; /* user consumable 1K blocks */
88 1.1 jonathan u_int32_t ufsd_pgthresh; /* min size in bytes before paging*/
89 1.1 jonathan int32_t ufsd_uid; /* uid that mounted me */
90 1.1 jonathan int16_t ufsd_dev; /* major/minor of fs */
91 1.1 jonathan int16_t ufsd_exroot; /* root mapping from exports */
92 1.1 jonathan char ufsd_devname[ULTRIX_MAXPATHLEN + 4]; /* name of dev */
93 1.1 jonathan char ufsd_path[ULTRIX_MAXPATHLEN + 4]; /* name of mnt point */
94 1.1 jonathan u_int32_t ufsd_nupdate; /* number of writes */
95 1.1 jonathan u_int32_t ufsd_pad[112]; /* pad to 2560 bytes. */
96 1.1 jonathan };
97 1.1 jonathan
98 1.1 jonathan /*
99 1.1 jonathan * Get statistics on mounted filesystems.
100 1.1 jonathan */
101 1.1 jonathan #if 0
102 1.1 jonathan struct ultrix_getmnt_args {
103 1.1 jonathan int32_t *start;
104 1.1 jonathan struct ultrix_fs_data *buf;
105 1.1 jonathan int32_t bufsize;
106 1.1 jonathan int32_t mode;
107 1.1 jonathan char *path;
108 1.1 jonathan };
109 1.1 jonathan
110 1.1 jonathan #endif
111 1.1 jonathan /*
112 1.1 jonathan * Ultrix getmnt() flags.
113 1.1 jonathan * The operation getmnt() should perform is incoded in the flag
114 1.1 jonathan * argument. There are two independent attributes.
115 1.1 jonathan *
116 1.1 jonathan * ULTRIX_NOSTAT_xxx will never hang, but it may not return
117 1.1 jonathan * up-to-date statistics. (For NFS clients, it returns whatever is
118 1.1 jonathan * in the cache.) ULTRIX_STAT_xxx returns up-to-date info but may
119 1.1 jonathan * hang (e.g., on dead NFS servers).
120 1.1 jonathan *
121 1.1 jonathan * ULTRIX_xxSTAT_ONE returns statistics on just one filesystem, determined
122 1.1 jonathan * by the parth argument. ULTRIX_xxSTAT_MANY ignores the path argument and
123 1.1 jonathan * returns info on as many filesystems fit in the structure.
124 1.1 jonathan * the start argument, which should be zero on the first call,
125 1.1 jonathan * can be used to iterate over all filesystems.
126 1.1 jonathan *
127 1.1 jonathan */
128 1.1 jonathan #define ULTRIX_NOSTAT_MANY 1
129 1.1 jonathan #define ULTRIX_STAT_MANY 2
130 1.1 jonathan #define ULTRIX_STAT_ONE 3
131 1.1 jonathan #define ULTRIX_NOSTAT_ONE 4
132 1.1 jonathan
133 1.1 jonathan /*
134 1.1 jonathan * Ultrix gnode-layer filesystem codes.
135 1.1 jonathan */
136 1.1 jonathan #define ULTRIX_FSTYPE_UNKNOWN 0x0
137 1.2 jonathan #define ULTRIX_FSTYPE_ULTRIX 0x1 /* Ultrix UFS: basically 4.2bsd FFS */
138 1.1 jonathan #define ULTRIX_FSTYPE_NFS 0x5 /* NFS v2 */
139 1.1 jonathan
140 1.1 jonathan /*
141 1.2 jonathan * Ultrix mount(2) options
142 1.2 jonathan */
143 1.2 jonathan #define ULTRIX_NM_RONLY 0x0001 /* mount read-only */
144 1.2 jonathan #define ULTRIX_NM_SOFT 0x0002 /* soft mount (hard is default) */
145 1.2 jonathan #define ULTRIX_NM_WSIZE 0x0004 /* set write size */
146 1.2 jonathan #define ULTRIX_NM_RSIZE 0x0008 /* set read size */
147 1.2 jonathan #define ULTRIX_NM_TIMEO 0x0010 /* set initial timeout */
148 1.2 jonathan #define ULTRIX_NM_RETRANS 0x0020 /* set number of request retrys */
149 1.2 jonathan #define ULTRIX_NM_HOSTNAME 0x0040 /* set hostname for error printf */
150 1.2 jonathan #define ULTRIX_NM_PGTHRESH 0x0080 /* set page threshold for exec */
151 1.2 jonathan #define ULTRIX_NM_INT 0x0100 /* allow hard mount keyboard interrupts */
152 1.2 jonathan #define ULTRIX_NM_NOAC 0x0200 /* don't cache attributes */
153 1.30 perry
154 1.11 jonathan
155 1.11 jonathan static void
156 1.29 simonb make_ultrix_mntent(struct statvfs *, struct ultrix_fs_data *);
157 1.2 jonathan
158 1.2 jonathan /*
159 1.1 jonathan * Construct an Ultrix getmnt() ultrix_fs_data from the native NetBSD
160 1.1 jonathan * struct statfs.
161 1.1 jonathan */
162 1.1 jonathan static void
163 1.29 simonb make_ultrix_mntent(struct statvfs *sp, struct ultrix_fs_data *tem)
164 1.1 jonathan {
165 1.1 jonathan
166 1.16 perry memset(tem, 0, sizeof (*tem));
167 1.2 jonathan
168 1.28 simonb tem->ufsd_flags = sp->f_flag; /* XXX translate */
169 1.1 jonathan tem->ufsd_mtsize = sp->f_bsize; /* XXX max transfer size */
170 1.1 jonathan tem->ufsd_otsize = sp->f_iosize;
171 1.1 jonathan tem->ufsd_bsize = sp->f_bsize;
172 1.1 jonathan /*
173 1.2 jonathan * Translate file system type. NetBSD/1.1 has f_type zero,
174 1.2 jonathan * and uses an fstype string instead.
175 1.2 jonathan * For now, map types not in Ultrix (kernfs, null, procfs...)
176 1.2 jonathan * to UFS, since Ultrix mout will try and call mount_unknown
177 1.2 jonathan * for ULTRIX_FSTYPE_UNKNOWN, but lacks a mount_unknown binary.
178 1.1 jonathan */
179 1.2 jonathan tem->ufsd_fstype = ULTRIX_FSTYPE_NFS;
180 1.2 jonathan if (strcmp(sp->f_fstypename, "ffs") == 0)
181 1.2 jonathan tem->ufsd_fstype = ULTRIX_FSTYPE_ULTRIX;
182 1.2 jonathan
183 1.2 jonathan tem->ufsd_gtot = sp->f_files; /* total "gnodes" */
184 1.4 jonathan tem->ufsd_gfree = sp->f_ffree; /* free "gnodes" */
185 1.2 jonathan tem->ufsd_btot = sp->f_blocks; /* total 1k blocks */
186 1.4 jonathan #ifdef needsmorethought /* XXX */
187 1.4 jonathan /* tem->ufsd_bfree = sp->f_bfree; */ /* free 1k blocks */
188 1.4 jonathan /* tem->ufsd_bfree = sp->f_bavail; */ /* free 1k blocks */
189 1.4 jonathan #endif
190 1.4 jonathan
191 1.2 jonathan tem->ufsd_bfreen = sp->f_bavail; /* blocks available to users */
192 1.1 jonathan tem->ufsd_pgthresh = 0; /* not relevant */
193 1.1 jonathan tem->ufsd_uid = 0; /* XXX kept where ?*/
194 1.1 jonathan tem->ufsd_dev = 0; /* ?? */
195 1.1 jonathan tem->ufsd_exroot = 0; /* ?? */
196 1.1 jonathan strncpy(tem->ufsd_path, sp->f_mntonname, ULTRIX_MAXPATHLEN);
197 1.1 jonathan strncpy(tem->ufsd_devname, sp->f_mntfromname, ULTRIX_MAXPATHLEN);
198 1.2 jonathan #if 0
199 1.2 jonathan /* In NetBSD-1.1, filesystem type is unused and always 0 */
200 1.6 christos printf("mntent: %s type %d\n", tem->ufsd_devname, tem->ufsd_fstype);
201 1.6 christos printf("mntent: %s tot %d free %d user%d\n",
202 1.2 jonathan tem->ufsd_devname, sp->f_blocks, sp->f_bfree, sp->f_bavail);
203 1.2 jonathan #endif
204 1.1 jonathan }
205 1.1 jonathan
206 1.1 jonathan int
207 1.44 dsl ultrix_sys_getmnt(struct lwp *l, const struct ultrix_sys_getmnt_args *uap, register_t *retval)
208 1.1 jonathan {
209 1.1 jonathan struct mount *mp, *nmp;
210 1.28 simonb struct statvfs *sp;
211 1.1 jonathan struct ultrix_fs_data *sfsp;
212 1.1 jonathan char *path;
213 1.1 jonathan int mntflags;
214 1.1 jonathan int skip;
215 1.1 jonathan int start;
216 1.1 jonathan long count, maxcount;
217 1.1 jonathan int error = 0;
218 1.1 jonathan
219 1.17 simonb nmp = NULL; /* XXX keep gcc quiet */
220 1.1 jonathan path = NULL;
221 1.1 jonathan error = 0;
222 1.1 jonathan maxcount = SCARG(uap, bufsize) / sizeof(struct ultrix_fs_data);
223 1.1 jonathan sfsp = SCARG(uap, buf);
224 1.1 jonathan
225 1.1 jonathan if (SCARG(uap, mode) == ULTRIX_STAT_ONE ||
226 1.1 jonathan SCARG(uap, mode) == ULTRIX_STAT_MANY)
227 1.1 jonathan mntflags = MNT_WAIT;
228 1.1 jonathan else
229 1.1 jonathan mntflags = MNT_NOWAIT;
230 1.1 jonathan
231 1.1 jonathan if (SCARG(uap, mode) == ULTRIX_STAT_ONE || SCARG(uap, mode) == ULTRIX_NOSTAT_ONE) {
232 1.1 jonathan /*
233 1.1 jonathan * Only get info on mountpoints that matches the path
234 1.1 jonathan * provided.
235 1.1 jonathan */
236 1.1 jonathan MALLOC(path, char *, MAXPATHLEN, M_TEMP, M_WAITOK);
237 1.4 jonathan if ((error = copyinstr(SCARG(uap, path), path,
238 1.4 jonathan MAXPATHLEN, NULL)) != 0)
239 1.1 jonathan goto bad;
240 1.1 jonathan maxcount = 1;
241 1.1 jonathan } else {
242 1.1 jonathan /*
243 1.1 jonathan * Get info on any mountpoints, somewhat like readdir().
244 1.1 jonathan * Find out how many mount list entries to skip, and skip
245 1.1 jonathan * them.
246 1.1 jonathan */
247 1.36 christos if ((error = copyin((void *)SCARG(uap, start), &start,
248 1.4 jonathan sizeof(*SCARG(uap, start)))) != 0)
249 1.1 jonathan goto bad;
250 1.41 ad mutex_enter(&mountlist_lock);
251 1.1 jonathan for (skip = start, mp = mountlist.cqh_first;
252 1.1 jonathan mp != (void*)&mountlist && skip-- > 0; mp = nmp)
253 1.1 jonathan nmp = mp->mnt_list.cqe_next;
254 1.41 ad mutex_exit(&mountlist_lock);
255 1.1 jonathan }
256 1.1 jonathan
257 1.41 ad mutex_enter(&mountlist_lock);
258 1.1 jonathan for (count = 0, mp = mountlist.cqh_first;
259 1.1 jonathan mp != (void*)&mountlist && count < maxcount; mp = nmp) {
260 1.49 ad if (vfs_busy(mp, &nmp)) {
261 1.15 thorpej continue;
262 1.15 thorpej }
263 1.15 thorpej if (sfsp != NULL) {
264 1.1 jonathan struct ultrix_fs_data tem;
265 1.1 jonathan sp = &mp->mnt_stat;
266 1.1 jonathan
267 1.1 jonathan /*
268 1.1 jonathan * If requested, refresh the fsstat cache.
269 1.1 jonathan */
270 1.15 thorpej if (mntflags != MNT_WAIT &&
271 1.43 dogcow (error = VFS_STATVFS(mp, sp)) != 0)
272 1.1 jonathan continue;
273 1.1 jonathan
274 1.1 jonathan /*
275 1.1 jonathan * XXX what does this do? -- cgd
276 1.1 jonathan */
277 1.28 simonb sp->f_flag = mp->mnt_flag & MNT_VISFLAGMASK;
278 1.1 jonathan if (path == NULL ||
279 1.1 jonathan strcmp(path, sp->f_mntonname) == 0) {
280 1.1 jonathan make_ultrix_mntent(sp, &tem);
281 1.36 christos if ((error = copyout((void *)&tem, sfsp,
282 1.46 ad sizeof(tem))) != 0) {
283 1.48 ad vfs_unbusy(mp, false, NULL);
284 1.1 jonathan goto bad;
285 1.46 ad }
286 1.1 jonathan sfsp++;
287 1.1 jonathan count++;
288 1.1 jonathan }
289 1.1 jonathan }
290 1.48 ad vfs_unbusy(mp, false, &nmp);
291 1.1 jonathan }
292 1.41 ad mutex_exit(&mountlist_lock);
293 1.1 jonathan
294 1.1 jonathan if (sfsp != NULL && count > maxcount)
295 1.1 jonathan *retval = maxcount;
296 1.1 jonathan else
297 1.1 jonathan *retval = count;
298 1.1 jonathan
299 1.1 jonathan bad:
300 1.1 jonathan if (path)
301 1.1 jonathan FREE(path, M_TEMP);
302 1.45 christos return error;
303 1.2 jonathan }
304 1.2 jonathan
305 1.2 jonathan
306 1.2 jonathan
307 1.2 jonathan /* Old-style inet sockaddr (no len field) as passed to Ultrix mount(2) */
308 1.2 jonathan struct osockaddr_in {
309 1.2 jonathan short sin_family;
310 1.2 jonathan u_short sin_port;
311 1.2 jonathan struct in_addr sin_addr;
312 1.2 jonathan char sin_zero[8];
313 1.2 jonathan };
314 1.2 jonathan
315 1.2 jonathan
316 1.2 jonathan /*
317 1.2 jonathan * fstype-dependent structure passed to Ultrix mount(2) when
318 1.2 jonathan * mounting NFS filesystems
319 1.2 jonathan */
320 1.2 jonathan struct ultrix_nfs_args {
321 1.2 jonathan struct osockaddr_in *addr; /* file server address */
322 1.3 pk void *fh; /* file handle to be mounted */
323 1.2 jonathan int flags; /* flags */
324 1.2 jonathan int wsize; /* write size in bytes */
325 1.2 jonathan int rsize; /* read size in bytes */
326 1.2 jonathan int timeo; /* initial timeout in .1 secs */
327 1.2 jonathan int retrans; /* times to retry send */
328 1.2 jonathan char *hostname; /* server's hostname */
329 1.2 jonathan char *optstr; /* string of nfs mount options*/
330 1.2 jonathan int gfs_flags; /* gnode flags (ugh) */
331 1.2 jonathan int pg_thresh; /* paging threshold ? */
332 1.2 jonathan };
333 1.2 jonathan
334 1.2 jonathan
335 1.2 jonathan /*
336 1.2 jonathan * fstype-dependent structure passed to Ultrix mount(2) when
337 1.2 jonathan * mounting local (4.2bsd FFS) filesystems
338 1.2 jonathan */
339 1.2 jonathan struct ultrix_ufs_args {
340 1.2 jonathan u_long ufs_flags; /* mount flags?*/
341 1.2 jonathan u_long ufs_pgthresh; /* minimum file size to page */
342 1.2 jonathan };
343 1.2 jonathan
344 1.2 jonathan int
345 1.44 dsl ultrix_sys_mount(struct lwp *l, const struct ultrix_sys_mount_args *uap, register_t *retval)
346 1.2 jonathan {
347 1.2 jonathan int error;
348 1.2 jonathan int otype = SCARG(uap, type);
349 1.2 jonathan char fsname[MFSNAMELEN];
350 1.39 ad register_t dummy;
351 1.38 dsl int nflags;
352 1.2 jonathan
353 1.38 dsl nflags = 0;
354 1.2 jonathan
355 1.2 jonathan /*
356 1.2 jonathan * Translate Ultrix integer mount codes for UFS and NFS to
357 1.2 jonathan * NetBSD fstype strings. Other Ultrix filesystem types
358 1.2 jonathan * (msdos, DEC ods-2) are not supported.
359 1.2 jonathan */
360 1.2 jonathan
361 1.2 jonathan /* Translate the Ultrix mount-readonly option parameter */
362 1.2 jonathan if (SCARG(uap, rdonly))
363 1.38 dsl nflags |= MNT_RDONLY;
364 1.2 jonathan
365 1.2 jonathan
366 1.2 jonathan #ifdef later
367 1.2 jonathan parse ultrix mount option string and set NetBSD flags
368 1.2 jonathan #endif
369 1.2 jonathan
370 1.38 dsl if (otype == ULTRIX_FSTYPE_NFS) {
371 1.2 jonathan struct ultrix_nfs_args una;
372 1.2 jonathan struct nfs_args na;
373 1.2 jonathan
374 1.45 christos if ((error = copyin(SCARG(uap, data), &una, sizeof(una))) != 0)
375 1.45 christos return error;
376 1.38 dsl #if 0
377 1.2 jonathan /*
378 1.2 jonathan * This is the only syscall boundary the
379 1.2 jonathan * address of the server passes, so do backwards
380 1.2 jonathan * compatibility on 4.3style sockaddrs here.
381 1.2 jonathan */
382 1.4 jonathan if ((error = copyin(una.addr, &osa, sizeof osa)) != 0) {
383 1.6 christos printf("ultrix_mount: nfs copyin osa\n");
384 1.45 christos return error;
385 1.2 jonathan }
386 1.2 jonathan sap->sin_family = (u_char)osa.sin_family;
387 1.2 jonathan sap->sin_len = sizeof(*sap);
388 1.38 dsl /* XXXX teach nfs how to do the above */
389 1.38 dsl #endif
390 1.3 pk na.version = NFS_ARGSVERSION;
391 1.39 ad na.addr = (void *)una.addr;
392 1.38 dsl na.addrlen = sizeof (struct sockaddr_in);
393 1.2 jonathan na.sotype = SOCK_DGRAM;
394 1.2 jonathan na.proto = IPPROTO_UDP;
395 1.2 jonathan na.fh = una.fh;
396 1.3 pk na.fhsize = NFSX_V2FH;
397 1.2 jonathan na.flags = /*una.flags;*/ NFSMNT_NOCONN | NFSMNT_RESVPORT;
398 1.2 jonathan na.wsize = una.wsize;
399 1.2 jonathan na.rsize = una.rsize;
400 1.2 jonathan na.timeo = una.timeo;
401 1.2 jonathan na.retrans = una.retrans;
402 1.2 jonathan na.hostname = una.hostname;
403 1.42 pooka return do_sys_mount(l, vfs_getopsbyname("nfs"), NULL,
404 1.38 dsl SCARG(uap, special), nflags, &na, UIO_SYSSPACE,
405 1.38 dsl sizeof na, &dummy);
406 1.38 dsl }
407 1.38 dsl
408 1.38 dsl /*
409 1.38 dsl * Translate fstype-dependent mount options from
410 1.38 dsl * Ultrix format to native.
411 1.38 dsl */
412 1.38 dsl if (otype == ULTRIX_FSTYPE_ULTRIX) {
413 1.38 dsl /* attempt to mount a native, rather than 4.2bsd, ffs */
414 1.38 dsl struct ufs_args ua;
415 1.38 dsl
416 1.38 dsl memset(&ua, 0, sizeof(ua));
417 1.38 dsl ua.fspec = SCARG(uap, special);
418 1.38 dsl
419 1.38 dsl /*
420 1.38 dsl * Ultrix mount has no MNT_UPDATE flag.
421 1.38 dsl * Attempt to see if this is the root we're mounting,
422 1.38 dsl * and if so, set MNT_UPDATE so we can mount / read-write.
423 1.38 dsl */
424 1.38 dsl fsname[0] = 0;
425 1.39 ad if ((error = copyinstr(SCARG(uap, dir), fsname,
426 1.38 dsl sizeof fsname, NULL)) != 0)
427 1.38 dsl return(error);
428 1.38 dsl if (strcmp(fsname, "/") == 0) {
429 1.38 dsl nflags |= MNT_UPDATE;
430 1.38 dsl printf("COMPAT_ULTRIX: mount with MNT_UPDATE on %s\n",
431 1.38 dsl fsname);
432 1.38 dsl }
433 1.38 dsl return do_sys_mount(l, vfs_getopsbyname("ffs"), NULL,
434 1.39 ad SCARG(uap, dir), nflags, &ua, UIO_SYSSPACE, sizeof ua,
435 1.38 dsl &dummy);
436 1.2 jonathan }
437 1.38 dsl
438 1.45 christos return EINVAL;
439 1.1 jonathan }
440