conf.c revision 1.18
11.18Ssimonb/*	$NetBSD: conf.c,v 1.18 2002/03/15 13:31:08 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.16Ssimonb	{ "rz", rzstrategy, rzopen, rzclose, rzioctl },			/* 0 */
761.16Ssimonb#ifdef BOOTNET
771.16Ssimonb	{ "tftp", net_strategy, net_open, net_close, net_ioctl },	/* 1 */
781.16Ssimonb#endif
791.1Sderaadt};
801.1Sderaadt
811.1Sderaadtint	ndevs = (sizeof(devsw)/sizeof(devsw[0]));
821.13Ssimonb#endif
831.13Ssimonb
841.12Ssimonb
851.13Ssimonb#ifndef LIBSA_SINGLE_FILESYSTEM
861.12Ssimonb#ifdef LIBSA_NO_FS_CLOSE
871.12Ssimonb#define ufs_close	0
881.16Ssimonb#define lfs_close	0
891.16Ssimonb#define cd9660_close	0
901.16Ssimonb#define ustarfs_close	0
911.16Ssimonb#define nfs_close	0
921.12Ssimonb#endif
931.12Ssimonb#ifdef LIBSA_NO_FS_WRITE
941.12Ssimonb#define ufs_write	0
951.16Ssimonb#define lfs_write	0
961.16Ssimonb#define cd9660_write	0
971.16Ssimonb#define ustarfs_write	0
981.16Ssimonb#define nfs_write	0
991.12Ssimonb#endif
1001.11Ssimonb
1011.11Ssimonbstruct fs_ops file_system[] = {
1021.16Ssimonb	{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
1031.16Ssimonb	{ lfs_open, lfs_close, lfs_read, lfs_write, lfs_seek, lfs_stat },
1041.16Ssimonb	{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
1051.16Ssimonb	    cd9660_stat },
1061.16Ssimonb	{ ustarfs_open, ustarfs_close, ustarfs_read, ustarfs_write,
1071.16Ssimonb	    ustarfs_seek, ustarfs_stat },
1081.16Ssimonb#ifdef BOOTNET
1091.16Ssimonb	{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
1101.16Ssimonb#endif
1111.11Ssimonb};
1121.11Ssimonb
1131.11Ssimonbint nfsys = sizeof(file_system)/sizeof(struct fs_ops);
1141.16Ssimonb#endif
1151.16Ssimonb
1161.16Ssimonb#ifdef BOOTNET
1171.16Ssimonbextern struct netif_driver prom_netif_driver;
1181.16Ssimonb
1191.16Ssimonbstruct netif_driver *netif_drivers[] = {
1201.16Ssimonb	&prom_netif_driver,
1211.16Ssimonb};
1221.16Ssimonbint	n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
1231.13Ssimonb#endif
124