aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-4.14/480-mtd-set-rootfs-to-be-root-dev.patch
Commit message (Expand)AuthorAgeFilesLines
* kernel: generic: Add kernel 4.14 supportHauke Mehrtens2017-12-161-0/+38
a id='n34' href='#n34'>34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * Copyright (C) IBM Corp. 2005
 *
 * Authors: Jimi Xenidis <jimix@watson.ibm.com>
 */

#include <xen/config.h>
#include <xen/types.h>
#include <xen/lib.h>
#include <xen/nodemask.h>
#include <xen/sched.h>
#include <xen/guest_access.h>
#include <public/xen.h>
#include <public/domctl.h>
#include <public/sysctl.h>
#include <asm/processor.h>

long arch_do_sysctl(struct xen_sysctl *sysctl,
                    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl);
long arch_do_sysctl(struct xen_sysctl *sysctl,
                    XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
{
    long ret = 0;

    switch (sysctl->cmd) {
    case XEN_SYSCTL_physinfo:
    {
        xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;

        memset(pi, 0, sizeof(*pi));
        pi->threads_per_core =
            cpus_weight(cpu_sibling_map[0]);
        pi->cores_per_socket =
            cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
        pi->nr_cpus          = (u32)num_online_cpus();
        pi->nr_nodes         = num_online_nodes();
        pi->total_pages      = total_pages;
        pi->free_pages       = avail_domheap_pages();
        pi->cpu_khz          = cpu_khz;
        ret = copy_to_guest(u_sysctl, sysctl, 1) ? -EFAULT : 0;
    }
    break;

    default:
        printk("%s: unsupported sysctl: 0x%x\n", __func__, (sysctl->cmd));
        ret = -ENOSYS;
        break;
    }

    return ret;
}