conf.c revision 1.21
11.21Ssimonb/*	$NetBSD: conf.c,v 1.21 2003/05/29 03:53:57 simonb Exp $	*/
21.4Scgd
31.1Sderaadt/*
41.2Sglass * Copyright (c) 1992, 1993
51.2Sglass *	The Regents of the University of California.  All rights reserved.
61.1Sderaadt *
71.1Sderaadt * This code is derived from software contributed to Berkeley by
81.1Sderaadt * Ralph Campbell.
91.1Sderaadt *
101.1Sderaadt * Redistribution and use in source and binary forms, with or without
111.1Sderaadt * modification, are permitted provided that the following conditions
121.1Sderaadt * are met:
131.1Sderaadt * 1. Redistributions of source code must retain the above copyright
141.1Sderaadt *    notice, this list of conditions and the following disclaimer.
151.1Sderaadt * 2. Redistributions in binary form must reproduce the above copyright
161.1Sderaadt *    notice, this list of conditions and the following disclaimer in the
171.1Sderaadt *    documentation and/or other materials provided with the distribution.
181.1Sderaadt * 3. All advertising materials mentioning features or use of this software
191.1Sderaadt *    must display the following acknowledgement:
201.1Sderaadt *	This product includes software developed by the University of
211.1Sderaadt *	California, Berkeley and its contributors.
221.1Sderaadt * 4. Neither the name of the University nor the names of its contributors
231.1Sderaadt *    may be used to endorse or promote products derived from this software
241.1Sderaadt *    without specific prior written permission.
251.1Sderaadt *
261.1Sderaadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271.1Sderaadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281.1Sderaadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291.1Sderaadt * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301.1Sderaadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311.1Sderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321.1Sderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331.1Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341.1Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351.1Sderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361.1Sderaadt * SUCH DAMAGE.
371.1Sderaadt *
381.4Scgd *	@(#)conf.c	8.1 (Berkeley) 6/10/93
391.1Sderaadt */
401.1Sderaadt
411.6Ssimonb#include <sys/types.h>
421.16Ssimonb#include <netinet/in.h>
431.16Ssimonb#include <lib/libsa/stand.h>
441.16Ssimonb#include <lib/libsa/dev_net.h>
451.16Ssimonb#include <lib/libsa/ufs.h>
461.16Ssimonb#include <lib/libsa/lfs.h>
471.16Ssimonb#include <lib/libsa/nfs.h>
481.16Ssimonb#include <lib/libsa/cd9660.h>
491.16Ssimonb#include <lib/libsa/ustarfs.h>
501.8Ssimonb#include <machine/dec_prom.h>
511.16Ssimonb#include "../common/rz.h"
521.17Sgmcgarry
531.18Ssimonb#ifdef NET_DEBUG
541.18Ssimonb/* only used for network debugging for now */
551.17Sgmcgarry#ifdef DEBUG_VAL
561.17Sgmcgarryint debug = DEBUG_VAL;
571.17Sgmcgarry#else
581.17Sgmcgarryint debug = 0;
591.17Sgmcgarry#endif
601.18Ssimonb#endif /* NET_DEBUG */
611.1Sderaadt
621.13Ssimonb#ifndef LIBSA_SINGLE_DEVICE
631.14Ssimonb
641.14Ssimonb#ifdef LIBSA_NO_DEV_CLOSE
651.6Ssimonb#define rzclose /*(()(struct open_file*))*/0
661.14Ssimonb#endif
671.14Ssimonb
681.14Ssimonb#ifdef LIBSA_NO_DEV_IOCTL
691.9Ssimonb#define rzioctl /*(()(struct open_file*, u_long, void*))*/0
701.9Ssimonb#else
711.9Ssimonb#define	rzioctl		noioctl
721.1Sderaadt#endif
731.1Sderaadt
741.1Sderaadtstruct devsw devsw[] = {
751.21Ssimonb	{ "rz", rzstrategy, rzopen, rzclose, rzioctl },
761.16Ssimonb#ifdef BOOTNET
771.21Ssimonb	{ "tftp", net_strategy, net_open, net_close, net_ioctl },
781.21Ssimonb	{ "mop", net_strategy, net_open, net_close, net_ioctl },
791.16Ssimonb#endif
801.1Sderaadt};
811.1Sderaadt
821.1Sderaadtint	ndevs = (sizeof(devsw)/sizeof(devsw[0]));
831.13Ssimonb#endif
841.13Ssimonb
851.12Ssimonb
861.13Ssimonb#ifndef LIBSA_SINGLE_FILESYSTEM
871.12Ssimonb#ifdef LIBSA_NO_FS_CLOSE
881.12Ssimonb#define ufs_close	0
891.19Ssimonb#define lfsv1_close	0
901.19Ssimonb#define lfsv2_close	0
911.16Ssimonb#define cd9660_close	0
921.16Ssimonb#define ustarfs_close	0
931.16Ssimonb#define nfs_close	0
941.12Ssimonb#endif
951.12Ssimonb#ifdef LIBSA_NO_FS_WRITE
961.12Ssimonb#define ufs_write	0
971.19Ssimonb#define lfsv1_write	0
981.19Ssimonb#define lfsv2_write	0
991.16Ssimonb#define cd9660_write	0
1001.16Ssimonb#define ustarfs_write	0
1011.16Ssimonb#define nfs_write	0
1021.12Ssimonb#endif
1031.11Ssimonb
1041.11Ssimonbstruct fs_ops file_system[] = {
1051.16Ssimonb	{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
1061.19Ssimonb	{ lfsv1_open, lfsv1_close, lfsv1_read, lfsv1_write, lfsv1_seek,
1071.19Ssimonb	    lfsv1_stat },
1081.19Ssimonb	{ lfsv2_open, lfsv2_close, lfsv2_read, lfsv2_write, lfsv2_seek,
1091.19Ssimonb	    lfsv2_stat },
1101.16Ssimonb	{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
1111.16Ssimonb	    cd9660_stat },
1121.16Ssimonb	{ ustarfs_open, ustarfs_close, ustarfs_read, ustarfs_write,
1131.16Ssimonb	    ustarfs_seek, ustarfs_stat },
1141.16Ssimonb#ifdef BOOTNET
1151.16Ssimonb	{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
1161.16Ssimonb#endif
1171.11Ssimonb};
1181.11Ssimonb
1191.11Ssimonbint nfsys = sizeof(file_system)/sizeof(struct fs_ops);
1201.16Ssimonb#endif
1211.16Ssimonb
1221.16Ssimonb#ifdef BOOTNET
1231.16Ssimonbextern struct netif_driver prom_netif_driver;
1241.16Ssimonb
1251.16Ssimonbstruct netif_driver *netif_drivers[] = {
1261.16Ssimonb	&prom_netif_driver,
1271.16Ssimonb};
1281.16Ssimonbint	n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
1291.13Ssimonb#endif
130