Bug 24282

Summary: linux/ext2_fs.h uses defines from linux/fs.h
Product: File System Reporter: Cezary Sliwa (sliwa)
Component: ext2Assignee: Eric Sandeen (sandeen)
Status: RESOLVED INVALID    
Severity: normal CC: adilger.kernelbugzilla, alan, sandeen, the.ridikulus.rat
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.33.4 Subsystem:
Regression: No Bisected commit-id:

Description Cezary Sliwa 2010-12-03 12:55:33 UTC
An inline function from linux/ext2_fs.h does not compile without including linux/fs.h.
Comment 1 Eric Sandeen 2010-12-03 15:13:08 UTC
Please attach your config and the compile error that you get, thanks.

-Eric
Comment 2 Cezary Sliwa 2010-12-03 15:20:24 UTC
The error occured when compiling a user space program. Just include linux/ext2_fs.h whithout linux/fs.h and you get:

/usr/include/linux/ext2_fs.h: In function 'ext2_mask_flags':
/usr/include/linux/ext2_fs.h:182: error: 'FS_DIRSYNC_FL' undeclared (first use in this function)
/usr/include/linux/ext2_fs.h:182: error: (Each undeclared identifier is reported only once
/usr/include/linux/ext2_fs.h:182: error: for each function it appears in.)
/usr/include/linux/ext2_fs.h:182: error: 'FS_TOPDIR_FL' undeclared (first use in this function)
/usr/include/linux/ext2_fs.h:184: error: 'FS_NODUMP_FL' undeclared (first use in this function)
/usr/include/linux/ext2_fs.h:184: error: 'FS_NOATIME_FL' undeclared (first use in this function)
Comment 3 Eric Sandeen 2010-12-03 15:58:32 UTC
ah, userspace.  Thanks, that wasn't clear.

commit 36695673b012096228ebdc1b39a6a5850daa474e
Author: David Howells <dhowells@redhat.com>
Date:   Tue Aug 29 19:06:16 2006 +0100

    [PATCH] BLOCK: Move common FS-specific ioctls to linux/fs.h [try #6]

changed to use those FS_ flags; maybe one of the existing #includes used to pull in fs.h, not sure.
Comment 4 Eric Sandeen 2010-12-03 16:27:02 UTC
I sent a patch upstream for this.
Comment 5 Andreas Dilger 2010-12-03 20:12:34 UTC
(In reply to comment #2)
> The error occured when compiling a user space program. Just include
> linux/ext2_fs.h whithout linux/fs.h and you get:
> 
> /usr/include/linux/ext2_fs.h: In function 'ext2_mask_flags':
> /usr/include/linux/ext2_fs.h:182: error: 'FS_DIRSYNC_FL' undeclared (first
> use
> in this function)
> /usr/include/linux/ext2_fs.h:182: error: (Each undeclared identifier is
> reported only once
> /usr/include/linux/ext2_fs.h:182: error: for each function it appears in.)
> /usr/include/linux/ext2_fs.h:182: error: 'FS_TOPDIR_FL' undeclared (first use
> in this function)
> /usr/include/linux/ext2_fs.h:184: error: 'FS_NODUMP_FL' undeclared (first use
> in this function)
> /usr/include/linux/ext2_fs.h:184: error: 'FS_NOATIME_FL' undeclared (first
> use
> in this function)

Wouldn't it be better to include <ext2fs/ext2_fs.h> from e2fsprogs-devel, instead of <linux/ext2_fs.h> from the kernel?
Comment 6 Eric Sandeen 2010-12-03 20:17:03 UTC
It probably is better but if the header is provided, shouldn't it work?
Comment 7 Cezary Sliwa 2012-08-15 19:03:13 UTC
Resolved invalid? I understand this needed 20 months, but what???

This is what makes Linux such a great piece of software.
Comment 8 Alan 2012-08-15 19:10:34 UTC
The kernel headers are not meant to be directly used by applications

(which was dealt with in 2010 in Andreas comment)

I'm just cleaning up old stuff