Re: [PATCH] linux/inotify.h: do not include <linux/fcntl.h> inuserspace

From: Kirill A. Shutemov
Date: Tue Sep 16 2008 - 10:43:20 EST


On Tue, Sep 16, 2008 at 07:10:25AM -0700, Ulrich Drepper wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Kirill A. Shutemov wrote:
> >> What is the error message?
> >
> > /usr/include/asm-generic/fcntl.h:117: error: redefinition of 'struct
> > flock'
>
> And? None of these programs should use <linux/inotify.h>. There has
> for the longest time been a <sys/inotify.h> header which doesn't need
> any kernel headers. In fact, <linux/inotify.h> should not be exported.

Ok. Let's unexport <linux/inotify.h>.

diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b68ec09..dbb8107 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -240,7 +240,6 @@ unifdef-y += igmp.h
unifdef-y += inet_diag.h
unifdef-y += in.h
unifdef-y += in6.h
-unifdef-y += inotify.h
unifdef-y += input.h
unifdef-y += ip.h
unifdef-y += ipc.h
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index bd57857..0188b6a 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -10,6 +10,8 @@
/* For O_CLOEXEC and O_NONBLOCK */
#include <linux/fcntl.h>
#include <linux/types.h>
+#include <linux/dcache.h>
+#include <linux/fs.h>

/*
* struct inotify_event - structure read from the inotify device for each event
@@ -69,11 +71,6 @@ struct inotify_event {
#define IN_CLOEXEC O_CLOEXEC
#define IN_NONBLOCK O_NONBLOCK

-#ifdef __KERNEL__
-
-#include <linux/dcache.h>
-#include <linux/fs.h>
-
/*
* struct inotify_watch - represents a watch request on a specific inode
*
@@ -230,6 +227,4 @@ static inline void put_inotify_watch(struct inotify_watch *watch)

#endif /* CONFIG_INOTIFY */

-#endif /* __KERNEL __ */
-
#endif /* _LINUX_INOTIFY_H */

--
Regards, Kirill A. Shutemov
+ Belarus, Minsk
+ ALT Linux Team, http://www.altlinux.com/

Attachment: signature.asc
Description: Digital signature