1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

Kill unneeded #include wherever possible

Tested on Linux, FreeBSD, NetBSD, OpenBSD, DOS.
Thanks to Jonathan A. Kollasch and Idwer Vollering for testing.

Corresponding to flashrom svn r1057.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Idwer Vollering <vidwer+lists.flashrom@gmail.com>
This commit is contained in:
Carl-Daniel Hailfinger 2010-06-21 23:20:15 +00:00
parent c96a8bd458
commit dcef67e468
4 changed files with 16 additions and 12 deletions

View File

@ -27,12 +27,10 @@
#define _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE
#include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <unistd.h>
#include <fcntl.h>
#include "flash.h" #include "flash.h"
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)

View File

@ -21,10 +21,12 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h>
#if !defined (__DJGPP__)
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h>
#include <errno.h> #include <errno.h>
#endif
#include "flash.h" #include "flash.h"
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)
@ -42,12 +44,14 @@ int io_fd;
void get_io_perms(void) void get_io_perms(void)
{ {
#if defined(__DJGPP__)
/* We have full permissions by default. */
return;
#else
#if defined (__sun) && (defined(__i386) || defined(__amd64)) #if defined (__sun) && (defined(__i386) || defined(__amd64))
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) { if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) {
#elif defined(__FreeBSD__) || defined (__DragonFly__) #elif defined(__FreeBSD__) || defined (__DragonFly__)
if ((io_fd = open("/dev/io", O_RDWR)) < 0) { if ((io_fd = open("/dev/io", O_RDWR)) < 0) {
#elif __DJGPP__
if (0) {
#else #else
if (iopl(3) != 0) { if (iopl(3) != 0) {
#endif #endif
@ -55,6 +59,7 @@ void get_io_perms(void)
"You need to be root.\n", strerror(errno)); "You need to be root.\n", strerror(errno));
exit(1); exit(1);
} }
#endif
} }
void release_io_perms(void) void release_io_perms(void)

View File

@ -21,10 +21,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include "flash.h" #include "flash.h"
#if NEED_PCI == 1 #if NEED_PCI == 1

View File

@ -23,13 +23,17 @@
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include "flash.h" #include "flash.h"
/* Do we need any file access or ioctl for physmap or MSR? */
#if !defined(__DJGPP__)
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#endif
#ifdef __DJGPP__ #ifdef __DJGPP__
#include <dpmi.h> #include <dpmi.h>
#include <sys/nearptr.h> #include <sys/nearptr.h>