Date: Mon, 7 Jan 2013 07:30:41 +0000 (UTC) From: Hiroki Sato <hrs@svn.freebsd.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245126 - user/hrs/releng/usr.sbin/makevd Message-ID: <50ea79a1.1957.5e0cec35@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hrs Date: Mon Jan 7 07:30:41 2013 New Revision: 245126 URL: http://svnweb.freebsd.org/changeset/base/245126 Log: - Use linked-list for chunks to support multiple formats in a consistent fashion. - Define VMDK_SEH_HOSTEDSPARSE_INIT and VHD_HDF_FIXEDHDD_INIT for some fixed parameters. - Fix license boilerplate. Added: user/hrs/releng/usr.sbin/makevd/common.c (contents, props changed) user/hrs/releng/usr.sbin/makevd/common.h (contents, props changed) Modified: user/hrs/releng/usr.sbin/makevd/Makefile user/hrs/releng/usr.sbin/makevd/raw.c user/hrs/releng/usr.sbin/makevd/vhd.c user/hrs/releng/usr.sbin/makevd/vhd.h user/hrs/releng/usr.sbin/makevd/vmdk.c user/hrs/releng/usr.sbin/makevd/vmdk.h Modified: user/hrs/releng/usr.sbin/makevd/Makefile ============================================================================== --- user/hrs/releng/usr.sbin/makevd/Makefile Mon Jan 7 07:05:57 2013 (r245125) +++ user/hrs/releng/usr.sbin/makevd/Makefile Mon Jan 7 07:30:41 2013 (r245126) @@ -3,6 +3,7 @@ PROG= makevd MAN= makevd.8 SRCS= makevd.c \ + common.c \ raw.c \ vhd.c \ vmdk.c Added: user/hrs/releng/usr.sbin/makevd/common.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/hrs/releng/usr.sbin/makevd/common.c Mon Jan 7 07:30:41 2013 (r245126) @@ -0,0 +1,108 @@ +/*- + * Copyright (c) 2013 + * Hiroki Sato <hrs@FreeBSD.org> All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <sys/queue.h> + +#include <err.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include "common.h" + +static int rawcopy(int, int); +static int writebuf(int, void *, ssize_t); + +int +dispatch_bl(int ofd, struct blhead_t *blhead) +{ + struct blist *bl; + int error; + + TAILQ_FOREACH(bl, blhead, bl_next) { + printf("processing section: %s\n", bl->bl_name); + switch (bl->bl_type) { + case BL_RAWCOPY: + error = rawcopy(ofd, bl->bl_tf.blf_fd); + break; + case BL_RAWDATA: + error = writebuf(ofd, bl->bl_tr.blr_data, + bl->bl_tr.blr_len); + break; + default: + error = 1; + break; + } + if (error) + return (error); + } + return (0); +} + +static int +rawcopy(int ofd, int ifd) +{ + ssize_t len0, len = 0; + char buf[BUFSIZ]; + + for (;;) { + len0 = read(ifd, buf, sizeof(buf)); + if (len0 == 0) + break; + if (len0 < 0) { + warn("read error"); + return (1); + } + len = write(ofd, buf, len0); + if (len < 0) { + warn("write error"); + return (1); + } + } + return (0); +} + +static int +writebuf(int ofd, void *buf, ssize_t len) +{ + ssize_t len0; + u_char *p; + + p = (u_char *)buf; + len0 = write(ofd, p, len); + if (len0 != len) { + warn("write error"); + return (1); + } + + return (0); +} Added: user/hrs/releng/usr.sbin/makevd/common.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/hrs/releng/usr.sbin/makevd/common.h Mon Jan 7 07:30:41 2013 (r245126) @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2013 + * Hiroki Sato <hrs@FreeBSD.org> All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ +#ifndef _COMMON_H +#define _COMMON_H + +#include <sys/queue.h> + +struct blist_raw { + size_t blr_len; + void *blr_data; +}; + +struct blist_fd { + int blf_fd; +}; + +struct blist { + TAILQ_ENTRY(blist) bl_next; + + int bl_type; +#define BL_UNKNOWN 0 +#define BL_RAWDATA 1 +#define BL_RAWCOPY 2 + const char *bl_name; + const char *bl_desc; + union { + struct blist_fd tf; + struct blist_raw tr; + } t; +#define bl_tf t.tf +#define bl_tr t.tr +}; + +TAILQ_HEAD(blhead_t, blist); + +int dispatch_bl(int, struct blhead_t *); + +#endif /* _COMMON_H */ Modified: user/hrs/releng/usr.sbin/makevd/raw.c ============================================================================== --- user/hrs/releng/usr.sbin/makevd/raw.c Mon Jan 7 07:05:57 2013 (r245125) +++ user/hrs/releng/usr.sbin/makevd/raw.c Mon Jan 7 07:30:41 2013 (r245126) @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR @@ -30,6 +30,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <sys/queue.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/uio.h> @@ -38,19 +39,23 @@ __FBSDID("$FreeBSD$"); #include <fcntl.h> #include <limits.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <sysexits.h> #include "makevd.h" +#include "common.h" int raw_makeim(struct iminfo *imi) { - char buf[BUFSIZ], rawfile[PATH_MAX + 10]; - ssize_t len0, len = 0; + struct blhead_t blhead; + struct blist *bl; + char rawfile[PATH_MAX + 10]; int ifd, ofd; + TAILQ_INIT(&blhead); ifd = imi->imi_fd; if (strcmp(imi->imi_imagename, "-") == 0) @@ -64,20 +69,14 @@ raw_makeim(struct iminfo *imi) err(EX_CANTCREAT, "%s", rawfile); } - for (;;) { - len0 = read(ifd, buf, sizeof(buf)); - if (len0 == 0) - break; - if (len0 < 0) { - warn("read error"); - return (1); - } - len = write(ofd, buf, len0); - if (len < 0) { - warn("write error"); - return (1); - } - } + bl = calloc(1, sizeof(*bl)); + if (bl == NULL) + err(EX_OSERR, NULL); + bl->bl_type = BL_RAWCOPY; + bl->bl_name = "rawcopy"; + bl->bl_tf.blf_fd = ifd; + + TAILQ_INSERT_TAIL(&blhead, bl, bl_next); - return (0); + return (dispatch_bl(ofd, &blhead)); } Modified: user/hrs/releng/usr.sbin/makevd/vhd.c ============================================================================== --- user/hrs/releng/usr.sbin/makevd/vhd.c Mon Jan 7 07:05:57 2013 (r245125) +++ user/hrs/releng/usr.sbin/makevd/vhd.c Mon Jan 7 07:30:41 2013 (r245126) @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR @@ -30,6 +30,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <sys/queue.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/uio.h> @@ -47,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #include "makevd.h" +#include "common.h" #include "vhd.h" static uint32_t vhd_checksum(struct HardDiskFooter *); @@ -54,16 +56,20 @@ static uint32_t vhd_checksum(struct Hard int vhd_makeim(struct iminfo *imi) { - struct HardDiskFooter DHF, *imh; + struct HardDiskFooter HDF = VHD_HDF_FIXEDHDD_INIT; + struct HardDiskFooter *imh; + struct blhead_t blhead; + struct blist *bl; uint64_t sectors, heads, cylinders, imagesize; uint8_t uuid[16]; char vhdfile[PATH_MAX + 10]; char buf[BUFSIZ]; char *p, *q; - ssize_t len0, len = 0; + ssize_t len = 0; int ifd, ofd; - imh = &DHF; + TAILQ_INIT(&blhead); + imh = &HDF; ifd = imi->imi_fd; imagesize = imi->imi_size; @@ -119,14 +125,7 @@ vhd_makeim(struct iminfo *imi) err(EX_CANTCREAT, "%s", vhdfile); /* All of the fields are in BE byte order. */ - imh->Cookie = htobe64(HDF_COOKIE); - imh->Features = htobe32(HDF_FEATURES_RES); - imh->FileFormatVersion = htobe32(HDF_FILEFORMATVERSION_DEFAULT); - imh->DataOffset = htobe32(HDF_DATAOFFSET_FIXEDHDD); imh->TimeStamp = 0; /* XXX */ - imh->CreatorApplication = htobe32(HDF_CREATORAPP_VPC); - imh->CreatorVersion = htobe32(HDF_CREATORVERSION_VPC2004); - imh->CreatorHostOS = htobe32(HDF_CREATORHOSTOS_WIN); imh->OriginalSize = htobe64(imagesize); imh->CurrentSize = htobe64(imagesize); @@ -141,33 +140,28 @@ vhd_makeim(struct iminfo *imi) imh->DiskGeometry.heads = heads; imh->DiskGeometry.sectcyl = sectors; - imh->DiskType = htobe32(HDF_DISKTYPE_FIXEDHDD); memcpy((char *)imh->UniqueId, (char *)&uuid, sizeof(imh->UniqueId)); - imh->SavedState = 0; imh->Checksum = htobe32(vhd_checksum(imh)); - for (;;) { - len0 = read(ifd, buf, sizeof(buf)); - if (len0 == 0) - break; - if (len0 < 0) { - warn("read error"); - return (1); - } - len = write(ofd, buf, len0); - if (len < 0) { - warn("write error"); - return (1); - } - } - len0 = write(ofd, imh, sizeof(*imh)); - if (len0 != sizeof(*imh)) { - warn("write error"); - return (1); - } + bl = calloc(1, sizeof(*bl)); + if (bl == NULL) + err(EX_OSERR, NULL); + bl->bl_type = BL_RAWCOPY; + bl->bl_name = "Rawcopy"; + bl->bl_tf.blf_fd = ifd; + TAILQ_INSERT_TAIL(&blhead, bl, bl_next); + + bl = calloc(1, sizeof(*bl)); + if (bl == NULL) + err(EX_OSERR, NULL); + bl->bl_type = BL_RAWDATA; + bl->bl_name = "Hard Disk Footer"; + bl->bl_tr.blr_data = imh; + bl->bl_tr.blr_len = sizeof(*imh); + TAILQ_INSERT_TAIL(&blhead, bl, bl_next); - return (0); + return (dispatch_bl(ofd, &blhead)); } static uint32_t Modified: user/hrs/releng/usr.sbin/makevd/vhd.h ============================================================================== --- user/hrs/releng/usr.sbin/makevd/vhd.h Mon Jan 7 07:05:57 2013 (r245125) +++ user/hrs/releng/usr.sbin/makevd/vhd.h Mon Jan 7 07:30:41 2013 (r245126) @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -70,6 +70,18 @@ struct HardDiskFooter { char Reserved[427]; } __attribute__((__packed__)); +#define VHD_HDF_FIXEDHDD_INIT { \ + .Cookie = htobe64(HDF_COOKIE), \ + .Features = htobe32(HDF_FEATURES_RES), \ + .FileFormatVersion = htobe32(HDF_FILEFORMATVERSION_DEFAULT), \ + .DataOffset = htobe32(HDF_DATAOFFSET_FIXEDHDD), \ + .CreatorApplication = htobe32(HDF_CREATORAPP_VPC), \ + .CreatorVersion = htobe32(HDF_CREATORVERSION_VPC2004), \ + .CreatorHostOS = htobe32(HDF_CREATORHOSTOS_WIN), \ + .DiskType = htobe32(HDF_DISKTYPE_FIXEDHDD), \ + .SavedState = 0, \ + } + struct DynamicDiskHeader { uint64_t Cookie; #define DDH_COOKIE (0x6378737061727365) /* "cxsparse" */ Modified: user/hrs/releng/usr.sbin/makevd/vmdk.c ============================================================================== --- user/hrs/releng/usr.sbin/makevd/vmdk.c Mon Jan 7 07:05:57 2013 (r245125) +++ user/hrs/releng/usr.sbin/makevd/vmdk.c Mon Jan 7 07:30:41 2013 (r245126) @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR @@ -30,6 +30,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <sys/queue.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/uio.h> @@ -39,27 +40,30 @@ __FBSDID("$FreeBSD$"); #include <inttypes.h> #include <limits.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> #include <sysexits.h> #include <unistd.h> #include "makevd.h" +#include "common.h" #include "vmdk.h" int vmdk_makeim(struct iminfo *imi) { - struct SparseExtentHeader SEH, *imh; + struct SparseExtentHeader SEH = VMDK_SEH_HOSTEDSPARSE_INIT; + struct SparseExtentHeader *imh; + struct blhead_t blhead; + struct blist *bl; uint64_t sectors, heads, cylinders, imagesize; char vmdkfile[PATH_MAX + 10], *vmdkfilebase; - char buf[BUFSIZ]; char desc[1024]; - ssize_t len0, len = 0; - int ifd, ofd; + int ofd; + TAILQ_INIT(&blhead); imh = &SEH; - ifd = imi->imi_fd; imagesize = imi->imi_size; memset(imh, 0, sizeof(*imh)); @@ -79,22 +83,9 @@ vmdk_makeim(struct iminfo *imi) vmdkfilebase = vmdkfile; /* All of the fields are in LE byte order. */ - imh->magicNumber = htole32(SEH_MAGICNUMBER); - imh->version = htole32(SEH_VERSION_DEFAULT); - imh->flags = htole32(1); - imh->capacity = htole64(0); - imh->grainSize = htole64(16); imh->descriptorOffset = htole64((sizeof(*imh) + 511) / 512); imh->descriptorSize = htole64((sizeof(desc) + 511) / 512); - imh->numGTEsPerGT = htole32(512); - imh->rgdOffset = htole64(0); - imh->gdOffset = htole64(0); imh->overHead = htole64(imh->descriptorOffset + imh->descriptorSize); - imh->uncleanShutdown = 0; - imh->singleEndLineChar = '\n'; - imh->nonEndLineChar = ' '; - imh->doubleEndLineChar1 = '\r'; - imh->doubleEndLineChar2 = '\n'; sectors = 63; heads = 16; @@ -128,30 +119,31 @@ vmdk_makeim(struct iminfo *imi) cylinders, imi->imi_uuid); - len0 = write(ofd, imh, sizeof(*imh)); - if (len0 != sizeof(*imh)) { - warn("write error"); - return (1); - } - len0 = write(ofd, desc, sizeof(desc)); - if (len0 != sizeof(desc)) { - warn("write error"); - return (1); - } - for (;;) { - len0 = read(ifd, buf, sizeof(buf)); - if (len0 == 0) - break; - if (len0 < 0) { - warn("read error"); - return (1); - } - len = write(ofd, buf, len0); - if (len < 0) { - warn("write error"); - return (1); - } - } + bl = calloc(1, sizeof(*bl)); + if (bl == NULL) + err(EX_OSERR, NULL); + bl->bl_type = BL_RAWDATA; + bl->bl_name = "Sparse Extent Header"; + bl->bl_tr.blr_data = imh; + bl->bl_tr.blr_len = sizeof(*imh); + TAILQ_INSERT_TAIL(&blhead, bl, bl_next); + + bl = calloc(1, sizeof(*bl)); + if (bl == NULL) + err(EX_OSERR, NULL); + bl->bl_type = BL_RAWDATA; + bl->bl_name = "Embedded descriptor"; + bl->bl_tr.blr_data = &desc; + bl->bl_tr.blr_len = sizeof(desc); + TAILQ_INSERT_TAIL(&blhead, bl, bl_next); + + bl = calloc(1, sizeof(*bl)); + if (bl == NULL) + err(EX_OSERR, NULL); + bl->bl_type = BL_RAWCOPY; + bl->bl_name = "Rawcopy"; + bl->bl_tf.blf_fd = imi->imi_fd; + TAILQ_INSERT_TAIL(&blhead, bl, bl_next); - return (0); + return (dispatch_bl(ofd, &blhead)); } Modified: user/hrs/releng/usr.sbin/makevd/vmdk.h ============================================================================== --- user/hrs/releng/usr.sbin/makevd/vmdk.h Mon Jan 7 07:05:57 2013 (r245125) +++ user/hrs/releng/usr.sbin/makevd/vmdk.h Mon Jan 7 07:30:41 2013 (r245126) @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -62,4 +62,20 @@ struct SparseExtentHeader { uint8 pad[433]; } __attribute__((__packed__)); +#define VMDK_SEH_HOSTEDSPARSE_INIT { \ + .magicNumber = htole32(SEH_MAGICNUMBER), \ + .version = htole32(SEH_VERSION_DEFAULT), \ + .flags = htole32(1), \ + .capacity = htole64(0), \ + .grainSize = htole64(16), \ + .numGTEsPerGT = htole32(512), \ + .rgdOffset = htole64(0), \ + .gdOffset = htole64(0), \ + .uncleanShutdown = 0, \ + .singleEndLineChar = '\n', \ + .nonEndLineChar = ' ', \ + .doubleEndLineChar1 = '\r', \ + .doubleEndLineChar2 = '\n', \ + } + #endif /* _VMDK_H */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50ea79a1.1957.5e0cec35>