diff options
author | Michael Brown | 2006-04-24 17:42:49 +0200 |
---|---|---|
committer | Michael Brown | 2006-04-24 17:42:49 +0200 |
commit | 824d6ffa7f3d52ce165419356bfe28eaaf36a81b (patch) | |
tree | c00a6a1cf46de5248259afd51fe64147e4b311d0 /src/include | |
parent | Network API now allows for multiple network devices (although the (diff) | |
download | ipxe-824d6ffa7f3d52ce165419356bfe28eaaf36a81b.tar.gz ipxe-824d6ffa7f3d52ce165419356bfe28eaaf36a81b.tar.xz ipxe-824d6ffa7f3d52ce165419356bfe28eaaf36a81b.zip |
Header rearrangement.
I want to get to the point where any header in include/ reflects a
standard user-level header (e.g. a POSIX header), while everything that's
specific to gPXE lives in include/gpxe/. Headers that reflect a Linux
header (e.g. if_ether.h) should also be in include/gpxe/, with the same
name as the Linux header and, preferably, the same names used for the
definitions.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/background.h | 2 | ||||
-rw-r--r-- | src/include/console.h | 2 | ||||
-rw-r--r-- | src/include/dev.h | 4 | ||||
-rw-r--r-- | src/include/errno.h | 3 | ||||
-rw-r--r-- | src/include/gpxe/hello.h | 4 | ||||
-rw-r--r-- | src/include/gpxe/if_arp.h | 6 | ||||
-rw-r--r-- | src/include/gpxe/if_ether.h | 6 | ||||
-rw-r--r-- | src/include/gpxe/in.h | 13 | ||||
-rw-r--r-- | src/include/gpxe/ip.h | 6 | ||||
-rw-r--r-- | src/include/gpxe/iscsi.h | 6 | ||||
-rw-r--r-- | src/include/gpxe/pci.h (renamed from src/include/pci.h) | 21 | ||||
-rw-r--r-- | src/include/gpxe/pci_ids.h (renamed from src/include/pci_ids.h) | 5 | ||||
-rw-r--r-- | src/include/gpxe/scsi.h | 6 | ||||
-rw-r--r-- | src/include/gpxe/tables.h (renamed from src/include/tables.h) | 10 | ||||
-rw-r--r-- | src/include/gpxe/tcp.h | 6 | ||||
-rw-r--r-- | src/include/image.h | 2 | ||||
-rw-r--r-- | src/include/init.h | 2 | ||||
-rw-r--r-- | src/include/proto.h | 2 | ||||
-rw-r--r-- | src/include/resolv.h | 2 |
19 files changed, 63 insertions, 45 deletions
diff --git a/src/include/background.h b/src/include/background.h index 24cb3201..40706cd7 100644 --- a/src/include/background.h +++ b/src/include/background.h @@ -17,7 +17,7 @@ * */ -#include "tables.h" +#include <gpxe/tables.h> #include "ip.h" /** A background protocol */ diff --git a/src/include/console.h b/src/include/console.h index 9e13293a..32d28219 100644 --- a/src/include/console.h +++ b/src/include/console.h @@ -3,7 +3,7 @@ #include "stdint.h" #include "vsprintf.h" -#include "tables.h" +#include <gpxe/tables.h> /** @file * diff --git a/src/include/dev.h b/src/include/dev.h index fa549deb..535181aa 100644 --- a/src/include/dev.h +++ b/src/include/dev.h @@ -5,7 +5,7 @@ #include "string.h" #include "buffer.h" #include "dhcp.h" /* for dhcp_dev_id */ -#include "tables.h" +#include <gpxe/tables.h> #include <assert.h> /* @@ -202,7 +202,7 @@ struct device_driver { #define DRIVER(_name,_type_driver,_bus_driver,_bus_info, \ _probe,_disable) \ - static struct device_driver device_ ## _bus_info __device_driver = { \ + struct device_driver device_ ## _bus_info __device_driver = { \ .name = _name, \ .type_driver = &_type_driver, \ .bus_driver = &_bus_driver, \ diff --git a/src/include/errno.h b/src/include/errno.h index f96231be..d6ddcc56 100644 --- a/src/include/errno.h +++ b/src/include/errno.h @@ -125,10 +125,11 @@ #define ENOENT 0xd4 #define EAFNOSUPPORT 0xd5 #define EAGAIN 0xd6 +#define EIO 0xd7 /* Data structures and declarations */ -#include "tables.h" +#include <gpxe/tables.h> extern int errno; diff --git a/src/include/gpxe/hello.h b/src/include/gpxe/hello.h index 23ee336f..de8127bf 100644 --- a/src/include/gpxe/hello.h +++ b/src/include/gpxe/hello.h @@ -1,5 +1,5 @@ -#ifndef _HELLO_H -#define _HELLO_H +#ifndef _GPXE_HELLO_H +#define _GPXE_HELLO_H /** @file * diff --git a/src/include/gpxe/if_arp.h b/src/include/gpxe/if_arp.h index 31e993de..5b250337 100644 --- a/src/include/gpxe/if_arp.h +++ b/src/include/gpxe/if_arp.h @@ -1,5 +1,5 @@ -#ifndef _IF_ARP_H -#define _IF_ARP_H +#ifndef _GPXE_IF_ARP_H +#define _GPXE_IF_ARP_H /** @file * @@ -97,4 +97,4 @@ static inline void * arp_target_pa ( struct arphdr *arphdr ) { return ( arp_target_ha ( arphdr ) + arphdr->ar_hln ); } -#endif /* _IF_ARP_H */ +#endif /* _GPXE_IF_ARP_H */ diff --git a/src/include/gpxe/if_ether.h b/src/include/gpxe/if_ether.h index f199220f..4d35bdf4 100644 --- a/src/include/gpxe/if_ether.h +++ b/src/include/gpxe/if_ether.h @@ -1,5 +1,5 @@ -#ifndef _IF_ETHER_H -#define _IF_ETHER_H +#ifndef _GPXE_IF_ETHER_H +#define _GPXE_IF_ETHER_H #include <stdint.h> @@ -29,4 +29,4 @@ struct ethhdr { uint16_t h_protocol; } __attribute__ ((packed)); -#endif /* _IF_ETHER_H */ +#endif /* _GPXE_IF_ETHER_H */ diff --git a/src/include/gpxe/in.h b/src/include/gpxe/in.h index e1bdde93..08fd76e2 100644 --- a/src/include/gpxe/in.h +++ b/src/include/gpxe/in.h @@ -1,5 +1,5 @@ -#ifndef _IN_H -#define _IN_H +#ifndef _GPXE_IN_H +#define _GPXE_IN_H #include <stdint.h> @@ -8,8 +8,11 @@ #define IP_TCP 6 #define IP_UDP 17 -/* Same after going through htonl */ -#define IP_BROADCAST 0xFFFFFFFF +#define INADDR_NONE 0xffffffff + +#define INADDR_BROADCAST 0xffffffff + +#define IN_MULTICAST(addr) ( ( (addr) & 0xf0000000 ) == 0xe0000000 ) struct in_addr { uint32_t s_addr; @@ -27,4 +30,4 @@ struct sockaddr_in { extern int inet_aton ( const char *cp, struct in_addr *inp ); extern char * inet_ntoa ( struct in_addr in ); -#endif /* _IN_H */ +#endif /* _GPXE_IN_H */ diff --git a/src/include/gpxe/ip.h b/src/include/gpxe/ip.h index 29aae517..94f906b5 100644 --- a/src/include/gpxe/ip.h +++ b/src/include/gpxe/ip.h @@ -1,5 +1,5 @@ -#ifndef _IP_H -#define _IP_H +#ifndef _GPXE_IP_H +#define _GPXE_IP_H /** @file * @@ -17,4 +17,4 @@ extern void set_gateway ( struct in_addr address ); extern void init_tcpip ( void ); extern void run_tcpip ( void ); -#endif /* _IP_H */ +#endif /* _GPXE_IP_H */ diff --git a/src/include/gpxe/iscsi.h b/src/include/gpxe/iscsi.h index 639da5e5..ab7b0a07 100644 --- a/src/include/gpxe/iscsi.h +++ b/src/include/gpxe/iscsi.h @@ -1,5 +1,5 @@ -#ifndef _ISCSI_H -#define _ISCSI_H +#ifndef _GPXE_ISCSI_H +#define _GPXE_ISCSI_H /** @file * @@ -457,4 +457,4 @@ static inline int iscsi_error ( struct iscsi_session *iscsi ) { return ( iscsi->state == ISCSI_STATE_FAILED ); } -#endif /* _ISCSI_H */ +#endif /* _GPXE_ISCSI_H */ diff --git a/src/include/pci.h b/src/include/gpxe/pci.h index c50b79a8..4322202c 100644 --- a/src/include/pci.h +++ b/src/include/gpxe/pci.h @@ -1,5 +1,5 @@ -#ifndef PCI_H -#define PCI_H +#ifndef _GPXEPCI_H +#define _GPXEPCI_H /* ** Support for NE2000 PCI clones added David Monro June 1997 @@ -21,8 +21,7 @@ * your option) any later version. */ -#include "stdint.h" -#include "nic.h" +#include <stdint.h> #include "pci_ids.h" #define PCI_BUS_TYPE 1 @@ -256,7 +255,8 @@ struct pci_device { uint16_t busdevfn; uint8_t revision; uint8_t irq; -} __attribute__ (( packed )); + void *priv; +}; /* * Useful busdevfn calculations @@ -348,7 +348,6 @@ extern unsigned long pci_bar_start ( struct pci_device *pci, unsigned int bar ); extern unsigned long pci_bar_size ( struct pci_device *pci, unsigned int bar ); extern int pci_find_capability ( struct pci_device *pci, int capability ); -extern void pci_fill_nic ( struct nic *nic, struct pci_device *pci ); /* * PCI bus global definition @@ -356,4 +355,12 @@ extern void pci_fill_nic ( struct nic *nic, struct pci_device *pci ); */ extern struct bus_driver pci_driver; -#endif /* PCI_H */ +static inline void pci_set_drvdata ( struct pci_device *pci, void *priv ) { + pci->priv = priv; +} + +static inline void * pci_get_drvdata ( struct pci_device *pci ) { + return pci->priv; +} + +#endif /* _GPXE_PCI_H */ diff --git a/src/include/pci_ids.h b/src/include/gpxe/pci_ids.h index a853d4dc..075ff96b 100644 --- a/src/include/pci_ids.h +++ b/src/include/gpxe/pci_ids.h @@ -1,3 +1,6 @@ +#ifndef _GPXE_PCI_IDS_H +#define _GPXE_PCI_IDS_H + /* * PCI Class, Vendor and Device IDs * @@ -341,3 +344,5 @@ #define PCI_SUBVENDOR_ID_EXSYS 0xd84d #define PCI_VENDOR_ID_TIGERJET 0xe159 #define PCI_VENDOR_ID_ARK 0xedd8 + +#endif /* _GPXE_PCI_IDS_H */ diff --git a/src/include/gpxe/scsi.h b/src/include/gpxe/scsi.h index 05f9010c..be71bab3 100644 --- a/src/include/gpxe/scsi.h +++ b/src/include/gpxe/scsi.h @@ -1,5 +1,5 @@ -#ifndef _SCSI_H -#define _SCSI_H +#ifndef _GPXE_SCSI_H +#define _GPXE_SCSI_H #include <stdint.h> @@ -31,4 +31,4 @@ union scsi_cdb { char bytes[16]; }; -#endif /* _SCSI_H */ +#endif /* _GPXE_SCSI_H */ diff --git a/src/include/tables.h b/src/include/gpxe/tables.h index c3e05e55..a565eba7 100644 --- a/src/include/tables.h +++ b/src/include/gpxe/tables.h @@ -1,5 +1,5 @@ -#ifndef TABLES_H -#define TABLES_H +#ifndef _GPXE_TABLES_H +#define _GPXE_TABLES_H /** @page ifdef_harmful #ifdef considered harmful * @@ -164,7 +164,9 @@ * */ -#include "compiler.h" /* for doxygen */ +#ifdef DOXYGEN +#define __attribute__(x) +#endif #define __table_str(x) #x #define __table_section(table,idx) \ @@ -224,4 +226,4 @@ #define __table_end(table) \ __attribute__ (( unused, __table_section_end(table) )) -#endif /* TABLES_H */ +#endif /* _GPXE_TABLES_H */ diff --git a/src/include/gpxe/tcp.h b/src/include/gpxe/tcp.h index bcb15365..0aa209b7 100644 --- a/src/include/gpxe/tcp.h +++ b/src/include/gpxe/tcp.h @@ -1,5 +1,5 @@ -#ifndef _TCP_H -#define _TCP_H +#ifndef _GPXE_TCP_H +#define _GPXE_TCP_H /** @file * @@ -99,4 +99,4 @@ extern void tcp_send ( struct tcp_connection *conn, const void *data, size_t len ); extern void tcp_close ( struct tcp_connection *conn ); -#endif /* _TCP_H */ +#endif /* _GPXE_TCP_H */ diff --git a/src/include/image.h b/src/include/image.h index 0aff17c0..3483fe09 100644 --- a/src/include/image.h +++ b/src/include/image.h @@ -3,7 +3,7 @@ #include "stdint.h" #include "io.h" -#include "tables.h" +#include <gpxe/tables.h> #include "dev.h" struct image { diff --git a/src/include/init.h b/src/include/init.h index 0b341b8d..71311bfb 100644 --- a/src/include/init.h +++ b/src/include/init.h @@ -2,7 +2,7 @@ #define INIT_H #include "stddef.h" /* for NULL */ -#include "tables.h" +#include <gpxe/tables.h> /* * In order to avoid having objects dragged in just because main() diff --git a/src/include/proto.h b/src/include/proto.h index 886d76e3..89b7c173 100644 --- a/src/include/proto.h +++ b/src/include/proto.h @@ -1,7 +1,7 @@ #ifndef PROTO_H #define PROTO_H -#include "tables.h" +#include <gpxe/tables.h> #include "buffer.h" #include <gpxe/in.h> diff --git a/src/include/resolv.h b/src/include/resolv.h index 1c74081e..e97fd1e5 100644 --- a/src/include/resolv.h +++ b/src/include/resolv.h @@ -2,7 +2,7 @@ #define RESOLV_H #include <gpxe/in.h> -#include "tables.h" +#include <gpxe/tables.h> struct resolver { const char *name; |