mfi_flash.c (214396) | mfi_flash.c (215526) |
---|---|
1/*- 2 * Copyright (c) 2008, 2009 Yahoo!, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2008, 2009 Yahoo!, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/usr.sbin/mfiutil/mfi_flash.c 214396 2010-10-26 19:11:09Z jhb $ | 29 * $FreeBSD: head/usr.sbin/mfiutil/mfi_flash.c 215526 2010-11-19 15:39:59Z jhb $ |
30 */ 31 32#include <sys/param.h> 33#include <sys/errno.h> 34#include <sys/stat.h> 35#include <err.h> 36#include <fcntl.h> 37#include <stdio.h> --- 120 unchanged lines hidden (view full) --- 158 mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_OPEN, NULL, 0, mbox, 4, &status); 159 if (status != MFI_STAT_OK) { 160 warnx("Failed to alloc flash memory: %s", mfi_status(status)); 161 return (EIO); 162 } 163 164 /* Upload the file 64k at a time. */ 165 buf = malloc(FLASH_BUF_SIZE); | 30 */ 31 32#include <sys/param.h> 33#include <sys/errno.h> 34#include <sys/stat.h> 35#include <err.h> 36#include <fcntl.h> 37#include <stdio.h> --- 120 unchanged lines hidden (view full) --- 158 mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_OPEN, NULL, 0, mbox, 4, &status); 159 if (status != MFI_STAT_OK) { 160 warnx("Failed to alloc flash memory: %s", mfi_status(status)); 161 return (EIO); 162 } 163 164 /* Upload the file 64k at a time. */ 165 buf = malloc(FLASH_BUF_SIZE); |
166 if (buf == NULL) { 167 warnx("malloc failed"); 168 return (ENOMEM); 169 } |
|
166 offset = 0; 167 while (sb.st_size > 0) { 168 nread = read(flash, buf, FLASH_BUF_SIZE); 169 if (nread <= 0 || nread % 1024 != 0) { 170 warnx("Bad read from flash file"); 171 mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_CLOSE, NULL, 0, 172 NULL, 0, NULL); 173 return (ENXIO); --- 33 unchanged lines hidden --- | 170 offset = 0; 171 while (sb.st_size > 0) { 172 nread = read(flash, buf, FLASH_BUF_SIZE); 173 if (nread <= 0 || nread % 1024 != 0) { 174 warnx("Bad read from flash file"); 175 mfi_dcmd_command(fd, MFI_DCMD_FLASH_FW_CLOSE, NULL, 0, 176 NULL, 0, NULL); 177 return (ENXIO); --- 33 unchanged lines hidden --- |