geom_dev.c (e8d57122849cfa78e59078a355d2c73936f00559) | geom_dev.c (9a6844d55fe33a5c55973951843be9aac013693f) |
---|---|
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 --- 535 unchanged lines hidden (view full) --- 544 545 if (arg->len > sizeof(arg->value)) { 546 error = EINVAL; 547 break; 548 } 549 error = g_io_getattr(arg->name, cp, &arg->len, &arg->value); 550 break; 551 } | 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 --- 535 unchanged lines hidden (view full) --- 544 545 if (arg->len > sizeof(arg->value)) { 546 error = EINVAL; 547 break; 548 } 549 error = g_io_getattr(arg->name, cp, &arg->len, &arg->value); 550 break; 551 } |
552 case DIOCZONECMD: { 553 struct disk_zone_args *zone_args =(struct disk_zone_args *)data; 554 struct disk_zone_rep_entry *new_entries, *old_entries; 555 struct disk_zone_report *rep; 556 size_t alloc_size; 557 558 old_entries = NULL; 559 new_entries = NULL; 560 rep = NULL; 561 alloc_size = 0; 562 563 if (zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES) { 564 565 rep = &zone_args->zone_params.report; 566 alloc_size = rep->entries_allocated * 567 sizeof(struct disk_zone_rep_entry); 568 if (alloc_size != 0) 569 new_entries = g_malloc(alloc_size, 570 M_WAITOK| M_ZERO); 571 old_entries = rep->entries; 572 rep->entries = new_entries; 573 } 574 error = g_io_zonecmd(zone_args, cp); 575 if ((zone_args->zone_cmd == DISK_ZONE_REPORT_ZONES) 576 && (alloc_size != 0) 577 && (error == 0)) { 578 error = copyout(new_entries, old_entries, alloc_size); 579 } 580 if ((old_entries != NULL) 581 && (rep != NULL)) 582 rep->entries = old_entries; 583 584 if (new_entries != NULL) 585 g_free(new_entries); 586 break; 587 } |
|
552 default: 553 if (cp->provider->geom->ioctl != NULL) { 554 error = cp->provider->geom->ioctl(cp->provider, cmd, data, fflag, td); 555 } else { 556 error = ENOIOCTL; 557 } 558 } 559 --- 9 unchanged lines hidden (view full) --- 569 int destroy; 570 571 cp = bp2->bio_from; 572 sc = cp->private; 573 bp = bp2->bio_parent; 574 bp->bio_error = bp2->bio_error; 575 bp->bio_completed = bp2->bio_completed; 576 bp->bio_resid = bp->bio_length - bp2->bio_completed; | 588 default: 589 if (cp->provider->geom->ioctl != NULL) { 590 error = cp->provider->geom->ioctl(cp->provider, cmd, data, fflag, td); 591 } else { 592 error = ENOIOCTL; 593 } 594 } 595 --- 9 unchanged lines hidden (view full) --- 605 int destroy; 606 607 cp = bp2->bio_from; 608 sc = cp->private; 609 bp = bp2->bio_parent; 610 bp->bio_error = bp2->bio_error; 611 bp->bio_completed = bp2->bio_completed; 612 bp->bio_resid = bp->bio_length - bp2->bio_completed; |
613 if (bp2->bio_cmd == BIO_ZONE) 614 bcopy(&bp2->bio_zone, &bp->bio_zone, sizeof(bp->bio_zone)); 615 |
|
577 if (bp2->bio_error != 0) { 578 g_trace(G_T_BIO, "g_dev_done(%p) had error %d", 579 bp2, bp2->bio_error); 580 bp->bio_flags |= BIO_ERROR; 581 } else { 582 g_trace(G_T_BIO, "g_dev_done(%p/%p) resid %ld completed %jd", 583 bp2, bp, bp2->bio_resid, (intmax_t)bp2->bio_completed); 584 } --- 18 unchanged lines hidden (view full) --- 603 struct g_consumer *cp; 604 struct bio *bp2; 605 struct cdev *dev; 606 struct g_dev_softc *sc; 607 608 KASSERT(bp->bio_cmd == BIO_READ || 609 bp->bio_cmd == BIO_WRITE || 610 bp->bio_cmd == BIO_DELETE || | 616 if (bp2->bio_error != 0) { 617 g_trace(G_T_BIO, "g_dev_done(%p) had error %d", 618 bp2, bp2->bio_error); 619 bp->bio_flags |= BIO_ERROR; 620 } else { 621 g_trace(G_T_BIO, "g_dev_done(%p/%p) resid %ld completed %jd", 622 bp2, bp, bp2->bio_resid, (intmax_t)bp2->bio_completed); 623 } --- 18 unchanged lines hidden (view full) --- 642 struct g_consumer *cp; 643 struct bio *bp2; 644 struct cdev *dev; 645 struct g_dev_softc *sc; 646 647 KASSERT(bp->bio_cmd == BIO_READ || 648 bp->bio_cmd == BIO_WRITE || 649 bp->bio_cmd == BIO_DELETE || |
611 bp->bio_cmd == BIO_FLUSH, | 650 bp->bio_cmd == BIO_FLUSH || 651 bp->bio_cmd == BIO_ZONE, |
612 ("Wrong bio_cmd bio=%p cmd=%d", bp, bp->bio_cmd)); 613 dev = bp->bio_dev; 614 cp = dev->si_drv2; 615 sc = cp->private; 616 KASSERT(cp->acr || cp->acw, 617 ("Consumer with zero access count in g_dev_strategy")); 618#ifdef INVARIANTS 619 if ((bp->bio_offset % cp->provider->sectorsize) != 0 || --- 92 unchanged lines hidden --- | 652 ("Wrong bio_cmd bio=%p cmd=%d", bp, bp->bio_cmd)); 653 dev = bp->bio_dev; 654 cp = dev->si_drv2; 655 sc = cp->private; 656 KASSERT(cp->acr || cp->acw, 657 ("Consumer with zero access count in g_dev_strategy")); 658#ifdef INVARIANTS 659 if ((bp->bio_offset % cp->provider->sectorsize) != 0 || --- 92 unchanged lines hidden --- |