[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c8c13453-c453-7de1-ae07-045064a938b8@oracle.com>
Date: Tue, 29 Nov 2022 11:29:56 -0500
From: Boris Ostrovsky <boris.ostrovsky@...cle.com>
To: Per Bilse <per.bilse@...rix.com>, linux-kernel@...r.kernel.org
Cc: Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
Jan Beulich <jbeulich@...e.com>,
"moderated list:XEN HYPERVISOR INTERFACE"
<xen-devel@...ts.xenproject.org>
Subject: Re: [PATCH] drivers/xen/hypervisor: Expose VM SIF flags to userspace
On 11/29/22 10:00 AM, Per Bilse wrote:
>
> +static ssize_t flags_show(struct hyp_sysfs_attr *attr, char *buffer)
> +{
> + static char const *const sifstr[SIFN_NUM_SIFN] = {
> + [SIFN_PRIV] = "privileged",
> + [SIFN_INIT] = "initdomain",
> + [SIFN_MULTI] = "multiboot",
> + [SIFN_PFN] = "mod_start_pfn",
> + [SIFN_VIRT] = "virtmap"
> + };
> + unsigned sifnum, sifmask;
> + ssize_t ret = 0;
> +
> + sifmask = ~(~0U << SIFN_NUM_SIFN); // ...0000111...
> + if (xen_domain() && (xen_start_flags & sifmask) != 0) {
> + for (sifnum = 0; sifnum != SIFN_NUM_SIFN; sifnum++) {
> + if ((xen_start_flags & (1<<sifnum)) != 0)
> + ret += sprintf(buffer+ret, "%s ", sifstr[sifnum]);
> + }
> + buffer[ret-1] = '\n';
> + }
> + return ret;
> +}
Why not simply show unprocessed xen_start_flags as a hex value?
-boris
Powered by blists - more mailing lists