Bug 5409 - linux/byteorder/*_endian.h cannot be used outside kernel builds
Summary: linux/byteorder/*_endian.h cannot be used outside kernel builds
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: kernel-headers-std26-up (show other bugs)
Version: unstable
Hardware: all Linux
: P2 normal
Assignee: Anton Farygin
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-27 19:58 MSD by Mikhail Zabaluev
Modified: 2006-10-10 20:16 MSD (History)
0 users

See Also:


Attachments
The testcase C source file (48 bytes, text/plain)
2004-10-27 19:59 MSD, Mikhail Zabaluev
no flags Details
Proposed patch (2.05 KB, patch)
2004-10-27 20:01 MSD, Mikhail Zabaluev
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Zabaluev 2004-10-27 19:58:40 MSD
Some user-space software, e.g. gnome-vfs, need both glibc headers and kernel
headers for compilation. With kernel headers of version 2.6.9, however,
inclusion of many kernel headers, for instance, linux/cdrom.h, leads to
inclusion of linux/byteorder/*_endian.h. These headers declare functions using
types that are hidden when the features.h header from glibc is included. The
attached testcase illustrates the problem.
To amend this, the conflicting declarations should be disabled when __KERNEL__
macro is not defined. The patch is underway.
Steps to Reproduce:
Try compiling the attached C source file.
Actual Results:  
Compilation fails.

Expected Results:  
Compilation should succeed.
Comment 1 Mikhail Zabaluev 2004-10-27 19:59:56 MSD
Created attachment 621 [details]
The testcase C source file
Comment 2 Mikhail Zabaluev 2004-10-27 20:01:20 MSD
Created attachment 622 [details]
Proposed patch

This patch has been tested against:
the testcase above;
gnome-vfs 2.8.x.
Comment 3 Anton Farygin 2004-11-01 18:46:01 MSK
fixed (2.6.9-alt11)
Comment 4 Mikhail Zabaluev 2004-11-03 13:13:10 MSK
Any chance it goes upstream?
Comment 5 Dmitry V. Levin 2006-10-06 03:31:52 MSD
The patch in question also breaks build:
$ rpmbuild -bc hdparm.spec
[...]
hdparm.c:1315: warning: implicit declaration of function '__le16_to_cpus'
hdparm.c:1315: warning: nested extern declaration of '__le16_to_cpus'
cc  -o hdparm hdparm.o identify.o
hdparm.o: In function `process_dev':
hdparm.c:(.text+0x1a4f): undefined reference to `__le16_to_cpus'
hdparm.o: In function `main':
hdparm.c:(.text+0x3791): undefined reference to `__le16_to_cpus'
collect2: ld returned 1 exit status
make: *** [hdparm] Error 1
Comment 6 Sergey Vlasov 2006-10-10 20:16:03 MSD
Broken patch removed in std26-2.6.16-alt11; let's see what breaks without it...