2005-12-11 15:16:03 +03:00
|
|
|
/* $NetBSD: cdvar.h,v 1.26 2005/12/11 12:23:50 christos Exp $ */
|
1997-08-27 15:22:52 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1997 Manuel Bouyer. 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:
|
2002-04-24 00:41:13 +04:00
|
|
|
* This product includes software developed by Manuel Bouyer.
|
1997-08-27 15:22:52 +04:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
1999-02-02 16:02:49 +03:00
|
|
|
#define CDRETRIES 4
|
1997-08-27 15:22:52 +04:00
|
|
|
|
|
|
|
struct cd_softc {
|
|
|
|
struct device sc_dev;
|
|
|
|
struct disk sc_dk;
|
2004-09-18 03:10:50 +04:00
|
|
|
struct lock sc_lock;
|
1997-08-27 15:22:52 +04:00
|
|
|
|
|
|
|
int flags;
|
|
|
|
#define CDF_WLABEL 0x04 /* label is writable */
|
|
|
|
#define CDF_LABELLING 0x08 /* writing label */
|
|
|
|
#define CDF_ANCIENT 0x10 /* disk is ancient; for minphys */
|
2001-04-25 21:53:04 +04:00
|
|
|
|
|
|
|
struct scsipi_periph *sc_periph;
|
|
|
|
|
1997-08-27 15:22:52 +04:00
|
|
|
struct cd_parms {
|
2005-02-01 03:19:34 +03:00
|
|
|
u_int blksize;
|
|
|
|
u_long disksize; /* total number sectors */
|
|
|
|
u_long disksize512; /* total number sectors */
|
1997-08-27 15:22:52 +04:00
|
|
|
} params;
|
2001-04-25 21:53:04 +04:00
|
|
|
|
2005-10-15 21:29:10 +04:00
|
|
|
struct bufq_state *buf_queue;
|
Improve handling of memory shortage, to fix problems like:
sd3(mpt0:0:1:0): unable to allocate scsipi_xfer
sd3: not queued, error 12
Havard Eidnes's analysis of this problem is that the scsipi_xfer pool is
competing for resources with other pools, including the the inode and vnode
pools which can grow quite large.
*_scsipi_cmd(): don't biodone the buffer if scsipi_make_xs() fails, let the
caller deal with the problem
start function of block devices drivers: dequeue the buffer after the
scsipi_command() call. If scsipi_command() fails with ENOMEM don't dequeue
the buffer, and schedule a callout to call the start function after
some delay.
scsipi_init(): prime the scsipi_xfer_pool with one page. This ensure that
there is always some scsipi_xfer to play with. If scsipi_command() fails
because of pool_get(), we're sure there will be resources available later,
when the pending commands have completed.
Reviewed by Jason Thorpe and Havard Eidnes.
Todo: remove the "unable to allocate scsipi_xfer" and "not queued, error %d"
printfs, but I choose to keep them for now, to help make sure the code does
what it should.
2004-08-28 00:37:28 +04:00
|
|
|
struct callout sc_callout;
|
1997-10-10 05:09:03 +04:00
|
|
|
|
1997-10-13 04:46:08 +04:00
|
|
|
#if NRND > 0
|
1997-10-10 05:09:03 +04:00
|
|
|
rndsource_element_t rnd_source;
|
1997-10-13 04:46:08 +04:00
|
|
|
#endif
|
1997-08-27 15:22:52 +04:00
|
|
|
};
|