md_intel.c (286615) | md_intel.c (298649) |
---|---|
1/*- 2 * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 3 * Copyright (c) 2000 - 2008 S��ren Schmidt <sos@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 3 * Copyright (c) 2000 - 2008 S��ren Schmidt <sos@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/geom/raid/md_intel.c 286615 2015-08-11 03:12:09Z pfg $"); | 29__FBSDID("$FreeBSD: head/sys/geom/raid/md_intel.c 298649 2016-04-26 15:38:17Z pfg $"); |
30 31#include <sys/param.h> 32#include <sys/bio.h> 33#include <sys/endian.h> 34#include <sys/kernel.h> 35#include <sys/kobj.h> 36#include <sys/limits.h> 37#include <sys/lock.h> --- 730 unchanged lines hidden (view full) --- 768 meta->checksum = 0; 769 for (checksum = 0, ptr = (uint32_t *)meta, i = 0; 770 i < (meta->config_size / sizeof(uint32_t)); i++) { 771 checksum += *ptr++; 772 } 773 meta->checksum = checksum; 774 775 /* Create and fill buffer. */ | 30 31#include <sys/param.h> 32#include <sys/bio.h> 33#include <sys/endian.h> 34#include <sys/kernel.h> 35#include <sys/kobj.h> 36#include <sys/limits.h> 37#include <sys/lock.h> --- 730 unchanged lines hidden (view full) --- 768 meta->checksum = 0; 769 for (checksum = 0, ptr = (uint32_t *)meta, i = 0; 770 i < (meta->config_size / sizeof(uint32_t)); i++) { 771 checksum += *ptr++; 772 } 773 meta->checksum = checksum; 774 775 /* Create and fill buffer. */ |
776 sectors = (meta->config_size + pp->sectorsize - 1) / pp->sectorsize; | 776 sectors = howmany(meta->config_size, pp->sectorsize); |
777 buf = malloc(sectors * pp->sectorsize, M_MD_INTEL, M_WAITOK | M_ZERO); 778 if (sectors > 1) { 779 memcpy(buf, ((char *)meta) + pp->sectorsize, 780 (sectors - 1) * pp->sectorsize); 781 } 782 memcpy(buf + (sectors - 1) * pp->sectorsize, meta, pp->sectorsize); 783 784 error = g_write_data(cp, --- 1930 unchanged lines hidden --- | 777 buf = malloc(sectors * pp->sectorsize, M_MD_INTEL, M_WAITOK | M_ZERO); 778 if (sectors > 1) { 779 memcpy(buf, ((char *)meta) + pp->sectorsize, 780 (sectors - 1) * pp->sectorsize); 781 } 782 memcpy(buf + (sectors - 1) * pp->sectorsize, meta, pp->sectorsize); 783 784 error = g_write_data(cp, --- 1930 unchanged lines hidden --- |