From patchwork Sat May 30 10:30:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jaswinder Singh Rajput X-Patchwork-Id: 27032 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4UAUSdf025527 for ; Sat, 30 May 2009 10:30:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755005AbZE3KaX (ORCPT ); Sat, 30 May 2009 06:30:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754274AbZE3KaX (ORCPT ); Sat, 30 May 2009 06:30:23 -0400 Received: from hera.kernel.org ([140.211.167.34]:39712 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753895AbZE3KaW (ORCPT ); Sat, 30 May 2009 06:30:22 -0400 Received: from [192.168.1.2] (ABTS-mp-dynamic-036.255.168.122.airtelbroadband.in [122.168.255.36] (may be forged)) (authenticated bits=0) by hera.kernel.org (8.14.2/8.13.8) with ESMTP id n4UAU5E0001427 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 30 May 2009 10:30:07 GMT Subject: [RFC][PATCH] qemu-kvm: vl.c remove unused functions gethugepagesize() and alloc_mem_area() From: Jaswinder Singh Rajput To: Avi Kivity , KVM list Date: Sat, 30 May 2009 16:00:03 +0530 Message-Id: <1243679403.6459.2.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) X-Virus-Scanned: ClamAV 0.93.3/9406/Sat May 30 04:15:35 2009 on hera.kernel.org X-Virus-Status: Clean Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org No user is available for functions gethugepagesize() and alloc_mem_area() Fixes : CC x86_64-softmmu/vl.o /home/jaswinder/jaswinder-git/qemu-kvm/vl.c:4884: warning: ‘alloc_mem_area’ defined but not used Signed-off-by: Jaswinder Singh Rajput --- vl.c | 84 ------------------------------------------------------------------ 1 files changed, 0 insertions(+), 84 deletions(-) diff --git a/vl.c b/vl.c index db8265b..c312e7a 100644 --- a/vl.c +++ b/vl.c @@ -4856,90 +4856,6 @@ int qemu_uuid_parse(const char *str, uint8_t *uuid) #define MAX_NET_CLIENTS 32 -#ifdef USE_KVM - -#define HUGETLBFS_MAGIC 0x958458f6 - -static long gethugepagesize(const char *path) -{ - struct statfs fs; - int ret; - - do { - ret = statfs(path, &fs); - } while (ret != 0 && errno == EINTR); - - if (ret != 0) { - perror("statfs"); - return 0; - } - - if (fs.f_type != HUGETLBFS_MAGIC) - fprintf(stderr, "Warning: path not on HugeTLBFS: %s\n", path); - - return fs.f_bsize; -} - -static void *alloc_mem_area(size_t memory, unsigned long *len, const char *path) -{ - char *filename; - void *area; - int fd; -#ifdef MAP_POPULATE - int flags; -#endif - - if (!kvm_has_sync_mmu()) { - fprintf(stderr, "host lacks mmu notifiers, disabling --mem-path\n"); - return NULL; - } - - if (asprintf(&filename, "%s/kvm.XXXXXX", path) == -1) - return NULL; - - hpagesize = gethugepagesize(path); - if (!hpagesize) - return NULL; - - fd = mkstemp(filename); - if (fd < 0) { - perror("mkstemp"); - free(filename); - return NULL; - } - unlink(filename); - free(filename); - - memory = (memory+hpagesize-1) & ~(hpagesize-1); - - /* - * ftruncate is not supported by hugetlbfs in older - * hosts, so don't bother checking for errors. - * If anything goes wrong with it under other filesystems, - * mmap will fail. - */ - ftruncate(fd, memory); - -#ifdef MAP_POPULATE - /* NB: MAP_POPULATE won't exhaustively alloc all phys pages in the case - * MAP_PRIVATE is requested. For mem_prealloc we mmap as MAP_SHARED - * to sidestep this quirk. - */ - flags = mem_prealloc ? MAP_POPULATE|MAP_SHARED : MAP_PRIVATE; - area = mmap(0, memory, PROT_READ|PROT_WRITE, flags, fd, 0); -#else - area = mmap(0, memory, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); -#endif - if (area == MAP_FAILED) { - perror("alloc_mem_area: can't mmap hugetlbfs pages"); - close(fd); - return (NULL); - } - *len = memory; - return area; -} -#endif - #ifndef _WIN32 static void termsig_handler(int signal)