/*
- * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
- * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ * The contents of this file constitute Original Code as defined in and
+ * are subject to the Apple Public Source License Version 1.1 (the
+ * "License"). You may not use this file except in compliance with the
+ * License. Please obtain a copy of the License at
+ * http://www.apple.com/publicsource and read it before using this file.
*
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This Original Code and all software distributed under the License are
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
VFS_SET(nfs_vfsops, nfs, MOUNT_NFS, VFCF_NETWORK);
#endif
+/*
+ * This structure must be filled in by a primary bootstrap or bootstrap
+ * server for a diskless/dataless machine. It is initialized below just
+ * to ensure that it is allocated to initialized data (.data not .bss).
+ */
+struct nfs_diskless nfs_diskless = { 0 };
+int nfs_diskless_valid = 0;
+
+/* XXX CSM 11/25/97 Upgrade sysctl.h someday */
+#ifdef notyet
+SYSCTL_INT(_vfs_nfs, OID_AUTO, diskless_valid, CTLFLAG_RD,
+ &nfs_diskless_valid, 0, "");
+
+SYSCTL_STRING(_vfs_nfs, OID_AUTO, diskless_rootpath, CTLFLAG_RD,
+ nfs_diskless.root_hostnam, 0, "");
+
+SYSCTL_OPAQUE(_vfs_nfs, OID_AUTO, diskless_rootaddr, CTLFLAG_RD,
+ &nfs_diskless.root_saddr, sizeof nfs_diskless.root_saddr,
+ "%Ssockaddr_in", "");
+
+SYSCTL_STRING(_vfs_nfs, OID_AUTO, diskless_swappath, CTLFLAG_RD,
+ nfs_diskless.swap_hostnam, 0, "");
+
+SYSCTL_OPAQUE(_vfs_nfs, OID_AUTO, diskless_swapaddr, CTLFLAG_RD,
+ &nfs_diskless.swap_saddr, sizeof nfs_diskless.swap_saddr,
+ "%Ssockaddr_in","");
+#endif
+
void nfsargs_ntoh __P((struct nfs_args *));
static int
iosize = max(nmp->nm_rsize, nmp->nm_wsize);
if (iosize < PAGE_SIZE)
iosize = PAGE_SIZE;
- return (trunc_page_32(iosize));
+ return (trunc_page(iosize));
}
static void nfs_convert_oargs(args,oargs)
struct mount *mppriv;
struct vnode *vppriv;
#endif /* NO_MOUNT_PRIVATE */
- int v3;
procp = current_proc(); /* XXX */
panic("nfs_boot_init failed with %d\n", error);
}
- /* try NFSv3 first, if that fails then try NFSv2 */
- v3 = 1;
-
-tryagain:
- error = nfs_boot_getfh(&nd, procp, v3);
- if (error) {
- if (v3) {
- printf("nfs_boot_getfh(v3) failed with %d, trying v2...\n", error);
- v3 = 0;
- goto tryagain;
- }
- panic("nfs_boot_getfh(v2) failed with %d\n", error);
- }
-
/*
* Create the root mount point.
*/
#else
if (error = nfs_mount_diskless(&nd.nd_root, "/", NULL, &vp, &mp)) {
#endif /* NO_MOUNT_PRIVATE */
- if (v3) {
- printf("nfs_mount_diskless(v3) failed with %d, trying v2...\n", error);
- v3 = 0;
- goto tryagain;
- }
- panic("nfs_mount_diskless root failed with %d\n", error);
+ panic("nfs_mount_diskless failed with %d\n", error);
}
printf("root on %s\n", (char *)&nd.nd_root.ndm_host);
error = nfs_mount_diskless_private(&nd.nd_private, "/private",
NULL, &vppriv, &mppriv);
if (error) {
- panic("nfs_mount_diskless private failed with %d\n", error);
+ panic("nfs_mount_diskless failed with %d\n", error);
}
printf("private on %s\n", (char *)&nd.nd_private.ndm_host);
#endif /* NO_MOUNT_PRIVATE */
- if (nd.nd_root.ndm_path)
- FREE_ZONE(nd.nd_root.ndm_path, MAXPATHLEN, M_NAMEI);
- if (nd.nd_private.ndm_path)
- FREE_ZONE(nd.nd_private.ndm_path, MAXPATHLEN, M_NAMEI);
-
/* Get root attributes (for the time). */
error = VOP_GETATTR(vp, &attr, procp->p_ucred, procp);
if (error) panic("nfs_mountroot: getattr for root");
args.addrlen = args.addr->sa_len;
args.sotype = SOCK_DGRAM;
args.fh = ndmntp->ndm_fh;
- args.fhsize = ndmntp->ndm_fhlen;
+ args.fhsize = NFSX_V2FH; /* need to try v3, then v2 */
args.hostname = ndmntp->ndm_host;
args.flags = NFSMNT_RESVPORT;
- if (ndmntp->ndm_nfsv3)
- args.flags |= NFSMNT_NFSV3;
MGET(m, M_DONTWAIT, MT_SONAME);
bcopy((caddr_t)args.addr, mtod(m, caddr_t),
args.addrlen = args.addr->sa_len;
args.sotype = SOCK_DGRAM;
args.fh = ndmntp->ndm_fh;
- args.fhsize = ndmntp->ndm_fhlen;
+ args.fhsize = NFSX_V2FH;
args.hostname = ndmntp->ndm_host;
args.flags = NFSMNT_RESVPORT;
- if (ndmntp->ndm_nfsv3)
- args.flags |= NFSMNT_NFSV3;
MGET(m, M_DONTWAIT, MT_SONAME);
bcopy((caddr_t)args.addr, mtod(m, caddr_t),