DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦a375c3fae⟧ TextFile

    Length: 5470 (0x155e)
    Types: TextFile
    Notes: UNIX file
    Names: »space.c«

Derivation

└─⟦fdc69b24d⟧ Bits:30004152 SW95705I 386/ix Multi User Update 1
└─⟦fdc69b24d⟧ UNIX Filesystem
    └─ ⟦this⟧ »U1/new/etc/atconf/modules/gendev/space.c« 

TextFile

/*
 * Generic Device Driver space allocations.  This version for DISK only.
 */

/*
 * Copyrighted as an unpublished work.
 * (c) Copyright 1986 INTERACTIVE Systems Corporation
 * All rights reserved.
 *
 * RESTRICTED RIGHTS
 *
 * These programs are supplied under a license.  They may be used,
 * disclosed, and/or copied only as permitted under such license
 * agreement.  Any copy must contain the above copyright notice and
 * this restricted rights notice.  Use, copying, and/or disclosure
 * of the programs is strictly prohibited unless otherwise provided
 * in the license agreement.
 */

#ident  "@(#)space.disk	1.1 - 88/08/02"

#include "sys/types.h"
#include "sys/param.h"
#include "sys/sysmacros.h"
#include "sys/buf.h"
#include "sys/elog.h"
#include "sys/iobuf.h"
#include "sys/vtoc.h"
#include "sys/alttbl.h"
#include "sys/gendev.h"
#include "sys/errno.h"
#include "sys/kdef.h"

/*
#include "config.h"     /* In case user wants to override defaults */

#define DRQ_NEEDED NBUF*2 + NBUF/3
#if (GDEV_DRQBLOX < DRQ_NEEDED)
#undef GDEV_DRQBLOX
#define GDEV_DRQBLOX NBUF*2 + NBUF/3
#endif

/*
 * extern defs for driver initialization functions
 */
extern int dsk_init();

ushort  gdev_drqblox = GDEV_DRQBLOX;
ushort  gdev_maxctls = GDEV_MAXCTLS;
ushort  gdev_maxdrivs = GDEV_MAXDRIVS;
ushort  gdev_max_int_span = GDEV_MAX_INT;
ushort  gdev_intents = GDEV_INTENTS;
ushort  gdev_sharemax = GDEV_SHAREMAX;

/*
 * The following defines a pool of gdev_ctl_blocks and gdev_parm_blocks
 * for use during initialization.  Also, a sample configuration table
 * is declared.  This must be filled in for actual controllers expected
 * to be present in a system.  The sample given is for an
 * Adaptec/WD/<stock AT> controller using minor numbers 0-31.
 */

struct gdev_ctl_block gdev_ctl_blocks[GDEV_MAXCTLS];
struct gdev_parm_block gdev_parm_blocks[GDEV_MAXDRIVS];
struct gdev_mem_block gdev_mem_blocks[GDEV_MEM_MAXBLK];

/*
 * V.3 iobuf and I/O Statistics blocks -- These are assigned one per drive,
 * so just use gdev_nextdriv to get at them...
 * NOTE: IF YOU CHANGE 'GDEV_MAXDRIVS', CHANGE THE INITIALIZATION FOR
 *       gdev_iobufs BELOW!!!!
 */

struct iotime gdev_stat[GDEV_MAXDRIVS];
struct iobuf gdev_iobufs[GDEV_MAXDRIVS] =
	{
	tabinit(0, &gdev_stat[0].ios),
	tabinit(0, &gdev_stat[1].ios),
	tabinit(0, &gdev_stat[2].ios),
	tabinit(0, &gdev_stat[3].ios),
	tabinit(0, &gdev_stat[4].ios),
	tabinit(0, &gdev_stat[5].ios),
	tabinit(0, &gdev_stat[6].ios),
	tabinit(0, &gdev_stat[7].ios),
	tabinit(0, &gdev_stat[8].ios),
	tabinit(0, &gdev_stat[9].ios),
	tabinit(0, &gdev_stat[10].ios),
	tabinit(0, &gdev_stat[11].ios),
	tabinit(0, &gdev_stat[12].ios),
	tabinit(0, &gdev_stat[13].ios),
	tabinit(0, &gdev_stat[14].ios),
	tabinit(0, &gdev_stat[15].ios),
	};

