mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Per Bilse <per.bilse@citrix.com>, linux-kernel@vger.kernel.org
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
	Jan Beulich <jbeulich@suse.com>,
	"moderated list:XEN HYPERVISOR INTERFACE" 
	<xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] drivers/xen/hypervisor: Expose VM SIF flags to userspace
Date: Tue, 29 Nov 2022 11:29:56 -0500	[thread overview]
Message-ID: <c8c13453-c453-7de1-ae07-045064a938b8@oracle.com> (raw)
In-Reply-To: <20221129150058.266943-1-per.bilse@citrix.com>


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


  parent reply	other threads:[~2022-11-29 16:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 15:00 Per Bilse
2022-11-29 15:27 ` Juergen Gross
2022-11-29 16:41   ` Andrew Cooper
2022-11-29 17:38     ` Per Bilse (3P)
2022-11-29 16:29 ` Boris Ostrovsky [this message]
2022-11-29 16:46   ` Per Bilse (3P)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8c13453-c453-7de1-ae07-045064a938b8@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=per.bilse@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®