WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Improve consistency of type-attribute usa

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Improve consistency of type-attribute usage (volatile/const).
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Dec 2006 09:05:18 -0800
Delivery-date: Thu, 21 Dec 2006 09:06:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1166709531 0
# Node ID 3e2d3d73762492fd03955d2574e30f535426c1ce
# Parent  e86605304e52ee2012f5812dbf3a425572e65faa
Improve consistency of type-attribute usage (volatile/const).
From: Christoph Egger <Christoph.Egger@xxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/xc_linux_build.c  |    2 
 tools/libxc/xc_linux_save.c   |   10 ++--
 tools/libxc/xc_load_bin.c     |   26 ++++++------
 tools/libxc/xc_load_elf.c     |   91 +++++++++++++++++++++++-------------------
 tools/libxc/xg_private.h      |    6 +-
 tools/xenstat/xentop/xentop.c |    4 -
 tools/xenstore/list.h         |    2 
 xen/arch/x86/domain_build.c   |    9 ++--
 xen/arch/x86/time.c           |    4 -
 xen/common/elf.c              |   63 +++++++++++++++--------------
 xen/common/kernel.c           |    7 +--
 xen/common/kexec.c            |    2 
 xen/common/lib.c              |   15 ++++--
 xen/common/page_alloc.c       |    2 
 xen/common/time.c             |    4 -
 xen/common/vsprintf.c         |   18 +++++---
 xen/common/xmalloc.c          |    4 -
 xen/drivers/char/ns16550.c    |    2 
 xen/include/asm-x86/bitops.h  |    8 +--
 xen/include/asm-x86/system.h  |    2 
 xen/include/asm-x86/uaccess.h |   10 ++--
 xen/include/xen/elf.h         |    2 
 xen/include/xen/kernel.h      |   14 +++---
 xen/include/xen/lib.h         |   10 ++--
 xen/include/xen/sched.h       |    4 -
 xen/include/xen/xmalloc.h     |    2 
 26 files changed, 173 insertions(+), 150 deletions(-)

