From owner-svn-src-head@freebsd.org Sat Sep 8 00:42:37 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 C7076FCEBCE; Sat, 8 Sep 2018 00:42:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 725F77E0D7; Sat, 8 Sep 2018 00:42:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 8CCA110A87D; Fri, 7 Sep 2018 20:42:29 -0400 (EDT) Subject: Re: svn commit: r338523 - head/sbin/sysctl To: Konstantin Belousov References: <201809071509.w87F9uEO078085@repo.freebsd.org> <8beb57f9-37dc-735c-fa85-78ecb67679ad@FreeBSD.org> <20180907162608.GV3161@kib.kiev.ua> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: John Baldwin Message-ID: <3748f268-f3fa-bd83-47a1-44fb41c28384@FreeBSD.org> Date: Fri, 7 Sep 2018 17:42:28 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180907162608.GV3161@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 07 Sep 2018 20:42:30 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 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: Sat, 08 Sep 2018 00:42:37 -0000 On 9/7/18 9:26 AM, Konstantin Belousov wrote: > On Fri, Sep 07, 2018 at 09:00:20AM -0700, John Baldwin wrote: >> On 9/7/18 8:09 AM, Konstantin Belousov wrote: >>> Author: kib >>> Date: Fri Sep 7 15:09:56 2018 >>> New Revision: 338523 >>> URL: https://svnweb.freebsd.org/changeset/base/338523 >>> >>> Log: >>> Teach sysctl(8) about the Persistent memory type. >>> >>> Add PersistentMemory to the list of sysctl's known memory types >>> when decoding an EFI memory map. >>> >>> Submitted by: D Scott Phillips >>> MFC after: 1 week >>> Approved by: re (rgrimes) >>> >>> Modified: >>> head/sbin/sysctl/sysctl.c >>> >>> Modified: head/sbin/sysctl/sysctl.c >>> ============================================================================== >>> --- head/sbin/sysctl/sysctl.c Fri Sep 7 14:37:44 2018 (r338522) >>> +++ head/sbin/sysctl/sysctl.c Fri Sep 7 15:09:56 2018 (r338523) >>> @@ -704,7 +704,8 @@ S_efi_map(size_t l2, void *p) >>> "ACPIMemoryNVS", >>> "MemoryMappedIO", >>> "MemoryMappedIOPortSpace", >>> - "PalCode" >>> + "PalCode", >>> + "PersistentMemory" >>> }; >>> >>> /* >>> @@ -733,7 +734,7 @@ S_efi_map(size_t l2, void *p) >>> >>> for (i = 0; i < ndesc; i++, >>> map = efi_next_descriptor(map, efihdr->descriptor_size)) { >>> - if (map->md_type <= EFI_MD_TYPE_PALCODE) >>> + if (map->md_type <= EFI_MD_TYPE_PERSISTENT) >> >> Perhaps this should use nitems(types) instead? (And I believe it's my >> fault it didn't originally.) > > For me, it was more an issue that the code assumes contiguous values for > the EFI_MD_TYPEs constants. > > What about the following: Looks good to me. -- John Baldwin