tools lib lk: Uninclude linux/magic.h in debugfs.c.
PATCH 1/1 tools lib lk: Uninclude linux/magic.h in debugfs.c.
From: Vinson Lee <[email protected]>
The compilation only looks for linux/magic.h from the default include paths, which does not include the source tree. This results in a build error if linux/magic.h is not available or not installed.
For example, this build error occurs on CentOS 5.
$ make -C tools/lib/lk V=1 [...] gcc -o debugfs.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -fPIC -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 debugfs.c debugfs.c:8:25: error: linux/magic.h: No such file or directory
The only symbol from linux/magic.h needed by debugfs.c is DEBUGFS_MAGIC, and that is already defined in debugfs.h. linux/magic.h isn't providing any extra symbols and can unincluded. This is similar to the approach by perf, which has its own magic.h wrapper at tools/perf/util/include/linux/magic.h
--- tools/lib/lk/debugfs.c | 1 - 1 file changed, 1 deletion(-)
tools/lib/lk/debugfs.c +0 -1
@@ -5,7 +5,6 @@#include <stdbool.h> #include <sys/vfs.h> #include <sys/mount.h> -#include <linux/magic.h> #include <linux/kernel.h> #include "debugfs.h"
Signature · 1 line
1.8.2.1
Quoted 5 lines · Vinson Lee
From: Vinson Lee <[email protected]>
The compilation only looks for
linux/magic.hfrom the default include paths, which does not include the source tree. This results in a build error iflinux/magic.his not available or not installed.
Right, we have:
tools/perf/util/include/linux/magic.h
but tools/lib/lk/Makefile doesn't know about it, it seems. Oh well, the solution falling back to debugfs.h is even better. :)
Quoted 14 lines
For example, this build error occurs on CentOS 5.
$ make -C tools/lib/lk V=1 [...] gcc -o debugfs.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6(quoted diff) +0
-7-D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -fPIC -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 debugfs.cdebugfs.c:8:25: error:
linux/magic.h: No such file or directory
Quoted 8 lines
The only symbol from
linux/magic.hneeded bydebugfs.cisDEBUGFS_MAGIC, and that is already defined indebugfs.h.linux/magic.hisn't providing any extra symbols and can unincluded. This is similar to the approach by perf, which has its ownmagic.hwrapper attools/perf/util/include/linux/magic.hSigned-off-by Vinson Lee <[email protected]>Cc [email protected] # 3.10+
Quoted 19 lines
--- tools/lib/lk/debugfs.c | 1 - 1 file changed, 1 deletion(-)tools/lib/lk/debugfs.c +0
-1@@ -5,7 +5,6 @@#include <stdbool.h> #include <sys/vfs.h> #include <sys/mount.h> -#include <linux/magic.h> #include <linux/kernel.h> #include "debugfs.h" Signature · 1 line
1.8.2.1
Signature · 5 lines
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--Arnaldo Carvalho de Melo
AppliedEm Thu, Sep 19, 2013 at 09:17:20AM +0200, Borislav Petkov escreveu:
Quoted 9 lines · Vinson Lee
Quoted 6 lines
From: Vinson Lee <[email protected]>
The compilation only looks for
linux/magic.hfrom the default includeSigned-off-by Vinson Lee <[email protected]>Cc [email protected] # 3.10+Acked-by Borislav Petkov <[email protected]>
Thanks, applied.
- Arnaldo
tip-bot for Vinson Lee
merge bot[tip:perf/urgent] tools lib lk: Uninclude linux/ magic.h in debugfs.c
In reply to Vinson Leetools lib lk: Uninclude linux/magic.h in debugfs.c
Commit-ID: ce7eebe5c3deef8e19c177c24ee75843256e69ca Gitweb: http://git.kernel.org/tip/ce7eebe5c3deef8e19c177c24ee75843256e69ca Author: Vinson Lee <[email protected]> AuthorDate: Wed, 18 Sep 2013 16:16:40 -0700 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 19 Sep 2013 15:08:53 -0300
tools lib lk: Uninclude linux/magic.h in debugfs.c
The compilation only looks for linux/magic.h from the default include paths, which does not include the source tree. This results in a build error if linux/magic.h is not available or not installed.
For example, this build error occurs on CentOS 5.
$ make -C tools/lib/lk V=1 [...] gcc -o debugfs.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -fPIC -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 debugfs.c debugfs.c:8:25: error: linux/magic.h: No such file or directory
The only symbol from linux/magic.h needed by debugfs.c is DEBUGFS_MAGIC, and that is already defined in debugfs.h. linux/magic.h isn't providing any extra symbols and can unincluded. This is similar to the approach by perf, which has its own magic.h wrapper at tools/perf/util/include/linux/magic.h
--- tools/lib/lk/debugfs.c | 1 - 1 file changed, 1 deletion(-)
tools/lib/lk/debugfs.c +0 -1
@@ -5,7 +5,6 @@#include <stdbool.h> #include <sys/vfs.h> #include <sys/mount.h> -#include <linux/magic.h> #include <linux/kernel.h> #include "debugfs.h"