ushort gdev_nextctl = 0;        /* Next gdev_ctl_block to allocate */
ushort gdev_nextdriv = 0;       /* Next gdev_parm_block to allocate */
ushort gdev_nextmem = 0;        /* Next gdev_mem_block to use */
ushort gdev_next_int = 0;       /* next gdev_int_routines to use */
ushort gdev_mem_lock = 0;       /* lock for memory map */

ushort gdev_mem_gran = GDEV_MEM_GRAN;
ushort gdev_mem_maxblk = GDEV_MEM_MAXBLK;

ushort gdev_nextminor = 0;      /* next minormap entry to use */
ushort gdev_minormaps = GDEV_MINORMAPS;
ushort gdev_majormaps = GDEV_MAJORMAPS;
struct minormap minormap[GDEV_MINORMAPS];       /* The actual minormap table */
struct majormap majormap[GDEV_MAJORMAPS];


struct  gdev_int_entry  *gdev_int_routines[GDEV_MAX_INT];  /* actual table */

struct  gdev_int_entry  gdev_int_entries[GDEV_INTENTS]; /* Pool of entries */

/*
 * The following defines the pool of available drq_entry's.  These
 * are allocated with 'getdrq' (which may return NULL, setting u.u_error
 * to ENOSPC if so) and freed with 'reldrq'.  Be sure to give back all
 * you allocate!  dskinit sets up the free chain.
 */

struct  drq_entry       drq_entries [GDEV_DRQBLOX];
struct  drq_entry       *drq_freelist;

/*
 * The following table is used to process device errors.
 * It is indexed by the Generic error code in dpb_drverror.
 */

struct gdev_err_msg gdev_err_msgs[] =
	{
	{EIO, ERF_PANIC, "Logic Problem.  NO ERROR FOUND"},
	{EIO, 0, "Data Address Mark not found"},
	{EIO, ERF_PANIC, "Track 0 not found (unable to recalibrate)"},
	{EIO, ERF_PANIC, "Write fault on drive"},
	{EIO, ERF_NORETRY, "Drive is not ready"},
	{EIO, 0, "Controller will not come ready"},
	{EIO, ERF_PANIC, "Seek will not complete"},
	{EIO, 0, "Seek error (wrong cylinder found)"},
	{EIO, 0, "No Index signal found"},
	{EIO, ERF_NORETRY, "Medium is write-protected"},
	{EIO, ERF_NORETRY, "Medium not present in drive"},
	{EIO, 0, "Error found in sector ID field"},
	{EIO, 0, "Sector not found"},
	{EIO, 0, "Uncorrectable data error in sector"},
	{EIO, 0, "Sector or track was marked bad"},
	{EIO, 0, "Error during FORMAT operation"},
	{EIO, 0, "Illegal or erroneous command"},
	{EIO, ERF_PANIC, "Controller error or failure"},
	{EIO, 0, "Controller command Aborted"},
	{EIO, 0, "Drive is still seeking"},
	{EIO, ERF_NORETRY, "Medium has been changed in drive"},
	{EIO, ERF_NORETRY, "Attempt to do I/O past end of drive"},
	{EIO, 0, "Data overrun"},
	{EIO, ERF_PANIC, "Command Timeout"},
	{EIO, 0, "Unable to get valid drive configuration"},
	{EIO, 0, "Undetermined error"},
	{0,   ERF_NORETRY | ERF_QUIET, "EOF/EOM Detected"},
	};

int (*gdev_drivers[])() =
	{
	dsk_init,
	NULL,
	};

ushort  gdev_lowlev_size = sizeof(ulong) * GDEV_LOWLEV;