ia64/xen-unstable
changeset 13156:3e2d3d737624
Improve consistency of type-attribute usage (volatile/const).
From: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
From: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
line diff
1.1 --- a/tools/libxc/xc_linux_build.c Thu Dec 21 13:48:13 2006 +0000 1.2 +++ b/tools/libxc/xc_linux_build.c Thu Dec 21 13:58:51 2006 +0000 1.3 @@ -1079,7 +1079,7 @@ static int setup_guest(int xc_handle, 1.4 static int xc_linux_build_internal(int xc_handle, 1.5 uint32_t domid, 1.6 unsigned int mem_mb, 1.7 - char *image, 1.8 + const char *image, 1.9 unsigned long image_size, 1.10 struct initrd_info *initrd, 1.11 const char *cmdline,
2.1 --- a/tools/libxc/xc_linux_save.c Thu Dec 21 13:48:13 2006 +0000 2.2 +++ b/tools/libxc/xc_linux_save.c Thu Dec 21 13:58:51 2006 +0000 2.3 @@ -80,7 +80,7 @@ static xen_pfn_t *live_m2p = NULL; 2.4 #define BITMAP_SIZE ((max_pfn + BITS_PER_LONG - 1) / 8) 2.5 2.6 #define BITMAP_ENTRY(_nr,_bmap) \ 2.7 - ((unsigned long *)(_bmap))[(_nr)/BITS_PER_LONG] 2.8 + ((volatile unsigned long *)(_bmap))[(_nr)/BITS_PER_LONG] 2.9 2.10 #define BITMAP_SHIFT(_nr) ((_nr) % BITS_PER_LONG) 2.11 2.12 @@ -112,7 +112,7 @@ static inline unsigned int hweight32(uns 2.13 static inline int count_bits ( int nr, volatile void *addr) 2.14 { 2.15 int i, count = 0; 2.16 - unsigned long *p = (unsigned long *)addr; 2.17 + volatile unsigned long *p = (volatile unsigned long *)addr; 2.18 /* We know that the array is padded to unsigned long. */ 2.19 for( i = 0; i < (nr / (sizeof(unsigned long)*8)); i++, p++ ) 2.20 count += hweight32(*p); 2.21 @@ -443,7 +443,7 @@ static int canonicalize_pagetable(unsign 2.22 2.23 /* XXX index of the L2 entry in PAE mode which holds the guest LPT */ 2.24 #define PAE_GLPT_L2ENTRY (495) 2.25 - pte = ((uint64_t*)spage)[PAE_GLPT_L2ENTRY]; 2.26 + pte = ((const uint64_t*)spage)[PAE_GLPT_L2ENTRY]; 2.27 2.28 if(((pte >> PAGE_SHIFT) & 0x0fffffff) == live_p2m[pfn]) 2.29 xen_start = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff; 2.30 @@ -464,9 +464,9 @@ static int canonicalize_pagetable(unsign 2.31 unsigned long pfn, mfn; 2.32 2.33 if (pt_levels == 2) 2.34 - pte = ((uint32_t*)spage)[i]; 2.35 + pte = ((const uint32_t*)spage)[i]; 2.36 else 2.37 - pte = ((uint64_t*)spage)[i]; 2.38 + pte = ((const uint64_t*)spage)[i]; 2.39 2.40 if (i >= xen_start && i < xen_end) 2.41 pte = 0;
3.1 --- a/tools/libxc/xc_load_bin.c Thu Dec 21 13:48:13 2006 +0000 3.2 +++ b/tools/libxc/xc_load_bin.c Thu Dec 21 13:58:51 2006 +0000 3.3 @@ -98,7 +98,7 @@ struct xen_bin_image_table 3.4 #define FLAGS_MASK ((~ 0) & (~ XEN_REACTOS_FLAG_ALIGN4K)) 3.5 #define FLAGS_REQUIRED XEN_REACTOS_FLAG_ADDRSVALID 3.6 3.7 -static struct xen_bin_image_table * 3.8 +static const struct xen_bin_image_table * 3.9 findtable(const char *image, unsigned long image_size); 3.10 static int 3.11 parsebinimage( 3.12 @@ -122,11 +122,11 @@ int probe_bin(const char *image, 3.13 return 0; 3.14 } 3.15 3.16 -static struct xen_bin_image_table * 3.17 +static const struct xen_bin_image_table * 3.18 findtable(const char *image, unsigned long image_size) 3.19 { 3.20 - struct xen_bin_image_table *table; 3.21 - unsigned long *probe_ptr; 3.22 + const struct xen_bin_image_table *table; 3.23 + const unsigned long *probe_ptr; 3.24 unsigned probe_index; 3.25 unsigned probe_count; 3.26 3.27 @@ -142,13 +142,13 @@ findtable(const char *image, unsigned lo 3.28 sizeof(unsigned long); 3.29 3.30 /* Search for the magic header */ 3.31 - probe_ptr = (unsigned long *) image; 3.32 + probe_ptr = (const unsigned long *) image; 3.33 table = NULL; 3.34 for ( probe_index = 0; probe_index < probe_count; probe_index++ ) 3.35 { 3.36 if ( XEN_REACTOS_MAGIC3 == *probe_ptr ) 3.37 { 3.38 - table = (struct xen_bin_image_table *) probe_ptr; 3.39 + table = (const struct xen_bin_image_table *) probe_ptr; 3.40 /* Checksum correct? */ 3.41 if ( 0 == table->magic + table->flags + table->checksum ) 3.42 { 3.43 @@ -165,7 +165,7 @@ static int parsebinimage(const char *ima 3.44 unsigned long image_size, 3.45 struct domain_setup_info *dsi) 3.46 { 3.47 - struct xen_bin_image_table *image_info; 3.48 + const struct xen_bin_image_table *image_info; 3.49 unsigned long start_addr; 3.50 unsigned long end_addr; 3.51 3.52 @@ -186,13 +186,13 @@ static int parsebinimage(const char *ima 3.53 3.54 /* Sanity check on the addresses */ 3.55 if ( image_info->header_addr < image_info->load_addr || 3.56 - ((char *) image_info - image) < 3.57 + ((const char *) image_info - image) < 3.58 (image_info->header_addr - image_info->load_addr) ) 3.59 { 3.60 ERROR("Invalid header_addr."); 3.61 return -EINVAL; 3.62 } 3.63 - start_addr = image_info->header_addr - ((char *) image_info - image); 3.64 + start_addr = image_info->header_addr - ((const char *) image_info - image); 3.65 if ( 0 != image_info->load_end_addr && 3.66 ( image_info->load_end_addr < image_info->load_end_addr || 3.67 start_addr + image_size < image_info->load_end_addr ) ) 3.68 @@ -221,7 +221,7 @@ static int parsebinimage(const char *ima 3.69 else 3.70 { 3.71 dsi->v_end = image_info->load_addr + image_size - 3.72 - (((char *) image_info - image) - 3.73 + (((const char *) image_info - image) - 3.74 (image_info->header_addr - image_info->load_addr)); 3.75 } 3.76 dsi->v_kernstart = dsi->v_start; 3.77 @@ -240,7 +240,7 @@ loadbinimage( 3.78 unsigned long size; 3.79 char *va; 3.80 unsigned long done, chunksz; 3.81 - struct xen_bin_image_table *image_info; 3.82 + const struct xen_bin_image_table *image_info; 3.83 3.84 image_info = findtable(image, image_size); 3.85 if ( NULL == image_info ) 3.86 @@ -252,7 +252,7 @@ loadbinimage( 3.87 /* Determine image size */ 3.88 if ( 0 == image_info->load_end_addr ) 3.89 { 3.90 - size = image_size - (((char *) image_info - image) - 3.91 + size = image_size - (((const char *)image_info - image) - 3.92 (image_info->header_addr - 3.93 image_info->load_addr)); 3.94 } 3.95 @@ -262,7 +262,7 @@ loadbinimage( 3.96 } 3.97 3.98 /* It's possible that we need to skip the first part of the image */ 3.99 - image += ((char *)image_info - image) - 3.100 + image += ((const char *)image_info - image) - 3.101 (image_info->header_addr - image_info->load_addr); 3.102 3.103 for ( done = 0; done < size; done += chunksz )
4.1 --- a/tools/libxc/xc_load_elf.c Thu Dec 21 13:48:13 2006 +0000 4.2 +++ b/tools/libxc/xc_load_elf.c Thu Dec 21 13:58:51 2006 +0000 4.3 @@ -75,7 +75,7 @@ int probe_elf(const char *image, 4.4 unsigned long image_size, 4.5 struct load_funcs *load_funcs) 4.6 { 4.7 - Elf_Ehdr *ehdr = (Elf_Ehdr *)image; 4.8 + const Elf_Ehdr *ehdr = (const Elf_Ehdr *)image; 4.9 4.10 if ( !IS_ELF(*ehdr) ) 4.11 return -EINVAL; 4.12 @@ -86,7 +86,7 @@ int probe_elf(const char *image, 4.13 return 0; 4.14 } 4.15 4.16 -static inline int is_loadable_phdr(Elf_Phdr *phdr) 4.17 +static inline int is_loadable_phdr(const Elf_Phdr *phdr) 4.18 { 4.19 return ((phdr->p_type == PT_LOAD) && 4.20 ((phdr->p_flags & (PF_W|PF_X)) != 0)); 4.21 @@ -96,12 +96,13 @@ static inline int is_loadable_phdr(Elf_P 4.22 * Fallback for kernels containing only the legacy __xen_guest string 4.23 * and no ELF notes. 4.24 */ 4.25 -static int is_xen_guest_section(Elf_Shdr *shdr, const char *shstrtab) 4.26 +static int is_xen_guest_section(const Elf_Shdr *shdr, const char *shstrtab) 4.27 { 4.28 return strcmp(&shstrtab[shdr->sh_name], "__xen_guest") == 0; 4.29 } 4.30 4.31 -static const char *xen_guest_lookup(struct domain_setup_info *dsi, int type) 4.32 +static const char *xen_guest_lookup( 4.33 + const struct domain_setup_info *dsi, int type) 4.34 { 4.35 const char *xenguest_fallbacks[] = { 4.36 [XEN_ELFNOTE_ENTRY] = "VIRT_ENTRY=", 4.37 @@ -134,7 +135,8 @@ static const char *xen_guest_lookup(stru 4.38 return p + strlen(fallback); 4.39 } 4.40 4.41 -static const char *xen_guest_string(struct domain_setup_info *dsi, int type) 4.42 +static const char *xen_guest_string( 4.43 + const struct domain_setup_info *dsi, int type) 4.44 { 4.45 const char *p = xen_guest_lookup(dsi, type); 4.46 4.47 @@ -148,8 +150,8 @@ static const char *xen_guest_string(stru 4.48 return p; 4.49 } 4.50 4.51 -static unsigned long long xen_guest_numeric(struct domain_setup_info *dsi, 4.52 - int type, int *defined) 4.53 +static unsigned long long xen_guest_numeric( 4.54 + const struct domain_setup_info *dsi, int type, int *defined) 4.55 { 4.56 const char *p = xen_guest_lookup(dsi, type); 4.57 unsigned long long value; 4.58 @@ -175,19 +177,19 @@ static unsigned long long xen_guest_nume 4.59 /* 4.60 * Interface to the Xen ELF notes. 4.61 */ 4.62 -#define ELFNOTE_NAME(_n_) ((void*)(_n_) + sizeof(*(_n_))) 4.63 +#define ELFNOTE_NAME(_n_) ((const void*)(_n_) + sizeof(*(_n_))) 4.64 #define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3)) 4.65 #define ELFNOTE_NEXT(_n_) (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3)) 4.66 4.67 -static int is_xen_elfnote_section(const char *image, Elf_Shdr *shdr) 4.68 +static int is_xen_elfnote_section(const char *image, const Elf_Shdr *shdr) 4.69 { 4.70 - Elf_Note *note; 4.71 + const Elf_Note *note; 4.72 4.73 if ( shdr->sh_type != SHT_NOTE ) 4.74 return 0; 4.75 4.76 - for ( note = (Elf_Note *)(image + shdr->sh_offset); 4.77 - note < (Elf_Note *)(image + shdr->sh_offset + shdr->sh_size); 4.78 + for ( note = (const Elf_Note *)(image + shdr->sh_offset); 4.79 + note < (const Elf_Note *)(image + shdr->sh_offset + shdr->sh_size); 4.80 note = ELFNOTE_NEXT(note) ) 4.81 { 4.82 if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) ) 4.83 @@ -197,15 +199,16 @@ static int is_xen_elfnote_section(const 4.84 return 0; 4.85 } 4.86 4.87 -static Elf_Note *xen_elfnote_lookup(struct domain_setup_info *dsi, int type) 4.88 +static const Elf_Note *xen_elfnote_lookup( 4.89 + const struct domain_setup_info *dsi, int type) 4.90 { 4.91 - Elf_Note *note; 4.92 + const Elf_Note *note; 4.93 4.94 if ( !dsi->__elfnote_section ) 4.95 return NULL; 4.96 4.97 - for ( note = (Elf_Note *)dsi->__elfnote_section; 4.98 - note < (Elf_Note *)dsi->__elfnote_section_end; 4.99 + for ( note = (const Elf_Note *)dsi->__elfnote_section; 4.100 + note < (const Elf_Note *)dsi->__elfnote_section_end; 4.101 note = ELFNOTE_NEXT(note) ) 4.102 { 4.103 if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) ) 4.104 @@ -218,9 +221,9 @@ static Elf_Note *xen_elfnote_lookup(stru 4.105 return NULL; 4.106 } 4.107 4.108 -const char *xen_elfnote_string(struct domain_setup_info *dsi, int type) 4.109 +const char *xen_elfnote_string(const struct domain_setup_info *dsi, int type) 4.110 { 4.111 - Elf_Note *note; 4.112 + const Elf_Note *note; 4.113 4.114 if ( !dsi->__elfnote_section ) 4.115 return xen_guest_string(dsi, type); 4.116 @@ -232,10 +235,10 @@ const char *xen_elfnote_string(struct do 4.117 return (const char *)ELFNOTE_DESC(note); 4.118 } 4.119 4.120 -unsigned long long xen_elfnote_numeric(struct domain_setup_info *dsi, 4.121 +unsigned long long xen_elfnote_numeric(const struct domain_setup_info *dsi, 4.122 int type, int *defined) 4.123 { 4.124 - Elf_Note *note; 4.125 + const Elf_Note *note; 4.126 4.127 *defined = 0; 4.128 4.129 @@ -252,10 +255,10 @@ unsigned long long xen_elfnote_numeric(s 4.130 { 4.131 case 4: 4.132 *defined = 1; 4.133 - return *(uint32_t*)ELFNOTE_DESC(note); 4.134 + return *(const uint32_t*)ELFNOTE_DESC(note); 4.135 case 8: 4.136 *defined = 1; 4.137 - return *(uint64_t*)ELFNOTE_DESC(note); 4.138 + return *(const uint64_t*)ELFNOTE_DESC(note); 4.139 default: 4.140 xc_set_error(XC_INVALID_KERNEL, 4.141 "elfnotes: unknown data size %#x for numeric type note %#x\n", 4.142 @@ -268,9 +271,9 @@ static int parseelfimage(const char *ima 4.143 unsigned long image_len, 4.144 struct domain_setup_info *dsi) 4.145 { 4.146 - Elf_Ehdr *ehdr = (Elf_Ehdr *)image; 4.147 - Elf_Phdr *phdr; 4.148 - Elf_Shdr *shdr; 4.149 + const Elf_Ehdr *ehdr = (const Elf_Ehdr *)image; 4.150 + const Elf_Phdr *phdr; 4.151 + const Elf_Shdr *shdr; 4.152 Elf_Addr kernstart = ~0, kernend = 0, vaddr, virt_entry; 4.153 const char *shstrtab, *p; 4.154 int h, virt_base_defined, elf_pa_off_defined, virt_entry_defined; 4.155 @@ -331,12 +334,13 @@ static int parseelfimage(const char *ima 4.156 /* Look for .notes segment containing at least one Xen note */ 4.157 for ( h = 0; h < ehdr->e_shnum; h++ ) 4.158 { 4.159 - shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize)); 4.160 + shdr = (const Elf_Shdr *)( 4.161 + image + ehdr->e_shoff + (h*ehdr->e_shentsize)); 4.162 if ( !is_xen_elfnote_section(image, shdr) ) 4.163 continue; 4.164 - dsi->__elfnote_section = (void *)image + shdr->sh_offset; 4.165 + dsi->__elfnote_section = (const void *)image + shdr->sh_offset; 4.166 dsi->__elfnote_section_end = 4.167 - (void *)image + shdr->sh_offset + shdr->sh_size; 4.168 + (const void *)image + shdr->sh_offset + shdr->sh_size; 4.169 break; 4.170 } 4.171 4.172 @@ -350,16 +354,18 @@ static int parseelfimage(const char *ima 4.173 "ELF image has no section-header strings table."); 4.174 return -EINVAL; 4.175 } 4.176 - shdr = (Elf_Shdr *)(image + ehdr->e_shoff + 4.177 + shdr = (const Elf_Shdr *)(image + ehdr->e_shoff + 4.178 (ehdr->e_shstrndx*ehdr->e_shentsize)); 4.179 shstrtab = image + shdr->sh_offset; 4.180 4.181 for ( h = 0; h < ehdr->e_shnum; h++ ) 4.182 { 4.183 - shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize)); 4.184 + shdr = (const Elf_Shdr *)( 4.185 + image + ehdr->e_shoff + (h*ehdr->e_shentsize)); 4.186 if ( is_xen_guest_section(shdr, shstrtab) ) 4.187 { 4.188 - dsi->__xen_guest_string = (char *)image + shdr->sh_offset; 4.189 + dsi->__xen_guest_string = 4.190 + (const char *)image + shdr->sh_offset; 4.191 break; 4.192 } 4.193 } 4.194 @@ -442,8 +448,8 @@ static int parseelfimage(const char *ima 4.195 * If we are using the modern ELF notes interface then the default 4.196 * is 0. 4.197 */ 4.198 - dsi->elf_paddr_offset = 4.199 - xen_elfnote_numeric(dsi, XEN_ELFNOTE_PADDR_OFFSET, &elf_pa_off_defined); 4.200 + dsi->elf_paddr_offset = xen_elfnote_numeric(dsi, XEN_ELFNOTE_PADDR_OFFSET, 4.201 + &elf_pa_off_defined); 4.202 if ( !elf_pa_off_defined ) 4.203 { 4.204 if ( dsi->__elfnote_section ) 4.205 @@ -462,7 +468,8 @@ static int parseelfimage(const char *ima 4.206 4.207 for ( h = 0; h < ehdr->e_phnum; h++ ) 4.208 { 4.209 - phdr = (Elf_Phdr *)(image + ehdr->e_phoff + (h*ehdr->e_phentsize)); 4.210 + phdr = (const Elf_Phdr *)( 4.211 + image + ehdr->e_phoff + (h*ehdr->e_phentsize)); 4.212 if ( !is_loadable_phdr(phdr) ) 4.213 continue; 4.214 vaddr = phdr->p_paddr - dsi->elf_paddr_offset + dsi->v_start; 4.215 @@ -514,8 +521,8 @@ loadelfimage( 4.216 const char *image, unsigned long elfsize, int xch, uint32_t dom, 4.217 xen_pfn_t *parray, struct domain_setup_info *dsi) 4.218 { 4.219 - Elf_Ehdr *ehdr = (Elf_Ehdr *)image; 4.220 - Elf_Phdr *phdr; 4.221 + const Elf_Ehdr *ehdr = (const Elf_Ehdr *)image; 4.222 + const Elf_Phdr *phdr; 4.223 int h; 4.224 4.225 char *va; 4.226 @@ -523,7 +530,8 @@ loadelfimage( 4.227 4.228 for ( h = 0; h < ehdr->e_phnum; h++ ) 4.229 { 4.230 - phdr = (Elf_Phdr *)(image + ehdr->e_phoff + (h*ehdr->e_phentsize)); 4.231 + phdr = (const Elf_Phdr *)( 4.232 + image + ehdr->e_phoff + (h*ehdr->e_phentsize)); 4.233 if ( !is_loadable_phdr(phdr) ) 4.234 continue; 4.235 4.236 @@ -569,7 +577,8 @@ loadelfsymtab( 4.237 const char *image, int xch, uint32_t dom, xen_pfn_t *parray, 4.238 struct domain_setup_info *dsi) 4.239 { 4.240 - Elf_Ehdr *ehdr = (Elf_Ehdr *)image, *sym_ehdr; 4.241 + const Elf_Ehdr *ehdr = (const Elf_Ehdr *)image; 4.242 + Elf_Ehdr *sym_ehdr; 4.243 Elf_Shdr *shdr; 4.244 unsigned long maxva, symva; 4.245 char *p;
5.1 --- a/tools/libxc/xg_private.h Thu Dec 21 13:48:13 2006 +0000 5.2 +++ b/tools/libxc/xg_private.h Thu Dec 21 13:58:51 2006 +0000 5.3 @@ -146,7 +146,7 @@ struct domain_setup_info 5.4 * You should use the xen_elfnote_* accessors below in order to 5.5 * pickup the correct one and retain backwards compatibility. 5.6 */ 5.7 - void *__elfnote_section, *__elfnote_section_end; 5.8 + const void *__elfnote_section, *__elfnote_section_end; 5.9 const char *__xen_guest_string; 5.10 }; 5.11 5.12 @@ -162,14 +162,14 @@ typedef int (*loadimagefunc)(const char 5.13 * in the note is returned and *defined is set to non-zero. If no such 5.14 * note is found then *defined is set to 0 and 0 is returned. 5.15 */ 5.16 -extern unsigned long long xen_elfnote_numeric(struct domain_setup_info *dsi, 5.17 +extern unsigned long long xen_elfnote_numeric(const struct domain_setup_info *dsi, 5.18 int type, int *defined); 5.19 5.20 /* 5.21 * If an ELF note of the given type is found then the string contained 5.22 * in the value is returned, otherwise NULL is returned. 5.23 */ 5.24 -extern const char * xen_elfnote_string(struct domain_setup_info *dsi, 5.25 +extern const char * xen_elfnote_string(const struct domain_setup_info *dsi, 5.26 int type); 5.27 5.28 struct load_funcs
6.1 --- a/tools/xenstat/xentop/xentop.c Thu Dec 21 13:48:13 2006 +0000 6.2 +++ b/tools/xenstat/xentop/xentop.c Thu Dec 21 13:58:51 2006 +0000 6.3 @@ -269,7 +269,7 @@ static void print(const char *fmt, ...) 6.4 if (!batch) { 6.5 if((current_row() < lines()-1)) { 6.6 va_start(args, fmt); 6.7 - vwprintw(stdscr, (char *)fmt, args); 6.8 + vwprintw(stdscr, (const char *)fmt, args); 6.9 va_end(args); 6.10 } 6.11 } else { 6.12 @@ -283,7 +283,7 @@ static void print(const char *fmt, ...) 6.13 static void attr_addstr(int attr, const char *str) 6.14 { 6.15 attron(attr); 6.16 - addstr((char *)str); 6.17 + addstr((const char *)str); 6.18 attroff(attr); 6.19 } 6.20
7.1 --- a/tools/xenstore/list.h Thu Dec 21 13:48:13 2006 +0000 7.2 +++ b/tools/xenstore/list.h Thu Dec 21 13:58:51 2006 +0000 7.3 @@ -12,7 +12,7 @@ 7.4 #define LIST_POISON2 ((void *) 0x00200200) 7.5 7.6 #define container_of(ptr, type, member) ({ \ 7.7 - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 7.8 + typeof( ((type *)0)->member ) *__mptr = (ptr); \ 7.9 (type *)( (char *)__mptr - offsetof(type,member) );}) 7.10 7.11 /*
8.1 --- a/xen/arch/x86/domain_build.c Thu Dec 21 13:48:13 2006 +0000 8.2 +++ b/xen/arch/x86/domain_build.c Thu Dec 21 13:58:51 2006 +0000 8.3 @@ -55,12 +55,12 @@ static long dom0_nrpages, dom0_min_nrpag 8.4 * If +ve: The specified amount is an absolute value. 8.5 * If -ve: The specified amount is subtracted from total available memory. 8.6 */ 8.7 -static long parse_amt(char *s, char **ps) 8.8 +static long parse_amt(const char *s, const char **ps) 8.9 { 8.10 long pages = parse_size_and_unit((*s == '-') ? s+1 : s, ps) >> PAGE_SHIFT; 8.11 return (*s == '-') ? -pages : pages; 8.12 } 8.13 -static void parse_dom0_mem(char *s) 8.14 +static void parse_dom0_mem(const char *s) 8.15 { 8.16 do { 8.17 if ( !strncmp(s, "min:", 4) ) 8.18 @@ -152,7 +152,8 @@ static unsigned long compute_dom0_nr_pag 8.19 static void process_dom0_ioports_disable(void) 8.20 { 8.21 unsigned long io_from, io_to; 8.22 - char *t, *u, *s = opt_dom0_ioports_disable; 8.23 + char *t, *s = opt_dom0_ioports_disable; 8.24 + const char *u; 8.25 8.26 if ( *s == '\0' ) 8.27 return; 8.28 @@ -892,7 +893,7 @@ int construct_dom0(struct domain *d, 8.29 return 0; 8.30 } 8.31 8.32 -int elf_sanity_check(Elf_Ehdr *ehdr) 8.33 +int elf_sanity_check(const Elf_Ehdr *ehdr) 8.34 { 8.35 if ( !IS_ELF(*ehdr) || 8.36 #if defined(__i386__)
9.1 --- a/xen/arch/x86/time.c Thu Dec 21 13:48:13 2006 +0000 9.2 +++ b/xen/arch/x86/time.c Thu Dec 21 13:58:51 2006 +0000 9.3 @@ -41,7 +41,7 @@ boolean_param("hpet_force", opt_hpet_for 9.4 unsigned long cpu_khz; /* CPU clock frequency in kHz. */ 9.5 unsigned long hpet_address; 9.6 DEFINE_SPINLOCK(rtc_lock); 9.7 -unsigned long volatile jiffies; 9.8 +volatile unsigned long jiffies; 9.9 static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */ 9.10 static DEFINE_SPINLOCK(wc_lock); 9.11 9.12 @@ -148,7 +148,7 @@ void timer_interrupt(int irq, void *dev_ 9.13 ASSERT(local_irq_is_enabled()); 9.14 9.15 /* Update jiffies counter. */ 9.16 - (*(unsigned long *)&jiffies)++; 9.17 + (*(volatile unsigned long *)&jiffies)++; 9.18 9.19 /* Rough hack to allow accurate timers to sort-of-work with no APIC. */ 9.20 if ( !cpu_has_apic )
10.1 --- a/xen/common/elf.c Thu Dec 21 13:48:13 2006 +0000 10.2 +++ b/xen/common/elf.c Thu Dec 21 13:58:51 2006 +0000 10.3 @@ -16,7 +16,7 @@ 10.4 #include <public/elfnote.h> 10.5 10.6 static void loadelfsymtab(struct domain_setup_info *dsi, int doload); 10.7 -static inline int is_loadable_phdr(Elf_Phdr *phdr) 10.8 +static inline int is_loadable_phdr(const Elf_Phdr *phdr) 10.9 { 10.10 return ((phdr->p_type == PT_LOAD) && 10.11 ((phdr->p_flags & (PF_W|PF_X)) != 0)); 10.12 @@ -26,7 +26,7 @@ static inline int is_loadable_phdr(Elf_P 10.13 * Fallback for kernels containing only the legacy __xen_guest string 10.14 * and no ELF notes. 10.15 */ 10.16 -static int is_xen_guest_section(Elf_Shdr *shdr, const char *shstrtab) 10.17 +static int is_xen_guest_section(const Elf_Shdr *shdr, const char *shstrtab) 10.18 { 10.19 return strcmp(&shstrtab[shdr->sh_name], "__xen_guest") == 0; 10.20 } 10.21 @@ -102,19 +102,19 @@ static unsigned long long xen_guest_nume 10.22 /* 10.23 * Interface to the Xen ELF notes. 10.24 */ 10.25 -#define ELFNOTE_NAME(_n_) ((void*)(_n_) + sizeof(*(_n_))) 10.26 +#define ELFNOTE_NAME(_n_) ((const void*)(_n_) + sizeof(*(_n_))) 10.27 #define ELFNOTE_DESC(_n_) (ELFNOTE_NAME(_n_) + (((_n_)->namesz+3)&~3)) 10.28 #define ELFNOTE_NEXT(_n_) (ELFNOTE_DESC(_n_) + (((_n_)->descsz+3)&~3)) 10.29 10.30 -static int is_xen_elfnote_section(const char *image, Elf_Shdr *shdr) 10.31 +static int is_xen_elfnote_section(const char *image, const Elf_Shdr *shdr) 10.32 { 10.33 - Elf_Note *note; 10.34 + const Elf_Note *note; 10.35 10.36 if ( shdr->sh_type != SHT_NOTE ) 10.37 return 0; 10.38 10.39 - for ( note = (Elf_Note *)(image + shdr->sh_offset); 10.40 - note < (Elf_Note *)(image + shdr->sh_offset + shdr->sh_size); 10.41 + for ( note = (const Elf_Note *)(image + shdr->sh_offset); 10.42 + note < (const Elf_Note *)(image + shdr->sh_offset + shdr->sh_size); 10.43 note = ELFNOTE_NEXT(note) ) 10.44 { 10.45 if ( !strncmp(ELFNOTE_NAME(note), "Xen", 4) ) 10.46 @@ -124,15 +124,16 @@ static int is_xen_elfnote_section(const 10.47 return 0; 10.48 } 10.49 10.50 -static Elf_Note *xen_elfnote_lookup(struct domain_setup_info *dsi, int type) 10.51 +static const Elf_Note *xen_elfnote_lookup( 10.52 + struct domain_setup_info *dsi, int type) 10.53 { 10.54 - Elf_Note *note; 10.55 + const Elf_Note *note; 10.56 10.57 if ( !dsi->__elfnote_section ) 10.58 return NULL; 10.59 10.60 - for ( note = (Elf_Note *)dsi->__elfnote_section; 10.61 - note < (Elf_Note *)dsi->__elfnote_section_end; 10.62 + for ( note = (const Elf_Note *)dsi->__elfnote_section; 10.63 + note < (const Elf_Note *)dsi->__elfnote_section_end; 10.64 note = ELFNOTE_NEXT(note) ) 10.65 { 10.66 if ( strncmp(ELFNOTE_NAME(note), "Xen", 4) ) 10.67 @@ -147,7 +148,7 @@ static Elf_Note *xen_elfnote_lookup(stru 10.68 10.69 const char *xen_elfnote_string(struct domain_setup_info *dsi, int type) 10.70 { 10.71 - Elf_Note *note; 10.72 + const Elf_Note *note; 10.73 10.74 if ( !dsi->__elfnote_section ) 10.75 return xen_guest_string(dsi, type); 10.76 @@ -162,7 +163,7 @@ const char *xen_elfnote_string(struct do 10.77 unsigned long long xen_elfnote_numeric(struct domain_setup_info *dsi, 10.78 int type, int *defined) 10.79 { 10.80 - Elf_Note *note; 10.81 + const Elf_Note *note; 10.82 10.83 *defined = 0; 10.84 10.85 @@ -179,10 +180,10 @@ unsigned long long xen_elfnote_numeric(s 10.86 { 10.87 case 4: 10.88 *defined = 1; 10.89 - return *(uint32_t*)ELFNOTE_DESC(note); 10.90 + return *(const uint32_t*)ELFNOTE_DESC(note); 10.91 case 8: 10.92 *defined = 1; 10.93 - return *(uint64_t*)ELFNOTE_DESC(note); 10.94 + return *(const uint64_t*)ELFNOTE_DESC(note); 10.95 default: 10.96 printk("ERROR: unknown data size %#x for numeric type note %#x\n", 10.97 note->descsz, type); 10.98 @@ -192,9 +193,9 @@ unsigned long long xen_elfnote_numeric(s 10.99 10.100 int parseelfimage(struct domain_setup_info *dsi) 10.101 { 10.102 - Elf_Ehdr *ehdr = (Elf_Ehdr *)dsi->image_addr; 10.103 - Elf_Phdr *phdr; 10.104 - Elf_Shdr *shdr; 10.105 + const Elf_Ehdr *ehdr = (const Elf_Ehdr *)dsi->image_addr; 10.106 + const Elf_Phdr *phdr; 10.107 + const Elf_Shdr *shdr; 10.108 Elf_Addr kernstart = ~0, kernend = 0, vaddr, virt_entry; 10.109 const char *shstrtab, *p; 10.110 const char *image = (char *)dsi->image_addr; 10.111 @@ -222,12 +223,13 @@ int parseelfimage(struct domain_setup_in 10.112 /* Look for .notes segment containing at least one Xen note */ 10.113 for ( h = 0; h < ehdr->e_shnum; h++ ) 10.114 { 10.115 - shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize)); 10.116 + shdr = (const Elf_Shdr *)( 10.117 + image + ehdr->e_shoff + (h*ehdr->e_shentsize)); 10.118 if ( !is_xen_elfnote_section(image, shdr) ) 10.119 continue; 10.120 - dsi->__elfnote_section = (void *)image + shdr->sh_offset; 10.121 + dsi->__elfnote_section = (const void *)image + shdr->sh_offset; 10.122 dsi->__elfnote_section_end = 10.123 - (void *)image + shdr->sh_offset + shdr->sh_size; 10.124 + (const void *)image + shdr->sh_offset + shdr->sh_size; 10.125 break; 10.126 } 10.127 10.128 @@ -240,16 +242,18 @@ int parseelfimage(struct domain_setup_in 10.129 printk("ELF image has no section-header strings table.\n"); 10.130 return -EINVAL; 10.131 } 10.132 - shdr = (Elf_Shdr *)(image + ehdr->e_shoff + 10.133 + shdr = (const Elf_Shdr *)(image + ehdr->e_shoff + 10.134 (ehdr->e_shstrndx*ehdr->e_shentsize)); 10.135 shstrtab = image + shdr->sh_offset; 10.136 10.137 for ( h = 0; h < ehdr->e_shnum; h++ ) 10.138 { 10.139 - shdr = (Elf_Shdr *)(image + ehdr->e_shoff + (h*ehdr->e_shentsize)); 10.140 + shdr = (const Elf_Shdr *)( 10.141 + image + ehdr->e_shoff + (h*ehdr->e_shentsize)); 10.142 if ( is_xen_guest_section(shdr, shstrtab) ) 10.143 { 10.144 - dsi->__xen_guest_string = (char *)image + shdr->sh_offset; 10.145 + dsi->__xen_guest_string = 10.146 + (const char *)image + shdr->sh_offset; 10.147 break; 10.148 } 10.149 } 10.150 @@ -327,8 +331,8 @@ int parseelfimage(struct domain_setup_in 10.151 * If we are using the modern ELF notes interface then the default 10.152 * is 0. 10.153 */ 10.154 - dsi->elf_paddr_offset = 10.155 - xen_elfnote_numeric(dsi, XEN_ELFNOTE_PADDR_OFFSET, &elf_pa_off_defined); 10.156 + dsi->elf_paddr_offset = xen_elfnote_numeric(dsi, XEN_ELFNOTE_PADDR_OFFSET, 10.157 + &elf_pa_off_defined); 10.158 if ( !elf_pa_off_defined ) 10.159 { 10.160 if ( dsi->__elfnote_section ) 10.161 @@ -346,7 +350,8 @@ int parseelfimage(struct domain_setup_in 10.162 10.163 for ( h = 0; h < ehdr->e_phnum; h++ ) 10.164 { 10.165 - phdr = (Elf_Phdr *)(image + ehdr->e_phoff + (h*ehdr->e_phentsize)); 10.166 + phdr = (const Elf_Phdr *)( 10.167 + image + ehdr->e_phoff + (h*ehdr->e_phentsize)); 10.168 if ( !is_loadable_phdr(phdr) ) 10.169 continue; 10.170 vaddr = phdr->p_paddr - dsi->elf_paddr_offset + dsi->v_start;
11.1 --- a/xen/common/kernel.c Thu Dec 21 13:48:13 2006 +0000 11.2 +++ b/xen/common/kernel.c Thu Dec 21 13:58:51 2006 +0000 11.3 @@ -20,7 +20,8 @@ int tainted; 11.4 11.5 void cmdline_parse(char *cmdline) 11.6 { 11.7 - char opt[100], *optval, *p = cmdline, *q; 11.8 + char opt[100], *optval, *q; 11.9 + const char *p = cmdline; 11.10 struct kernel_param *param; 11.11 11.12 if ( p == NULL ) 11.13 @@ -70,13 +71,13 @@ void cmdline_parse(char *cmdline) 11.14 break; 11.15 case OPT_UINT: 11.16 *(unsigned int *)param->var = 11.17 - simple_strtol(optval, (char **)&optval, 0); 11.18 + simple_strtol(optval, (const char **)&optval, 0); 11.19 break; 11.20 case OPT_BOOL: 11.21 *(int *)param->var = 1; 11.22 break; 11.23 case OPT_CUSTOM: 11.24 - ((void (*)(char *))param->var)(optval); 11.25 + ((void (*)(const char *))param->var)(optval); 11.26 break; 11.27 } 11.28 }
12.1 --- a/xen/common/kexec.c Thu Dec 21 13:48:13 2006 +0000 12.2 +++ b/xen/common/kexec.c Thu Dec 21 13:58:51 2006 +0000 12.3 @@ -37,7 +37,7 @@ spinlock_t kexec_lock = SPIN_LOCK_UNLOCK 12.4 12.5 xen_kexec_reserve_t kexec_crash_area; 12.6 12.7 -static void __init parse_crashkernel(char *str) 12.8 +static void __init parse_crashkernel(const char *str) 12.9 { 12.10 unsigned long start, size; 12.11
13.1 --- a/xen/common/lib.c Thu Dec 21 13:48:13 2006 +0000 13.2 +++ b/xen/common/lib.c Thu Dec 21 13:58:51 2006 +0000 13.3 @@ -439,11 +439,14 @@ s64 __moddi3(s64 a, s64 b) 13.4 13.5 #endif /* BITS_PER_LONG == 32 */ 13.6 13.7 -unsigned long long parse_size_and_unit(const char *s, char **ps) 13.8 +unsigned long long parse_size_and_unit(const char *s, const char **ps) 13.9 { 13.10 - unsigned long long ret = simple_strtoull(s, (char **)&s, 0); 13.11 + unsigned long long ret; 13.12 + const char *s1; 13.13 13.14 - switch (*s) { 13.15 + ret = simple_strtoull(s, &s1, 0); 13.16 + 13.17 + switch (*s1) { 13.18 case 'G': case 'g': 13.19 ret <<= 10; 13.20 case 'M': case 'm': 13.21 @@ -459,7 +462,7 @@ unsigned long long parse_size_and_unit(c 13.22 } 13.23 13.24 if (ps != NULL) 13.25 - *ps = (char *)s; 13.26 + *ps = s1; 13.27 13.28 return ret; 13.29 }
14.1 --- a/xen/common/page_alloc.c Thu Dec 21 13:48:13 2006 +0000 14.2 +++ b/xen/common/page_alloc.c Thu Dec 21 13:58:51 2006 +0000 14.3 @@ -197,7 +197,7 @@ paddr_t init_boot_allocator(paddr_t bitm 14.4 void init_boot_pages(paddr_t ps, paddr_t pe) 14.5 { 14.6 unsigned long bad_spfn, bad_epfn, i; 14.7 - char *p; 14.8 + const char *p; 14.9 14.10 ps = round_pgup(ps); 14.11 pe = round_pgdown(pe);
15.1 --- a/xen/common/time.c Thu Dec 21 13:48:13 2006 +0000 15.2 +++ b/xen/common/time.c Thu Dec 21 13:58:51 2006 +0000 15.3 @@ -40,7 +40,7 @@ struct tm gmtime(unsigned long t) 15.4 struct tm tbuf; 15.5 long days, rem; 15.6 int y; 15.7 - unsigned short int *ip; 15.8 + const unsigned short int *ip; 15.9 15.10 days = t / SECS_PER_DAY; 15.11 rem = t % SECS_PER_DAY; 15.12 @@ -66,7 +66,7 @@ struct tm gmtime(unsigned long t) 15.13 } 15.14 tbuf.tm_year = y - 1900; 15.15 tbuf.tm_yday = days; 15.16 - ip = (unsigned short int *)__mon_lengths[__isleap(y)]; 15.17 + ip = (const unsigned short int *)__mon_lengths[__isleap(y)]; 15.18 for ( y = 0; days >= ip[y]; ++y ) 15.19 days -= ip[y]; 15.20 tbuf.tm_mon = y;
16.1 --- a/xen/common/vsprintf.c Thu Dec 21 13:48:13 2006 +0000 16.2 +++ b/xen/common/vsprintf.c Thu Dec 21 13:58:51 2006 +0000 16.3 @@ -28,7 +28,8 @@ 16.4 * @endp: A pointer to the end of the parsed string will be placed here 16.5 * @base: The number base to use 16.6 */ 16.7 -unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) 16.8 +unsigned long simple_strtoul( 16.9 + const char *cp, const char **endp, unsigned int base) 16.10 { 16.11 unsigned long result = 0,value; 16.12 16.13 @@ -52,7 +53,7 @@ unsigned long simple_strtoul(const char 16.14 cp++; 16.15 } 16.16 if (endp) 16.17 - *endp = (char *)cp; 16.18 + *endp = cp; 16.19 return result; 16.20 } 16.21 16.22 @@ -64,7 +65,7 @@ EXPORT_SYMBOL(simple_strtoul); 16.23 * @endp: A pointer to the end of the parsed string will be placed here 16.24 * @base: The number base to use 16.25 */ 16.26 -long simple_strtol(const char *cp,char **endp,unsigned int base) 16.27 +long simple_strtol(const char *cp, const char **endp, unsigned int base) 16.28 { 16.29 if(*cp=='-') 16.30 return -simple_strtoul(cp+1,endp,base); 16.31 @@ -79,7 +80,8 @@ EXPORT_SYMBOL(simple_strtol); 16.32 * @endp: A pointer to the end of the parsed string will be placed here 16.33 * @base: The number base to use 16.34 */ 16.35 -unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base) 16.36 +unsigned long long simple_strtoull( 16.37 + const char *cp, const char **endp, unsigned int base) 16.38 { 16.39 unsigned long long result = 0,value; 16.40 16.41 @@ -103,7 +105,7 @@ unsigned long long simple_strtoull(const 16.42 cp++; 16.43 } 16.44 if (endp) 16.45 - *endp = (char *)cp; 16.46 + *endp = cp; 16.47 return result; 16.48 } 16.49 16.50 @@ -115,7 +117,7 @@ EXPORT_SYMBOL(simple_strtoull); 16.51 * @endp: A pointer to the end of the parsed string will be placed here 16.52 * @base: The number base to use 16.53 */ 16.54 -long long simple_strtoll(const char *cp,char **endp,unsigned int base) 16.55 +long long simple_strtoll(const char *cp,const char **endp,unsigned int base) 16.56 { 16.57 if(*cp=='-') 16.58 return -simple_strtoull(cp+1,endp,base); 16.59 @@ -139,7 +141,9 @@ static int skip_atoi(const char **s) 16.60 #define SPECIAL 32 /* 0x */ 16.61 #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ 16.62 16.63 -static char * number(char * buf, char * end, unsigned long long num, int base, int size, int precision, int type) 16.64 +static char *number( 16.65 + char *buf, char *end, unsigned long long num, 16.66 + int base, int size, int precision, int type) 16.67 { 16.68 char c,sign,tmp[66]; 16.69 const char *digits;
17.1 --- a/xen/common/xmalloc.c Thu Dec 21 13:48:13 2006 +0000 17.2 +++ b/xen/common/xmalloc.c Thu Dec 21 13:58:51 2006 +0000 17.3 @@ -87,7 +87,7 @@ static void *data_from_header(struct xma 17.4 #endif 17.5 } 17.6 17.7 -static struct xmalloc_hdr *header_from_data(const void *p) 17.8 +static struct xmalloc_hdr *header_from_data(void *p) 17.9 { 17.10 #if XMALLOC_DEBUG 17.11 unsigned char *data = (unsigned char *)p - SMP_CACHE_BYTES; 17.12 @@ -208,7 +208,7 @@ void *_xmalloc(size_t size, size_t align 17.13 return xmalloc_new_page(size); 17.14 } 17.15 17.16 -void xfree(const void *p) 17.17 +void xfree(void *p) 17.18 { 17.19 unsigned long flags; 17.20 struct xmalloc_hdr *i, *tmp, *hdr;
18.1 --- a/xen/drivers/char/ns16550.c Thu Dec 21 13:48:13 2006 +0000 18.2 +++ b/xen/drivers/char/ns16550.c Thu Dec 21 13:58:51 2006 +0000 18.3 @@ -300,7 +300,7 @@ static int parse_parity_char(int c) 18.4 return; \ 18.5 } while ( 0 ) 18.6 18.7 -static void ns16550_parse_port_config(struct ns16550 *uart, char *conf) 18.8 +static void ns16550_parse_port_config(struct ns16550 *uart, const char *conf) 18.9 { 18.10 int baud; 18.11
19.1 --- a/xen/include/asm-x86/bitops.h Thu Dec 21 13:48:13 2006 +0000 19.2 +++ b/xen/include/asm-x86/bitops.h Thu Dec 21 13:58:51 2006 +0000 19.3 @@ -288,7 +288,7 @@ static inline unsigned int __scanbit(uns 19.4 */ 19.5 #define find_first_bit(addr,size) \ 19.6 ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ 19.7 - (__scanbit(*(unsigned long *)addr)) : \ 19.8 + (__scanbit(*(const unsigned long *)addr)) : \ 19.9 __find_first_bit(addr,size))) 19.10 19.11 /** 19.12 @@ -299,7 +299,7 @@ static inline unsigned int __scanbit(uns 19.13 */ 19.14 #define find_next_bit(addr,size,off) \ 19.15 ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ 19.16 - ((off) + (__scanbit((*(unsigned long *)addr) >> (off)))) : \ 19.17 + ((off) + (__scanbit((*(const unsigned long *)addr) >> (off)))) : \ 19.18 __find_next_bit(addr,size,off))) 19.19 19.20 /** 19.21 @@ -312,7 +312,7 @@ static inline unsigned int __scanbit(uns 19.22 */ 19.23 #define find_first_zero_bit(addr,size) \ 19.24 ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ 19.25 - (__scanbit(~*(unsigned long *)addr)) : \ 19.26 + (__scanbit(~*(const unsigned long *)addr)) : \ 19.27 __find_first_zero_bit(addr,size))) 19.28 19.29 /** 19.30 @@ -323,7 +323,7 @@ static inline unsigned int __scanbit(uns 19.31 */ 19.32 #define find_next_zero_bit(addr,size,off) \ 19.33 ((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ 19.34 - ((off)+(__scanbit(~(((*(unsigned long *)addr)) >> (off))))) : \ 19.35 + ((off)+(__scanbit(~(((*(const unsigned long *)addr)) >> (off))))) : \ 19.36 __find_next_zero_bit(addr,size,off))) 19.37 19.38
20.1 --- a/xen/include/asm-x86/system.h Thu Dec 21 13:48:13 2006 +0000 20.2 +++ b/xen/include/asm-x86/system.h Thu Dec 21 13:58:51 2006 +0000 20.3 @@ -19,7 +19,7 @@ 20.4 #define xchg(ptr,v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr)))) 20.5 20.6 struct __xchg_dummy { unsigned long a[100]; }; 20.7 -#define __xg(x) ((struct __xchg_dummy *)(x)) 20.8 +#define __xg(x) ((volatile struct __xchg_dummy *)(x)) 20.9 20.10 20.11 /*
21.1 --- a/xen/include/asm-x86/uaccess.h Thu Dec 21 13:48:13 2006 +0000 21.2 +++ b/xen/include/asm-x86/uaccess.h Thu Dec 21 13:58:51 2006 +0000 21.3 @@ -140,7 +140,7 @@ extern void __put_user_bad(void); 21.4 }) 21.5 21.6 struct __large_struct { unsigned long buf[100]; }; 21.7 -#define __m(x) (*(struct __large_struct *)(x)) 21.8 +#define __m(x) (*(const struct __large_struct *)(x)) 21.9 21.10 /* 21.11 * Tell gcc we read from memory instead of writing: this is because 21.12 @@ -200,16 +200,16 @@ static always_inline unsigned long 21.13 21.14 switch (n) { 21.15 case 1: 21.16 - __put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret, 1); 21.17 + __put_user_size(*(const u8 *)from, (u8 __user *)to, 1, ret, 1); 21.18 return ret; 21.19 case 2: 21.20 - __put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret, 2); 21.21 + __put_user_size(*(const u16 *)from, (u16 __user *)to, 2, ret, 2); 21.22 return ret; 21.23 case 4: 21.24 - __put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret, 4); 21.25 + __put_user_size(*(const u32 *)from, (u32 __user *)to, 4, ret, 4); 21.26 return ret; 21.27 case 8: 21.28 - __put_user_size(*(u64 *)from, (u64 __user *)to, 8, ret, 8); 21.29 + __put_user_size(*(const u64 *)from, (u64 __user *)to, 8, ret, 8); 21.30 return ret; 21.31 } 21.32 }
22.1 --- a/xen/include/xen/elf.h Thu Dec 21 13:48:13 2006 +0000 22.2 +++ b/xen/include/xen/elf.h Thu Dec 21 13:58:51 2006 +0000 22.3 @@ -526,7 +526,7 @@ extern unsigned long long xen_elfnote_nu 22.4 extern const char *xen_elfnote_string(struct domain_setup_info *dsi, int type); 22.5 22.6 #ifdef Elf_Ehdr 22.7 -extern int elf_sanity_check(Elf_Ehdr *ehdr); 22.8 +extern int elf_sanity_check(const Elf_Ehdr *ehdr); 22.9 #endif 22.10 22.11 #endif /* __XEN_ELF_H__ */
23.1 --- a/xen/include/xen/kernel.h Thu Dec 21 13:48:13 2006 +0000 23.2 +++ b/xen/include/xen/kernel.h Thu Dec 21 13:58:51 2006 +0000 23.3 @@ -41,19 +41,19 @@ 23.4 * @member: the name of the member within the struct. 23.5 * 23.6 */ 23.7 -#define container_of(ptr, type, member) ({ \ 23.8 - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 23.9 +#define container_of(ptr, type, member) ({ \ 23.10 + typeof( ((type *)0)->member ) *__mptr = (ptr); \ 23.11 (type *)( (char *)__mptr - offsetof(type,member) );}) 23.12 23.13 /* 23.14 * Check at compile time that something is of a particular type. 23.15 * Always evaluates to 1 so you may use it easily in comparisons. 23.16 */ 23.17 -#define typecheck(type,x) \ 23.18 -({ type __dummy; \ 23.19 - typeof(x) __dummy2; \ 23.20 - (void)(&__dummy == &__dummy2); \ 23.21 - 1; \ 23.22 +#define typecheck(type,x) \ 23.23 +({ type __dummy; \ 23.24 + typeof(x) __dummy2; \ 23.25 + (void)(&__dummy == &__dummy2); \ 23.26 + 1; \ 23.27 }) 23.28 23.29
24.1 --- a/xen/include/xen/lib.h Thu Dec 21 13:48:13 2006 +0000 24.2 +++ b/xen/include/xen/lib.h Thu Dec 21 13:58:51 2006 +0000 24.3 @@ -74,15 +74,15 @@ extern int vscnprintf(char *buf, size_t 24.4 __attribute__ ((format (printf, 3, 0))); 24.5 24.6 long simple_strtol( 24.7 - const char *cp,char **endp, unsigned int base); 24.8 + const char *cp,const char **endp, unsigned int base); 24.9 unsigned long simple_strtoul( 24.10 - const char *cp,char **endp, unsigned int base); 24.11 + const char *cp,const char **endp, unsigned int base); 24.12 long long simple_strtoll( 24.13 - const char *cp,char **endp, unsigned int base); 24.14 + const char *cp,const char **endp, unsigned int base); 24.15 unsigned long long simple_strtoull( 24.16 - const char *cp,char **endp, unsigned int base); 24.17 + const char *cp,const char **endp, unsigned int base); 24.18 24.19 -unsigned long long parse_size_and_unit(const char *s, char **ps); 24.20 +unsigned long long parse_size_and_unit(const char *s, const char **ps); 24.21 24.22 #define TAINT_UNSAFE_SMP (1<<0) 24.23 #define TAINT_MACHINE_CHECK (1<<1)
25.1 --- a/xen/include/xen/sched.h Thu Dec 21 13:48:13 2006 +0000 25.2 +++ b/xen/include/xen/sched.h Thu Dec 21 13:58:51 2006 +0000 25.3 @@ -202,8 +202,8 @@ struct domain_setup_info 25.4 * You should use the xen_elfnote_* accessors below in order to 25.5 * pickup the correct one and retain backwards compatibility. 25.6 */ 25.7 - void *__elfnote_section, *__elfnote_section_end; 25.8 - char *__xen_guest_string; 25.9 + const void *__elfnote_section, *__elfnote_section_end; 25.10 + const char *__xen_guest_string; 25.11 }; 25.12 25.13 extern struct vcpu *idle_vcpu[NR_CPUS];
26.1 --- a/xen/include/xen/xmalloc.h Thu Dec 21 13:48:13 2006 +0000 26.2 +++ b/xen/include/xen/xmalloc.h Thu Dec 21 13:58:51 2006 +0000 26.3 @@ -12,7 +12,7 @@ 26.4 #define xmalloc_bytes(_bytes) (_xmalloc(_bytes, SMP_CACHE_BYTES)) 26.5 26.6 /* Free any of the above. */ 26.7 -extern void xfree(const void *); 26.8 +extern void xfree(void *); 26.9 26.10 /* Underlying functions */ 26.11 extern void *_xmalloc(size_t size, size_t align);