Index: head/sys/i386/isa/atapi.h =================================================================== --- head/sys/i386/isa/atapi.h (revision 32994) +++ head/sys/i386/isa/atapi.h (revision 32995) @@ -1,289 +1,290 @@ /* * Device-independent level for ATAPI drivers. * * Copyright (C) 1995 Cronyx Ltd. * Author Serge Vakulenko, * * This software is distributed with NO WARRANTIES, not even the implied * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Authors grant any other persons or organizations permission to use * or modify this software as long as this message is kept with the software, * all derivative works or modified versions. * * Version 1.9, Thu Oct 12 15:53:50 MSK 1995 */ /* * Disk Controller ATAPI register definitions. */ #ifdef PC98 #define AR_DATA 0x0 /* RW - data register (16 bits) */ #define AR_ERROR 0x2 /* R - error register */ #define AR_FEATURES 0x2 /* W - features */ #define AR_IREASON 0x4 /* RW - interrupt reason */ #define AR_TAG 0x6 /* - reserved for SAM TAG byte */ #define AR_CNTLO 0x8 /* RW - byte count, low byte */ #define AR_CNTHI 0xa /* RW - byte count, high byte */ #define AR_DRIVE 0xc /* RW - drive select */ #define AR_COMMAND 0xe /* W - command register */ #define AR_STATUS 0xe /* R - immediate status */ #else #define AR_DATA 0x0 /* RW - data register (16 bits) */ #define AR_ERROR 0x1 /* R - error register */ #define AR_FEATURES 0x1 /* W - features */ #define AR_IREASON 0x2 /* RW - interrupt reason */ #define AR_TAG 0x3 /* - reserved for SAM TAG byte */ #define AR_CNTLO 0x4 /* RW - byte count, low byte */ #define AR_CNTHI 0x5 /* RW - byte count, high byte */ #define AR_DRIVE 0x6 /* RW - drive select */ #define AR_COMMAND 0x7 /* W - command register */ #define AR_STATUS 0x7 /* R - immediate status */ #endif /* * Status register bits */ #define ARS_CHECK 0x01 /* error occured, see sense key/code */ /* bit 0x02 reserved */ #define ARS_CORR 0x04 /* correctable error occured */ #define ARS_DRQ 0x08 /* data request / ireason valid */ #define ARS_DSC 0x10 /* immediate operation completed */ #define ARS_DF 0x20 /* drive fault */ #define ARS_DRDY 0x40 /* ready to get command */ #define ARS_BSY 0x80 /* registers busy */ /* for overlap mode only: */ #define ARS_SERVICE 0x10 /* service is requested */ #define ARS_DMARDY 0x20 /* ready to start a DMA transfer */ #define ARS_BITS "\20\010busy\7ready\6fault\5opdone\4drq\3corr\1check" /* * Error register bits */ #define AER_ILI 0x01 /* illegal length indication */ #define AER_EOM 0x02 /* end of media detected */ #define AER_ABRT 0x04 /* command aborted */ #define AER_MCR 0x08 /* media change requested */ #define AER_SKEY 0xf0 /* sense key mask */ #define AER_SK_NO_SENSE 0x00 /* no specific sense key info */ #define AER_SK_RECOVERED_ERROR 0x10 /* command succeeded, data recovered */ #define AER_SK_NOT_READY 0x20 /* no access to drive */ #define AER_SK_MEDIUM_ERROR 0x30 /* non-recovered data error */ #define AER_SK_HARDWARE_ERROR 0x40 /* non-recoverable hardware failure */ #define AER_SK_ILLEGAL_REQUEST 0x50 /* invalid command parameter(s) */ #define AER_SK_UNIT_ATTENTION 0x60 /* media changed */ #define AER_SK_DATA_PROTECT 0x70 /* reading read-protected sector */ #define AER_SK_ABORTED_COMMAND 0xb0 /* command aborted, try again */ #define AER_SK_MISCOMPARE 0xe0 /* data did not match the medium */ #define AER_BITS "\20\4mchg\3abort\2eom\1ili" /* * Feature register bits */ #define ARF_DMA 0x01 /* transfer data via DMA */ #define ARF_OVERLAP 0x02 /* release the bus until completion */ /* * Interrupt reason register bits */ #define ARI_CMD 0x01 /* command(1) or data(0) */ #define ARI_IN 0x02 /* transfer to(1) or from(0) the host */ #define ARI_RELEASE 0x04 /* bus released until completion */ /* * Drive register values */ #define ARD_DRIVE0 0xa0 /* drive 0 selected */ #define ARD_DRIVE1 0xb0 /* drive 1 selected */ /* * ATA commands */ #define ATAPIC_IDENTIFY 0xa1 /* get drive parameters */ #define ATAPIC_PACKET 0xa0 /* execute packet command */ /* * Mandatory packet commands */ #define ATAPI_TEST_UNIT_READY 0x00 /* check if the device is ready */ #define ATAPI_REQUEST_SENSE 0x03 /* get sense data */ #define ATAPI_START_STOP 0x1b /* start/stop the media */ #define ATAPI_PREVENT_ALLOW 0x1e /* prevent/allow media removal */ #define ATAPI_READ_CAPACITY 0x25 /* get volume capacity */ #define ATAPI_READ_BIG 0x28 /* read data */ #define ATAPI_WRITE_BIG 0x2a /* write data */ #define ATAPI_READ_TOC 0x43 /* get table of contents */ #define ATAPI_READ_SUBCHANNEL 0x42 /* get subchannel info */ #define ATAPI_MODE_SELECT_BIG 0x55 /* set device parameters */ #define ATAPI_MODE_SENSE 0x5a /* get device parameters */ #define ATAPI_PLAY_CD 0xb4 /* universal play command */ #define ATAPI_MECH_STATUS 0xbd /* get changer mechanism status */ #define ATAPI_LOAD_UNLOAD 0xa6 /* changer control command */ /* * Optional packet commands */ #define ATAPI_PLAY_MSF 0x47 /* play by MSF address */ #define ATAPI_PAUSE 0x4b /* stop/start audio operation */ /* * Nonstandard packet commands */ #define ATAPI_PLAY_TRACK 0x48 /* play by track number */ #define ATAPI_PLAY_BIG 0xa5 /* play by logical block address */ /* * Drive parameter information */ struct atapi_params { unsigned cmdsz : 2; /* packet command size */ #define AT_PSIZE_12 0 /* 12 bytes */ #define AT_PSIZE_16 1 /* 16 bytes */ unsigned : 3; unsigned drqtype : 2; /* DRQ type */ #define AT_DRQT_MPROC 0 /* microprocessor DRQ - 3 msec delay */ #define AT_DRQT_INTR 1 /* interrupt DRQ - 10 msec delay */ #define AT_DRQT_ACCEL 2 /* accelerated DRQ - 50 usec delay */ unsigned removable : 1; /* device is removable */ unsigned devtype : 5; /* device type */ #define AT_TYPE_DIRECT 0 /* direct-access (magnetic disk) */ #define AT_TYPE_TAPE 1 /* streaming tape (QIC-121 model) */ #define AT_TYPE_CDROM 5 /* CD-ROM device */ #define AT_TYPE_OPTICAL 7 /* optical disk */ unsigned : 1; unsigned proto : 2; /* command protocol */ #define AT_PROTO_ATAPI 2 short reserved1[9]; char serial[20]; /* serial number - optional */ short reserved2[3]; char revision[8]; /* firmware revision */ char model[40]; /* model name */ short reserved3[2]; u_char vendor_cap; /* vendor unique capabilities */ unsigned dmaflag : 1; /* DMA supported */ unsigned lbaflag : 1; /* LBA supported - always 1 */ unsigned iordydis : 1; /* IORDY can be disabled */ unsigned iordyflag : 1; /* IORDY supported */ unsigned : 1; unsigned ovlapflag : 1; /* overlap operation supported */ unsigned : 1; unsigned idmaflag : 1; /* interleaved DMA supported */ short reserved4; u_short pio_timing; /* PIO cycle timing */ u_short dma_timing; /* DMA cycle timing */ u_short flags; #define AT_FLAG_54_58 1 /* words 54-58 valid */ #define AT_FLAG_64_70 2 /* words 64-70 valid */ short reserved5[8]; u_char swdma_flag; /* singleword DMA mode supported */ u_char swdma_active; /* singleword DMA mode active */ u_char mwdma_flag; /* multiword DMA mode supported */ u_char mwdma_active; /* multiword DMA mode active */ u_char apio_flag; /* advanced PIO mode supported */ u_char reserved6; u_short mwdma_min; /* min. M/W DMA time per word (ns) */ u_short mwdma_dflt; /* recommended M/W DMA time (ns) - optional */ u_short pio_nfctl_min; /* min. PIO cycle time w/o flow ctl - optional */ u_short pio_iordy_min; /* min. PIO c/t with IORDY flow ctl - optional */ short reserved7[2]; u_short rls_ovlap; /* release time (us) for overlap cmd - optional */ u_short rls_service; /* release time (us) for service cmd - optional */ }; /* * ATAPI operation result structure */ struct atapires { u_char code; /* result code */ #define RES_OK 0 /* i/o done */ #define RES_ERR 1 /* i/o finished with error */ #define RES_NOTRDY 2 /* controller not ready */ #define RES_NODRQ 3 /* no data request */ #define RES_INVDIR 4 /* invalid bus phase direction */ #define RES_OVERRUN 5 /* data overrun */ #define RES_UNDERRUN 6 /* data underrun */ u_char status; /* status register contents */ u_char error; /* error register contents */ }; struct atapidrv { /* delayed attach info */ int ctlr; /* IDE controller, 0/1 */ int unit; /* drive unit, 0/1 */ int port; /* controller base port */ int attached; /* the drive is attached */ }; +struct buf; struct wcd; typedef void atapi_callback_t(struct wcd *, struct buf *, int, struct atapires); struct atapicmd { /* ATAPI command block */ struct atapicmd *next; /* next command in queue */ int busy; /* busy flag */ u_char cmd[16]; /* command and args */ int unit; /* drive unit number */ int count; /* byte count, >0 - read, <0 - write */ char *addr; /* data to transfer */ atapi_callback_t *callback; /* call when done */ void *cbarg1; /* callback arg 1 */ void *cbarg2; /* callback arg 1 */ struct atapires result; /* resulting error code */ }; struct atapi { /* ATAPI controller data */ u_short port; /* i/o port base */ u_char ctrlr; /* physical controller number */ u_char debug : 1; /* trace enable flag */ u_char cmd16 : 1; /* 16-byte command flag */ u_char intrcmd : 1; /* interrupt before cmd flag */ u_char slow : 1; /* slow reaction device */ u_char attached[2]; /* units are attached to subdrivers */ struct atapi_params *params[2]; /* params for units 0,1 */ struct atapicmd *queue; /* queue of commands to perform */ struct atapicmd *tail; /* tail of queue */ struct atapicmd *free; /* queue of free command blocks */ struct atapicmd cmdrq[16]; /* pool of command requests */ }; #ifdef KERNEL struct atapi; extern struct atapidrv atapi_drvtab[4]; /* delayed attach info */ extern int atapi_ndrv; /* the number of potential drives */ extern struct atapi *atapi_tab; /* the table of atapi controllers */ #ifndef ATAPI_STATIC # define atapi_start (*atapi_start_ptr) # define atapi_intr (*atapi_intr_ptr) # define atapi_debug (*atapi_debug_ptr) # define atapi_request_wait (*atapi_request_wait_ptr) # define atapi_request_callback (*atapi_request_callback_ptr) # define atapi_request_immediate (*atapi_request_immediate_ptr) #endif #ifndef ATAPI_MODULE int atapi_attach (int ctlr, int unit, int port); #endif /* * These "functions" are declared with archaic `extern's because they are * actually pointers in the !ATAPI_STATIC case. */ extern int atapi_start (int ctrlr); extern int atapi_intr (int ctrlr); extern void atapi_debug (struct atapi *ata, int on); extern struct atapires atapi_request_wait (struct atapi *ata, int unit, u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, char *addr, int count); extern void atapi_request_callback (struct atapi *ata, int unit, u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, char *addr, int count, atapi_callback_t *done, void *x, void *y); extern struct atapires atapi_request_immediate (struct atapi *ata, int unit, u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, char *addr, int count); #endif Index: head/sys/netipx/ipx_var.h =================================================================== --- head/sys/netipx/ipx_var.h (revision 32994) +++ head/sys/netipx/ipx_var.h (revision 32995) @@ -1,102 +1,103 @@ /* * Copyright (c) 1995, Mike Mitchell * Copyright (c) 1984, 1985, 1986, 1987, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ipx_var.h * - * $Id: ipx_var.h,v 1.7 1997/06/26 19:35:59 jhay Exp $ + * $Id: ipx_var.h,v 1.8 1997/08/16 19:15:46 wollman Exp $ */ #ifndef _NETIPX_IPX_VAR_H_ #define _NETIPX_IPX_VAR_H_ /* * IPX Kernel Structures and Variables */ struct ipxstat { u_long ipxs_total; /* total packets received */ u_long ipxs_badsum; /* checksum bad */ u_long ipxs_tooshort; /* packet too short */ u_long ipxs_toosmall; /* not enough data */ u_long ipxs_forward; /* packets forwarded */ u_long ipxs_cantforward; /* packets rcvd for unreachable dest */ u_long ipxs_delivered; /* datagrams delivered to upper level*/ u_long ipxs_localout; /* total ipx packets generated here */ u_long ipxs_odropped; /* lost packets due to nobufs, etc. */ u_long ipxs_noroute; /* packets discarded due to no route */ u_long ipxs_mtutoosmall; /* the interface mtu is too small */ }; #ifdef KERNEL extern int ipxcksum; extern long ipx_pexseq; extern struct ipxstat ipxstat; extern struct ipxpcb ipxrawpcb; extern struct pr_usrreqs ipx_usrreqs; extern struct pr_usrreqs ripx_usrreqs; extern struct sockaddr_ipx ipx_netmask; extern struct sockaddr_ipx ipx_hostmask; extern union ipx_net ipx_zeronet; extern union ipx_host ipx_zerohost; extern union ipx_net ipx_broadnet; extern union ipx_host ipx_broadhost; struct ifnet; struct ipx_addr; struct mbuf; +struct proc; struct route; struct sockaddr; struct socket; void ipx_abort __P((struct ipxpcb *ipxp)); u_short ipx_cksum __P((struct mbuf *m, int len)); int ipx_control __P((struct socket *so, int cmd, caddr_t data, struct ifnet *ifp, struct proc *p)); void ipx_ctlinput __P((int cmd, struct sockaddr *arg_as_sa, void *dummy)); int ipx_ctloutput __P((int req, struct socket *so, int level, int name, struct mbuf **value, struct proc *p)); void ipx_drop __P((struct ipxpcb *ipxp, int errno)); void ipx_init __P((void)); void ipx_input __P((struct mbuf *m, struct ipxpcb *ipxp)); void ipxintr __P((void)); int ipx_outputfl __P((struct mbuf *m0, struct route *ro, int flags)); int ipx_output_type20 __P((struct mbuf *)); int ipx_peeraddr __P((struct socket *so, struct sockaddr **nam)); void ipx_printhost __P((struct ipx_addr *addr)); int ipx_sockaddr __P((struct socket *so, struct sockaddr **nam)); void ipx_watch_output __P((struct mbuf *m, struct ifnet *ifp)); #endif /* KERNEL */ #endif /* !_NETIPX_IPX_VAR_H_ */ Index: head/sys/pc98/pc98/atapi.h =================================================================== --- head/sys/pc98/pc98/atapi.h (revision 32994) +++ head/sys/pc98/pc98/atapi.h (revision 32995) @@ -1,289 +1,290 @@ /* * Device-independent level for ATAPI drivers. * * Copyright (C) 1995 Cronyx Ltd. * Author Serge Vakulenko, * * This software is distributed with NO WARRANTIES, not even the implied * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Authors grant any other persons or organizations permission to use * or modify this software as long as this message is kept with the software, * all derivative works or modified versions. * * Version 1.9, Thu Oct 12 15:53:50 MSK 1995 */ /* * Disk Controller ATAPI register definitions. */ #ifdef PC98 #define AR_DATA 0x0 /* RW - data register (16 bits) */ #define AR_ERROR 0x2 /* R - error register */ #define AR_FEATURES 0x2 /* W - features */ #define AR_IREASON 0x4 /* RW - interrupt reason */ #define AR_TAG 0x6 /* - reserved for SAM TAG byte */ #define AR_CNTLO 0x8 /* RW - byte count, low byte */ #define AR_CNTHI 0xa /* RW - byte count, high byte */ #define AR_DRIVE 0xc /* RW - drive select */ #define AR_COMMAND 0xe /* W - command register */ #define AR_STATUS 0xe /* R - immediate status */ #else #define AR_DATA 0x0 /* RW - data register (16 bits) */ #define AR_ERROR 0x1 /* R - error register */ #define AR_FEATURES 0x1 /* W - features */ #define AR_IREASON 0x2 /* RW - interrupt reason */ #define AR_TAG 0x3 /* - reserved for SAM TAG byte */ #define AR_CNTLO 0x4 /* RW - byte count, low byte */ #define AR_CNTHI 0x5 /* RW - byte count, high byte */ #define AR_DRIVE 0x6 /* RW - drive select */ #define AR_COMMAND 0x7 /* W - command register */ #define AR_STATUS 0x7 /* R - immediate status */ #endif /* * Status register bits */ #define ARS_CHECK 0x01 /* error occured, see sense key/code */ /* bit 0x02 reserved */ #define ARS_CORR 0x04 /* correctable error occured */ #define ARS_DRQ 0x08 /* data request / ireason valid */ #define ARS_DSC 0x10 /* immediate operation completed */ #define ARS_DF 0x20 /* drive fault */ #define ARS_DRDY 0x40 /* ready to get command */ #define ARS_BSY 0x80 /* registers busy */ /* for overlap mode only: */ #define ARS_SERVICE 0x10 /* service is requested */ #define ARS_DMARDY 0x20 /* ready to start a DMA transfer */ #define ARS_BITS "\20\010busy\7ready\6fault\5opdone\4drq\3corr\1check" /* * Error register bits */ #define AER_ILI 0x01 /* illegal length indication */ #define AER_EOM 0x02 /* end of media detected */ #define AER_ABRT 0x04 /* command aborted */ #define AER_MCR 0x08 /* media change requested */ #define AER_SKEY 0xf0 /* sense key mask */ #define AER_SK_NO_SENSE 0x00 /* no specific sense key info */ #define AER_SK_RECOVERED_ERROR 0x10 /* command succeeded, data recovered */ #define AER_SK_NOT_READY 0x20 /* no access to drive */ #define AER_SK_MEDIUM_ERROR 0x30 /* non-recovered data error */ #define AER_SK_HARDWARE_ERROR 0x40 /* non-recoverable hardware failure */ #define AER_SK_ILLEGAL_REQUEST 0x50 /* invalid command parameter(s) */ #define AER_SK_UNIT_ATTENTION 0x60 /* media changed */ #define AER_SK_DATA_PROTECT 0x70 /* reading read-protected sector */ #define AER_SK_ABORTED_COMMAND 0xb0 /* command aborted, try again */ #define AER_SK_MISCOMPARE 0xe0 /* data did not match the medium */ #define AER_BITS "\20\4mchg\3abort\2eom\1ili" /* * Feature register bits */ #define ARF_DMA 0x01 /* transfer data via DMA */ #define ARF_OVERLAP 0x02 /* release the bus until completion */ /* * Interrupt reason register bits */ #define ARI_CMD 0x01 /* command(1) or data(0) */ #define ARI_IN 0x02 /* transfer to(1) or from(0) the host */ #define ARI_RELEASE 0x04 /* bus released until completion */ /* * Drive register values */ #define ARD_DRIVE0 0xa0 /* drive 0 selected */ #define ARD_DRIVE1 0xb0 /* drive 1 selected */ /* * ATA commands */ #define ATAPIC_IDENTIFY 0xa1 /* get drive parameters */ #define ATAPIC_PACKET 0xa0 /* execute packet command */ /* * Mandatory packet commands */ #define ATAPI_TEST_UNIT_READY 0x00 /* check if the device is ready */ #define ATAPI_REQUEST_SENSE 0x03 /* get sense data */ #define ATAPI_START_STOP 0x1b /* start/stop the media */ #define ATAPI_PREVENT_ALLOW 0x1e /* prevent/allow media removal */ #define ATAPI_READ_CAPACITY 0x25 /* get volume capacity */ #define ATAPI_READ_BIG 0x28 /* read data */ #define ATAPI_WRITE_BIG 0x2a /* write data */ #define ATAPI_READ_TOC 0x43 /* get table of contents */ #define ATAPI_READ_SUBCHANNEL 0x42 /* get subchannel info */ #define ATAPI_MODE_SELECT_BIG 0x55 /* set device parameters */ #define ATAPI_MODE_SENSE 0x5a /* get device parameters */ #define ATAPI_PLAY_CD 0xb4 /* universal play command */ #define ATAPI_MECH_STATUS 0xbd /* get changer mechanism status */ #define ATAPI_LOAD_UNLOAD 0xa6 /* changer control command */ /* * Optional packet commands */ #define ATAPI_PLAY_MSF 0x47 /* play by MSF address */ #define ATAPI_PAUSE 0x4b /* stop/start audio operation */ /* * Nonstandard packet commands */ #define ATAPI_PLAY_TRACK 0x48 /* play by track number */ #define ATAPI_PLAY_BIG 0xa5 /* play by logical block address */ /* * Drive parameter information */ struct atapi_params { unsigned cmdsz : 2; /* packet command size */ #define AT_PSIZE_12 0 /* 12 bytes */ #define AT_PSIZE_16 1 /* 16 bytes */ unsigned : 3; unsigned drqtype : 2; /* DRQ type */ #define AT_DRQT_MPROC 0 /* microprocessor DRQ - 3 msec delay */ #define AT_DRQT_INTR 1 /* interrupt DRQ - 10 msec delay */ #define AT_DRQT_ACCEL 2 /* accelerated DRQ - 50 usec delay */ unsigned removable : 1; /* device is removable */ unsigned devtype : 5; /* device type */ #define AT_TYPE_DIRECT 0 /* direct-access (magnetic disk) */ #define AT_TYPE_TAPE 1 /* streaming tape (QIC-121 model) */ #define AT_TYPE_CDROM 5 /* CD-ROM device */ #define AT_TYPE_OPTICAL 7 /* optical disk */ unsigned : 1; unsigned proto : 2; /* command protocol */ #define AT_PROTO_ATAPI 2 short reserved1[9]; char serial[20]; /* serial number - optional */ short reserved2[3]; char revision[8]; /* firmware revision */ char model[40]; /* model name */ short reserved3[2]; u_char vendor_cap; /* vendor unique capabilities */ unsigned dmaflag : 1; /* DMA supported */ unsigned lbaflag : 1; /* LBA supported - always 1 */ unsigned iordydis : 1; /* IORDY can be disabled */ unsigned iordyflag : 1; /* IORDY supported */ unsigned : 1; unsigned ovlapflag : 1; /* overlap operation supported */ unsigned : 1; unsigned idmaflag : 1; /* interleaved DMA supported */ short reserved4; u_short pio_timing; /* PIO cycle timing */ u_short dma_timing; /* DMA cycle timing */ u_short flags; #define AT_FLAG_54_58 1 /* words 54-58 valid */ #define AT_FLAG_64_70 2 /* words 64-70 valid */ short reserved5[8]; u_char swdma_flag; /* singleword DMA mode supported */ u_char swdma_active; /* singleword DMA mode active */ u_char mwdma_flag; /* multiword DMA mode supported */ u_char mwdma_active; /* multiword DMA mode active */ u_char apio_flag; /* advanced PIO mode supported */ u_char reserved6; u_short mwdma_min; /* min. M/W DMA time per word (ns) */ u_short mwdma_dflt; /* recommended M/W DMA time (ns) - optional */ u_short pio_nfctl_min; /* min. PIO cycle time w/o flow ctl - optional */ u_short pio_iordy_min; /* min. PIO c/t with IORDY flow ctl - optional */ short reserved7[2]; u_short rls_ovlap; /* release time (us) for overlap cmd - optional */ u_short rls_service; /* release time (us) for service cmd - optional */ }; /* * ATAPI operation result structure */ struct atapires { u_char code; /* result code */ #define RES_OK 0 /* i/o done */ #define RES_ERR 1 /* i/o finished with error */ #define RES_NOTRDY 2 /* controller not ready */ #define RES_NODRQ 3 /* no data request */ #define RES_INVDIR 4 /* invalid bus phase direction */ #define RES_OVERRUN 5 /* data overrun */ #define RES_UNDERRUN 6 /* data underrun */ u_char status; /* status register contents */ u_char error; /* error register contents */ }; struct atapidrv { /* delayed attach info */ int ctlr; /* IDE controller, 0/1 */ int unit; /* drive unit, 0/1 */ int port; /* controller base port */ int attached; /* the drive is attached */ }; +struct buf; struct wcd; typedef void atapi_callback_t(struct wcd *, struct buf *, int, struct atapires); struct atapicmd { /* ATAPI command block */ struct atapicmd *next; /* next command in queue */ int busy; /* busy flag */ u_char cmd[16]; /* command and args */ int unit; /* drive unit number */ int count; /* byte count, >0 - read, <0 - write */ char *addr; /* data to transfer */ atapi_callback_t *callback; /* call when done */ void *cbarg1; /* callback arg 1 */ void *cbarg2; /* callback arg 1 */ struct atapires result; /* resulting error code */ }; struct atapi { /* ATAPI controller data */ u_short port; /* i/o port base */ u_char ctrlr; /* physical controller number */ u_char debug : 1; /* trace enable flag */ u_char cmd16 : 1; /* 16-byte command flag */ u_char intrcmd : 1; /* interrupt before cmd flag */ u_char slow : 1; /* slow reaction device */ u_char attached[2]; /* units are attached to subdrivers */ struct atapi_params *params[2]; /* params for units 0,1 */ struct atapicmd *queue; /* queue of commands to perform */ struct atapicmd *tail; /* tail of queue */ struct atapicmd *free; /* queue of free command blocks */ struct atapicmd cmdrq[16]; /* pool of command requests */ }; #ifdef KERNEL struct atapi; extern struct atapidrv atapi_drvtab[4]; /* delayed attach info */ extern int atapi_ndrv; /* the number of potential drives */ extern struct atapi *atapi_tab; /* the table of atapi controllers */ #ifndef ATAPI_STATIC # define atapi_start (*atapi_start_ptr) # define atapi_intr (*atapi_intr_ptr) # define atapi_debug (*atapi_debug_ptr) # define atapi_request_wait (*atapi_request_wait_ptr) # define atapi_request_callback (*atapi_request_callback_ptr) # define atapi_request_immediate (*atapi_request_immediate_ptr) #endif #ifndef ATAPI_MODULE int atapi_attach (int ctlr, int unit, int port); #endif /* * These "functions" are declared with archaic `extern's because they are * actually pointers in the !ATAPI_STATIC case. */ extern int atapi_start (int ctrlr); extern int atapi_intr (int ctrlr); extern void atapi_debug (struct atapi *ata, int on); extern struct atapires atapi_request_wait (struct atapi *ata, int unit, u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, char *addr, int count); extern void atapi_request_callback (struct atapi *ata, int unit, u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, char *addr, int count, atapi_callback_t *done, void *x, void *y); extern struct atapires atapi_request_immediate (struct atapi *ata, int unit, u_char cmd, u_char a1, u_char a2, u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8, u_char a9, u_char a10, u_char a11, u_char a12, u_char a13, u_char a14, u_char a15, char *addr, int count); #endif Index: head/sys/sys/acct.h =================================================================== --- head/sys/sys/acct.h (revision 32994) +++ head/sys/sys/acct.h (revision 32995) @@ -1,83 +1,85 @@ /*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)acct.h 8.4 (Berkeley) 1/9/95 - * $Id$ + * $Id: acct.h,v 1.8 1997/02/22 09:44:48 peter Exp $ */ #ifndef _SYS_ACCT_H_ #define _SYS_ACCT_H_ /* * Accounting structures; these use a comp_t type which is a 3 bits base 8 * exponent, 13 bit fraction ``floating point'' number. Units are 1/AHZ * seconds. */ typedef u_int16_t comp_t; #define AC_COMM_LEN 16 struct acct { char ac_comm[AC_COMM_LEN]; /* command name */ comp_t ac_utime; /* user time */ comp_t ac_stime; /* system time */ comp_t ac_etime; /* elapsed time */ time_t ac_btime; /* starting time */ uid_t ac_uid; /* user id */ gid_t ac_gid; /* group id */ u_int16_t ac_mem; /* average memory usage */ comp_t ac_io; /* count of IO blocks */ dev_t ac_tty; /* controlling tty */ #define AFORK 0x01 /* forked but not exec'ed */ #define ASU 0x02 /* used super-user permissions */ #define ACOMPAT 0x04 /* used compatibility mode */ #define ACORE 0x08 /* dumped core */ #define AXSIG 0x10 /* killed by a signal */ u_int8_t ac_flag; /* accounting flags */ }; /* * 1/AHZ is the granularity of the data encoded in the comp_t fields. * This is not necessarily equal to hz. */ #define AHZ 64 #ifdef KERNEL +struct proc; + int acct_process __P((struct proc *p)); #endif #endif /* !_SYS_ACCT_H_ */ Index: head/sys/sys/disklabel.h =================================================================== --- head/sys/sys/disklabel.h (revision 32994) +++ head/sys/sys/disklabel.h (revision 32995) @@ -1,451 +1,452 @@ /* * Copyright (c) 1987, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 - * $Id: disklabel.h,v 1.27 1997/02/22 09:45:05 peter Exp $ + * $Id: disklabel.h,v 1.28 1997/09/21 22:09:07 gibbs Exp $ */ #ifndef _SYS_DISKLABEL_H_ #define _SYS_DISKLABEL_H_ #ifndef KERNEL #include #endif #include /* * Disk description table, see disktab(5) */ #define _PATH_DISKTAB "/etc/disktab" #define DISKTAB "/etc/disktab" /* deprecated */ /* * Each disk has a label which includes information about the hardware * disk geometry, filesystem partitions, and drive specific information. * The label is in block 0 or 1, possibly offset from the beginning * to leave room for a bootstrap, etc. */ /* XXX these should be defined per controller (or drive) elsewhere, not here! */ #ifdef __i386__ #define LABELSECTOR 1 /* sector containing label */ #define LABELOFFSET 0 /* offset of label in sector */ #endif #ifndef LABELSECTOR #define LABELSECTOR 0 /* sector containing label */ #endif #ifndef LABELOFFSET #define LABELOFFSET 64 /* offset of label in sector */ #endif #define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */ #ifndef MAXPARTITIONS #define MAXPARTITIONS 8 #endif #define LABEL_PART 2 /* partition containing label */ #define RAW_PART 2 /* partition containing whole disk */ #define SWAP_PART 1 /* partition normally containing swap */ #ifndef LOCORE struct disklabel { u_int32_t d_magic; /* the magic number */ u_int16_t d_type; /* drive type */ u_int16_t d_subtype; /* controller/d_type specific */ char d_typename[16]; /* type name, e.g. "eagle" */ /* * d_packname contains the pack identifier and is returned when * the disklabel is read off the disk or in-core copy. * d_boot0 and d_boot1 are the (optional) names of the * primary (block 0) and secondary (block 1-15) bootstraps * as found in /usr/mdec. These are returned when using * getdiskbyname(3) to retrieve the values from /etc/disktab. */ #if defined(KERNEL) || defined(STANDALONE) char d_packname[16]; /* pack identifier */ #else union { char un_d_packname[16]; /* pack identifier */ struct { char *un_d_boot0; /* primary bootstrap name */ char *un_d_boot1; /* secondary bootstrap name */ } un_b; } d_un; #define d_packname d_un.un_d_packname #define d_boot0 d_un.un_b.un_d_boot0 #define d_boot1 d_un.un_b.un_d_boot1 #endif /* ! KERNEL or STANDALONE */ /* disk geometry: */ u_int32_t d_secsize; /* # of bytes per sector */ u_int32_t d_nsectors; /* # of data sectors per track */ u_int32_t d_ntracks; /* # of tracks per cylinder */ u_int32_t d_ncylinders; /* # of data cylinders per unit */ u_int32_t d_secpercyl; /* # of data sectors per cylinder */ u_int32_t d_secperunit; /* # of data sectors per unit */ /* * Spares (bad sector replacements) below are not counted in * d_nsectors or d_secpercyl. Spare sectors are assumed to * be physical sectors which occupy space at the end of each * track and/or cylinder. */ u_int16_t d_sparespertrack; /* # of spare sectors per track */ u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ /* * Alternate cylinders include maintenance, replacement, configuration * description areas, etc. */ u_int32_t d_acylinders; /* # of alt. cylinders per unit */ /* hardware characteristics: */ /* * d_interleave, d_trackskew and d_cylskew describe perturbations * in the media format used to compensate for a slow controller. * Interleave is physical sector interleave, set up by the * formatter or controller when formatting. When interleaving is * in use, logically adjacent sectors are not physically * contiguous, but instead are separated by some number of * sectors. It is specified as the ratio of physical sectors * traversed per logical sector. Thus an interleave of 1:1 * implies contiguous layout, while 2:1 implies that logical * sector 0 is separated by one sector from logical sector 1. * d_trackskew is the offset of sector 0 on track N relative to * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew * is the offset of sector 0 on cylinder N relative to sector 0 * on cylinder N-1. */ u_int16_t d_rpm; /* rotational speed */ u_int16_t d_interleave; /* hardware sector interleave */ u_int16_t d_trackskew; /* sector 0 skew, per track */ u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ u_int32_t d_headswitch; /* head switch time, usec */ u_int32_t d_trkseek; /* track-to-track seek, usec */ u_int32_t d_flags; /* generic flags */ #define NDDATA 5 u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */ #define NSPARE 5 u_int32_t d_spare[NSPARE]; /* reserved for future use */ u_int32_t d_magic2; /* the magic number (again) */ u_int16_t d_checksum; /* xor of data incl. partitions */ /* filesystem and partition information: */ u_int16_t d_npartitions; /* number of partitions in following */ u_int32_t d_bbsize; /* size of boot area at sn0, bytes */ u_int32_t d_sbsize; /* max size of fs superblock, bytes */ struct partition { /* the partition table */ u_int32_t p_size; /* number of sectors in partition */ u_int32_t p_offset; /* starting sector */ u_int32_t p_fsize; /* filesystem basic fragment size */ u_int8_t p_fstype; /* filesystem type, see below */ u_int8_t p_frag; /* filesystem fragments per block */ union { u_int16_t cpg; /* UFS: FS cylinders per group */ u_int16_t sgs; /* LFS: FS segment shift */ } __partition_u1; #define p_cpg __partition_u1.cpg #define p_sgs __partition_u1.sgs } d_partitions[MAXPARTITIONS]; /* actually may be more */ }; #else /* LOCORE */ /* * offsets for asm boot files. */ .set d_secsize,40 .set d_nsectors,44 .set d_ntracks,48 .set d_ncylinders,52 .set d_secpercyl,56 .set d_secperunit,60 .set d_end_,276 /* size of disk label */ #endif /* LOCORE */ /* d_type values: */ #define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ #define DTYPE_MSCP 2 /* MSCP */ #define DTYPE_DEC 3 /* other DEC (rk, rl) */ #define DTYPE_SCSI 4 /* SCSI */ #define DTYPE_ESDI 5 /* ESDI interface */ #define DTYPE_ST506 6 /* ST506 etc. */ #define DTYPE_HPIB 7 /* CS/80 on HP-IB */ #define DTYPE_HPFL 8 /* HP Fiber-link */ #define DTYPE_FLOPPY 10 /* floppy */ #define DTYPE_CCD 11 /* concatenated disk */ #ifdef PC98 #define DSTYPE_SEC256 0x80 /* physical sector size=256*/ #endif #ifdef DKTYPENAMES static char *dktypenames[] = { "unknown", "SMD", "MSCP", "old DEC", "SCSI", "ESDI", "ST506", "HP-IB", "HP-FL", "type 9", "floppy", "CCD", NULL }; #define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1) #endif /* * Filesystem type and version. * Used to interpret other filesystem-specific * per-partition information. */ #define FS_UNUSED 0 /* unused */ #define FS_SWAP 1 /* swap */ #define FS_V6 2 /* Sixth Edition */ #define FS_V7 3 /* Seventh Edition */ #define FS_SYSV 4 /* System V */ #define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ #define FS_V8 6 /* Eighth Edition, 4K blocks */ #define FS_BSDFFS 7 /* 4.2BSD fast file system */ #define FS_MSDOS 8 /* MSDOS file system */ #define FS_BSDLFS 9 /* 4.4BSD log-structured file system */ #define FS_OTHER 10 /* in use, but unknown/unsupported */ #define FS_HPFS 11 /* OS/2 high-performance file system */ #define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */ #define FS_BOOT 13 /* partition contains bootstrap */ #ifdef DKTYPENAMES static char *fstypenames[] = { "unused", "swap", "Version 6", "Version 7", "System V", "4.1BSD", "Eighth Edition", "4.2BSD", "MSDOS", "4.4LFS", "unknown", "HPFS", "ISO9660", "boot", NULL }; #define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1) #endif /* * flags shared by various drives: */ #define D_REMOVABLE 0x01 /* removable media */ #define D_ECC 0x02 /* supports ECC */ #define D_BADSECT 0x04 /* supports bad sector forw. */ #define D_RAMDISK 0x08 /* disk emulator */ #define D_CHAIN 0x10 /* can do back-back transfers */ /* * Drive data for SMD. */ #define d_smdflags d_drivedata[0] #define D_SSE 0x1 /* supports skip sectoring */ #define d_mindist d_drivedata[1] #define d_maxdist d_drivedata[2] #define d_sdist d_drivedata[3] /* * Drive data for ST506. */ #define d_precompcyl d_drivedata[0] #define d_gap3 d_drivedata[1] /* used only when formatting */ /* * Drive data for SCSI. */ #define d_blind d_drivedata[0] #ifndef LOCORE /* * Structure used to perform a format or other raw operation, returning * data and/or register values. Register identification and format * are device- and driver-dependent. */ struct format_op { char *df_buf; int df_count; /* value-result */ daddr_t df_startblk; int df_reg[8]; /* result */ }; /* * Structure used internally to retrieve information about a partition * on a disk. */ struct partinfo { struct disklabel *disklab; struct partition *part; }; /* DOS partition table -- located in boot block */ #ifdef PC98 #define DOSBBSECTOR 0 /* DOS boot block relative sector number */ #define DOSLABELSECTOR 1 /* 0: 256b/s, 1: 512b/s */ #define DOSPARTOFF 0 #define NDOSPART 16 #define DOSPTYP_386BSD 0x94 /* 386BSD partition type */ #define MBR_PTYPE_FreeBSD 0x94 /* FreeBSD partition type */ struct dos_partition { unsigned char dp_mid; #define DOSMID_386BSD (0x14|0x80) /* 386bsd|bootable */ unsigned char dp_sid; #define DOSSID_386BSD (0x44|0x80) /* 386bsd|active */ unsigned char dp_dum1; unsigned char dp_dum2; unsigned char dp_ipl_sct; unsigned char dp_ipl_head; unsigned short dp_ipl_cyl; unsigned char dp_ssect; /* starting sector */ unsigned char dp_shd; /* starting head */ unsigned short dp_scyl; /* starting cylinder */ unsigned char dp_esect; /* end sector */ unsigned char dp_ehd; /* end head */ unsigned short dp_ecyl; /* end cylinder */ unsigned char dp_name[16]; }; #else /* IBMPC */ #define DOSBBSECTOR 0 /* DOS boot block relative sector number */ #define DOSPARTOFF 446 #define NDOSPART 4 #define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ struct dos_partition { unsigned char dp_flag; /* bootstrap flags */ unsigned char dp_shd; /* starting head */ unsigned char dp_ssect; /* starting sector */ unsigned char dp_scyl; /* starting cylinder */ unsigned char dp_typ; /* partition type */ unsigned char dp_ehd; /* end head */ unsigned char dp_esect; /* end sector */ unsigned char dp_ecyl; /* end cylinder */ unsigned long dp_start; /* absolute starting sector number */ unsigned long dp_size; /* partition size in sectors */ }; #endif #define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ #define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ /* * Disk-specific ioctls. */ /* get and set disklabel; DIOCGPART used internally */ #define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */ #define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */ #define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */ #define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */ /* do format operation, read or write */ #define DIOCRFORMAT _IOWR('d', 105, struct format_op) #define DIOCWFORMAT _IOWR('d', 106, struct format_op) #define DIOCSSTEP _IOW('d', 107, int) /* set step rate */ #define DIOCSRETRIES _IOW('d', 108, int) /* set # of retries */ #define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */ #define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */ #define DIOCSBADSCAN _IOW('d', 111, int) /* set badscan mode */ /* * XXX encoding of disk minor numbers, should be elsewhere. * * See for a possibly better encoding. * * "cpio -H newc" can be used to back up device files with large minor * numbers (but not ones >= 2^31). Old cpio formats and all tar formats * don't have enough bits, and cpio and tar don't notice the lossage. * There are also some sign extension bugs. */ /* 3 2 1 0 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 _________________________________________________________________ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------------------------------------------- | TYPE |UNIT_2 | SLICE | MAJOR? | UNIT |PART | ----------------------------------------------------------------- */ #define dkmakeminor(unit, slice, part) \ (((slice) << 16) | ((unit) << 3) | (part)) #define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part)) #define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16)) #define dkpart(dev) (minor(dev) & 7) #define dkslice(dev) ((minor(dev) >> 16) & 0x1f) #define dktype(dev) ((minor(dev) >> 25) & 0x7f) #define dkunit(dev) ((((dev) >> 16) & 0x1e0) | (((dev) >> 3) & 0x1f)) #ifdef KERNEL +struct buf; struct buf_queue_head; int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, int wlabel)); void diskerr __P((struct buf *bp, char *dname, char *what, int pri, int blkdone, struct disklabel *lp)); void disksort __P((struct buf *ap, struct buf *bp)); u_int dkcksum __P((struct disklabel *lp)); char *readdisklabel __P((dev_t dev, void (*strat)(struct buf *bp), struct disklabel *lp)); void bufqdisksort __P((struct buf_queue_head *ap, struct buf *bp)); int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp, u_long openmask)); int writedisklabel __P((dev_t dev, void (*strat)(struct buf *bp), struct disklabel *lp)); #endif /* KERNEL */ #endif /* LOCORE */ #ifndef KERNEL __BEGIN_DECLS struct disklabel *getdiskbyname __P((const char *)); __END_DECLS #endif #endif /* !_SYS_DISKLABEL_H_ */ Index: head/sys/sys/diskmbr.h =================================================================== --- head/sys/sys/diskmbr.h (revision 32994) +++ head/sys/sys/diskmbr.h (revision 32995) @@ -1,451 +1,452 @@ /* * Copyright (c) 1987, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 - * $Id: disklabel.h,v 1.27 1997/02/22 09:45:05 peter Exp $ + * $Id: disklabel.h,v 1.28 1997/09/21 22:09:07 gibbs Exp $ */ #ifndef _SYS_DISKLABEL_H_ #define _SYS_DISKLABEL_H_ #ifndef KERNEL #include #endif #include /* * Disk description table, see disktab(5) */ #define _PATH_DISKTAB "/etc/disktab" #define DISKTAB "/etc/disktab" /* deprecated */ /* * Each disk has a label which includes information about the hardware * disk geometry, filesystem partitions, and drive specific information. * The label is in block 0 or 1, possibly offset from the beginning * to leave room for a bootstrap, etc. */ /* XXX these should be defined per controller (or drive) elsewhere, not here! */ #ifdef __i386__ #define LABELSECTOR 1 /* sector containing label */ #define LABELOFFSET 0 /* offset of label in sector */ #endif #ifndef LABELSECTOR #define LABELSECTOR 0 /* sector containing label */ #endif #ifndef LABELOFFSET #define LABELOFFSET 64 /* offset of label in sector */ #endif #define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */ #ifndef MAXPARTITIONS #define MAXPARTITIONS 8 #endif #define LABEL_PART 2 /* partition containing label */ #define RAW_PART 2 /* partition containing whole disk */ #define SWAP_PART 1 /* partition normally containing swap */ #ifndef LOCORE struct disklabel { u_int32_t d_magic; /* the magic number */ u_int16_t d_type; /* drive type */ u_int16_t d_subtype; /* controller/d_type specific */ char d_typename[16]; /* type name, e.g. "eagle" */ /* * d_packname contains the pack identifier and is returned when * the disklabel is read off the disk or in-core copy. * d_boot0 and d_boot1 are the (optional) names of the * primary (block 0) and secondary (block 1-15) bootstraps * as found in /usr/mdec. These are returned when using * getdiskbyname(3) to retrieve the values from /etc/disktab. */ #if defined(KERNEL) || defined(STANDALONE) char d_packname[16]; /* pack identifier */ #else union { char un_d_packname[16]; /* pack identifier */ struct { char *un_d_boot0; /* primary bootstrap name */ char *un_d_boot1; /* secondary bootstrap name */ } un_b; } d_un; #define d_packname d_un.un_d_packname #define d_boot0 d_un.un_b.un_d_boot0 #define d_boot1 d_un.un_b.un_d_boot1 #endif /* ! KERNEL or STANDALONE */ /* disk geometry: */ u_int32_t d_secsize; /* # of bytes per sector */ u_int32_t d_nsectors; /* # of data sectors per track */ u_int32_t d_ntracks; /* # of tracks per cylinder */ u_int32_t d_ncylinders; /* # of data cylinders per unit */ u_int32_t d_secpercyl; /* # of data sectors per cylinder */ u_int32_t d_secperunit; /* # of data sectors per unit */ /* * Spares (bad sector replacements) below are not counted in * d_nsectors or d_secpercyl. Spare sectors are assumed to * be physical sectors which occupy space at the end of each * track and/or cylinder. */ u_int16_t d_sparespertrack; /* # of spare sectors per track */ u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ /* * Alternate cylinders include maintenance, replacement, configuration * description areas, etc. */ u_int32_t d_acylinders; /* # of alt. cylinders per unit */ /* hardware characteristics: */ /* * d_interleave, d_trackskew and d_cylskew describe perturbations * in the media format used to compensate for a slow controller. * Interleave is physical sector interleave, set up by the * formatter or controller when formatting. When interleaving is * in use, logically adjacent sectors are not physically * contiguous, but instead are separated by some number of * sectors. It is specified as the ratio of physical sectors * traversed per logical sector. Thus an interleave of 1:1 * implies contiguous layout, while 2:1 implies that logical * sector 0 is separated by one sector from logical sector 1. * d_trackskew is the offset of sector 0 on track N relative to * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew * is the offset of sector 0 on cylinder N relative to sector 0 * on cylinder N-1. */ u_int16_t d_rpm; /* rotational speed */ u_int16_t d_interleave; /* hardware sector interleave */ u_int16_t d_trackskew; /* sector 0 skew, per track */ u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ u_int32_t d_headswitch; /* head switch time, usec */ u_int32_t d_trkseek; /* track-to-track seek, usec */ u_int32_t d_flags; /* generic flags */ #define NDDATA 5 u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */ #define NSPARE 5 u_int32_t d_spare[NSPARE]; /* reserved for future use */ u_int32_t d_magic2; /* the magic number (again) */ u_int16_t d_checksum; /* xor of data incl. partitions */ /* filesystem and partition information: */ u_int16_t d_npartitions; /* number of partitions in following */ u_int32_t d_bbsize; /* size of boot area at sn0, bytes */ u_int32_t d_sbsize; /* max size of fs superblock, bytes */ struct partition { /* the partition table */ u_int32_t p_size; /* number of sectors in partition */ u_int32_t p_offset; /* starting sector */ u_int32_t p_fsize; /* filesystem basic fragment size */ u_int8_t p_fstype; /* filesystem type, see below */ u_int8_t p_frag; /* filesystem fragments per block */ union { u_int16_t cpg; /* UFS: FS cylinders per group */ u_int16_t sgs; /* LFS: FS segment shift */ } __partition_u1; #define p_cpg __partition_u1.cpg #define p_sgs __partition_u1.sgs } d_partitions[MAXPARTITIONS]; /* actually may be more */ }; #else /* LOCORE */ /* * offsets for asm boot files. */ .set d_secsize,40 .set d_nsectors,44 .set d_ntracks,48 .set d_ncylinders,52 .set d_secpercyl,56 .set d_secperunit,60 .set d_end_,276 /* size of disk label */ #endif /* LOCORE */ /* d_type values: */ #define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ #define DTYPE_MSCP 2 /* MSCP */ #define DTYPE_DEC 3 /* other DEC (rk, rl) */ #define DTYPE_SCSI 4 /* SCSI */ #define DTYPE_ESDI 5 /* ESDI interface */ #define DTYPE_ST506 6 /* ST506 etc. */ #define DTYPE_HPIB 7 /* CS/80 on HP-IB */ #define DTYPE_HPFL 8 /* HP Fiber-link */ #define DTYPE_FLOPPY 10 /* floppy */ #define DTYPE_CCD 11 /* concatenated disk */ #ifdef PC98 #define DSTYPE_SEC256 0x80 /* physical sector size=256*/ #endif #ifdef DKTYPENAMES static char *dktypenames[] = { "unknown", "SMD", "MSCP", "old DEC", "SCSI", "ESDI", "ST506", "HP-IB", "HP-FL", "type 9", "floppy", "CCD", NULL }; #define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1) #endif /* * Filesystem type and version. * Used to interpret other filesystem-specific * per-partition information. */ #define FS_UNUSED 0 /* unused */ #define FS_SWAP 1 /* swap */ #define FS_V6 2 /* Sixth Edition */ #define FS_V7 3 /* Seventh Edition */ #define FS_SYSV 4 /* System V */ #define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ #define FS_V8 6 /* Eighth Edition, 4K blocks */ #define FS_BSDFFS 7 /* 4.2BSD fast file system */ #define FS_MSDOS 8 /* MSDOS file system */ #define FS_BSDLFS 9 /* 4.4BSD log-structured file system */ #define FS_OTHER 10 /* in use, but unknown/unsupported */ #define FS_HPFS 11 /* OS/2 high-performance file system */ #define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */ #define FS_BOOT 13 /* partition contains bootstrap */ #ifdef DKTYPENAMES static char *fstypenames[] = { "unused", "swap", "Version 6", "Version 7", "System V", "4.1BSD", "Eighth Edition", "4.2BSD", "MSDOS", "4.4LFS", "unknown", "HPFS", "ISO9660", "boot", NULL }; #define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1) #endif /* * flags shared by various drives: */ #define D_REMOVABLE 0x01 /* removable media */ #define D_ECC 0x02 /* supports ECC */ #define D_BADSECT 0x04 /* supports bad sector forw. */ #define D_RAMDISK 0x08 /* disk emulator */ #define D_CHAIN 0x10 /* can do back-back transfers */ /* * Drive data for SMD. */ #define d_smdflags d_drivedata[0] #define D_SSE 0x1 /* supports skip sectoring */ #define d_mindist d_drivedata[1] #define d_maxdist d_drivedata[2] #define d_sdist d_drivedata[3] /* * Drive data for ST506. */ #define d_precompcyl d_drivedata[0] #define d_gap3 d_drivedata[1] /* used only when formatting */ /* * Drive data for SCSI. */ #define d_blind d_drivedata[0] #ifndef LOCORE /* * Structure used to perform a format or other raw operation, returning * data and/or register values. Register identification and format * are device- and driver-dependent. */ struct format_op { char *df_buf; int df_count; /* value-result */ daddr_t df_startblk; int df_reg[8]; /* result */ }; /* * Structure used internally to retrieve information about a partition * on a disk. */ struct partinfo { struct disklabel *disklab; struct partition *part; }; /* DOS partition table -- located in boot block */ #ifdef PC98 #define DOSBBSECTOR 0 /* DOS boot block relative sector number */ #define DOSLABELSECTOR 1 /* 0: 256b/s, 1: 512b/s */ #define DOSPARTOFF 0 #define NDOSPART 16 #define DOSPTYP_386BSD 0x94 /* 386BSD partition type */ #define MBR_PTYPE_FreeBSD 0x94 /* FreeBSD partition type */ struct dos_partition { unsigned char dp_mid; #define DOSMID_386BSD (0x14|0x80) /* 386bsd|bootable */ unsigned char dp_sid; #define DOSSID_386BSD (0x44|0x80) /* 386bsd|active */ unsigned char dp_dum1; unsigned char dp_dum2; unsigned char dp_ipl_sct; unsigned char dp_ipl_head; unsigned short dp_ipl_cyl; unsigned char dp_ssect; /* starting sector */ unsigned char dp_shd; /* starting head */ unsigned short dp_scyl; /* starting cylinder */ unsigned char dp_esect; /* end sector */ unsigned char dp_ehd; /* end head */ unsigned short dp_ecyl; /* end cylinder */ unsigned char dp_name[16]; }; #else /* IBMPC */ #define DOSBBSECTOR 0 /* DOS boot block relative sector number */ #define DOSPARTOFF 446 #define NDOSPART 4 #define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ struct dos_partition { unsigned char dp_flag; /* bootstrap flags */ unsigned char dp_shd; /* starting head */ unsigned char dp_ssect; /* starting sector */ unsigned char dp_scyl; /* starting cylinder */ unsigned char dp_typ; /* partition type */ unsigned char dp_ehd; /* end head */ unsigned char dp_esect; /* end sector */ unsigned char dp_ecyl; /* end cylinder */ unsigned long dp_start; /* absolute starting sector number */ unsigned long dp_size; /* partition size in sectors */ }; #endif #define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ #define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ /* * Disk-specific ioctls. */ /* get and set disklabel; DIOCGPART used internally */ #define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */ #define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */ #define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */ #define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */ /* do format operation, read or write */ #define DIOCRFORMAT _IOWR('d', 105, struct format_op) #define DIOCWFORMAT _IOWR('d', 106, struct format_op) #define DIOCSSTEP _IOW('d', 107, int) /* set step rate */ #define DIOCSRETRIES _IOW('d', 108, int) /* set # of retries */ #define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */ #define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */ #define DIOCSBADSCAN _IOW('d', 111, int) /* set badscan mode */ /* * XXX encoding of disk minor numbers, should be elsewhere. * * See for a possibly better encoding. * * "cpio -H newc" can be used to back up device files with large minor * numbers (but not ones >= 2^31). Old cpio formats and all tar formats * don't have enough bits, and cpio and tar don't notice the lossage. * There are also some sign extension bugs. */ /* 3 2 1 0 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 _________________________________________________________________ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------------------------------------------- | TYPE |UNIT_2 | SLICE | MAJOR? | UNIT |PART | ----------------------------------------------------------------- */ #define dkmakeminor(unit, slice, part) \ (((slice) << 16) | ((unit) << 3) | (part)) #define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part)) #define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16)) #define dkpart(dev) (minor(dev) & 7) #define dkslice(dev) ((minor(dev) >> 16) & 0x1f) #define dktype(dev) ((minor(dev) >> 25) & 0x7f) #define dkunit(dev) ((((dev) >> 16) & 0x1e0) | (((dev) >> 3) & 0x1f)) #ifdef KERNEL +struct buf; struct buf_queue_head; int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, int wlabel)); void diskerr __P((struct buf *bp, char *dname, char *what, int pri, int blkdone, struct disklabel *lp)); void disksort __P((struct buf *ap, struct buf *bp)); u_int dkcksum __P((struct disklabel *lp)); char *readdisklabel __P((dev_t dev, void (*strat)(struct buf *bp), struct disklabel *lp)); void bufqdisksort __P((struct buf_queue_head *ap, struct buf *bp)); int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp, u_long openmask)); int writedisklabel __P((dev_t dev, void (*strat)(struct buf *bp), struct disklabel *lp)); #endif /* KERNEL */ #endif /* LOCORE */ #ifndef KERNEL __BEGIN_DECLS struct disklabel *getdiskbyname __P((const char *)); __END_DECLS #endif #endif /* !_SYS_DISKLABEL_H_ */ Index: head/sys/sys/diskpc98.h =================================================================== --- head/sys/sys/diskpc98.h (revision 32994) +++ head/sys/sys/diskpc98.h (revision 32995) @@ -1,451 +1,452 @@ /* * Copyright (c) 1987, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 - * $Id: disklabel.h,v 1.27 1997/02/22 09:45:05 peter Exp $ + * $Id: disklabel.h,v 1.28 1997/09/21 22:09:07 gibbs Exp $ */ #ifndef _SYS_DISKLABEL_H_ #define _SYS_DISKLABEL_H_ #ifndef KERNEL #include #endif #include /* * Disk description table, see disktab(5) */ #define _PATH_DISKTAB "/etc/disktab" #define DISKTAB "/etc/disktab" /* deprecated */ /* * Each disk has a label which includes information about the hardware * disk geometry, filesystem partitions, and drive specific information. * The label is in block 0 or 1, possibly offset from the beginning * to leave room for a bootstrap, etc. */ /* XXX these should be defined per controller (or drive) elsewhere, not here! */ #ifdef __i386__ #define LABELSECTOR 1 /* sector containing label */ #define LABELOFFSET 0 /* offset of label in sector */ #endif #ifndef LABELSECTOR #define LABELSECTOR 0 /* sector containing label */ #endif #ifndef LABELOFFSET #define LABELOFFSET 64 /* offset of label in sector */ #endif #define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */ #ifndef MAXPARTITIONS #define MAXPARTITIONS 8 #endif #define LABEL_PART 2 /* partition containing label */ #define RAW_PART 2 /* partition containing whole disk */ #define SWAP_PART 1 /* partition normally containing swap */ #ifndef LOCORE struct disklabel { u_int32_t d_magic; /* the magic number */ u_int16_t d_type; /* drive type */ u_int16_t d_subtype; /* controller/d_type specific */ char d_typename[16]; /* type name, e.g. "eagle" */ /* * d_packname contains the pack identifier and is returned when * the disklabel is read off the disk or in-core copy. * d_boot0 and d_boot1 are the (optional) names of the * primary (block 0) and secondary (block 1-15) bootstraps * as found in /usr/mdec. These are returned when using * getdiskbyname(3) to retrieve the values from /etc/disktab. */ #if defined(KERNEL) || defined(STANDALONE) char d_packname[16]; /* pack identifier */ #else union { char un_d_packname[16]; /* pack identifier */ struct { char *un_d_boot0; /* primary bootstrap name */ char *un_d_boot1; /* secondary bootstrap name */ } un_b; } d_un; #define d_packname d_un.un_d_packname #define d_boot0 d_un.un_b.un_d_boot0 #define d_boot1 d_un.un_b.un_d_boot1 #endif /* ! KERNEL or STANDALONE */ /* disk geometry: */ u_int32_t d_secsize; /* # of bytes per sector */ u_int32_t d_nsectors; /* # of data sectors per track */ u_int32_t d_ntracks; /* # of tracks per cylinder */ u_int32_t d_ncylinders; /* # of data cylinders per unit */ u_int32_t d_secpercyl; /* # of data sectors per cylinder */ u_int32_t d_secperunit; /* # of data sectors per unit */ /* * Spares (bad sector replacements) below are not counted in * d_nsectors or d_secpercyl. Spare sectors are assumed to * be physical sectors which occupy space at the end of each * track and/or cylinder. */ u_int16_t d_sparespertrack; /* # of spare sectors per track */ u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ /* * Alternate cylinders include maintenance, replacement, configuration * description areas, etc. */ u_int32_t d_acylinders; /* # of alt. cylinders per unit */ /* hardware characteristics: */ /* * d_interleave, d_trackskew and d_cylskew describe perturbations * in the media format used to compensate for a slow controller. * Interleave is physical sector interleave, set up by the * formatter or controller when formatting. When interleaving is * in use, logically adjacent sectors are not physically * contiguous, but instead are separated by some number of * sectors. It is specified as the ratio of physical sectors * traversed per logical sector. Thus an interleave of 1:1 * implies contiguous layout, while 2:1 implies that logical * sector 0 is separated by one sector from logical sector 1. * d_trackskew is the offset of sector 0 on track N relative to * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew * is the offset of sector 0 on cylinder N relative to sector 0 * on cylinder N-1. */ u_int16_t d_rpm; /* rotational speed */ u_int16_t d_interleave; /* hardware sector interleave */ u_int16_t d_trackskew; /* sector 0 skew, per track */ u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ u_int32_t d_headswitch; /* head switch time, usec */ u_int32_t d_trkseek; /* track-to-track seek, usec */ u_int32_t d_flags; /* generic flags */ #define NDDATA 5 u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */ #define NSPARE 5 u_int32_t d_spare[NSPARE]; /* reserved for future use */ u_int32_t d_magic2; /* the magic number (again) */ u_int16_t d_checksum; /* xor of data incl. partitions */ /* filesystem and partition information: */ u_int16_t d_npartitions; /* number of partitions in following */ u_int32_t d_bbsize; /* size of boot area at sn0, bytes */ u_int32_t d_sbsize; /* max size of fs superblock, bytes */ struct partition { /* the partition table */ u_int32_t p_size; /* number of sectors in partition */ u_int32_t p_offset; /* starting sector */ u_int32_t p_fsize; /* filesystem basic fragment size */ u_int8_t p_fstype; /* filesystem type, see below */ u_int8_t p_frag; /* filesystem fragments per block */ union { u_int16_t cpg; /* UFS: FS cylinders per group */ u_int16_t sgs; /* LFS: FS segment shift */ } __partition_u1; #define p_cpg __partition_u1.cpg #define p_sgs __partition_u1.sgs } d_partitions[MAXPARTITIONS]; /* actually may be more */ }; #else /* LOCORE */ /* * offsets for asm boot files. */ .set d_secsize,40 .set d_nsectors,44 .set d_ntracks,48 .set d_ncylinders,52 .set d_secpercyl,56 .set d_secperunit,60 .set d_end_,276 /* size of disk label */ #endif /* LOCORE */ /* d_type values: */ #define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ #define DTYPE_MSCP 2 /* MSCP */ #define DTYPE_DEC 3 /* other DEC (rk, rl) */ #define DTYPE_SCSI 4 /* SCSI */ #define DTYPE_ESDI 5 /* ESDI interface */ #define DTYPE_ST506 6 /* ST506 etc. */ #define DTYPE_HPIB 7 /* CS/80 on HP-IB */ #define DTYPE_HPFL 8 /* HP Fiber-link */ #define DTYPE_FLOPPY 10 /* floppy */ #define DTYPE_CCD 11 /* concatenated disk */ #ifdef PC98 #define DSTYPE_SEC256 0x80 /* physical sector size=256*/ #endif #ifdef DKTYPENAMES static char *dktypenames[] = { "unknown", "SMD", "MSCP", "old DEC", "SCSI", "ESDI", "ST506", "HP-IB", "HP-FL", "type 9", "floppy", "CCD", NULL }; #define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1) #endif /* * Filesystem type and version. * Used to interpret other filesystem-specific * per-partition information. */ #define FS_UNUSED 0 /* unused */ #define FS_SWAP 1 /* swap */ #define FS_V6 2 /* Sixth Edition */ #define FS_V7 3 /* Seventh Edition */ #define FS_SYSV 4 /* System V */ #define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ #define FS_V8 6 /* Eighth Edition, 4K blocks */ #define FS_BSDFFS 7 /* 4.2BSD fast file system */ #define FS_MSDOS 8 /* MSDOS file system */ #define FS_BSDLFS 9 /* 4.4BSD log-structured file system */ #define FS_OTHER 10 /* in use, but unknown/unsupported */ #define FS_HPFS 11 /* OS/2 high-performance file system */ #define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */ #define FS_BOOT 13 /* partition contains bootstrap */ #ifdef DKTYPENAMES static char *fstypenames[] = { "unused", "swap", "Version 6", "Version 7", "System V", "4.1BSD", "Eighth Edition", "4.2BSD", "MSDOS", "4.4LFS", "unknown", "HPFS", "ISO9660", "boot", NULL }; #define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1) #endif /* * flags shared by various drives: */ #define D_REMOVABLE 0x01 /* removable media */ #define D_ECC 0x02 /* supports ECC */ #define D_BADSECT 0x04 /* supports bad sector forw. */ #define D_RAMDISK 0x08 /* disk emulator */ #define D_CHAIN 0x10 /* can do back-back transfers */ /* * Drive data for SMD. */ #define d_smdflags d_drivedata[0] #define D_SSE 0x1 /* supports skip sectoring */ #define d_mindist d_drivedata[1] #define d_maxdist d_drivedata[2] #define d_sdist d_drivedata[3] /* * Drive data for ST506. */ #define d_precompcyl d_drivedata[0] #define d_gap3 d_drivedata[1] /* used only when formatting */ /* * Drive data for SCSI. */ #define d_blind d_drivedata[0] #ifndef LOCORE /* * Structure used to perform a format or other raw operation, returning * data and/or register values. Register identification and format * are device- and driver-dependent. */ struct format_op { char *df_buf; int df_count; /* value-result */ daddr_t df_startblk; int df_reg[8]; /* result */ }; /* * Structure used internally to retrieve information about a partition * on a disk. */ struct partinfo { struct disklabel *disklab; struct partition *part; }; /* DOS partition table -- located in boot block */ #ifdef PC98 #define DOSBBSECTOR 0 /* DOS boot block relative sector number */ #define DOSLABELSECTOR 1 /* 0: 256b/s, 1: 512b/s */ #define DOSPARTOFF 0 #define NDOSPART 16 #define DOSPTYP_386BSD 0x94 /* 386BSD partition type */ #define MBR_PTYPE_FreeBSD 0x94 /* FreeBSD partition type */ struct dos_partition { unsigned char dp_mid; #define DOSMID_386BSD (0x14|0x80) /* 386bsd|bootable */ unsigned char dp_sid; #define DOSSID_386BSD (0x44|0x80) /* 386bsd|active */ unsigned char dp_dum1; unsigned char dp_dum2; unsigned char dp_ipl_sct; unsigned char dp_ipl_head; unsigned short dp_ipl_cyl; unsigned char dp_ssect; /* starting sector */ unsigned char dp_shd; /* starting head */ unsigned short dp_scyl; /* starting cylinder */ unsigned char dp_esect; /* end sector */ unsigned char dp_ehd; /* end head */ unsigned short dp_ecyl; /* end cylinder */ unsigned char dp_name[16]; }; #else /* IBMPC */ #define DOSBBSECTOR 0 /* DOS boot block relative sector number */ #define DOSPARTOFF 446 #define NDOSPART 4 #define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ struct dos_partition { unsigned char dp_flag; /* bootstrap flags */ unsigned char dp_shd; /* starting head */ unsigned char dp_ssect; /* starting sector */ unsigned char dp_scyl; /* starting cylinder */ unsigned char dp_typ; /* partition type */ unsigned char dp_ehd; /* end head */ unsigned char dp_esect; /* end sector */ unsigned char dp_ecyl; /* end cylinder */ unsigned long dp_start; /* absolute starting sector number */ unsigned long dp_size; /* partition size in sectors */ }; #endif #define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ #define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ /* * Disk-specific ioctls. */ /* get and set disklabel; DIOCGPART used internally */ #define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */ #define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */ #define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */ #define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */ /* do format operation, read or write */ #define DIOCRFORMAT _IOWR('d', 105, struct format_op) #define DIOCWFORMAT _IOWR('d', 106, struct format_op) #define DIOCSSTEP _IOW('d', 107, int) /* set step rate */ #define DIOCSRETRIES _IOW('d', 108, int) /* set # of retries */ #define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */ #define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */ #define DIOCSBADSCAN _IOW('d', 111, int) /* set badscan mode */ /* * XXX encoding of disk minor numbers, should be elsewhere. * * See for a possibly better encoding. * * "cpio -H newc" can be used to back up device files with large minor * numbers (but not ones >= 2^31). Old cpio formats and all tar formats * don't have enough bits, and cpio and tar don't notice the lossage. * There are also some sign extension bugs. */ /* 3 2 1 0 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 _________________________________________________________________ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------------------------------------------- | TYPE |UNIT_2 | SLICE | MAJOR? | UNIT |PART | ----------------------------------------------------------------- */ #define dkmakeminor(unit, slice, part) \ (((slice) << 16) | ((unit) << 3) | (part)) #define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part)) #define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16)) #define dkpart(dev) (minor(dev) & 7) #define dkslice(dev) ((minor(dev) >> 16) & 0x1f) #define dktype(dev) ((minor(dev) >> 25) & 0x7f) #define dkunit(dev) ((((dev) >> 16) & 0x1e0) | (((dev) >> 3) & 0x1f)) #ifdef KERNEL +struct buf; struct buf_queue_head; int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, int wlabel)); void diskerr __P((struct buf *bp, char *dname, char *what, int pri, int blkdone, struct disklabel *lp)); void disksort __P((struct buf *ap, struct buf *bp)); u_int dkcksum __P((struct disklabel *lp)); char *readdisklabel __P((dev_t dev, void (*strat)(struct buf *bp), struct disklabel *lp)); void bufqdisksort __P((struct buf_queue_head *ap, struct buf *bp)); int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp, u_long openmask)); int writedisklabel __P((dev_t dev, void (*strat)(struct buf *bp), struct disklabel *lp)); #endif /* KERNEL */ #endif /* LOCORE */ #ifndef KERNEL __BEGIN_DECLS struct disklabel *getdiskbyname __P((const char *)); __END_DECLS #endif #endif /* !_SYS_DISKLABEL_H_ */ Index: head/sys/sys/dkbad.h =================================================================== --- head/sys/sys/dkbad.h (revision 32994) +++ head/sys/sys/dkbad.h (revision 32995) @@ -1,98 +1,99 @@ /*- * Copyright (c) 1982, 1986, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)dkbad.h 8.2 (Berkeley) 7/10/94 - * $Id$ + * $Id: dkbad.h,v 1.9 1997/02/22 09:45:07 peter Exp $ */ #ifndef _SYS_DKBAD_H_ #define _SYS_DKBAD_H_ /* * Definitions needed to perform bad sector revectoring ala DEC STD 144. * * The bad sector information is located in the first 5 even numbered * sectors of the last track of the disk pack. There are five identical * copies of the information, described by the dkbad structure. * * Replacement sectors are allocated starting with the first sector before * the bad sector information and working backwards towards the beginning of * the disk. A maximum of 126 bad sectors are supported. The position of * the bad sector in the bad sector table determines which replacement sector * it corresponds to. * * The bad sector information and replacement sectors are conventionally * only accessible through the 'c' file system partition of the disk. If * that partition is used for a file system, the user is responsible for * making sure that it does not overlap the bad sector information or any * replacement sectors. */ #define DKBAD_MAGIC 0x4321 /* normal value for bt_flag */ #define DKBAD_MAXBAD 126 /* maximum bad sectors supported */ #define DKBAD_NOCYL 0xffff /* cylinder to mark end of disk table */ #define DKBAD_NOTRKSEC 0xffff /* track/sector to mark end */ struct dkbad { int32_t bt_csn; /* cartridge serial number */ u_int16_t bt_mbz; /* unused; should be 0 */ u_int16_t bt_flag; /* -1 => alignment cartridge */ struct bt_bad { u_int16_t bt_cyl; /* cylinder number of bad sector */ u_int16_t bt_trksec; /* track and sector number */ } bt_bad[DKBAD_MAXBAD]; }; #define ECC 0 #define SSE 1 #define BSE 2 #define CONT 3 #ifdef KERNEL #define DKBAD_NOSECT (-1) /* sector to mark end of core table */ struct dkbad_intern { daddr_t bi_maxspare; /* last spare sector */ u_int bi_nbad; /* actual dimension of bi_badsect[] */ long bi_bad[DKBAD_MAXBAD + 1]; /* actually usually less */ }; +struct buf; struct disklabel; struct dkbad_intern *internbad144 __P((struct dkbad *btp, struct disklabel *lp)); char *readbad144 __P((dev_t dev, void (*strat)(struct buf *bp), struct disklabel *lp, struct dkbad *btp)); daddr_t transbad144 __P((struct dkbad_intern *bip, daddr_t blkno)); #endif #endif /* !_SYS_DKBAD_H_ */ Index: head/sys/sys/ipc.h =================================================================== --- head/sys/sys/ipc.h (revision 32994) +++ head/sys/sys/ipc.h (revision 32995) @@ -1,100 +1,102 @@ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ipc.h 8.4 (Berkeley) 2/19/95 - * $Id$ + * $Id: ipc.h,v 1.10 1997/02/22 09:45:24 peter Exp $ */ /* * SVID compatible ipc.h file */ #ifndef _SYS_IPC_H_ #define _SYS_IPC_H_ struct ipc_perm { ushort cuid; /* creator user id */ ushort cgid; /* creator group id */ ushort uid; /* user id */ ushort gid; /* group id */ ushort mode; /* r/w permission */ ushort seq; /* sequence # (to generate unique msg/sem/shm id) */ key_t key; /* user specified msg/sem/shm key */ }; /* common mode bits */ #define IPC_R 000400 /* read permission */ #define IPC_W 000200 /* write/alter permission */ #define IPC_M 010000 /* permission to change control info */ /* SVID required constants (same values as system 5) */ #define IPC_CREAT 001000 /* create entry if key does not exist */ #define IPC_EXCL 002000 /* fail if key exists */ #define IPC_NOWAIT 004000 /* error if request must wait */ #define IPC_PRIVATE (key_t)0 /* private key */ #define IPC_RMID 0 /* remove identifier */ #define IPC_SET 1 /* set options */ #define IPC_STAT 2 /* get options */ #ifdef KERNEL /* Macros to convert between ipc ids and array indices or sequence ids */ #define IPCID_TO_IX(id) ((id) & 0xffff) #define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff) #define IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff)) -int ipcperm __P((struct ucred *,struct ipc_perm *,int)); +struct ucred; + +int ipcperm __P((struct ucred *, struct ipc_perm *, int)); #else /* ! KERNEL */ /* XXX doesn't really belong here, but has been historical practice in SysV. */ #ifndef _POSIX_SOURCE #include __BEGIN_DECLS key_t ftok __P((const char *, int)); __END_DECLS #endif /* ! POSIX */ #endif /* KERNEL */ #endif /* !_SYS_IPC_H_ */ Index: head/sys/sys/protosw.h =================================================================== --- head/sys/sys/protosw.h (revision 32994) +++ head/sys/sys/protosw.h (revision 32995) @@ -1,318 +1,318 @@ /*- * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)protosw.h 8.1 (Berkeley) 6/2/93 - * $Id: protosw.h,v 1.21 1997/09/14 02:25:40 peter Exp $ + * $Id: protosw.h,v 1.22 1997/12/21 16:35:10 bde Exp $ */ #ifndef _SYS_PROTOSW_H_ #define _SYS_PROTOSW_H_ /* Forward declare these structures referenced from prototypes below. */ -struct ifnet; struct mbuf; struct proc; struct sockaddr; struct socket; -struct sockproto; -struct stat; -struct uio; -struct proc; /*#ifdef KERNEL*/ /* * Protocol switch table. * * Each protocol has a handle initializing one of these structures, * which is used for protocol-protocol and system-protocol communication. * * A protocol is called through the pr_init entry before any other. * Thereafter it is called every 200ms through the pr_fasttimo entry and * every 500ms through the pr_slowtimo for timer based actions. * The system will call the pr_drain entry if it is low on space and * this should throw away any non-critical data. * * Protocols pass data between themselves as chains of mbufs using * the pr_input and pr_output hooks. Pr_input passes data up (towards * UNIX) and pr_output passes it down (towards the imps); control * information passes up and down on pr_ctlinput and pr_ctloutput. * The protocol is responsible for the space occupied by any the * arguments to these entries and must dispose it. * * The userreq routine interfaces protocols to the system and is * described below. */ struct protosw { short pr_type; /* socket type used for */ struct domain *pr_domain; /* domain protocol a member of */ short pr_protocol; /* protocol number */ short pr_flags; /* see below */ /* protocol-protocol hooks */ void (*pr_input) __P((struct mbuf *, int len)); /* input to protocol (from below) */ int (*pr_output) __P((struct mbuf *m, struct socket *so)); /* output to protocol (from above) */ void (*pr_ctlinput)__P((int, struct sockaddr *, void *)); /* control input (from below) */ int (*pr_ctloutput)__P((int, struct socket *, int, int, struct mbuf **, struct proc *)); /* control output (from above) */ /* user-protocol hook */ void *pr_ousrreq; /* utility hooks */ void (*pr_init) __P((void)); /* initialization hook */ void (*pr_fasttimo) __P((void)); /* fast timeout (200ms) */ void (*pr_slowtimo) __P((void)); /* slow timeout (500ms) */ void (*pr_drain) __P((void)); /* flush any excess space possible */ struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */ }; /*#endif*/ #define PR_SLOWHZ 2 /* 2 slow timeouts per second */ #define PR_FASTHZ 5 /* 5 fast timeouts per second */ /* * Values for pr_flags. * PR_ADDR requires PR_ATOMIC; * PR_ADDR and PR_CONNREQUIRED are mutually exclusive. * PR_IMPLOPCL means that the protocol allows sendto without prior connect, * and the protocol understands the MSG_EOF flag. The first property is * is only relevant if PR_CONNREQUIRED is set (otherwise sendto is allowed * anyhow). */ #define PR_ATOMIC 0x01 /* exchange atomic messages only */ #define PR_ADDR 0x02 /* addresses given with messages */ #define PR_CONNREQUIRED 0x04 /* connection required by protocol */ #define PR_WANTRCVD 0x08 /* want PRU_RCVD calls */ #define PR_RIGHTS 0x10 /* passes capabilities */ #define PR_IMPLOPCL 0x20 /* implied open/close */ /* * The arguments to usrreq are: * (*protosw[].pr_usrreq)(up, req, m, nam, opt); * where up is a (struct socket *), req is one of these requests, * m is a optional mbuf chain containing a message, * nam is an optional mbuf chain containing an address, * and opt is a pointer to a socketopt structure or nil. * The protocol is responsible for disposal of the mbuf chain m, * the caller is responsible for any space held by nam and opt. * A non-zero return from usrreq gives an * UNIX error number which should be passed to higher level software. */ #define PRU_ATTACH 0 /* attach protocol to up */ #define PRU_DETACH 1 /* detach protocol from up */ #define PRU_BIND 2 /* bind socket to address */ #define PRU_LISTEN 3 /* listen for connection */ #define PRU_CONNECT 4 /* establish connection to peer */ #define PRU_ACCEPT 5 /* accept connection from peer */ #define PRU_DISCONNECT 6 /* disconnect from peer */ #define PRU_SHUTDOWN 7 /* won't send any more data */ #define PRU_RCVD 8 /* have taken data; more room now */ #define PRU_SEND 9 /* send this data */ #define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */ #define PRU_CONTROL 11 /* control operations on protocol */ #define PRU_SENSE 12 /* return status into m */ #define PRU_RCVOOB 13 /* retrieve out of band data */ #define PRU_SENDOOB 14 /* send out of band data */ #define PRU_SOCKADDR 15 /* fetch socket's address */ #define PRU_PEERADDR 16 /* fetch peer's address */ #define PRU_CONNECT2 17 /* connect two sockets */ /* begin for protocols internal use */ #define PRU_FASTTIMO 18 /* 200ms timeout */ #define PRU_SLOWTIMO 19 /* 500ms timeout */ #define PRU_PROTORCV 20 /* receive from below */ #define PRU_PROTOSEND 21 /* send to below */ /* end for protocol's internal use */ #define PRU_SEND_EOF 22 /* send and close */ #define PRU_NREQ 22 #ifdef PRUREQUESTS char *prurequests[] = { "ATTACH", "DETACH", "BIND", "LISTEN", "CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN", "RCVD", "SEND", "ABORT", "CONTROL", "SENSE", "RCVOOB", "SENDOOB", "SOCKADDR", "PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO", "PROTORCV", "PROTOSEND", "SEND_EOF", }; #endif #ifdef KERNEL /* users shouldn't see this decl */ + +struct ifnet; +struct stat; +struct ucred; +struct uio; /* * If the ordering here looks odd, that's because it's alphabetical. * Having this structure separated out from the main protoswitch is allegedly * a big (12 cycles per call) lose on high-end CPUs. We will eventually * migrate this stuff back into the main structure. */ struct pr_usrreqs { int (*pru_abort) __P((struct socket *so)); int (*pru_accept) __P((struct socket *so, struct sockaddr **nam)); int (*pru_attach) __P((struct socket *so, int proto, struct proc *p)); int (*pru_bind) __P((struct socket *so, struct sockaddr *nam, struct proc *p)); int (*pru_connect) __P((struct socket *so, struct sockaddr *nam, struct proc *p)); int (*pru_connect2) __P((struct socket *so1, struct socket *so2)); int (*pru_control) __P((struct socket *so, int cmd, caddr_t data, struct ifnet *ifp, struct proc *p)); int (*pru_detach) __P((struct socket *so)); int (*pru_disconnect) __P((struct socket *so)); int (*pru_listen) __P((struct socket *so, struct proc *p)); int (*pru_peeraddr) __P((struct socket *so, struct sockaddr **nam)); int (*pru_rcvd) __P((struct socket *so, int flags)); int (*pru_rcvoob) __P((struct socket *so, struct mbuf *m, int flags)); int (*pru_send) __P((struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct proc *p)); #define PRUS_OOB 0x1 #define PRUS_EOF 0x2 int (*pru_sense) __P((struct socket *so, struct stat *sb)); int (*pru_shutdown) __P((struct socket *so)); int (*pru_sockaddr) __P((struct socket *so, struct sockaddr **nam)); /* * These three added later, so they are out of order. They are used * for shortcutting (fast path input/output) in some protocols. * XXX - that's a lie, they are not implemented yet * Rather than calling sosend() etc. directly, calls are made * through these entry points. For protocols which still use * the generic code, these just point to those routines. */ int (*pru_sosend) __P((struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct proc *p)); int (*pru_soreceive) __P((struct socket *so, struct sockaddr **paddr, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp)); int (*pru_sopoll) __P((struct socket *so, int events, struct ucred *cred, struct proc *p)); }; int pru_accept_notsupp __P((struct socket *so, struct sockaddr **nam)); int pru_connect_notsupp __P((struct socket *so, struct sockaddr *nam, struct proc *p)); int pru_connect2_notsupp __P((struct socket *so1, struct socket *so2)); int pru_control_notsupp __P((struct socket *so, int cmd, caddr_t data, struct ifnet *ifp, struct proc *p)); int pru_listen_notsupp __P((struct socket *so, struct proc *p)); int pru_rcvd_notsupp __P((struct socket *so, int flags)); int pru_rcvoob_notsupp __P((struct socket *so, struct mbuf *m, int flags)); int pru_sense_null __P((struct socket *so, struct stat *sb)); #endif /* KERNEL */ /* * The arguments to the ctlinput routine are * (*protosw[].pr_ctlinput)(cmd, sa, arg); * where cmd is one of the commands below, sa is a pointer to a sockaddr, * and arg is a `void *' argument used within a protocol family. */ #define PRC_IFDOWN 0 /* interface transition */ #define PRC_ROUTEDEAD 1 /* select new route if possible ??? */ #define PRC_IFUP 2 /* interface has come back up */ #define PRC_QUENCH2 3 /* DEC congestion bit says slow down */ #define PRC_QUENCH 4 /* some one said to slow down */ #define PRC_MSGSIZE 5 /* message size forced drop */ #define PRC_HOSTDEAD 6 /* host appears to be down */ #define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */ #define PRC_UNREACH_NET 8 /* no route to network */ #define PRC_UNREACH_HOST 9 /* no route to host */ #define PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */ #define PRC_UNREACH_PORT 11 /* bad port # */ /* was PRC_UNREACH_NEEDFRAG 12 (use PRC_MSGSIZE) */ #define PRC_UNREACH_SRCFAIL 13 /* source route failed */ #define PRC_REDIRECT_NET 14 /* net routing redirect */ #define PRC_REDIRECT_HOST 15 /* host routing redirect */ #define PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */ #define PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */ #define PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */ #define PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */ #define PRC_PARAMPROB 20 /* header incorrect */ #define PRC_NCMDS 21 #define PRC_IS_REDIRECT(cmd) \ ((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST) #ifdef PRCREQUESTS char *prcrequests[] = { "IFDOWN", "ROUTEDEAD", "IFUP", "DEC-BIT-QUENCH2", "QUENCH", "MSGSIZE", "HOSTDEAD", "#7", "NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH", "#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT", "TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS", "PARAMPROB" }; #endif /* * The arguments to ctloutput are: * (*protosw[].pr_ctloutput)(req, so, level, optname, optval, p); * req is one of the actions listed below, so is a (struct socket *), * level is an indication of which protocol layer the option is intended. * optname is a protocol dependent socket option request, * optval is a pointer to a mbuf-chain pointer, for value-return results. * The protocol is responsible for disposal of the mbuf chain *optval * if supplied, * the caller is responsible for any space held by *optval, when returned. * A non-zero return from usrreq gives an * UNIX error number which should be passed to higher level software. */ #define PRCO_GETOPT 0 #define PRCO_SETOPT 1 #define PRCO_NCMDS 2 #ifdef PRCOREQUESTS char *prcorequests[] = { "GETOPT", "SETOPT", }; #endif #ifdef KERNEL void pfctlinput __P((int, struct sockaddr *)); struct protosw *pffindproto __P((int family, int protocol, int type)); struct protosw *pffindtype __P((int family, int type)); #endif #endif Index: head/sys/sys/shm.h =================================================================== --- head/sys/sys/shm.h (revision 32994) +++ head/sys/sys/shm.h (revision 32995) @@ -1,98 +1,100 @@ -/* $Id$ */ +/* $Id: shm.h,v 1.11 1997/02/22 09:45:52 peter Exp $ */ /* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */ /* * Copyright (c) 1994 Adam Glass * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Adam Glass. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * As defined+described in "X/Open System Interfaces and Headers" * Issue 4, p. XXX */ #ifndef _SYS_SHM_H_ #define _SYS_SHM_H_ #include #define SHM_RDONLY 010000 /* Attach read-only (else read-write) */ #define SHM_RND 020000 /* Round attach address to SHMLBA */ #define SHMLBA PAGE_SIZE /* Segment low boundary address multiple */ /* "official" access mode definitions; somewhat braindead since you have to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */ #define SHM_R (IPC_R) #define SHM_W (IPC_W) struct shmid_ds { struct ipc_perm shm_perm; /* operation permission structure */ int shm_segsz; /* size of segment in bytes */ pid_t shm_lpid; /* process ID of last shared memory op */ pid_t shm_cpid; /* process ID of creator */ short shm_nattch; /* number of current attaches */ time_t shm_atime; /* time of last shmat() */ time_t shm_dtime; /* time of last shmdt() */ time_t shm_ctime; /* time of last change by shmctl() */ void *shm_internal; /* sysv stupidity */ }; #ifdef KERNEL /* * System 5 style catch-all structure for shared memory constants that * might be of interest to user programs. Do we really want/need this? */ struct shminfo { int shmmax, /* max shared memory segment size (bytes) */ shmmin, /* min shared memory segment size (bytes) */ shmmni, /* max number of shared memory identifiers */ shmseg, /* max shared memory segments per process */ shmall; /* max amount of shared memory (pages) */ }; extern struct shminfo shminfo; extern struct shmid_ds *shmsegs; + +struct proc; void shmexit __P((struct proc *)); void shmfork __P((struct proc *, struct proc *)); #else /* !KERNEL */ #include __BEGIN_DECLS int shmsys __P((int, ...)); void *shmat __P((int, void *, int)); int shmget __P((key_t, int, int)); int shmctl __P((int, int, struct shmid_ds *)); int shmdt __P((void *)); __END_DECLS #endif /* !KERNEL */ #endif /* !_SYS_SHM_H_ */ Index: head/sys/sys/socketvar.h =================================================================== --- head/sys/sys/socketvar.h (revision 32994) +++ head/sys/sys/socketvar.h (revision 32995) @@ -1,290 +1,293 @@ /*- * Copyright (c) 1982, 1986, 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)socketvar.h 8.3 (Berkeley) 2/19/95 - * $Id: socketvar.h,v 1.22 1997/09/14 02:25:41 peter Exp $ + * $Id: socketvar.h,v 1.23 1997/12/21 16:35:11 bde Exp $ */ #ifndef _SYS_SOCKETVAR_H_ #define _SYS_SOCKETVAR_H_ #include /* for TAILQ macros */ #include /* for struct selinfo */ /* * Kernel structure per socket. * Contains send and receive buffer queues, * handle on protocol and pointer to protocol * private data and error information. */ struct socket { short so_type; /* generic type, see socket.h */ short so_options; /* from socket call, see socket.h */ short so_linger; /* time to linger while closing */ short so_state; /* internal state flags SS_*, below */ caddr_t so_pcb; /* protocol control block */ struct protosw *so_proto; /* protocol handle */ /* * Variables for connection queuing. * Socket where accepts occur is so_head in all subsidiary sockets. * If so_head is 0, socket is not related to an accept. * For head socket so_q0 queues partially completed connections, * while so_q is a queue of connections ready to be accepted. * If a connection is aborted and it has so_head set, then * it has to be pulled out of either so_q0 or so_q. * We allow connections to queue up based on current queue lengths * and limit on number of queued connections for this socket. */ struct socket *so_head; /* back pointer to accept socket */ TAILQ_HEAD(, socket) so_incomp; /* queue of partial unaccepted connections */ TAILQ_HEAD(, socket) so_comp; /* queue of complete unaccepted connections */ TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */ short so_qlen; /* number of unaccepted connections */ short so_incqlen; /* number of unaccepted incomplete connections */ short so_qlimit; /* max number queued connections */ short so_timeo; /* connection timeout */ u_short so_error; /* error affecting connection */ pid_t so_pgid; /* pgid for signals */ u_long so_oobmark; /* chars to oob mark */ /* * Variables for socket buffering. */ struct sockbuf { u_long sb_cc; /* actual chars in buffer */ u_long sb_hiwat; /* max actual char count */ u_long sb_mbcnt; /* chars of mbufs used */ u_long sb_mbmax; /* max chars of mbufs to use */ long sb_lowat; /* low water mark */ struct mbuf *sb_mb; /* the mbuf chain */ struct selinfo sb_sel; /* process selecting read/write */ short sb_flags; /* flags, see below */ short sb_timeo; /* timeout for read/write */ } so_rcv, so_snd; #define SB_MAX (256*1024) /* default for max chars in sockbuf */ #define SB_LOCK 0x01 /* lock on data queue */ #define SB_WANT 0x02 /* someone is waiting to lock */ #define SB_WAIT 0x04 /* someone is waiting for data/space */ #define SB_SEL 0x08 /* someone is selecting */ #define SB_ASYNC 0x10 /* ASYNC I/O, need signals */ #define SB_NOTIFY (SB_WAIT|SB_SEL|SB_ASYNC) #define SB_NOINTR 0x40 /* operations not interruptible */ caddr_t so_tpcb; /* Wisc. protocol control block XXX */ void (*so_upcall) __P((struct socket *so, caddr_t arg, int waitf)); caddr_t so_upcallarg; /* Arg for above */ }; /* * Socket state bits. */ #define SS_NOFDREF 0x0001 /* no file table ref any more */ #define SS_ISCONNECTED 0x0002 /* socket connected to a peer */ #define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */ #define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */ #define SS_CANTSENDMORE 0x0010 /* can't send more data to peer */ #define SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */ #define SS_RCVATMARK 0x0040 /* at mark on input */ /*efine SS_PRIV 0x0080 privileged for broadcast, raw... */ #define SS_NBIO 0x0100 /* non-blocking ops */ #define SS_ASYNC 0x0200 /* async i/o notify */ #define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */ #define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */ #define SS_COMP 0x1000 /* unaccepted, complete connection */ /* * Macros for sockets and socket buffering. */ /* * How much space is there in a socket buffer (so->so_snd or so->so_rcv)? * This is problematical if the fields are unsigned, as the space might * still be negative (cc > hiwat or mbcnt > mbmax). Should detect * overflow and return 0. Should use "lmin" but it doesn't exist now. */ #define sbspace(sb) \ ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \ (int)((sb)->sb_mbmax - (sb)->sb_mbcnt))) /* do we have to send all at once on a socket? */ #define sosendallatonce(so) \ ((so)->so_proto->pr_flags & PR_ATOMIC) /* can we read something from so? */ #define soreadable(so) \ ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ ((so)->so_state & SS_CANTRCVMORE) || \ (so)->so_comp.tqh_first || (so)->so_error) /* can we write something to so? */ #define sowriteable(so) \ ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \ (((so)->so_state&SS_ISCONNECTED) || \ ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \ ((so)->so_state & SS_CANTSENDMORE) || \ (so)->so_error) /* adjust counters in sb reflecting allocation of m */ #define sballoc(sb, m) { \ (sb)->sb_cc += (m)->m_len; \ (sb)->sb_mbcnt += MSIZE; \ if ((m)->m_flags & M_EXT) \ (sb)->sb_mbcnt += (m)->m_ext.ext_size; \ } /* adjust counters in sb reflecting freeing of m */ #define sbfree(sb, m) { \ (sb)->sb_cc -= (m)->m_len; \ (sb)->sb_mbcnt -= MSIZE; \ if ((m)->m_flags & M_EXT) \ (sb)->sb_mbcnt -= (m)->m_ext.ext_size; \ } /* * Set lock on sockbuf sb; sleep if lock is already held. * Unless SB_NOINTR is set on sockbuf, sleep is interruptible. * Returns error without lock if sleep is interrupted. */ #define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \ (((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \ ((sb)->sb_flags |= SB_LOCK), 0) /* release lock on sockbuf sb */ #define sbunlock(sb) { \ (sb)->sb_flags &= ~SB_LOCK; \ if ((sb)->sb_flags & SB_WANT) { \ (sb)->sb_flags &= ~SB_WANT; \ wakeup((caddr_t)&(sb)->sb_flags); \ } \ } #define sorwakeup(so) { sowakeup((so), &(so)->so_rcv); \ if ((so)->so_upcall) \ (*((so)->so_upcall))((so), (so)->so_upcallarg, M_DONTWAIT); \ } #define sowwakeup(so) sowakeup((so), &(so)->so_snd) #ifdef KERNEL #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_PCB); MALLOC_DECLARE(M_SOCKET); MALLOC_DECLARE(M_SONAME); #endif extern u_long sb_max; +struct file; struct filedesc; struct mbuf; struct sockaddr; struct stat; +struct ucred; +struct uio; /* * File operations on sockets. */ int soo_ioctl __P((struct file *fp, int cmd, caddr_t data, struct proc *p)); int soo_poll __P((struct file *fp, int events, struct ucred *cred, struct proc *p)); int soo_stat __P((struct socket *so, struct stat *ub)); /* * From uipc_socket and friends */ struct sockaddr *dup_sockaddr __P((struct sockaddr *sa, int canwait)); int getsock __P((struct filedesc *fdp, int fdes, struct file **fpp)); int sockargs __P((struct mbuf **mp, caddr_t buf, int buflen, int type)); int getsockaddr __P((struct sockaddr **namp, caddr_t uaddr, size_t len)); void sbappend __P((struct sockbuf *sb, struct mbuf *m)); int sbappendaddr __P((struct sockbuf *sb, struct sockaddr *asa, struct mbuf *m0, struct mbuf *control)); int sbappendcontrol __P((struct sockbuf *sb, struct mbuf *m0, struct mbuf *control)); void sbappendrecord __P((struct sockbuf *sb, struct mbuf *m0)); void sbcheck __P((struct sockbuf *sb)); void sbcompress __P((struct sockbuf *sb, struct mbuf *m, struct mbuf *n)); struct mbuf * sbcreatecontrol __P((caddr_t p, int size, int type, int level)); void sbdrop __P((struct sockbuf *sb, int len)); void sbdroprecord __P((struct sockbuf *sb)); void sbflush __P((struct sockbuf *sb)); void sbinsertoob __P((struct sockbuf *sb, struct mbuf *m0)); void sbrelease __P((struct sockbuf *sb)); int sbreserve __P((struct sockbuf *sb, u_long cc)); int sbwait __P((struct sockbuf *sb)); int sb_lock __P((struct sockbuf *sb)); int soabort __P((struct socket *so)); int soaccept __P((struct socket *so, struct sockaddr **nam)); int sobind __P((struct socket *so, struct sockaddr *nam, struct proc *p)); void socantrcvmore __P((struct socket *so)); void socantsendmore __P((struct socket *so)); int soclose __P((struct socket *so)); int soconnect __P((struct socket *so, struct sockaddr *nam, struct proc *p)); int soconnect2 __P((struct socket *so1, struct socket *so2)); int socreate __P((int dom, struct socket **aso, int type, int proto, struct proc *p)); int sodisconnect __P((struct socket *so)); void sofree __P((struct socket *so)); int sogetopt __P((struct socket *so, int level, int optname, struct mbuf **mp, struct proc *p)); void sohasoutofband __P((struct socket *so)); void soisconnected __P((struct socket *so)); void soisconnecting __P((struct socket *so)); void soisdisconnected __P((struct socket *so)); void soisdisconnecting __P((struct socket *so)); int solisten __P((struct socket *so, int backlog, struct proc *p)); struct socket * sodropablereq __P((struct socket *head)); struct socket * sonewconn __P((struct socket *head, int connstatus)); int sopoll __P((struct socket *so, int events, struct ucred *cred, struct proc *p)); int soreceive __P((struct socket *so, struct sockaddr **paddr, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp)); int soreserve __P((struct socket *so, u_long sndcc, u_long rcvcc)); void sorflush __P((struct socket *so)); int sosend __P((struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct proc *p)); int sosetopt __P((struct socket *so, int level, int optname, struct mbuf *m0, struct proc *p)); int soshutdown __P((struct socket *so, int how)); void sowakeup __P((struct socket *so, struct sockbuf *sb)); #endif /* KERNEL */ #endif /* !_SYS_SOCKETVAR_H_ */ Index: head/sys/vm/pmap.h =================================================================== --- head/sys/vm/pmap.h (revision 32994) +++ head/sys/vm/pmap.h (revision 32995) @@ -1,138 +1,141 @@ /* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * The Mach Operating System project at Carnegie-Mellon University. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * from: @(#)pmap.h 8.1 (Berkeley) 6/11/93 * * * Copyright (c) 1987, 1990 Carnegie-Mellon University. * All rights reserved. * * Author: Avadis Tevanian, Jr. * * Permission to use, copy, modify and distribute this software and * its documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: pmap.h,v 1.25 1997/12/14 02:10:30 dyson Exp $ + * $Id: pmap.h,v 1.26 1998/01/22 17:30:30 dyson Exp $ */ /* * Machine address mapping definitions -- machine-independent * section. [For machine-dependent section, see "machine/pmap.h".] */ #ifndef _PMAP_VM_ #define _PMAP_VM_ /* * Each machine dependent implementation is expected to * keep certain statistics. They may do this anyway they * so choose, but are expected to return the statistics * in the following structure. */ struct pmap_statistics { long resident_count; /* # of pages mapped (total) */ long wired_count; /* # of pages wired */ }; typedef struct pmap_statistics *pmap_statistics_t; #include #ifdef KERNEL + +struct proc; + void pmap_change_wiring __P((pmap_t, vm_offset_t, boolean_t)); void pmap_clear_modify __P((vm_offset_t pa)); void pmap_clear_reference __P((vm_offset_t pa)); void pmap_copy __P((pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t)); void pmap_copy_page __P((vm_offset_t, vm_offset_t)); void pmap_destroy __P((pmap_t)); void pmap_enter __P((pmap_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t)); vm_offset_t pmap_extract __P((pmap_t, vm_offset_t)); void pmap_growkernel __P((vm_offset_t)); void pmap_init __P((vm_offset_t, vm_offset_t)); boolean_t pmap_is_modified __P((vm_offset_t pa)); boolean_t pmap_ts_referenced __P((vm_offset_t pa)); void pmap_kenter __P((vm_offset_t, vm_offset_t)); void pmap_kremove __P((vm_offset_t)); vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int)); void pmap_object_init_pt __P((pmap_t pmap, vm_offset_t addr, vm_object_t object, vm_pindex_t pindex, vm_offset_t size, int pagelimit)); boolean_t pmap_page_exists __P((pmap_t, vm_offset_t)); void pmap_page_protect __P((vm_offset_t, vm_prot_t)); void pmap_pageable __P((pmap_t, vm_offset_t, vm_offset_t, boolean_t)); vm_offset_t pmap_phys_address __P((int)); void pmap_pinit __P((pmap_t)); void pmap_pinit0 __P((pmap_t)); void pmap_protect __P((pmap_t, vm_offset_t, vm_offset_t, vm_prot_t)); void pmap_qenter __P((vm_offset_t, vm_page_t *, int)); void pmap_qremove __P((vm_offset_t, int)); void pmap_reference __P((pmap_t)); void pmap_release __P((pmap_t)); void pmap_remove __P((pmap_t, vm_offset_t, vm_offset_t)); void pmap_remove_pages __P((pmap_t, vm_offset_t, vm_offset_t)); void pmap_zero_page __P((vm_offset_t)); void pmap_prefault __P((pmap_t, vm_offset_t, vm_map_entry_t)); int pmap_mincore __P((pmap_t pmap, vm_offset_t addr)); void pmap_new_proc __P((struct proc *p)); void pmap_dispose_proc __P((struct proc *p)); void pmap_swapout_proc __P((struct proc *p)); void pmap_swapin_proc __P((struct proc *p)); void pmap_activate __P((struct proc *p)); vm_offset_t pmap_addr_hint __P((vm_object_t obj, vm_offset_t addr, vm_size_t size)); void pmap_init2 __P((void)); #endif /* KERNEL */ #endif /* _PMAP_VM_ */