diff -r e86605304e52 -r 3e2d3d737624 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Thu Dec 21 13:48:13 2006 +0000
+++ b/tools/libxc/xc_linux_build.c      Thu Dec 21 13:58:51 2006 +0000
@@ -1079,7 +1079,7 @@ static int xc_linux_build_internal(int x
 static int xc_linux_build_internal(int xc_handle,
                                    uint32_t domid,
                                    unsigned int mem_mb,
-                                   char *image,
+                                   const char *image,
                                    unsigned long image_size,
                                    struct initrd_info *initrd,
                                    const char *cmdline,
diff -r e86605304e52 -r 3e2d3d737624 tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       Thu Dec 21 13:48:13 2006 +0000
+++ b/tools/libxc/xc_linux_save.c       Thu Dec 21 13:58:51 2006 +0000
@@ -80,7 +80,7 @@ static xen_pfn_t *live_m2p = NULL;
 #define BITMAP_SIZE   ((max_pfn + BITS_PER_LONG - 1) / 8)
 
 #define BITMAP_ENTRY(_nr,_bmap) \
-   ((unsigned long *)(_bmap))[(_nr)/BITS_PER_LONG]
+   ((volatile unsigned long *)(_bmap))[(_nr)/BITS_PER_LONG]
 
 #define BITMAP_SHIFT(_nr) ((_nr) % BITS_PER_LONG)
 
@@ -112,7 +112,7 @@ static inline int count_bits ( int nr, v
 static inline int count_bits ( int nr, volatile void *addr)
 {
     int i, count = 0;
-    unsigned long *p = (unsigned long *)addr;
+    volatile unsigned long *p = (volatile unsigned long *)addr;
     /* We know that the array is padded to unsigned long. */
     for( i = 0; i < (nr / (sizeof(unsigned long)*8)); i++, p++ )
         count += hweight32(*p);
@@ -443,7 +443,7 @@ static int canonicalize_pagetable(unsign
 
 /* XXX index of the L2 entry in PAE mode which holds the guest LPT */
 #define PAE_GLPT_L2ENTRY (495)
-        pte = ((uint64_t*)spage)[PAE_GLPT_L2ENTRY];
+        pte = ((const uint64_t*)spage)[PAE_GLPT_L2ENTRY];
 
         if(((pte >> PAGE_SHIFT) & 0x0fffffff) == live_p2m[pfn])
             xen_start = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
@@ -464,9 +464,9 @@ static int canonicalize_pagetable(unsign
         unsigned long pfn, mfn;
 
         if (pt_levels == 2)
-            pte = ((uint32_t*)spage)[i];
+            pte = ((const uint32_t*)spage)[i];
         else
-            pte = ((uint64_t*)spage)[i];
+            pte = ((const uint64_t*)spage)[i];
 
         if (i >= xen_start && i < xen_end)
             pte = 0;
diff -r e86605304e52 -r 3e2d3d737624 tools/libxc/xc_load_bin.c
--- a/tools/libxc/xc_load_bin.c Thu Dec 21 13:48:13 2006 +0000
+++ b/tools/libxc/xc_load_bin.c Thu Dec 21 13:58:51 2006 +0000
@@ -98,7 +98,7 @@ struct xen_bin_image_table
 #define FLAGS_MASK     ((~ 0) & (~ XEN_REACTOS_FLAG_ALIGN4K))
 #define FLAGS_REQUIRED XEN_REACTOS_FLAG_ADDRSVALID
 
-static struct xen_bin_image_table *
+static const struct xen_bin_image_table *
 findtable(const char *image, unsigned long image_size);
 static int
 parsebinimage(
@@ -122,11 +122,11 @@ int probe_bin(const char *image,
     return 0;
 }
 
-static struct xen_bin_image_table *
+static const struct xen_bin_image_table *
 findtable(const char *image, unsigned long image_size)
 {
-    struct xen_bin_image_table *table;
-    unsigned long *probe_ptr;
+    const struct xen_bin_image_table *table;
+    const unsigned long *probe_ptr;
     unsigned probe_index;
     unsigned probe_count;
 
@@ -142,13 +142,13 @@ findtable(const char *image, unsigned lo
                   sizeof(unsigned long);
 
     /* Search for the magic header */
-    probe_ptr = (unsigned long *) image;
+    probe_ptr = (const unsigned long *) image;
     table = NULL;
     for ( probe_index = 0; probe_index < probe_count; probe_index++ )
     {
         if ( XEN_REACTOS_MAGIC3 == *probe_ptr )
         {
-            table = (struct xen_bin_image_table *) probe_ptr;
+            table = (const struct xen_bin_image_table *) probe_ptr;
             /* Checksum correct? */
             if ( 0 == table->magic + table->flags + table->checksum )
             {
@@ -165,7 +165,7 @@ static int parsebinimage(const char *ima
                          unsigned long image_size,
                          struct domain_setup_info *dsi)
 {
-    struct xen_bin_image_table *image_info;
+    const struct xen_bin_image_table *image_info;
     unsigned long start_addr;
     unsigned long end_addr;
 
@@ -186,13 +186,13 @@ static int parsebinimage(const char *ima
 
     /* Sanity check on the addresses */
     if ( image_info->header_addr < image_info->load_addr ||
-         ((char *) image_info - image) <
+         ((const char *) image_info - image) <
          (image_info->header_addr - image_info->load_addr) )
     {
         ERROR("Invalid header_addr.");
         return -EINVAL;
     }
-    start_addr = image_info->header_addr - ((char *) image_info - image);
+    start_addr = image_info->header_addr - ((const char *) image_info - image);
     if ( 0 != image_info->load_end_addr &&
          ( image_info->load_end_addr < image_info->load_end_addr ||
            start_addr + image_size < image_info->load_end_addr ) )
@@ -221,7 +221,7 @@ static int parsebinimage(const char *ima
     else
     {
         dsi->v_end = image_info->load_addr + image_size -
-                     (((char *) image_info - image) -
+                     (((const char *) image_info - image) -
                       (image_info->header_addr - image_info->load_addr));
     }
     dsi->v_kernstart = dsi->v_start;
@@ -240,7 +240,7 @@ loadbinimage(
     unsigned long size;
     char         *va;
     unsigned long done, chunksz;
-    struct xen_bin_image_table *image_info;
+    const struct xen_bin_image_table *image_info;
 
     image_info = findtable(image, image_size);
     if ( NULL == image_info )
@@ -252,7 +252,7 @@ loadbinimage(
     /* Determine image size */
     if ( 0 == image_info->load_end_addr )
     {
-        size = image_size  - (((char *) image_info - image) -
+        size = image_size  - (((const char *)image_info - image) -
                               (image_info->header_addr -
                                image_info->load_addr));
     }
@@ -262,7 +262,7 @@ loadbinimage(
     }
 
     /* It's possible that we need to skip the first part of the image */
-    image += ((char *)image_info - image) -
+    image += ((const char *)image_info - image) -
              (image_info->header_addr - image_info->load_addr);
 
     for ( done = 0; done < size; done += chunksz )
diff -r e86605304e52 -r 3e2d3d737624 tools/libxc/xc_load_elf.c
--- a/tools/libxc/xc_load_elf.c Thu Dec 21 13:48:13 2006 +0000
+++ b/tools/libxc/xc_load_elf.c Thu Dec 21 13:58:51 2006 +0000
@@ -75,7 +75,7 @@ int probe_elf(const char *image,
               unsigned long image_size,
               struct load_funcs *load_funcs)
 {
-    Elf_Ehdr *ehdr = (Elf_Ehdr *)image;
+    const Elf_Ehdr *ehdr = (const Elf_Ehdr *)image;
 
     if ( !IS_ELF(*ehdr) )
         return -EINVAL;
@@ -86,7 +86,7 @@ int probe_elf(const char *image,
     return 0;
 }
 
-static inline int is_loadable_phdr(Elf_Phdr *phdr)
+static inline int is_loadable_phdr(const Elf_Phdr *phdr)
 {
     return ((phdr->p_type == PT_LOAD) &&
             ((phdr->p_flags & (PF_W|PF_X)) != 0));
@@ -96,12 +96,13 @@ static inline int is_loadable_phdr(Elf_P
  * Fallback for kernels containing only the legacy __xen_guest string
  * and no ELF notes.
  */
-static int is_xen_guest_section(Elf_Shdr *shdr, const char *shstrtab)
+static int is_xen_guest_section(const Elf_Shdr *shdr, const char *shstrtab)
 {
     return strcmp(&shstrtab[shdr->sh_name], "__xen_guest") == 0;
 }
 
-static const char *xen_guest_lookup(struct domain_setup_info *dsi, int type)
+static const char *xen_guest_lookup(
+    const struct domain_setup_info *dsi, int type)
 {
     const char *xenguest_fallbacks[] = {
         [XEN_ELFNOTE_ENTRY] = "VIRT_ENTRY=",
@@ -134,7 +135,8 @@ static const char *xen_guest_lookup(stru
     return p + strlen(fallback);
 }
 
-static const char *xen_guest_string(struct domain_setup_info *dsi, int type)
+static const char *xen_guest_string(
+    const struct domain_setup_info *dsi, int type)
 {
     const char *p = xen_guest_lookup(dsi, type);
 
@@ -148,8 +150,8 @@ static const char *xen_guest_string(stru
     return p;
 }
 
-static unsigned long long xen_guest_numeric(struct domain_setup_info *dsi,
-                                                   int type, int *defined)
+static unsigned long long xen_guest_numeric(
+    const struct domain_setup_info *dsi, int type, int *defined)
 {
     const char *p = xen_guest_lookup(dsi, type);
     unsigned long long value;
@@ -175,19 +177,19 @@ static unsigned long long xen_guest_nume
 /*
  * Interface to the Xen ELF notes.
  */
-#define ELFNOTE_NAME(_n_)   ((void*)(_n_) + sizeof(*(_n_)))
+#define ELFNOTE_NAME(_n_)   ((const void*)(_n_) + sizeof(*(_n_)))
 #define ELFNOTE_DESC(_n_)   (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3))
 #define ELFNOTE_NEXT(_n_)   (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3))
 
-static int is_xen_elfnote_section(const char *image, Elf_Shdr *shdr)
-{
-    Elf_Note *note;
+static int is_xen_elfnote_section(const char *image, const Elf_Shdr *shdr)
+{
+    const Elf_Note *note;
 
     if ( shdr->sh_type != SHT_NOTE )
         return 0;
 
-    for ( note = (Elf_Note *)(image + shdr->sh_offset);
-          note < (Elf_Note *)(image + shdr->sh_offset + shdr->sh_size);
+    for ( note = (const Elf_Note *)(image + shdr->sh_offset);
+          note < (const Elf_Note *)(image + shdr->sh_offset + shdr->sh_size);
           note = ELFNOTE_NEXT(note) )
     {
         if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) )
@@ -197,15 +199,16 @@ static int is_xen_elfnote_section(const 
     return 0;
 }
 
-static Elf_Note *xen_elfnote_lookup(struct domain_setup_info *dsi, int type)
-{
-    Elf_Note *note;
+static const Elf_Note *xen_elfnote_lookup(
+    const struct domain_setup_info *dsi, int type)
+{
+    const Elf_Note *note;
 
     if ( !dsi->__elfnote_section )
         return NULL;
 
-    for ( note = (Elf_Note *)dsi->__elfnote_section;
-          note < (Elf_Note *)dsi->__elfnote_section_end;
+    for ( note = (const Elf_Note *)dsi->__elfnote_section;
+          note < (const Elf_Note *)dsi->__elfnote_section_end;
           note = ELFNOTE_NEXT(note) )
     {
         if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) )
@@ -218,9 +221,9 @@ static Elf_Note *xen_elfnote_lookup(stru
     return NULL;
 }
 
-const char *xen_elfnote_string(struct domain_setup_info *dsi, int type)
-{
-    Elf_Note *note;
+const char *xen_elfnote_string(const struct domain_setup_info *dsi, int type)
+{
+    const Elf_Note *note;
 
     if ( !dsi->__elfnote_section )
         return xen_guest_string(dsi, type);
@@ -232,10 +235,10 @@ const char *xen_elfnote_string(struct do
     return (const char *)ELFNOTE_DESC(note);
 }
 
-unsigned long long xen_elfnote_numeric(struct domain_setup_info *dsi,
+unsigned long long xen_elfnote_numeric(const struct domain_setup_info *dsi,
                                        int type, int *defined)
 {
-    Elf_Note *note;
+    const Elf_Note *note;
 
     *defined = 0;
 
@@ -252,10 +255,10 @@ unsigned long long xen_elfnote_numeric(s
     {
     case 4:
         *defined = 1;
-        return *(uint32_t*)ELFNOTE_DESC(note);
+        return *(const uint32_t*)ELFNOTE_DESC(note);
     case 8:
         *defined = 1;
-        return *(uint64_t*)ELFNOTE_DESC(note);
+        return *(const uint64_t*)ELFNOTE_DESC(note);
     default:
         xc_set_error(XC_INVALID_KERNEL,
                      "elfnotes: unknown data size %#x for numeric type note 
%#x\n",
@@ -268,9 +271,9 @@ static int parseelfimage(const char *ima
                          unsigned long image_len,
                          struct domain_setup_info *dsi)
 {
-    Elf_Ehdr *ehdr = (Elf_Ehdr *)image;
-    Elf_Phdr *phdr;
-    Elf_Shdr *shdr;
+    const Elf_Ehdr *ehdr = (const Elf_Ehdr *)image;
+    const Elf_Phdr *phdr;
+    const Elf_Shdr *shdr;
     Elf_Addr kernstart = ~0, kernend = 0, vaddr, virt_entry;
     const char *shstrtab, *p;
     int h, virt_base_defined, elf_pa_off_defined, virt_entry_defined;
@@ -331,12 +334,13 @@ static int parseelfimage(const char *ima
     /* Look for .notes segment containing at least one Xen note */
     for ( h = 0; h < ehdr->e_shnum; h++ )
     {
-        shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize));
+        shdr = (const Elf_Shdr *)(
+            image + ehdr->e_shoff + (h*ehdr->e_shentsize));
         if ( !is_xen_elfnote_section(image, shdr) )
             continue;
-        dsi->__elfnote_section = (void *)image + shdr->sh_offset;
+        dsi->__elfnote_section = (const void *)image + shdr->sh_offset;
         dsi->__elfnote_section_end =
-            (void *)image + shdr->sh_offset + shdr->sh_size;
+            (const void *)image + shdr->sh_offset + shdr->sh_size;
         break;
     }
 
@@ -350,16 +354,18 @@ static int parseelfimage(const char *ima
                          "ELF image has no section-header strings table.");
             return -EINVAL;
         }
-        shdr = (Elf_Shdr *)(image + ehdr->e_shoff +
+        shdr = (const Elf_Shdr *)(image + ehdr->e_shoff +
                             (ehdr->e_shstrndx*ehdr->e_shentsize));
         shstrtab = image + shdr->sh_offset;
 
         for ( h = 0; h < ehdr->e_shnum; h++ )
         {
-            shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize));
+            shdr = (const Elf_Shdr *)(
+                image + ehdr->e_shoff + (h*ehdr->e_shentsize));
             if ( is_xen_guest_section(shdr, shstrtab) )
             {
-                dsi->__xen_guest_string = (char *)image + shdr->sh_offset;
+                dsi->__xen_guest_string =
+                    (const char *)image + shdr->sh_offset;
                 break;
             }
         }
@@ -442,8 +448,8 @@ static int parseelfimage(const char *ima
      * If we are using the modern ELF notes interface then the default
      * is 0.
      */
-    dsi->elf_paddr_offset =
-        xen_elfnote_numeric(dsi, XEN_ELFNOTE_PADDR_OFFSET, 
&elf_pa_off_defined);
+    dsi->elf_paddr_offset = xen_elfnote_numeric(dsi, XEN_ELFNOTE_PADDR_OFFSET,
+                                                &elf_pa_off_defined);
     if ( !elf_pa_off_defined )
     {
         if ( dsi->__elfnote_section )
@@ -462,7 +468,8 @@ static int parseelfimage(const char *ima
 
     for ( h = 0; h < ehdr->e_phnum; h++ )
     {
-        phdr = (Elf_Phdr *)(image + ehdr->e_phoff + (h*ehdr->e_phentsize));
+        phdr = (const Elf_Phdr *)(
+            image + ehdr->e_phoff + (h*ehdr->e_phentsize));
         if ( !is_loadable_phdr(phdr) )
             continue;
         vaddr = phdr->p_paddr - dsi->elf_paddr_offset + dsi->v_start;
@@ -514,8 +521,8 @@ loadelfimage(
     const char *image, unsigned long elfsize, int xch, uint32_t dom,
     xen_pfn_t *parray, struct domain_setup_info *dsi)
 {
-    Elf_Ehdr *ehdr = (Elf_Ehdr *)image;
-    Elf_Phdr *phdr;
+    const Elf_Ehdr *ehdr = (const Elf_Ehdr *)image;
+    const Elf_Phdr *phdr;
     int h;
 
     char         *va;
@@ -523,7 +530,8 @@ loadelfimage(
 
     for ( h = 0; h < ehdr->e_phnum; h++ )
     {
-        phdr = (Elf_Phdr *)(image + ehdr->e_phoff + (h*ehdr->e_phentsize));
+        phdr = (const Elf_Phdr *)(
+            image + ehdr->e_phoff + (h*ehdr->e_phentsize));
         if ( !is_loadable_phdr(phdr) )
             continue;
 
@@ -569,7 +577,8 @@ loadelfsymtab(
     const char *image, int xch, uint32_t dom, xen_pfn_t *parray,
     struct domain_setup_info *dsi)
 {
-    Elf_Ehdr *ehdr = (Elf_Ehdr *)image, *sym_ehdr;
+    const Elf_Ehdr *ehdr = (const Elf_Ehdr *)image;
+    Elf_Ehdr *sym_ehdr;
     Elf_Shdr *shdr;
     unsigned long maxva, symva;
     char *p;
diff -r e86605304e52 -r 3e2d3d737624 tools/libxc/xg_private.h
--- a/tools/libxc/xg_private.h  Thu Dec 21 13:48:13 2006 +0000
+++ b/tools/libxc/xg_private.h  Thu Dec 21 13:58:51 2006 +0000
@@ -146,7 +146,7 @@ struct domain_setup_info
      * You should use the xen_elfnote_* accessors below in order to
      * pickup the correct one and retain backwards compatibility.
      */
-    void *__elfnote_section, *__elfnote_section_end;
+    const void *__elfnote_section, *__elfnote_section_end;
     const char *__xen_guest_string;
 };
 
@@ -162,14 +162,14 @@ typedef int (*loadimagefunc)(const char 
  * in the note is returned and *defined is set to non-zero. If no such
  * note is found then *defined is set to 0 and 0 is returned.
  */
-extern unsigned long long xen_elfnote_numeric(struct domain_setup_info *dsi,
+extern unsigned long long xen_elfnote_numeric(const struct domain_setup_info 
*dsi,
                                              int type, int *defined);
 
 /*
  * If an ELF note of the given type is found then the string contained
  * in the value is returned, otherwise NULL is returned.
  */
-extern const char * xen_elfnote_string(struct domain_setup_info *dsi,
+extern const char * xen_elfnote_string(const struct domain_setup_info *dsi,
                                       int type);
 
 struct load_funcs
diff -r e86605304e52 -r 3e2d3d737624 tools/xenstat/xentop/xentop.c
--- a/tools/xenstat/xentop/xentop.c     Thu Dec 21 13:48:13 2006 +0000
+++ b/tools/xenstat/xentop/xentop.c     Thu Dec 21 13:58:51 2006 +0000
@@ -269,7 +269,7 @@ static void print(const char *fmt, ...)
        if (!batch) {
                if((current_row() < lines()-1)) {
                        va_start(args, fmt);
-                       vwprintw(stdscr, (char *)fmt, args);
+                       vwprintw(stdscr, (const char *)fmt, args);
                        va_end(args);
                }
        } else {
@@ -283,7 +283,7 @@ static void attr_addstr(int attr, const 
 static void attr_addstr(int attr, const char *str)
 {
        attron(attr);
-       addstr((char *)str);
+       addstr((const char *)str);
        attroff(attr);
 }
 
diff -r e86605304e52 -r 3e2d3d737624 tools/xenstore/list.h
--- a/tools/xenstore/list.h     Thu Dec 21 13:48:13 2006 +0000
+++ b/tools/xenstore/list.h     Thu Dec 21 13:58:51 2006 +0000
@@ -12,7 +12,7 @@
 #define LIST_POISON2  ((void *) 0x00200200)
 
 #define container_of(ptr, type, member) ({                     \
-        const typeof( ((type *)0)->member ) *__mptr = (ptr);   \
+        typeof( ((type *)0)->member ) *__mptr = (ptr); \
         (type *)( (char *)__mptr - offsetof(type,member) );})
 
 /*
diff -r e86605304e52 -r 3e2d3d737624 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/arch/x86/domain_build.c       Thu Dec 21 13:58:51 2006 +0000
@@ -55,12 +55,12 @@ static long dom0_nrpages, dom0_min_nrpag
  *  If +ve: The specified amount is an absolute value.
  *  If -ve: The specified amount is subtracted from total available memory.
  */
-static long parse_amt(char *s, char **ps)
+static long parse_amt(const char *s, const char **ps)
 {
     long pages = parse_size_and_unit((*s == '-') ? s+1 : s, ps) >> PAGE_SHIFT;
     return (*s == '-') ? -pages : pages;
 }
-static void parse_dom0_mem(char *s)
+static void parse_dom0_mem(const char *s)
 {
     do {
         if ( !strncmp(s, "min:", 4) )
@@ -152,7 +152,8 @@ static void process_dom0_ioports_disable
 static void process_dom0_ioports_disable(void)
 {
     unsigned long io_from, io_to;
-    char *t, *u, *s = opt_dom0_ioports_disable;
+    char *t, *s = opt_dom0_ioports_disable;
+    const char *u;
 
     if ( *s == '\0' )
         return;
@@ -892,7 +893,7 @@ int construct_dom0(struct domain *d,
     return 0;
 }
 
-int elf_sanity_check(Elf_Ehdr *ehdr)
+int elf_sanity_check(const Elf_Ehdr *ehdr)
 {
     if ( !IS_ELF(*ehdr) ||
 #if defined(__i386__)
diff -r e86605304e52 -r 3e2d3d737624 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/arch/x86/time.c       Thu Dec 21 13:58:51 2006 +0000
@@ -41,7 +41,7 @@ unsigned long cpu_khz;  /* CPU clock fre
 unsigned long cpu_khz;  /* CPU clock frequency in kHz. */
 unsigned long hpet_address;
 DEFINE_SPINLOCK(rtc_lock);
-unsigned long volatile jiffies;
+volatile unsigned long jiffies;
 static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */
 static DEFINE_SPINLOCK(wc_lock);
 
@@ -148,7 +148,7 @@ void timer_interrupt(int irq, void *dev_
     ASSERT(local_irq_is_enabled());
 
     /* Update jiffies counter. */
-    (*(unsigned long *)&jiffies)++;
+    (*(volatile unsigned long *)&jiffies)++;
 
     /* Rough hack to allow accurate timers to sort-of-work with no APIC. */
     if ( !cpu_has_apic )
diff -r e86605304e52 -r 3e2d3d737624 xen/common/elf.c
--- a/xen/common/elf.c  Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/common/elf.c  Thu Dec 21 13:58:51 2006 +0000
@@ -16,7 +16,7 @@
 #include <public/elfnote.h>
 
 static void loadelfsymtab(struct domain_setup_info *dsi, int doload);
-static inline int is_loadable_phdr(Elf_Phdr *phdr)
+static inline int is_loadable_phdr(const Elf_Phdr *phdr)
 {
     return ((phdr->p_type == PT_LOAD) &&
             ((phdr->p_flags & (PF_W|PF_X)) != 0));
@@ -26,7 +26,7 @@ static inline int is_loadable_phdr(Elf_P
  * Fallback for kernels containing only the legacy __xen_guest string
  * and no ELF notes.
  */
-static int is_xen_guest_section(Elf_Shdr *shdr, const char *shstrtab)
+static int is_xen_guest_section(const Elf_Shdr *shdr, const char *shstrtab)
 {
     return strcmp(&shstrtab[shdr->sh_name], "__xen_guest") == 0;
 }
@@ -102,19 +102,19 @@ static unsigned long long xen_guest_nume
 /*
  * Interface to the Xen ELF notes.
  */
-#define ELFNOTE_NAME(_n_)   ((void*)(_n_) + sizeof(*(_n_)))
+#define ELFNOTE_NAME(_n_)   ((const void*)(_n_) + sizeof(*(_n_)))
 #define ELFNOTE_DESC(_n_)   (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3))
 #define ELFNOTE_NEXT(_n_)   (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3))
 
-static int is_xen_elfnote_section(const char *image, Elf_Shdr *shdr)
-{
-    Elf_Note *note;
+static int is_xen_elfnote_section(const char *image, const Elf_Shdr *shdr)
+{
+    const Elf_Note *note;
 
     if ( shdr->sh_type != SHT_NOTE )
         return 0;
 
-    for ( note = (Elf_Note *)(image + shdr->sh_offset);
-          note < (Elf_Note *)(image + shdr->sh_offset + shdr->sh_size);
+    for ( note = (const Elf_Note *)(image + shdr->sh_offset);
+          note < (const Elf_Note *)(image + shdr->sh_offset + shdr->sh_size);
           note = ELFNOTE_NEXT(note) )
     {
         if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) )
@@ -124,15 +124,16 @@ static int is_xen_elfnote_section(const 
     return 0;
 }
 
-static Elf_Note *xen_elfnote_lookup(struct domain_setup_info *dsi, int type)
-{
-    Elf_Note *note;
+static const Elf_Note *xen_elfnote_lookup(
+    struct domain_setup_info *dsi, int type)
+{
+    const Elf_Note *note;
 
     if ( !dsi->__elfnote_section )
         return NULL;
 
-    for ( note = (Elf_Note *)dsi->__elfnote_section;
-          note < (Elf_Note *)dsi->__elfnote_section_end;
+    for ( note = (const Elf_Note *)dsi->__elfnote_section;
+          note < (const Elf_Note *)dsi->__elfnote_section_end;
           note = ELFNOTE_NEXT(note) )
     {
         if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) )
@@ -147,7 +148,7 @@ static Elf_Note *xen_elfnote_lookup(stru
 
 const char *xen_elfnote_string(struct domain_setup_info *dsi, int type)
 {
-    Elf_Note *note;
+    const Elf_Note *note;
 
     if ( !dsi->__elfnote_section )
         return xen_guest_string(dsi, type);
@@ -162,7 +163,7 @@ unsigned long long xen_elfnote_numeric(s
 unsigned long long xen_elfnote_numeric(struct domain_setup_info *dsi,
                                        int type, int *defined)
 {
-    Elf_Note *note;
+    const Elf_Note *note;
 
     *defined = 0;
 
@@ -179,10 +180,10 @@ unsigned long long xen_elfnote_numeric(s
     {
     case 4:
         *defined = 1;
-        return *(uint32_t*)ELFNOTE_DESC(note);
+        return *(const uint32_t*)ELFNOTE_DESC(note);
     case 8:
         *defined = 1;
-        return *(uint64_t*)ELFNOTE_DESC(note);
+        return *(const uint64_t*)ELFNOTE_DESC(note);
     default:
         printk("ERROR: unknown data size %#x for numeric type note %#x\n",
                note->descsz, type);
@@ -192,9 +193,9 @@ unsigned long long xen_elfnote_numeric(s
 
 int parseelfimage(struct domain_setup_info *dsi)
 {
-    Elf_Ehdr *ehdr = (Elf_Ehdr *)dsi->image_addr;
-    Elf_Phdr *phdr;
-    Elf_Shdr *shdr;
+    const Elf_Ehdr *ehdr = (const Elf_Ehdr *)dsi->image_addr;
+    const Elf_Phdr *phdr;
+    const Elf_Shdr *shdr;
     Elf_Addr kernstart = ~0, kernend = 0, vaddr, virt_entry;
     const char *shstrtab, *p;
     const char *image = (char *)dsi->image_addr;
@@ -222,12 +223,13 @@ int parseelfimage(struct domain_setup_in
     /* Look for .notes segment containing at least one Xen note */
     for ( h = 0; h < ehdr->e_shnum; h++ )
     {
-        shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize));
+        shdr = (const Elf_Shdr *)(
+            image + ehdr->e_shoff + (h*ehdr->e_shentsize));
         if ( !is_xen_elfnote_section(image, shdr) )
             continue;
-        dsi->__elfnote_section = (void *)image + shdr->sh_offset;
+        dsi->__elfnote_section = (const void *)image + shdr->sh_offset;
         dsi->__elfnote_section_end =
-            (void *)image + shdr->sh_offset + shdr->sh_size;
+            (const void *)image + shdr->sh_offset + shdr->sh_size;
         break;
     }
 
@@ -240,16 +242,18 @@ int parseelfimage(struct domain_setup_in
             printk("ELF image has no section-header strings table.\n");
             return -EINVAL;
         }
-        shdr = (Elf_Shdr *)(image + ehdr->e_shoff +
+        shdr = (const Elf_Shdr *)(image + ehdr->e_shoff +
                             (ehdr->e_shstrndx*ehdr->e_shentsize));
         shstrtab = image + shdr->sh_offset;
 
         for ( h = 0; h < ehdr->e_shnum; h++ )
         {
-            shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize));
+            shdr = (const Elf_Shdr *)(
+                image + ehdr->e_shoff + (h*ehdr->e_shentsize));
             if ( is_xen_guest_section(shdr, shstrtab) )
             {
-                dsi->__xen_guest_string = (char *)image + shdr->sh_offset;
+                dsi->__xen_guest_string =
+                    (const char *)image + shdr->sh_offset;
                 break;
             }
         }
@@ -327,8 +331,8 @@ int parseelfimage(struct domain_setup_in
      * If we are using the modern ELF notes interface then the default
      * is 0.
      */
-    dsi->elf_paddr_offset =
-        xen_elfnote_numeric(dsi, XEN_ELFNOTE_PADDR_OFFSET, 
&elf_pa_off_defined);
+    dsi->elf_paddr_offset = xen_elfnote_numeric(dsi, XEN_ELFNOTE_PADDR_OFFSET,
+                                                &elf_pa_off_defined);
     if ( !elf_pa_off_defined )
     {
         if ( dsi->__elfnote_section )
@@ -346,7 +350,8 @@ int parseelfimage(struct domain_setup_in
 
     for ( h = 0; h < ehdr->e_phnum; h++ )
     {
-        phdr = (Elf_Phdr *)(image + ehdr->e_phoff + (h*ehdr->e_phentsize));
+        phdr = (const Elf_Phdr *)(
+            image + ehdr->e_phoff + (h*ehdr->e_phentsize));
         if ( !is_loadable_phdr(phdr) )
             continue;
         vaddr = phdr->p_paddr - dsi->elf_paddr_offset + dsi->v_start;
diff -r e86605304e52 -r 3e2d3d737624 xen/common/kernel.c
--- a/xen/common/kernel.c       Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/common/kernel.c       Thu Dec 21 13:58:51 2006 +0000
@@ -20,7 +20,8 @@ int tainted;
 
 void cmdline_parse(char *cmdline)
 {
-    char opt[100], *optval, *p = cmdline, *q;
+    char opt[100], *optval, *q;
+    const char *p = cmdline;
     struct kernel_param *param;
     
     if ( p == NULL )
@@ -70,13 +71,13 @@ void cmdline_parse(char *cmdline)
                 break;
             case OPT_UINT:
                 *(unsigned int *)param->var =
-                    simple_strtol(optval, (char **)&optval, 0);
+                    simple_strtol(optval, (const char **)&optval, 0);
                 break;
             case OPT_BOOL:
                 *(int *)param->var = 1;
                 break;
             case OPT_CUSTOM:
-                ((void (*)(char *))param->var)(optval);
+                ((void (*)(const char *))param->var)(optval);
                 break;
             }
         }
diff -r e86605304e52 -r 3e2d3d737624 xen/common/kexec.c
--- a/xen/common/kexec.c        Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/common/kexec.c        Thu Dec 21 13:58:51 2006 +0000
@@ -37,7 +37,7 @@ spinlock_t kexec_lock = SPIN_LOCK_UNLOCK
 
 xen_kexec_reserve_t kexec_crash_area;
 
-static void __init parse_crashkernel(char *str)
+static void __init parse_crashkernel(const char *str)
 {
     unsigned long start, size;
 
diff -r e86605304e52 -r 3e2d3d737624 xen/common/lib.c
--- a/xen/common/lib.c  Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/common/lib.c  Thu Dec 21 13:58:51 2006 +0000
@@ -439,11 +439,14 @@ s64 __moddi3(s64 a, s64 b)
 
 #endif /* BITS_PER_LONG == 32 */
 
-unsigned long long parse_size_and_unit(const char *s, char **ps)
-{
-       unsigned long long ret = simple_strtoull(s, (char **)&s, 0);
-
-       switch (*s) {
+unsigned long long parse_size_and_unit(const char *s, const char **ps)
+{
+       unsigned long long ret;
+       const char *s1;
+
+       ret = simple_strtoull(s, &s1, 0);
+
+       switch (*s1) {
        case 'G': case 'g':
                ret <<= 10;
        case 'M': case 'm':
@@ -459,7 +462,7 @@ unsigned long long parse_size_and_unit(c
        }
 
        if (ps != NULL)
-               *ps = (char *)s;
+               *ps = s1;
 
        return ret;
 }
diff -r e86605304e52 -r 3e2d3d737624 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/common/page_alloc.c   Thu Dec 21 13:58:51 2006 +0000
@@ -197,7 +197,7 @@ void init_boot_pages(paddr_t ps, paddr_t
 void init_boot_pages(paddr_t ps, paddr_t pe)
 {
     unsigned long bad_spfn, bad_epfn, i;
-    char *p;
+    const char *p;
 
     ps = round_pgup(ps);
     pe = round_pgdown(pe);
diff -r e86605304e52 -r 3e2d3d737624 xen/common/time.c
--- a/xen/common/time.c Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/common/time.c Thu Dec 21 13:58:51 2006 +0000
@@ -40,7 +40,7 @@ struct tm gmtime(unsigned long t)
     struct tm tbuf;
     long days, rem;
     int y;
-    unsigned short int *ip;
+    const unsigned short int *ip;
 
     days = t / SECS_PER_DAY;
     rem = t % SECS_PER_DAY;
@@ -66,7 +66,7 @@ struct tm gmtime(unsigned long t)
     }
     tbuf.tm_year = y - 1900;
     tbuf.tm_yday = days;
-    ip = (unsigned short int *)__mon_lengths[__isleap(y)];
+    ip = (const unsigned short int *)__mon_lengths[__isleap(y)];
     for ( y = 0; days >= ip[y]; ++y )
         days -= ip[y];
     tbuf.tm_mon = y;
diff -r e86605304e52 -r 3e2d3d737624 xen/common/vsprintf.c
--- a/xen/common/vsprintf.c     Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/common/vsprintf.c     Thu Dec 21 13:58:51 2006 +0000
@@ -28,7 +28,8 @@
  * @endp: A pointer to the end of the parsed string will be placed here
  * @base: The number base to use
  */
-unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
+unsigned long simple_strtoul(
+    const char *cp, const char **endp, unsigned int base)
 {
     unsigned long result = 0,value;
 
@@ -52,7 +53,7 @@ unsigned long simple_strtoul(const char 
         cp++;
     }
     if (endp)
-        *endp = (char *)cp;
+        *endp = cp;
     return result;
 }
 
@@ -64,7 +65,7 @@ EXPORT_SYMBOL(simple_strtoul);
  * @endp: A pointer to the end of the parsed string will be placed here
  * @base: The number base to use
  */
-long simple_strtol(const char *cp,char **endp,unsigned int base)
+long simple_strtol(const char *cp, const char **endp, unsigned int base)
 {
     if(*cp=='-')
         return -simple_strtoul(cp+1,endp,base);
@@ -79,7 +80,8 @@ EXPORT_SYMBOL(simple_strtol);
  * @endp: A pointer to the end of the parsed string will be placed here
  * @base: The number base to use
  */
-unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int 
base)
+unsigned long long simple_strtoull(
+    const char *cp, const char **endp, unsigned int base)
 {
     unsigned long long result = 0,value;
 
@@ -103,7 +105,7 @@ unsigned long long simple_strtoull(const
         cp++;
     }
     if (endp)
-        *endp = (char *)cp;
+        *endp = cp;
     return result;
 }
 
@@ -115,7 +117,7 @@ EXPORT_SYMBOL(simple_strtoull);
  * @endp: A pointer to the end of the parsed string will be placed here
  * @base: The number base to use
  */
-long long simple_strtoll(const char *cp,char **endp,unsigned int base)
+long long simple_strtoll(const char *cp,const char **endp,unsigned int base)
 {
     if(*cp=='-')
         return -simple_strtoull(cp+1,endp,base);
@@ -139,7 +141,9 @@ static int skip_atoi(const char **s)
 #define SPECIAL 32              /* 0x */
 #define LARGE   64              /* use 'ABCDEF' instead of 'abcdef' */
 
-static char * number(char * buf, char * end, unsigned long long num, int base, 
int size, int precision, int type)
+static char *number(
+    char *buf, char *end, unsigned long long num,
+    int base, int size, int precision, int type)
 {
     char c,sign,tmp[66];
     const char *digits;
diff -r e86605304e52 -r 3e2d3d737624 xen/common/xmalloc.c
--- a/xen/common/xmalloc.c      Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/common/xmalloc.c      Thu Dec 21 13:58:51 2006 +0000
@@ -87,7 +87,7 @@ static void *data_from_header(struct xma
 #endif
 }
 
-static struct xmalloc_hdr *header_from_data(const void *p)
+static struct xmalloc_hdr *header_from_data(void *p)
 {
 #if XMALLOC_DEBUG
     unsigned char *data = (unsigned char *)p - SMP_CACHE_BYTES;
@@ -208,7 +208,7 @@ void *_xmalloc(size_t size, size_t align
     return xmalloc_new_page(size);
 }
 
-void xfree(const void *p)
+void xfree(void *p)
 {
     unsigned long flags;
     struct xmalloc_hdr *i, *tmp, *hdr;
diff -r e86605304e52 -r 3e2d3d737624 xen/drivers/char/ns16550.c
--- a/xen/drivers/char/ns16550.c        Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/drivers/char/ns16550.c        Thu Dec 21 13:58:51 2006 +0000
@@ -300,7 +300,7 @@ static int parse_parity_char(int c)
         return;                              \
     } while ( 0 )
 
-static void ns16550_parse_port_config(struct ns16550 *uart, char *conf)
+static void ns16550_parse_port_config(struct ns16550 *uart, const char *conf)
 {
     int baud;
 
diff -r e86605304e52 -r 3e2d3d737624 xen/include/asm-x86/bitops.h
--- a/xen/include/asm-x86/bitops.h      Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/include/asm-x86/bitops.h      Thu Dec 21 13:58:51 2006 +0000
@@ -288,7 +288,7 @@ static inline unsigned int __scanbit(uns
  */
 #define find_first_bit(addr,size) \
 ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \
-  (__scanbit(*(unsigned long *)addr)) : \
+  (__scanbit(*(const unsigned long *)addr)) : \
   __find_first_bit(addr,size)))
 
 /**
@@ -299,7 +299,7 @@ static inline unsigned int __scanbit(uns
  */
 #define find_next_bit(addr,size,off) \
 ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \
-  ((off) + (__scanbit((*(unsigned long *)addr) >> (off)))) : \
+  ((off) + (__scanbit((*(const unsigned long *)addr) >> (off)))) : \
   __find_next_bit(addr,size,off)))
 
 /**
@@ -312,7 +312,7 @@ static inline unsigned int __scanbit(uns
  */
 #define find_first_zero_bit(addr,size) \
 ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \
-  (__scanbit(~*(unsigned long *)addr)) : \
+  (__scanbit(~*(const unsigned long *)addr)) : \
   __find_first_zero_bit(addr,size)))
 
 /**
@@ -323,7 +323,7 @@ static inline unsigned int __scanbit(uns
  */
 #define find_next_zero_bit(addr,size,off) \
 ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \
-  ((off)+(__scanbit(~(((*(unsigned long *)addr)) >> (off))))) : \
+  ((off)+(__scanbit(~(((*(const unsigned long *)addr)) >> (off))))) : \
   __find_next_zero_bit(addr,size,off)))
 
 
diff -r e86605304e52 -r 3e2d3d737624 xen/include/asm-x86/system.h
--- a/xen/include/asm-x86/system.h      Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/include/asm-x86/system.h      Thu Dec 21 13:58:51 2006 +0000
@@ -19,7 +19,7 @@
 #define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned 
long)(v),(ptr),sizeof(*(ptr))))
 
 struct __xchg_dummy { unsigned long a[100]; };
-#define __xg(x) ((struct __xchg_dummy *)(x))
+#define __xg(x) ((volatile struct __xchg_dummy *)(x))
 
 
 /*
diff -r e86605304e52 -r 3e2d3d737624 xen/include/asm-x86/uaccess.h
--- a/xen/include/asm-x86/uaccess.h     Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/include/asm-x86/uaccess.h     Thu Dec 21 13:58:51 2006 +0000
@@ -140,7 +140,7 @@ extern void __put_user_bad(void);
 })                                                     
 
 struct __large_struct { unsigned long buf[100]; };
-#define __m(x) (*(struct __large_struct *)(x))
+#define __m(x) (*(const struct __large_struct *)(x))
 
 /*
  * Tell gcc we read from memory instead of writing: this is because
@@ -200,16 +200,16 @@ __copy_to_user(void __user *to, const vo
 
         switch (n) {
         case 1:
-            __put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret, 1);
+            __put_user_size(*(const u8 *)from, (u8 __user *)to, 1, ret, 1);
             return ret;
         case 2:
-            __put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret, 2);
+            __put_user_size(*(const u16 *)from, (u16 __user *)to, 2, ret, 2);
             return ret;
         case 4:
-            __put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret, 4);
+            __put_user_size(*(const u32 *)from, (u32 __user *)to, 4, ret, 4);
             return ret;
         case 8:
-            __put_user_size(*(u64 *)from, (u64 __user *)to, 8, ret, 8);
+            __put_user_size(*(const u64 *)from, (u64 __user *)to, 8, ret, 8);
             return ret;
         }
     }
diff -r e86605304e52 -r 3e2d3d737624 xen/include/xen/elf.h
--- a/xen/include/xen/elf.h     Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/include/xen/elf.h     Thu Dec 21 13:58:51 2006 +0000
@@ -526,7 +526,7 @@ extern const char *xen_elfnote_string(st
 extern const char *xen_elfnote_string(struct domain_setup_info *dsi, int type);
 
 #ifdef Elf_Ehdr
-extern int elf_sanity_check(Elf_Ehdr *ehdr);
+extern int elf_sanity_check(const Elf_Ehdr *ehdr);
 #endif
 
 #endif /* __XEN_ELF_H__ */
diff -r e86605304e52 -r 3e2d3d737624 xen/include/xen/kernel.h
--- a/xen/include/xen/kernel.h  Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/include/xen/kernel.h  Thu Dec 21 13:58:51 2006 +0000
@@ -41,19 +41,19 @@
  * @member:    the name of the member within the struct.
  *
  */
-#define container_of(ptr, type, member) ({                     \
-        const typeof( ((type *)0)->member ) *__mptr = (ptr);   \
+#define container_of(ptr, type, member) ({                      \
+        typeof( ((type *)0)->member ) *__mptr = (ptr);          \
         (type *)( (char *)__mptr - offsetof(type,member) );})
 
 /*
  * Check at compile time that something is of a particular type.
  * Always evaluates to 1 so you may use it easily in comparisons.
  */
-#define typecheck(type,x) \
-({     type __dummy; \
-       typeof(x) __dummy2; \
-       (void)(&__dummy == &__dummy2); \
-       1; \
+#define typecheck(type,x)                       \
+({     type __dummy;                           \
+       typeof(x) __dummy2;                     \
+       (void)(&__dummy == &__dummy2);          \
+       1;                                      \
 })
 
 
diff -r e86605304e52 -r 3e2d3d737624 xen/include/xen/lib.h
--- a/xen/include/xen/lib.h     Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/include/xen/lib.h     Thu Dec 21 13:58:51 2006 +0000
@@ -74,15 +74,15 @@ extern int vscnprintf(char *buf, size_t 
     __attribute__ ((format (printf, 3, 0)));
 
 long simple_strtol(
-    const char *cp,char **endp, unsigned int base);
+    const char *cp,const char **endp, unsigned int base);
 unsigned long simple_strtoul(
-    const char *cp,char **endp, unsigned int base);
+    const char *cp,const char **endp, unsigned int base);
 long long simple_strtoll(
-    const char *cp,char **endp, unsigned int base);
+    const char *cp,const char **endp, unsigned int base);
 unsigned long long simple_strtoull(
-    const char *cp,char **endp, unsigned int base);
+    const char *cp,const char **endp, unsigned int base);
 
-unsigned long long parse_size_and_unit(const char *s, char **ps);
+unsigned long long parse_size_and_unit(const char *s, const char **ps);
 
 #define TAINT_UNSAFE_SMP                (1<<0)
 #define TAINT_MACHINE_CHECK             (1<<1)
diff -r e86605304e52 -r 3e2d3d737624 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/include/xen/sched.h   Thu Dec 21 13:58:51 2006 +0000
@@ -202,8 +202,8 @@ struct domain_setup_info
      * You should use the xen_elfnote_* accessors below in order to
      * pickup the correct one and retain backwards compatibility.
      */
-    void *__elfnote_section, *__elfnote_section_end;
-    char *__xen_guest_string;
+    const void *__elfnote_section, *__elfnote_section_end;
+    const char *__xen_guest_string;
 };
 
 extern struct vcpu *idle_vcpu[NR_CPUS];
diff -r e86605304e52 -r 3e2d3d737624 xen/include/xen/xmalloc.h
--- a/xen/include/xen/xmalloc.h Thu Dec 21 13:48:13 2006 +0000
+++ b/xen/include/xen/xmalloc.h Thu Dec 21 13:58:51 2006 +0000
@@ -12,7 +12,7 @@
 #define xmalloc_bytes(_bytes) (_xmalloc(_bytes, SMP_CACHE_BYTES))
 
 /* Free any of the above. */
-extern void xfree(const void *);
+extern void xfree(void *);
 
 /* Underlying functions */
 extern void *_xmalloc(size_t size, size_t align);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Improve consistency of type-attribute usage (volatile/const)., Xen patchbot-unstable <=