docsrc: build Documentation/ sources
Subsystems (7)
PATCH 1/5 docsrc: build Documentation/ sources
From: Randy Dunlap <[email protected]>
Currently source files in the Documentation/ sub-dir can easily bit-rot since they are not generally buildable, either because they are hidden in text files or because there are no Makefile rules for them. This needs to be fixed so that the source files remain usable and good examples of code instead of bad examples.
Add the ability to build source files that are in the Documentation/ dir. Add to Kconfig as "BUILD_DOCSRC" config symbol.
Use "CONFIG_BUILD_DOCSRC=1 make ..." to build objects from the Documentation/ sources. Or enable BUILD_DOCSRC in the *config system. However, this symbol depends on HEADERS_CHECK since the header files need to be installed (for userspace builds).
Built (using cross-tools) for x86-64, i386, alpha, ia64, sparc32, sparc64, powerpc, sh, m68k, & mips.
--- Documentation/DocBook/Makefile | 7 +++++++ Documentation/Makefile | 3 +++ Documentation/accounting/Makefile | 10 ++++++++++ Documentation/auxdisplay/Makefile | 10 ++++++++++ Documentation/connector/Makefile | 11 +++++++++++ Documentation/filesystems/configfs/Makefile | 3 +++ Documentation/ia64/Makefile | 8 ++++++++ Documentation/networking/Makefile | 8 ++++++++ Documentation/pcmcia/Makefile | 10 ++++++++++ Documentation/spi/Makefile | 11 +++++++++++ Documentation/video4linux/Makefile | 8 ++++++++ Documentation/vm/Makefile | 8 ++++++++ Documentation/watchdog/src/Makefile | 8 ++++++++ Makefile | 5 ++++- lib/Kconfig.debug | 9 +++++++++ 15 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 Documentation/Makefile create mode 100644 Documentation/accounting/Makefile
Documentation/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-m := DocBook/ accounting/ auxdisplay/ connector/ \ + filesystems/configfs/ ia64/ networking/ \ + pcmcia/ spi/ video4linux/ vm/ watchdog/src/
Documentation/accounting/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# kbuild trick to avoid linker error. Can be omitted if a module is built. +obj- := dummy.o + +# List of programs to build +hostprogs-y := getdelays + +# Tell kbuild to always build the programs +always := $(hostprogs-y) + +HOSTCFLAGS_getdelays.o += -I$(objtree)/usr/include
Makefile +4 -1
@@ -823,6 +823,9 @@ endif ifdef CONFIG_SAMPLES $(Q)$(MAKE) $(build)=samples endif +ifdef CONFIG_BUILD_DOCSRC + $(Q)$(MAKE) $(build)=Documentation +endif $(call vmlinux-modpost) $(call if_changed_rule,vmlinux__) $(Q)rm -f .old_version
@@ -1167,7 +1170,7 @@ MRPROPER_FILES += .config .config.old in # clean: rm-dirs := $(CLEAN_DIRS) clean: rm-files := $(CLEAN_FILES) -clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs)) +clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs) Documentation) PHONY += $(clean-dirs) clean archclean $(clean-dirs):
Documentation/DocBook/Makefile +7 -0
@@ -102,6 +102,13 @@ C-procfs-example = procfs_example.xml C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example)) $(obj)/procfs-guide.xml: $(C-procfs-example2) +# List of programs to build +##oops, this is a kernel module::hostprogs-y := procfs_example +obj-m += procfs_example.o + +# Tell kbuild to always build the programs +always := $(hostprogs-y) + notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \ exit 1 db2xtemplate = db2TYPE -o $(dir $@) $<
Documentation/auxdisplay/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# kbuild trick to avoid linker error. Can be omitted if a module is built. +obj- := dummy.o + +# List of programs to build +hostprogs-y := cfag12864b-example + +# Tell kbuild to always build the programs +always := $(hostprogs-y) + +HOSTCFLAGS_cfag12864b-example.o += -I$(objtree)/usr/include
Documentation/connector/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +ifneq ($(CONFIG_CONNECTOR),) +obj-m += cn_test.o +endif + +# List of programs to build +hostprogs-y := ucon + +# Tell kbuild to always build the programs +always := $(hostprogs-y) + +HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include
Documentation/ia64/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# kbuild trick to avoid linker error. Can be omitted if a module is built. +obj- := dummy.o + +# List of programs to build +hostprogs-y := aliasing-test + +# Tell kbuild to always build the programs +always := $(hostprogs-y)
Documentation/networking/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# kbuild trick to avoid linker error. Can be omitted if a module is built. +obj- := dummy.o + +# List of programs to build +hostprogs-y := ifenslave + +# Tell kbuild to always build the programs +always := $(hostprogs-y)
Documentation/pcmcia/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# kbuild trick to avoid linker error. Can be omitted if a module is built. +obj- := dummy.o + +# List of programs to build +hostprogs-y := crc32hash + +# Tell kbuild to always build the programs +always := $(hostprogs-y) + +HOSTCFLAGS_crc32hash.o += -I$(objtree)/usr/include
Documentation/spi/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# kbuild trick to avoid linker error. Can be omitted if a module is built. +obj- := dummy.o + +# List of programs to build +hostprogs-y := spidev_test spidev_fdx + +# Tell kbuild to always build the programs +always := $(hostprogs-y) + +HOSTCFLAGS_spidev_test.o += -I$(objtree)/usr/include +HOSTCFLAGS_spidev_fdx.o += -I$(objtree)/usr/include
Documentation/video4linux/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# kbuild trick to avoid linker error. Can be omitted if a module is built. +obj- := dummy.o + +# List of programs to build +hostprogs-y := v4lgrab + +# Tell kbuild to always build the programs +always := $(hostprogs-y)
Documentation/vm/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# kbuild trick to avoid linker error. Can be omitted if a module is built. +obj- := dummy.o + +# List of programs to build +hostprogs-y := slabinfo + +# Tell kbuild to always build the programs +always := $(hostprogs-y)
Documentation/watchdog/src/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# kbuild trick to avoid linker error. Can be omitted if a module is built. +obj- := dummy.o + +# List of programs to build +hostprogs-y := watchdog-simple watchdog-test + +# Tell kbuild to always build the programs +always := $(hostprogs-y)
Documentation/filesystems/configfs/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +ifneq ($(CONFIG_CONFIGFS_FS),) +obj-m += configfs_example_explicit.o configfs_example_macros.o +endif
lib/Kconfig.debug +9 -0
@@ -644,6 +644,15 @@ config FIREWIRE_OHCI_REMOTE_DMA If unsure, say N. +menuconfig BUILD_DOCSRC + bool "Build targets in Documentation/ tree" + depends on HEADERS_CHECK + help + This option attempts to build objects from the source files in the + kernel Documentation/ tree. + + Say N if you are unsure. + source "samples/Kconfig" source "lib/Kconfig.kgdb"
PATCH 2/5 docsrc: fix procfs example
From: Randy Dunlap <[email protected]>
Add MODULE_LICENSE() to DocBook/procfs_example.c since modpost complained about a missing license there.
Remove tty procfs removal since the creation was deleted long ago
(http://git.kernel.org/?p=linux/kernel/git/tglx/history.git;a=commitdiff;h=5ad9cb65e9b15e5b83e2dd1c10a4bcaccc4ec644).
--- Documentation/DocBook/procfs_example.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Documentation/DocBook/procfs_example.c +1 -3
@@ -189,8 +189,6 @@ static int __init init_procfs_example(voreturn 0 ; no_symlink: -remove_proc_entry ("tty" , example_dir); -no_tty:remove_proc_entry ("bar" , example_dir); no_bar:remove_proc_entry ("foo" , example_dir);
@@ -206,7 +204,6 @@ out: static void __exit cleanup_procfs_example(void) {remove_proc_entry ("jiffies_too" , example_dir); -remove_proc_entry ("tty" , example_dir);remove_proc_entry ("bar" , example_dir);remove_proc_entry ("foo" , example_dir);remove_proc_entry ("jiffies" , example_dir);
@@ -222,3 +219,4 @@ module_exit(cleanup_procfs_example);MODULE_AUTHOR ("Erik Mouw" );MODULE_DESCRIPTION ("procfs examples" ); +MODULE_LICENSE ("GPL" );
PATCH 3/5 docsrc: fix ifenslave type
In reply to Randy DunlapFrom: Randy Dunlap <[email protected]>
Documentation/networking/ifenslave.c:1084: warning: pointer targets in assignment differ in signedness
Quoted 1 line
From
include/linux/socket.h:
* 1003.1g requires sa_family_t and that sa_data is char.
and from SUSv3:
(http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html)
The <sys/socket.h> header shall define the sockaddr structure that includes at least the following members:
sa_family_t sa_family Address family. char sa_data[] Socket address (variable-length data).
<end SUSv3>
--- Documentation/networking/ifenslave.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/networking/ifenslave.c +1 -1
@@ -1081,7 +1081,7 @@ static int set_if_addr(char *master_ifna } - ipaddr = ifr.ifr_addr.sa_data; + ipaddr = (unsigned char *)ifr.ifr_addr.sa_data;v_print ("Interface '%s': set IP %s to %d.%d.%d.%d\n" , slave_ifname, ifra[i].desc, ipaddr[0 ], ipaddr[1 ], ipaddr[2 ], ipaddr[3 ]);
PATCH 4/5 docsrc: fix crc32hash type
In reply to Randy DunlapFrom: Randy Dunlap <[email protected]>
Fix differing signedness warning:
Documentation/pcmcia/crc32hash.c:29: warning: pointer targets in passing argument 1 of 'crc32' differ in signedness
--- Documentation/pcmcia/crc32hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/pcmcia/crc32hash.c +1 -1
@@ -26,7 +26,7 @@ int main(int argc, char **argv) {printf ("no string passed as argument\n" );return -1 ; } - result =crc32 (argv[1 ],strlen (argv[1 ])); + result =crc32 ((unsigned char const *)argv[1 ],strlen (argv[1 ]));printf ("0x%x\n" , result);return 0 ; }
Re: [PATCH 4/5] docsrc: fix crc32hash type
Hi,
Quoted 7 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Fix differing signedness warning:
Documentation/pcmcia/crc32hash.c:29: warning: pointer targets in passing argument 1 of 'crc32' differ in signednessSigned-off-by Randy Dunlap <[email protected]>
Shall this go in via the pcmcia git tree, or with the other doc patches?
Best,
Dominik
Andrew Morton
maintainerRe: [PATCH 4/5] docsrc: fix crc32hash type
Quoted 5 lines · On Wed, 30 Jul 2008 08:47:20 +0200 Dominik Brodowski…
Hi,
Quoted 2 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Quoted 9 lines
Quoted 5 lines
Fix differing signedness warning:
Documentation/pcmcia/crc32hash.c:29: warning: pointer targets in passing argument 1 of 'crc32' differ in signednessSigned-off-by Randy Dunlap <[email protected]>Shall this go in via the pcmcia git tree, or with the other doc patches?
I was planning on merging them up in a week or so, if they don't appear in anyone else's tree.
Re: [PATCH 4/5] docsrc: fix crc32hash type
Quoted 11 lines · Andrew Morton
Quoted 9 lines · On Wed, 30 Jul 2008 08:47:20 +0200 Dominik Brodowski…
Hi,
Quoted 6 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Fix differing signedness warning:
Documentation/pcmcia/crc32hash.c:29: warning: pointer targets in passing argument 1 of 'crc32' differ in signedness
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Randy Dunlap <[email protected]>Shall this go in via the pcmcia git tree, or with the other doc patches?
I was planning on merging them up in a week or so, if they don't appear in anyone else's tree.
Would be good.
I would usually postpone this till next merge window if I carried them in a kbuild tree.
Sam
PATCH 5/5 docsrc: fix getdelays printk formats
In reply to Randy DunlapFrom: Randy Dunlap <[email protected]>
Fix printf format type warnings (seen on alpha & ia64):
Documentation/accounting/getdelays.c:206: warning: format '%15llu' expects type 'long long unsigned int', but argument 6 has type '__u64' Documentation/accounting/getdelays.c:206: warning: format '%15llu' expects type 'long long unsigned int', but argument 7 has type '__u64' Documentation/accounting/getdelays.c:206: warning: format '%15llu' expects type 'long long unsigned int', but argument 8 has type '__u64' Documentation/accounting/getdelays.c:206: warning: format '%15llu' expects type 'long long unsigned int', but argument 9 has type '__u64' Documentation/accounting/getdelays.c:206: warning: format '%15llu' expects type 'long long unsigned int', but argument 12 has type '__u64' Documentation/accounting/getdelays.c:206: warning: format '%15llu' expects type 'long long unsigned int', but argument 13 has type '__u64' Documentation/accounting/getdelays.c:206: warning: format '%15llu' expects type 'long long unsigned int', but argument 16 has type '__u64' Documentation/accounting/getdelays.c:206: warning: format '%15llu' expects type 'long long unsigned int', but argument 17 has type '__u64' Documentation/accounting/getdelays.c:214: warning: format '%15llu' expects type 'long long unsigned int', but argument 4 has type '__u64' Documentation/accounting/getdelays.c:214: warning: format '%15llu' expects type 'long long unsigned int', but argument 5 has type '__u64' Documentation/accounting/getdelays.c:221: warning: format '%llu' expects type 'long long unsigned int', but argument 2 has type '__u64' Documentation/accounting/getdelays.c:221: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type '__u64' Documentation/accounting/getdelays.c:221: warning: format '%llu' expects type 'long long unsigned int', but argument 4 has type '__u64' Documentation/accounting/getdelays.c:221: warning: format '%llu' expects type 'long long unsigned int', but argument 5 has type '__u64' Documentation/accounting/getdelays.c:221: warning: format '%llu' expects type 'long long unsigned int', but argument 6 has type '__u64' Documentation/accounting/getdelays.c:236: warning: 'cmd_type' may be used uninitialized in this function
--- Documentation/accounting/getdelays.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
Documentation/accounting/getdelays.c +17 -8
@@ -201,13 +201,19 @@ void print_delayacct(struct taskstats *t"RECLAIM %12s%15s\n" " %15llu%15llu\n" ,"count" ,"real total" ,"virtual total" ,"delay total" , - t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total, - t->cpu_delay_total, + (unsigned long long )t->cpu_count, + (unsigned long long )t->cpu_run_real_total, + (unsigned long long )t->cpu_run_virtual_total, + (unsigned long long )t->cpu_delay_total,"count" ,"delay total" , - t->blkio_count, t->blkio_delay_total, -"count" ,"delay total" , t->swapin_count, t->swapin_delay_total, + (unsigned long long )t->blkio_count, + (unsigned long long )t->blkio_delay_total,"count" ,"delay total" , - t->freepages_count, t->freepages_delay_total); + (unsigned long long )t->swapin_count, + (unsigned long long )t->swapin_delay_total, +"count" ,"delay total" , + (unsigned long long )t->freepages_count, + (unsigned long long)t->freepages_delay_total); }void task_context_switch_counts (struct taskstats *t)
@@ -215,14 +221,17 @@ void task_context_switch_counts(struct tprintf ("\n\nTask %15s%15s\n" " %15llu%15llu\n" ,"voluntary" ,"nonvoluntary" , - t->nvcsw, t->nivcsw); + (unsigned long long )t->nvcsw, (unsigned long long )t->nivcsw); }void print_cgroupstats (struct cgroupstats *c) {printf ("sleeping %llu, blocked %llu, running %llu, stopped %llu, " -"uninterruptible %llu\n" , c->nr_sleeping, c->nr_io_wait, - c->nr_running, c->nr_stopped, c->nr_uninterruptible); +"uninterruptible %llu\n" , (unsigned long long )c->nr_sleeping, + (unsigned long long )c->nr_io_wait, + (unsigned long long )c->nr_running, + (unsigned long long )c->nr_stopped, + (unsigned long long )c->nr_uninterruptible); }
Quoted 8 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Currently source files in the
Documentation/sub-dir can easily bit-rot since they are not generally buildable, either because they are hidden in text files or because there are noMakefilerules for them. This needs to be fixed so that the source files remain usable and good examples of code instead of bad examples.
Quoted 5 lines
Add the ability to build source files that are in the
Documentation/dir. Add toKconfigas "BUILD_DOCSRC" config symbol.Use "
CONFIG_BUILD_DOCSRC=1make ..." to build objects from theDocumentation/sources. Or enableBUILD_DOCSRCin the *config system.
How about simply adding another makefile target instead? This is more intuitive, imho, and complies with the Kbuild conventions so far. Something like:
make docsrc
similar to 'make help' or 'make pdfdocs' etc.
[..]
Signature · 2 lines
Regards/Gruß,
Boris.Quoted 15 lines · On Tue, 29 Jul 2008 22:27:32 +0200 Borislav Petkov wrote:
Quoted 8 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Currently source files in the
Documentation/sub-dir can easily bit-rot since they are not generally buildable, either because they are hidden in text files or because there are noMakefilerules for them. This needs to be fixed so that the source files remain usable and good examples of code instead of bad examples.Quoted 5 lines
Add the ability to build source files that are in the
Documentation/dir. Add toKconfigas "BUILD_DOCSRC" config symbol.Use "
CONFIG_BUILD_DOCSRC=1make ..." to build objects from theDocumentation/sources. Or enableBUILD_DOCSRCin the *config system.
Quoted 7 lines
How about simply adding another makefile target instead? This is more intuitive, imho, and complies with the
Kbuildconventions so far. Something like:make docsrc
similar to 'make help' or 'make pdfdocs' etc.
Hi Boris,
I happen to have a previous version of the patch that does that, so yes, I can post that if that's the preferred solution. I'll wait for other comments before reposting.
---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
Quoted 15 lines · Borislav Petkov
Quoted 8 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Currently source files in the
Documentation/sub-dir can easily bit-rot since they are not generally buildable, either because they are hidden in text files or because there are noMakefilerules for them. This needs to be fixed so that the source files remain usable and good examples of code instead of bad examples.Quoted 5 lines
Add the ability to build source files that are in the
Documentation/dir. Add toKconfigas "BUILD_DOCSRC" config symbol.Use "
CONFIG_BUILD_DOCSRC=1make ..." to build objects from theDocumentation/sources. Or enableBUILD_DOCSRCin the *config system.
Quoted 7 lines
How about simply adding another makefile target instead? This is more intuitive, imho, and complies with the
Kbuildconventions so far. Something like:make docsrc
similar to 'make help' or 'make pdfdocs' etc.
With the current approach we have much better build coverage. All "allyesconfig" and "allmodconfig" builds will do the test builds which is a good think.
If we introduce "make docsrc" then almost only Randy will do the test builds and report the breakage - which is not good.
Sam
Quoted 22 lines · Sam Ravnborg
Quoted 21 lines · Borislav Petkov
Quoted 8 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Currently source files in the
Documentation/sub-dir can easily bit-rot since they are not generally buildable, either because they are hidden in text files or because there are noMakefilerules for them. This needs to be fixed so that the source files remain usable and good examples of code instead of bad examples.Quoted 5 lines
Add the ability to build source files that are in the
Documentation/dir. Add toKconfigas "BUILD_DOCSRC" config symbol.Use "
CONFIG_BUILD_DOCSRC=1make ..." to build objects from theDocumentation/sources. Or enableBUILD_DOCSRCin the *config system.How about simply adding another makefile target instead? This is more intuitive, imho, and complies with the
Kbuildconventions so far. Something like:make docsrc
Quoted 7 lines
Quoted 1 line
similar to 'make help' or 'make pdfdocs' etc.
With the current approach we have much better build coverage. All "allyesconfig" and "allmodconfig" builds will do the test builds which is a good think.
If we introduce "make docsrc" then almost only Randy will do the test builds and report the breakage - which is not good.
Well, i don't see anymore people than Randy doing
CONFIG_BUILD_DOCSRC=1 make ...
either so only the other option remains, which means CONFIG_BUILD_DOCSRC should be "default y" for more coverage...
Signature · 2 lines
Regards/Gruß, Boris
Quoted 10 lines
Quoted 6 lines
With the current approach we have much better build coverage. All "allyesconfig" and "allmodconfig" builds will do the test builds which is a good think.
If we introduce "make docsrc" then almost only Randy will do the test builds and report the breakage - which is not good.Well, i don't see anymore people than Randy doing
CONFIG_BUILD_DOCSRC=1make ...
One such example is:
http://kisskb.ellerman.id.au/linux-next
Here the all*config will do the build test of the
documentation and Stephen will tell if it breaks.
Quoted 2 lines
either so only the other option remains, which means
CONFIG_BUILD_DOCSRCshould be "default y" for more coverage...
No - we do not want to set config options to "default y" unless there are _very_ good reasons to do so.
You should check a few of Linus' responses during this merge window if you want more background on this.
Sam
Quoted 14 lines · Sam Ravnborg
Quoted 10 lines
Quoted 6 lines
With the current approach we have much better build coverage. All "allyesconfig" and "allmodconfig" builds will do the test builds which is a good think.
If we introduce "make docsrc" then almost only Randy will do the test builds and report the breakage - which is not good.Well, i don't see anymore people than Randy doing
CONFIG_BUILD_DOCSRC=1make ...One such example is:
http://kisskb.ellerman.id.au/linux-next
Quoted 7 lines
Here the all*config will do the build test of the
documentation and Stephen will tell if it breaks.Quoted 2 lines
either so only the other option remains, which means
CONFIG_BUILD_DOCSRCshould be "default y" for more coverage...No - we do not want to set config options to "default y" unless there are _very_ good reasons to do so.
Sorry, I had to think about it a bit to realize what you were implying - the all(yes|mod)config targets _will_ turn on the CONFIG_BUILD_DOCSRC option so no need for the 'default y' setting, which seems pretty silly for that case anyway.
Signature · 2 lines
Regards/Gruß, Boris