Deleted Added
full compact
aac_disk.c (103675) aac_disk.c (103714)
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2001 Scott Long
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001 Adaptec, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2001 Scott Long
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001 Adaptec, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/dev/aac/aac_disk.c 103675 2002-09-20 12:52:03Z phk $
29 * $FreeBSD: head/sys/dev/aac/aac_disk.c 103714 2002-09-20 19:36:05Z phk $
30 */
31
32#include "opt_aac.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/sysctl.h>

--- 87 unchanged lines hidden (view full) ---

125 *
126 * This is called by the diskslice code on first open in order to get the
127 * basic device geometry paramters.
128 */
129static int
130aac_disk_open(dev_t dev, int flags, int fmt, d_thread_t *td)
131{
132 struct aac_disk *sc;
30 */
31
32#include "opt_aac.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/sysctl.h>

--- 87 unchanged lines hidden (view full) ---

125 *
126 * This is called by the diskslice code on first open in order to get the
127 * basic device geometry paramters.
128 */
129static int
130aac_disk_open(dev_t dev, int flags, int fmt, d_thread_t *td)
131{
132 struct aac_disk *sc;
133 struct disklabel *label;
134
135 debug_called(4);
136
137 sc = (struct aac_disk *)dev->si_drv1;
138
139 if (sc == NULL)
140 return (ENXIO);
141
142 /* check that the controller is up and running */
143 if (sc->ad_controller->aac_state & AAC_STATE_SUSPEND)
144 return(ENXIO);
145
133
134 debug_called(4);
135
136 sc = (struct aac_disk *)dev->si_drv1;
137
138 if (sc == NULL)
139 return (ENXIO);
140
141 /* check that the controller is up and running */
142 if (sc->ad_controller->aac_state & AAC_STATE_SUSPEND)
143 return(ENXIO);
144
146 /* build synthetic label */
147 label = &sc->ad_disk.d_label;
148 bzero(label, sizeof(*label));
149 label->d_type = DTYPE_ESDI;
150 label->d_secsize = AAC_BLOCK_SIZE;
151 label->d_nsectors = sc->ad_sectors;
152 label->d_ntracks = sc->ad_heads;
153 label->d_ncylinders = sc->ad_cylinders;
154 label->d_secpercyl = sc->ad_sectors * sc->ad_heads;
155 label->d_secperunit = sc->ad_size;
145 sc->ad_disk.d_sectorsize = AAC_BLOCK_SIZE;
146 sc->ad_disk.d_mediasize = (off_t)sc->ad_size * AAC_BLOCK_SIZE;
147 sc->ad_disk.d_fwsectors = sc->ad_sectors;
148 sc->ad_disk.d_fwheads = sc->ad_heads;
156
157 sc->ad_flags |= AAC_DISK_OPEN;
158 return (0);
159}
160
161/*
162 * Handle last close of the disk device.
163 */

--- 260 unchanged lines hidden ---
149
150 sc->ad_flags |= AAC_DISK_OPEN;
151 return (0);
152}
153
154/*
155 * Handle last close of the disk device.
156 */

--- 260 unchanged lines hidden ---