1/*-
2 * Copyright (c) 2002 Poul-Henning Kamp
3 * Copyright (c) 2002 Networks Associates Technology, Inc.
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7 * and NAI Labs, the Security Research Division of Network Associates, Inc.
8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
--- 18 unchanged lines hidden (view full) ---
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * $FreeBSD: head/sys/geom/geom_disk.c 110727 2003-02-11 21:23:34Z phk $
36 */
37
38#include "opt_geom.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>
--- 74 unchanged lines hidden (view full) ---
118 if (error != 0)
119 printf("Opened disk %s -> %d\n",
120 pp->name, error);
121 g_disk_unlock_giant(dp);
122 }
123 pp->mediasize = dp->d_mediasize;
124 pp->sectorsize = dp->d_sectorsize;
125 dp->d_flags |= DISKFLAG_OPEN;
126 if (dp->d_maxsize == 0 && dp->d_dev->si_iosize_max != 0)
127 dp->d_maxsize = dp->d_dev->si_iosize_max;
128 if (dp->d_maxsize == 0) {
129 printf("WARNING: Disk drive %s%d has no d_maxsize\n",
130 dp->d_name, dp->d_unit);
131 dp->d_maxsize = DFLTPHYS;
132 }
133 } else if ((pp->acr + pp->acw + pp->ace) > 0 && (r + w + e) == 0) {
134 if (dp->d_close != NULL || dp->d_cclose != NULL) {
135 g_disk_lock_giant(dp);
136 if (dp->d_close != NULL)
137 error = dp->d_close(dp);
138 else
139 error = dp->d_cclose(dev, FREAD|FWRITE, 0, NULL);
140 if (error != 0)
--- 56 unchanged lines hidden (view full) ---
197 case BIO_DELETE:
198 if (!(dp->d_flags & DISKFLAG_CANDELETE)) {
199 error = 0;
200 break;
201 }
202 /* fall-through */
203 case BIO_READ:
204 case BIO_WRITE:
205 off = 0;
206 bp3 = NULL;
207 bp2 = g_clone_bio(bp);
208 if (bp2 == NULL) {
209 error = ENOMEM;
210 break;
211 }
212 do {
--- 205 unchanged lines hidden ---
2 * Copyright (c) 2002 Poul-Henning Kamp
3 * Copyright (c) 2002 Networks Associates Technology, Inc.
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7 * and NAI Labs, the Security Research Division of Network Associates, Inc.
8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
--- 18 unchanged lines hidden (view full) ---
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * $FreeBSD: head/sys/geom/geom_disk.c 110727 2003-02-11 21:23:34Z phk $
36 */
37
38#include "opt_geom.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/sysctl.h>
--- 74 unchanged lines hidden (view full) ---
118 if (error != 0)
119 printf("Opened disk %s -> %d\n",
120 pp->name, error);
121 g_disk_unlock_giant(dp);
122 }
123 pp->mediasize = dp->d_mediasize;
124 pp->sectorsize = dp->d_sectorsize;
125 dp->d_flags |= DISKFLAG_OPEN;
126 if (dp->d_maxsize == 0 && dp->d_dev->si_iosize_max != 0)
127 dp->d_maxsize = dp->d_dev->si_iosize_max;
128 if (dp->d_maxsize == 0) {
129 printf("WARNING: Disk drive %s%d has no d_maxsize\n",
130 dp->d_name, dp->d_unit);
131 dp->d_maxsize = DFLTPHYS;
132 }
133 } else if ((pp->acr + pp->acw + pp->ace) > 0 && (r + w + e) == 0) {
134 if (dp->d_close != NULL || dp->d_cclose != NULL) {
135 g_disk_lock_giant(dp);
136 if (dp->d_close != NULL)
137 error = dp->d_close(dp);
138 else
139 error = dp->d_cclose(dev, FREAD|FWRITE, 0, NULL);
140 if (error != 0)
--- 56 unchanged lines hidden (view full) ---
197 case BIO_DELETE:
198 if (!(dp->d_flags & DISKFLAG_CANDELETE)) {
199 error = 0;
200 break;
201 }
202 /* fall-through */
203 case BIO_READ:
204 case BIO_WRITE:
205 off = 0;
206 bp3 = NULL;
207 bp2 = g_clone_bio(bp);
208 if (bp2 == NULL) {
209 error = ENOMEM;
210 break;
211 }
212 do {
--- 205 unchanged lines hidden ---