conf.c revision 1.22
11.22Sagc/*	$NetBSD: conf.c,v 1.22 2003/08/07 16:29:15 agc 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.22Sagc * 3. Neither the name of the University nor the names of its contributors
191.1Sderaadt *    may be used to endorse or promote products derived from this software
201.1Sderaadt *    without specific prior written permission.
211.1Sderaadt *
221.1Sderaadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231.1Sderaadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241.1Sderaadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251.1Sderaadt * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261.1Sderaadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271.1Sderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281.1Sderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291.1Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301.1Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311.1Sderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321.1Sderaadt * SUCH DAMAGE.
331.1Sderaadt *
341.4Scgd *	@(#)conf.c	8.1 (Berkeley) 6/10/93
351.1Sderaadt */
361.1Sderaadt
371.6Ssimonb#include <sys/types.h>
381.16Ssimonb#include <netinet/in.h>
391.16Ssimonb#include <lib/libsa/stand.h>
401.16Ssimonb#include <lib/libsa/dev_net.h>
411.16Ssimonb#include <lib/libsa/ufs.h>
421.16Ssimonb#include <lib/libsa/lfs.h>
431.16Ssimonb#include <lib/libsa/nfs.h>
441.16Ssimonb#include <lib/libsa/cd9660.h>
451.16Ssimonb#include <lib/libsa/ustarfs.h>
461.8Ssimonb#include <machine/dec_prom.h>
471.16Ssimonb#include "../common/rz.h"
481.17Sgmcgarry
491.18Ssimonb#ifdef NET_DEBUG
501.18Ssimonb/* only used for network debugging for now */
511.17Sgmcgarry#ifdef DEBUG_VAL
521.17Sgmcgarryint debug = DEBUG_VAL;
531.17Sgmcgarry#else
541.17Sgmcgarryint debug = 0;
551.17Sgmcgarry#endif
561.18Ssimonb#endif /* NET_DEBUG */
571.1Sderaadt
581.13Ssimonb#ifndef LIBSA_SINGLE_DEVICE
591.14Ssimonb
601.14Ssimonb#ifdef LIBSA_NO_DEV_CLOSE
611.6Ssimonb#define rzclose /*(()(struct open_file*))*/0
621.14Ssimonb#endif
631.14Ssimonb
641.14Ssimonb#ifdef LIBSA_NO_DEV_IOCTL
651.9Ssimonb#define rzioctl /*(()(struct open_file*, u_long, void*))*/0
661.9Ssimonb#else
671.9Ssimonb#define	rzioctl		noioctl
681.1Sderaadt#endif
691.1Sderaadt
701.1Sderaadtstruct devsw devsw[] = {
711.21Ssimonb	{ "rz", rzstrategy, rzopen, rzclose, rzioctl },
721.16Ssimonb#ifdef BOOTNET
731.21Ssimonb	{ "tftp", net_strategy, net_open, net_close, net_ioctl },
741.21Ssimonb	{ "mop", net_strategy, net_open, net_close, net_ioctl },
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.19Ssimonb#define lfsv1_close	0
861.19Ssimonb#define lfsv2_close	0
871.16Ssimonb#define cd9660_close	0
881.16Ssimonb#define ustarfs_close	0
891.16Ssimonb#define nfs_close	0
901.12Ssimonb#endif
911.12Ssimonb#ifdef LIBSA_NO_FS_WRITE
921.12Ssimonb#define ufs_write	0
931.19Ssimonb#define lfsv1_write	0
941.19Ssimonb#define lfsv2_write	0
951.16Ssimonb#define cd9660_write	0
961.16Ssimonb#define ustarfs_write	0
971.16Ssimonb#define nfs_write	0
981.12Ssimonb#endif
991.11Ssimonb
1001.11Ssimonbstruct fs_ops file_system[] = {
1011.16Ssimonb	{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
1021.19Ssimonb	{ lfsv1_open, lfsv1_close, lfsv1_read, lfsv1_write, lfsv1_seek,
1031.19Ssimonb	    lfsv1_stat },
1041.19Ssimonb	{ lfsv2_open, lfsv2_close, lfsv2_read, lfsv2_write, lfsv2_seek,
1051.19Ssimonb	    lfsv2_stat },
1061.16Ssimonb	{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
1071.16Ssimonb	    cd9660_stat },
1081.16Ssimonb	{ ustarfs_open, ustarfs_close, ustarfs_read, ustarfs_write,
1091.16Ssimonb	    ustarfs_seek, ustarfs_stat },
1101.16Ssimonb#ifdef BOOTNET
1111.16Ssimonb	{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
1121.16Ssimonb#endif
1131.11Ssimonb};
1141.11Ssimonb
1151.11Ssimonbint nfsys = sizeof(file_system)/sizeof(struct fs_ops);
1161.16Ssimonb#endif
1171.16Ssimonb
1181.16Ssimonb#ifdef BOOTNET
1191.16Ssimonbextern struct netif_driver prom_netif_driver;
1201.16Ssimonb
1211.16Ssimonbstruct netif_driver *netif_drivers[] = {
1221.16Ssimonb	&prom_netif_driver,
1231.16Ssimonb};
1241.16Ssimonbint	n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
1251.13Ssimonb#endif
126