conf.c revision 1.17
11.17Sgmcgarry/*	$NetBSD: conf.c,v 1.17 2002/02/23 21:43:59 gmcgarry 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.17Sgmcgarry#ifdef DEBUG_VAL
541.17Sgmcgarryint debug = DEBUG_VAL;
551.17Sgmcgarry#else
561.17Sgmcgarryint debug = 0;
571.17Sgmcgarry#endif
581.1Sderaadt
591.13Ssimonb#ifndef LIBSA_SINGLE_DEVICE
601.14Ssimonb
611.14Ssimonb#ifdef LIBSA_NO_DEV_CLOSE
621.6Ssimonb#define rzclose /*(()(struct open_file*))*/0
631.14Ssimonb#endif
641.14Ssimonb
651.14Ssimonb#ifdef LIBSA_NO_DEV_IOCTL
661.9Ssimonb#define rzioctl /*(()(struct open_file*, u_long, void*))*/0
671.9Ssimonb#else
681.9Ssimonb#define	rzioctl		noioctl
691.1Sderaadt#endif
701.1Sderaadt
711.1Sderaadtstruct devsw devsw[] = {
721.16Ssimonb	{ "rz", rzstrategy, rzopen, rzclose, rzioctl },			/* 0 */
731.16Ssimonb#ifdef BOOTNET
741.16Ssimonb	{ "tftp", net_strategy, net_open, net_close, net_ioctl },	/* 1 */
751.16Ssimonb#endif
761.1Sderaadt};
771.1Sderaadt
781.1Sderaadtint	ndevs = (sizeof(devsw)/sizeof(devsw[0]));
791.13Ssimonb#endif
801.13Ssimonb
811.12Ssimonb
821.13Ssimonb#ifndef LIBSA_SINGLE_FILESYSTEM
831.12Ssimonb#ifdef LIBSA_NO_FS_CLOSE
841.12Ssimonb#define ufs_close	0
851.16Ssimonb#define lfs_close	0
861.16Ssimonb#define cd9660_close	0
871.16Ssimonb#define ustarfs_close	0
881.16Ssimonb#define nfs_close	0
891.12Ssimonb#endif
901.12Ssimonb#ifdef LIBSA_NO_FS_WRITE
911.12Ssimonb#define ufs_write	0
921.16Ssimonb#define lfs_write	0
931.16Ssimonb#define cd9660_write	0
941.16Ssimonb#define ustarfs_write	0
951.16Ssimonb#define nfs_write	0
961.12Ssimonb#endif
971.11Ssimonb
981.11Ssimonbstruct fs_ops file_system[] = {
991.16Ssimonb	{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
1001.16Ssimonb	{ lfs_open, lfs_close, lfs_read, lfs_write, lfs_seek, lfs_stat },
1011.16Ssimonb	{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
1021.16Ssimonb	    cd9660_stat },
1031.16Ssimonb	{ ustarfs_open, ustarfs_close, ustarfs_read, ustarfs_write,
1041.16Ssimonb	    ustarfs_seek, ustarfs_stat },
1051.16Ssimonb#ifdef BOOTNET
1061.16Ssimonb	{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
1071.16Ssimonb#endif
1081.11Ssimonb};
1091.11Ssimonb
1101.11Ssimonbint nfsys = sizeof(file_system)/sizeof(struct fs_ops);
1111.16Ssimonb#endif
1121.16Ssimonb
1131.16Ssimonb#ifdef BOOTNET
1141.16Ssimonbextern struct netif_driver prom_netif_driver;
1151.16Ssimonb
1161.16Ssimonbstruct netif_driver *netif_drivers[] = {
1171.16Ssimonb	&prom_netif_driver,
1181.16Ssimonb};
1191.16Ssimonbint	n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
1201.13Ssimonb#endif
121