+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;
+}