Author: mav Date: Sun Mar 15 08:09:56 2015 New Revision: 280017 URL: https://svnweb.freebsd.org/changeset/base/280017
Log: Block delete capability for read-only devices. Submitted by: neel MFC after: 2 weeks Modified: head/usr.sbin/bhyve/block_if.c head/usr.sbin/bhyve/pci_ahci.c Modified: head/usr.sbin/bhyve/block_if.c ============================================================================== --- head/usr.sbin/bhyve/block_if.c Sun Mar 15 00:39:18 2015 (r280016) +++ head/usr.sbin/bhyve/block_if.c Sun Mar 15 08:09:56 2015 (r280017) @@ -230,6 +230,8 @@ blockif_proc(struct blockif_ctxt *bc, st case BOP_DELETE: if (!bc->bc_candelete) err = EOPNOTSUPP; + else if (bc->bc_rdonly) + err = EROFS; else if (bc->bc_ischr) { arg[0] = br->br_offset; arg[1] = br->br_iov[0].iov_len; Modified: head/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- head/usr.sbin/bhyve/pci_ahci.c Sun Mar 15 00:39:18 2015 (r280016) +++ head/usr.sbin/bhyve/pci_ahci.c Sun Mar 15 08:09:56 2015 (r280017) @@ -840,10 +840,11 @@ handle_identify(struct ahci_port *p, int } else { uint16_t buf[256]; uint64_t sectors; - int sectsz, psectsz, psectoff, candelete; + int sectsz, psectsz, psectoff, candelete, ro; uint16_t cyl; uint8_t sech, heads; + ro = blockif_is_ro(p->bctx); candelete = blockif_candelete(p->bctx); sectsz = blockif_sectsz(p->bctx); sectors = blockif_size(p->bctx) / sectsz; @@ -906,7 +907,7 @@ handle_identify(struct ahci_port *p, int buf[101] = (sectors >> 16); buf[102] = (sectors >> 32); buf[103] = (sectors >> 48); - if (candelete) { + if (candelete && !ro) { buf[69] |= ATA_SUPPORT_RZAT | ATA_SUPPORT_DRAT; buf[105] = 1; buf[169] = ATA_SUPPORT_DSM_TRIM; _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"