All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch-2.6.x] fix compile failure if CONFIG_PROC_KCORE not set.
@ 2004-12-03 17:01 Tigran Aivazian
  2004-12-03 17:08 ` Russell King
  0 siblings, 1 reply; 2+ messages in thread
From: Tigran Aivazian @ 2004-12-03 17:01 UTC (permalink / raw)
  To: linux-kernel

Hello,

I know that /proc/kcore support cannot be disabled by normal means but 
since it is conditional upon CONFIG_PROC_KCORE in fs/proc/Makefile it 
makes sense to make sure that kernel compiles even if it is disabled 
manually by editing .config and include/linux/autoconf.h or if in the 
future CONFIG_PROC_KCORE becomes a real CONFIG_ variable.

The patch below only fixes i386 arch. Similar changes are needed for ia64, 
ppc64 and x86_64 architectures (trivial to do but I don't like sending 
untested patches). Note that the proc initialization part in 
fs/proc/proc_misc.c was already correctly checking CONFIG_PROC_KCORE so it 
didn't need fixing. Tested that the kernel compiles and boots fine.

Probably CONFIG_PROC_KCORE should be added to a Kconfig to make this more 
useful.

Kind regards
Tigran

--- arch/i386/mm/init.c.0	2004-12-03 16:24:55.000000000 +0000
+++ arch/i386/mm/init.c	2004-12-03 16:25:34.182931952 +0000
@@ -559,7 +559,9 @@
  extern void set_max_mapnr_init(void);
  #endif /* !CONFIG_DISCONTIGMEM */

+#ifdef CONFIG_PROC_KCORE
  static struct kcore_list kcore_mem, kcore_vmalloc; 
+#endif

  void __init mem_init(void)
  {
@@ -610,9 +612,11 @@
  	datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
  	initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;

+#ifdef CONFIG_PROC_KCORE
  	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
  	kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
  		   VMALLOC_END-VMALLOC_START);
+#endif

  	printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
  		(unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
--- include/linux/proc_fs.h.0	2004-12-03 16:31:28.177116656 +0000
+++ include/linux/proc_fs.h	2004-12-03 16:44:52.383858648 +0000
@@ -68,11 +68,13 @@
  	int deleted;		/* delete flag */
  };

+#ifdef CONFIG_PROC_KCORE
  struct kcore_list {
  	struct kcore_list *next;
  	unsigned long addr;
  	size_t size;
  };
+#endif

  #ifdef CONFIG_PROC_FS

@@ -221,15 +223,7 @@

  #endif /* CONFIG_PROC_FS */

-#if !defined(CONFIG_PROC_FS)
-static inline void kclist_add(struct kcore_list *new, void *addr, size_t size)
-{
-}
-static inline struct kcore_list * kclist_del(void *addr)
-{
-	return NULL;
-}
-#else
+#ifdef CONFIG_PROC_KCORE
  extern void kclist_add(struct kcore_list *, void *, size_t);
  extern struct kcore_list *kclist_del(void *);
  #endif

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch-2.6.x] fix compile failure if CONFIG_PROC_KCORE not set.
  2004-12-03 17:01 [patch-2.6.x] fix compile failure if CONFIG_PROC_KCORE not set Tigran Aivazian
@ 2004-12-03 17:08 ` Russell King
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King @ 2004-12-03 17:08 UTC (permalink / raw)
  To: Tigran Aivazian; +Cc: linux-kernel

On Fri, Dec 03, 2004 at 05:01:57PM +0000, Tigran Aivazian wrote:
> I know that /proc/kcore support cannot be disabled by normal means but 
> since it is conditional upon CONFIG_PROC_KCORE in fs/proc/Makefile it 
> makes sense to make sure that kernel compiles even if it is disabled 
> manually by editing .config and include/linux/autoconf.h or if in the 
> future CONFIG_PROC_KCORE becomes a real CONFIG_ variable.

CONFIG_PROC_KCORE currently exists to allow ARM and others to drop
the nonfunctional /proc/kcore support from the kernel.  It wasn't
intended to be a configuration option as such.

However, if you wish it to be so, there's no problem provided that
the architectures are fixed up as you've done for x86, and that the
ability for certain architectures to ensure that this is never
selected is preserved.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-03 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-03 17:01 [patch-2.6.x] fix compile failure if CONFIG_PROC_KCORE not set Tigran Aivazian
2004-12-03 17:08 ` Russell King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.