From patchwork Thu Apr 28 13:40:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 739291 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3SDfE0m008459 for ; Thu, 28 Apr 2011 13:41:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932600Ab1D1NlH (ORCPT ); Thu, 28 Apr 2011 09:41:07 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:52574 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932581Ab1D1NlF (ORCPT ); Thu, 28 Apr 2011 09:41:05 -0400 Received: by mail-bw0-f46.google.com with SMTP id 15so2302490bwz.19 for ; Thu, 28 Apr 2011 06:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=tm17y29csSqTfHH/DfGWM/DHD7vwvXcIk/A085BdUm0=; b=GXh+dH51IUqqxzOrnBAbgMn5gyY612jN6vPXzDcKrvOzmdsMdx50PjvreXfI0QqbXj YZfXvnKpFTKVwLgAJewsyBcw8M4kMn6hE5mH06SlKonDkEswX2DqqH+Vi65xl1Mcf+l2 YN3BtZSeTYQQVntMrNoKWJMZRVdXfAy4yQ5fk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=loTvMn0fVCjr34ngSLEjX6KT2PkQNd1NWfSUHfaT0MAykXYIulbTpzGx/qYKVblWeP 76hI1ayxJcEUL9zcg1yv8cVwxv6YA5MQsx8GyR3YbkYoIQUgofsKv99/3A/yoMor8bd2 plk1CsmcAdfS3WiDHmV6eGHRWmMWp09ZZtUsE= Received: by 10.204.15.67 with SMTP id j3mr3348681bka.24.1303998064638; Thu, 28 Apr 2011 06:41:04 -0700 (PDT) Received: from localhost.localdomain ([188.120.129.206]) by mx.google.com with ESMTPS id w3sm1033795bkt.17.2011.04.28.06.41.01 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Apr 2011 06:41:03 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, kvm@vger.kernel.org, Sasha Levin Subject: [PATCH 2/6] kvm tools: Add kernel headers required for using list Date: Thu, 28 Apr 2011 16:40:41 +0300 Message-Id: <1303998045-22932-2-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.5.rc3 In-Reply-To: <1303998045-22932-1-git-send-email-levinsasha928@gmail.com> References: <1303998045-22932-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 28 Apr 2011 13:41:14 +0000 (UTC) Adds kernel headers so that (and others) could be included directly. Signed-off-by: Sasha Levin --- tools/kvm/include/linux/kernel.h | 26 ++++++++++++++++++++++++++ tools/kvm/include/linux/prefetch.h | 6 ++++++ tools/kvm/include/linux/types.h | 12 ++++++++++++ 3 files changed, 44 insertions(+), 0 deletions(-) create mode 100644 tools/kvm/include/linux/kernel.h create mode 100644 tools/kvm/include/linux/prefetch.h diff --git a/tools/kvm/include/linux/kernel.h b/tools/kvm/include/linux/kernel.h new file mode 100644 index 0000000..8d83037 --- /dev/null +++ b/tools/kvm/include/linux/kernel.h @@ -0,0 +1,26 @@ +#ifndef KVM__LINUX_KERNEL_H_ +#define KVM__LINUX_KERNEL_H_ + +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) + +#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) +#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) + +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif + +#ifndef container_of +/** + * container_of - cast a member of a structure out to the containing structure + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof(((type *)0)->member) * __mptr = (ptr); \ + (type *)((char *)__mptr - offsetof(type, member)); }) +#endif + +#endif diff --git a/tools/kvm/include/linux/prefetch.h b/tools/kvm/include/linux/prefetch.h new file mode 100644 index 0000000..62f6788 --- /dev/null +++ b/tools/kvm/include/linux/prefetch.h @@ -0,0 +1,6 @@ +#ifndef KVM__LINUX_PREFETCH_H +#define KVM__LINUX_PREFETCH_H + +static inline void prefetch(void *a __attribute__((unused))) { } + +#endif diff --git a/tools/kvm/include/linux/types.h b/tools/kvm/include/linux/types.h index efd8519..c7c444e 100644 --- a/tools/kvm/include/linux/types.h +++ b/tools/kvm/include/linux/types.h @@ -46,4 +46,16 @@ typedef __u32 __bitwise __be32; typedef __u64 __bitwise __le64; typedef __u64 __bitwise __be64; +struct list_head { + struct list_head *next, *prev; +}; + +struct hlist_head { + struct hlist_node *first; +}; + +struct hlist_node { + struct hlist_node *next, **pprev; +}; + #endif /* LINUX_TYPES_H */