fdc.c (3745c395ecae17ef47be82433463d561629220b0) fdc.c (fc9f8bcf4f25461d922731c3e114fbc76b45600e)
1/*-
2 * Copyright (c) 2004 Poul-Henning Kamp
3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Don Ahn.
8 *

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

1200 printf("\n");
1201 }
1202 printf("Retry line %d\n", retry_line);
1203 }
1204 fdc->retry += i;
1205 mtx_lock(&fdc->fdc_mtx);
1206 }
1207 fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE);
1/*-
2 * Copyright (c) 2004 Poul-Henning Kamp
3 * Copyright (c) 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Don Ahn.
8 *

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

1200 printf("\n");
1201 }
1202 printf("Retry line %d\n", retry_line);
1203 }
1204 fdc->retry += i;
1205 mtx_lock(&fdc->fdc_mtx);
1206 }
1207 fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE);
1208 wakeup(&fdc->fdc_thread);
1208 mtx_unlock(&fdc->fdc_mtx);
1209
1210 kproc_exit(0);
1211}
1212
1213/*
1214 * Enqueue a request.
1215 */

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

1378};
1379
1380static int
1381fd_access(struct g_provider *pp, int r, int w, int e)
1382{
1383 struct fd_data *fd;
1384 struct fdc_data *fdc;
1385 int ar, aw, ae;
1209 mtx_unlock(&fdc->fdc_mtx);
1210
1211 kproc_exit(0);
1212}
1213
1214/*
1215 * Enqueue a request.
1216 */

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

1379};
1380
1381static int
1382fd_access(struct g_provider *pp, int r, int w, int e)
1383{
1384 struct fd_data *fd;
1385 struct fdc_data *fdc;
1386 int ar, aw, ae;
1387 int busy;
1386
1387 fd = pp->geom->softc;
1388 fdc = fd->fdc;
1389
1390 /*
1391 * If our provider is withering, we can only get negative requests
1392 * and we don't want to even see them
1393 */

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

1398 aw = w + pp->acw;
1399 ae = e + pp->ace;
1400
1401 if (ar == 0 && aw == 0 && ae == 0) {
1402 device_unbusy(fd->dev);
1403 return (0);
1404 }
1405
1388
1389 fd = pp->geom->softc;
1390 fdc = fd->fdc;
1391
1392 /*
1393 * If our provider is withering, we can only get negative requests
1394 * and we don't want to even see them
1395 */

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

1400 aw = w + pp->acw;
1401 ae = e + pp->ace;
1402
1403 if (ar == 0 && aw == 0 && ae == 0) {
1404 device_unbusy(fd->dev);
1405 return (0);
1406 }
1407
1408 busy = 0;
1406 if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) {
1407 if (fdmisccmd(fd, BIO_PROBE, NULL))
1408 return (ENXIO);
1409 if (fd->flags & FD_EMPTY)
1410 return (ENXIO);
1411 if (fd->flags & FD_NEWDISK) {
1412 fdautoselect(fd);
1413 mtx_lock(&fdc->fdc_mtx);
1414 fd->flags &= ~FD_NEWDISK;
1415 mtx_unlock(&fdc->fdc_mtx);
1416 }
1417 device_busy(fd->dev);
1409 if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) {
1410 if (fdmisccmd(fd, BIO_PROBE, NULL))
1411 return (ENXIO);
1412 if (fd->flags & FD_EMPTY)
1413 return (ENXIO);
1414 if (fd->flags & FD_NEWDISK) {
1415 fdautoselect(fd);
1416 mtx_lock(&fdc->fdc_mtx);
1417 fd->flags &= ~FD_NEWDISK;
1418 mtx_unlock(&fdc->fdc_mtx);
1419 }
1420 device_busy(fd->dev);
1421 busy = 1;
1418 }
1419
1422 }
1423
1420 if (w > 0 && (fd->flags & FD_WP))
1424 if (w > 0 && (fd->flags & FD_WP)) {
1425 if (busy)
1426 device_unbusy(fd->dev);
1421 return (EROFS);
1427 return (EROFS);
1428 }
1422
1423 pp->sectorsize = fd->sectorsize;
1424 pp->stripesize = fd->ft->heads * fd->ft->sectrac * fd->sectorsize;
1425 pp->mediasize = pp->stripesize * fd->ft->tracks;
1426 return (0);
1427}
1428
1429static void

--- 621 unchanged lines hidden ---
1429
1430 pp->sectorsize = fd->sectorsize;
1431 pp->stripesize = fd->ft->heads * fd->ft->sectrac * fd->sectorsize;
1432 pp->mediasize = pp->stripesize * fd->ft->tracks;
1433 return (0);
1434}
1435
1436static void

--- 621 unchanged lines hidden ---