From mboxrd@z Thu Jan 1 00:00:00 1970 From: Glauber Costa Subject: [PATCH 7/8] process a cpu affinity mask Date: Tue, 4 Mar 2008 13:22:00 -0300 Message-ID: <12046477552955-git-send-email-gcosta@redhat.com> References: <12046477213193-git-send-email-gcosta@redhat.com> <12046477274124-git-send-email-gcosta@redhat.com> <1204647732256-git-send-email-gcosta@redhat.com> <1204647737666-git-send-email-gcosta@redhat.com> <12046477422762-git-send-email-gcosta@redhat.com> <1204647746790-git-send-email-gcosta@redhat.com> <12046477503889-git-send-email-gcosta@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: chrisw@sous-sol.org, avi@qumranet.com, Glauber Costa To: kvm-devel@lists.sourceforge.net Return-path: In-Reply-To: <12046477503889-git-send-email-gcosta@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org This patch provides a function that process a cpu affinity list in the form x,y,z... into a cpu_set_t variable. Signed-off-by: Glauber Costa --- qemu/vl.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/qemu/vl.c b/qemu/vl.c index 6a94724..4715594 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -8646,6 +8646,23 @@ void *qemu_alloc_physram(unsigned long memory) return area; } +#ifdef USE_KVM +#include +void process_cpu_set(const char *map, cpu_set_t *set) +{ + char *ptr = map; + int c; + CPU_ZERO(set); + do { + c = atoi(ptr); + CPU_SET(c, set); + ptr = strchr(ptr, ','); + if (!ptr) + break; + ptr++; + } while (*ptr); +} +#endif int main(int argc, char **argv) { -- 1.5.0.6 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/