Deleted Added
full compact
block_if.c (267071) block_if.c (268953)
1/*-
2 * Copyright (c) 2013 Peter Grehan <grehan@freebsd.org>
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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2013 Peter Grehan <grehan@freebsd.org>
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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: stable/10/usr.sbin/bhyve/block_if.c 267071 2014-06-04 18:08:08Z jhb $
26 * $FreeBSD: stable/10/usr.sbin/bhyve/block_if.c 268953 2014-07-21 19:08:02Z jhb $
27 */
28
29#include <sys/cdefs.h>
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: stable/10/usr.sbin/bhyve/block_if.c 267071 2014-06-04 18:08:08Z jhb $");
30__FBSDID("$FreeBSD: stable/10/usr.sbin/bhyve/block_if.c 268953 2014-07-21 19:08:02Z jhb $");
31
32#include <sys/param.h>
33#include <sys/queue.h>
34#include <sys/errno.h>
35#include <sys/stat.h>
36#include <sys/ioctl.h>
37#include <sys/disk.h>
38

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

265 perror("Could not fetch dev blk/sector size");
266 close(fd);
267 return (NULL);
268 }
269 assert(size != 0);
270 assert(sectsz != 0);
271 }
272
31
32#include <sys/param.h>
33#include <sys/queue.h>
34#include <sys/errno.h>
35#include <sys/stat.h>
36#include <sys/ioctl.h>
37#include <sys/disk.h>
38

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

265 perror("Could not fetch dev blk/sector size");
266 close(fd);
267 return (NULL);
268 }
269 assert(size != 0);
270 assert(sectsz != 0);
271 }
272
273 bc = malloc(sizeof(struct blockif_ctxt));
273 bc = calloc(1, sizeof(struct blockif_ctxt));
274 if (bc == NULL) {
275 close(fd);
276 return (NULL);
277 }
278
274 if (bc == NULL) {
275 close(fd);
276 return (NULL);
277 }
278
279 memset(bc, 0, sizeof(*bc));
280 bc->bc_magic = BLOCKIF_SIG;
281 bc->bc_fd = fd;
282 bc->bc_size = size;
283 bc->bc_sectsz = sectsz;
284 pthread_mutex_init(&bc->bc_mtx, NULL);
285 pthread_cond_init(&bc->bc_cond, NULL);
286 TAILQ_INIT(&bc->bc_freeq);
287 TAILQ_INIT(&bc->bc_inuseq);

--- 139 unchanged lines hidden ---
279 bc->bc_magic = BLOCKIF_SIG;
280 bc->bc_fd = fd;
281 bc->bc_size = size;
282 bc->bc_sectsz = sectsz;
283 pthread_mutex_init(&bc->bc_mtx, NULL);
284 pthread_cond_init(&bc->bc_cond, NULL);
285 TAILQ_INIT(&bc->bc_freeq);
286 TAILQ_INIT(&bc->bc_inuseq);

--- 139 unchanged lines hidden ---