Refactored sd and cd to use common disk subroutines.

This commit is contained in:
mlelstv 2016-12-10 10:26:38 +00:00
parent d141926363
commit 722016fe51
5 changed files with 1004 additions and 1710 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.dev,v 1.1 2015/08/21 02:18:18 uebayasi Exp $
# $NetBSD: files.dev,v 1.2 2016/12/10 10:26:38 mlelstv Exp $
file dev/bio.c bio needs-flag
file dev/ccd.c ccd
@ -6,7 +6,7 @@ file dev/cgd.c cgd
file dev/cgd_crypto.c cgd
file dev/clock_subr.c kern # XXX
file dev/clockctl.c clockctl
file dev/dksubr.c cgd | xbd | ccd | raid | dm | ld
file dev/dksubr.c cgd | xbd | ccd | raid | dm | ld | sd | cd
file dev/dkwedge/dk.c kern # XXX
file dev/dkwedge/dkwedge_apple.c dkwedge_method_apple
file dev/dkwedge/dkwedge_bsdlabel.c dkwedge_method_bsdlabel

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: cdvar.h,v 1.32 2015/04/14 20:32:36 riastradh Exp $ */
/* $NetBSD: cdvar.h,v 1.33 2016/12/10 10:26:38 mlelstv Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@ -24,19 +24,16 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/rndsource.h>
#include <dev/dkvar.h>
#define CDRETRIES 4
struct cd_softc {
device_t sc_dev;
struct disk sc_dk;
kmutex_t sc_lock;
struct dk_softc sc_dksc;
int flags;
#define CDF_WLABEL 0x04 /* label is writable */
#define CDF_LABELLING 0x08 /* writing label */
#define CDF_ANCIENT 0x10 /* disk is ancient; for minphys */
#define CDF_EJECTED 0x20 /* be silent when flushing cache */
struct scsipi_periph *sc_periph;
@ -46,8 +43,9 @@ struct cd_softc {
u_long disksize512; /* total number sectors */
} params;
struct bufq_state *buf_queue;
struct callout sc_callout;
krndsource_t rnd_source;
};
#define CDGP_RESULT_OK 0 /* parameters obtained */
#define CDGP_RESULT_OFFLINE 1 /* no media, or otherwise losing */
#define CDGP_RESULT_UNFORMATTED 2 /* unformatted media (max params) */

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: sdvar.h,v 1.37 2015/08/24 23:13:15 pooka Exp $ */
/* $NetBSD: sdvar.h,v 1.38 2016/12/10 10:26:38 mlelstv Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@ -53,7 +53,7 @@
#include "opt_scsi.h"
#endif
#include <sys/rndsource.h>
#include <dev/dkvar.h>
#ifndef SDRETRIES
#define SDRETRIES 4
@ -74,12 +74,9 @@ struct disk_parms {
};
struct sd_softc {
device_t sc_dev;
struct disk sc_dk;
struct dk_softc sc_dksc;
int flags;
#define SDF_WLABEL 0x04 /* label is writable */
#define SDF_LABELLING 0x08 /* writing label */
#define SDF_ANCIENT 0x10 /* disk is ancient; for minphys */
#define SDF_DIRTY 0x20 /* disk is dirty; needs cache flush */
#define SDF_FLUSHING 0x40 /* flushing, for sddone() */
@ -88,12 +85,9 @@ struct sd_softc {
struct disk_parms params;
struct bufq_state *buf_queue;
callout_t sc_callout;
u_int8_t type;
char name[16]; /* product name, for default disklabel */
krndsource_t rnd_source;
};
#define SDGP_RESULT_OK 0 /* parameters obtained */