From owner-svn-src-head@freebsd.org Tue Jun 12 22:05:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2751410023E3 for ; Tue, 12 Jun 2018 22:05:28 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb0-x233.google.com (mail-yb0-x233.google.com [IPv6:2607:f8b0:4002:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CA607BFFF for ; Tue, 12 Jun 2018 22:05:27 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb0-x233.google.com with SMTP id u11-v6so191961ybi.8 for ; Tue, 12 Jun 2018 15:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=dfKvm5RlaJzHrd2I5Np0mhwmN83Ikl0Y/QAtZI09HKo=; b=miyaeYcmOtCEGcXh4N2S6vKjeLyYGOpsLf0zF8Jdtcj6wZR8d67PYfGDRNjlpDsbM2 IpVOUG5I7UDzNEt6cGMINZ4t9Amjo8gg7MVE6zq5/P9PDrYi9R18H3YVxlF4RRnttnDk Qo4+ZQcF5dl3LV81Ic9K5tzvq3Pa1MRXOlAzXm/DaccltD6pZjG3N98f6O95bS1T2JMI 37nEH7mGRYAwBOCRsO/Br2hfh22njL95R2IWCBeo6iDE0498cc3WnZjiQ5hlJnlQBqaS jXBrHN1z3FpOjzDEMoVNGjPKjy3pasXSu8YkaLkTGdjX0EEidtPW8H9BYYNOLvkocC2n raZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dfKvm5RlaJzHrd2I5Np0mhwmN83Ikl0Y/QAtZI09HKo=; b=e0QdKqDnwOnD//OJOJSeBueubRd5Bm/gVA/t/RZAOBm/Sa1F/tFtTRgPZad4u2GEx2 o+AvIjrg7v8BeeErcw9nLEhbLHvWafBqXOiuc4ClY4lL1CpBGFuM6tgxyppbS29Cd7R2 5Fwshc4SoH/m8EqH+jvVPyyH3mxaTv77b4EL1Q6115pulfS3C6C6rpZzg9bJIR6Qds49 jVttof4ikSUudaGe2pn/+rZN4F8+vwaKVaf13Sw9vBgbizBs8fwdulPiyGRY05k4/a5c Z/6zHnqMrSwfngJOWnkuM521ujaaiVOwYuyCWGTlmoPQ4FbmbWeL5lfTH/dFVbc+WrY2 9AHw== X-Gm-Message-State: APt69E1Z+DeHQryqr62haUoHjVo2VCTK/s3kJtkgOioZC9EBGIcevbnF Kg7qWBw1H7MUnrbv+18UgGQS6duqpWtEdIXcH8RtBQ== X-Google-Smtp-Source: ADUXVKIP0RN9AXHh3CBF+2RWcP4C0vyA1KgdEepMeJhT7m+XEVmIyOoSNaNThZpZVpT5BnETg9HZ6BfXkplQOVjsl7Q= X-Received: by 2002:a25:55d4:: with SMTP id j203-v6mr1132670ybb.199.1528841126855; Tue, 12 Jun 2018 15:05:26 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:db86:0:0:0:0:0 with HTTP; Tue, 12 Jun 2018 15:05:26 -0700 (PDT) In-Reply-To: <201805221435.w4MEZXnW041963@repo.freebsd.org> References: <201805221435.w4MEZXnW041963@repo.freebsd.org> From: Oliver Pinter Date: Wed, 13 Jun 2018 00:05:26 +0200 Message-ID: Subject: Re: svn commit: r334046 - head/tools/tools/intel-ucode-split To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2018 22:05:28 -0000 On 5/22/18, Ed Maste wrote: > Author: emaste > Date: Tue May 22 14:35:33 2018 > New Revision: 334046 > URL: https://svnweb.freebsd.org/changeset/base/334046 > > Log: > intel-ucode-split: add -n flag to skip creating output files > > Sponsored by: The FreeBSD Foundation > > Modified: > head/tools/tools/intel-ucode-split/intel-ucode-split.c Hi! Could you please MFC the intel-ucode-split related commits to 11-STABLE? Thanks, op > > Modified: head/tools/tools/intel-ucode-split/intel-ucode-split.c > ============================================================================== > --- head/tools/tools/intel-ucode-split/intel-ucode-split.c Tue May 22 > 14:26:58 2018 (r334045) > +++ head/tools/tools/intel-ucode-split/intel-ucode-split.c Tue May 22 > 14:35:33 2018 (r334046) > @@ -112,7 +112,7 @@ static void > usage(void) > { > > - printf("ucode-split [-v] microcode_file\n"); > + printf("ucode-split [-nv] microcode_file\n"); > exit(1); > } > > @@ -124,11 +124,14 @@ main(int argc, char *argv[]) > size_t len, resid; > ssize_t rv; > int c, ifd, ofd; > - bool vflag; > + bool nflag, vflag; > > - vflag = false; > - while ((c = getopt(argc, argv, "v")) != -1) { > + nflag = vflag = false; > + while ((c = getopt(argc, argv, "nv")) != -1) { > switch (c) { > + case 'n': > + nflag = true; > + break; > case 'v': > vflag = true; > break; > @@ -166,40 +169,48 @@ main(int argc, char *argv[]) > if (vflag) > dump_header(&hdr); > > - sig_str = format_signature(hdr.processor_signature); > - asprintf(&output_file, "%s.%02x", sig_str, > - hdr.processor_flags & 0xff); > - free(sig_str); > - if (output_file == NULL) > - err(1, "asprintf"); > - ofd = open(output_file, O_WRONLY | O_CREAT | O_TRUNC, 0600); > - if (ofd < 0) > - err(1, "open"); > - > - /* Write header. */ > - rv = write(ofd, &hdr, sizeof(hdr)); > - if (rv < (ssize_t)sizeof(hdr)) > - err(1, "write"); > - > - /* Copy data. */ > resid = (hdr.total_size != 0 ? hdr.total_size : 2048) - > sizeof(hdr); > if (resid > 1 << 24) /* Arbitrary chosen maximum size. */ > errx(1, "header total_size too large"); > - while (resid > 0) { > - len = resid < bufsize ? resid : bufsize; > - rv = read(ifd, buf, len); > - if (rv < 0) > - err(1, "read"); > - else if (rv < (ssize_t)len) > - errx(1, "truncated microcode data"); > - if (write(ofd, buf, len) < (ssize_t)len) > + > + if (nflag) { > + if (lseek(ifd, resid, SEEK_CUR) == -1) > + err(1, "lseek"); > + printf("\n"); > + } else { > + sig_str = format_signature(hdr.processor_signature); > + asprintf(&output_file, "%s.%02x", sig_str, > + hdr.processor_flags & 0xff); > + free(sig_str); > + if (output_file == NULL) > + err(1, "asprintf"); > + ofd = open(output_file, O_WRONLY | O_CREAT | O_TRUNC, > + 0600); > + if (ofd < 0) > + err(1, "open"); > + > + /* Write header. */ > + rv = write(ofd, &hdr, sizeof(hdr)); > + if (rv < (ssize_t)sizeof(hdr)) > err(1, "write"); > - resid -= len; > + > + /* Copy data. */ > + while (resid > 0) { > + len = resid < bufsize ? resid : bufsize; > + rv = read(ifd, buf, len); > + if (rv < 0) > + err(1, "read"); > + else if (rv < (ssize_t)len) > + errx(1, "truncated microcode data"); > + if (write(ofd, buf, len) < (ssize_t)len) > + err(1, "write"); > + resid -= len; > + } > + if (vflag) > + printf("written to %s\n\n", output_file); > + close(ofd); > + free(output_file); > } > - if (vflag) > - printf("written to %s\n\n", output_file); > - close(ofd); > - free(output_file); > } > } > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >