summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gpxe')
-rw-r--r--src/include/gpxe/crypto.h28
-rw-r--r--src/include/gpxe/errfile.h121
-rw-r--r--src/include/gpxe/errortab.h1
-rw-r--r--src/include/gpxe/iobuf.h20
-rw-r--r--src/include/gpxe/ndp.h1
5 files changed, 129 insertions, 42 deletions
diff --git a/src/include/gpxe/crypto.h b/src/include/gpxe/crypto.h
index fc1f50bc..95665acc 100644
--- a/src/include/gpxe/crypto.h
+++ b/src/include/gpxe/crypto.h
@@ -9,7 +9,6 @@
#include <stdint.h>
#include <stddef.h>
-#include <errno.h>
/** A cryptographic algorithm */
struct crypto_algorithm {
@@ -101,30 +100,17 @@ static inline int cipher_setkey ( struct crypto_algorithm *crypto,
return crypto->setkey ( ctx, key, keylen );
}
-static inline int cipher_encrypt ( struct crypto_algorithm *crypto,
- void *ctx, const void *src, void *dst,
- size_t len ) {
- if ( ( len & ( crypto->blocksize - 1 ) ) ) {
- return -EINVAL;
- }
- crypto->encode ( ctx, src, dst, len );
- return 0;
-}
-
-static inline int cipher_decrypt ( struct crypto_algorithm *crypto,
- void *ctx, const void *src, void *dst,
- size_t len ) {
- if ( ( len & ( crypto->blocksize - 1 ) ) ) {
- return -EINVAL;
- }
- crypto->decode ( ctx, src, dst, len );
- return 0;
-}
-
static inline int is_stream_cipher ( struct crypto_algorithm *crypto ) {
return ( crypto->blocksize == 1 );
}
extern struct crypto_algorithm crypto_null;
+extern int cipher_encrypt ( struct crypto_algorithm *crypto,
+ void *ctx, const void *src, void *dst,
+ size_t len );
+extern int cipher_decrypt ( struct crypto_algorithm *crypto,
+ void *ctx, const void *src, void *dst,
+ size_t len );
+
#endif /* _GPXE_CRYPTO_H */
diff --git a/src/include/gpxe/errfile.h b/src/include/gpxe/errfile.h
new file mode 100644
index 00000000..0615818f
--- /dev/null
+++ b/src/include/gpxe/errfile.h
@@ -0,0 +1,121 @@
+#ifndef _GPXE_ERRFILE_H
+#define _GPXE_ERRFILE_H
+
+/** @file
+ *
+ * Error file identifiers
+ *
+ */
+
+#include <bits/errfile.h>
+
+/**
+ * @defgroup errfilecat Error file identifier categories
+ *
+ * @{
+ */
+
+#define ERRFILE_CORE 0x00002000 /**< Core code */
+#define ERRFILE_DRIVER 0x00004000 /**< Driver code */
+#define ERRFILE_NET 0x00006000 /**< Networking code */
+#define ERRFILE_IMAGE 0x00008000 /**< Image code */
+#define ERRFILE_OTHER 0x0000e000 /**< Any other code */
+
+/** @} */
+
+/** Flag for architecture-dependent error files */
+#define ERRFILE_ARCH 0x00800000
+
+/**
+ * @defgroup errfile Error file identifiers
+ *
+ * These values are automatically incorporated into the definitions
+ * for error numbers such as EINVAL.
+ *
+ * @{
+ */
+
+#define ERRFILE_asprintf ( ERRFILE_CORE | 0x00000000 )
+#define ERRFILE_downloader ( ERRFILE_CORE | 0x00010000 )
+#define ERRFILE_exec ( ERRFILE_CORE | 0x00020000 )
+#define ERRFILE_hw ( ERRFILE_CORE | 0x00030000 )
+#define ERRFILE_iobuf ( ERRFILE_CORE | 0x00040000 )
+#define ERRFILE_job ( ERRFILE_CORE | 0x00050000 )
+#define ERRFILE_linebuf ( ERRFILE_CORE | 0x00060000 )
+#define ERRFILE_monojob ( ERRFILE_CORE | 0x00070000 )
+#define ERRFILE_nvo ( ERRFILE_CORE | 0x00080000 )
+#define ERRFILE_open ( ERRFILE_CORE | 0x00090000 )
+#define ERRFILE_posix_io ( ERRFILE_CORE | 0x000a0000 )
+#define ERRFILE_resolv ( ERRFILE_CORE | 0x000b0000 )
+#define ERRFILE_settings ( ERRFILE_CORE | 0x000c0000 )
+#define ERRFILE_vsprintf ( ERRFILE_CORE | 0x000d0000 )
+#define ERRFILE_xfer ( ERRFILE_CORE | 0x000e0000 )
+
+#define ERRFILE_eisa ( ERRFILE_DRIVER | 0x00000000 )
+#define ERRFILE_isa ( ERRFILE_DRIVER | 0x00010000 )
+#define ERRFILE_isapnp ( ERRFILE_DRIVER | 0x00020000 )
+#define ERRFILE_mca ( ERRFILE_DRIVER | 0x00030000 )
+#define ERRFILE_pci ( ERRFILE_DRIVER | 0x00040000 )
+
+#define ERRFILE_nvs ( ERRFILE_DRIVER | 0x00100000 )
+#define ERRFILE_spi ( ERRFILE_DRIVER | 0x00110000 )
+#define ERRFILE_i2c_bit ( ERRFILE_DRIVER | 0x00120000 )
+#define ERRFILE_spi_bit ( ERRFILE_DRIVER | 0x00130000 )
+
+#define ERRFILE_3c509 ( ERRFILE_DRIVER | 0x00200000 )
+#define ERRFILE_bnx2 ( ERRFILE_DRIVER | 0x00210000 )
+#define ERRFILE_cs89x0 ( ERRFILE_DRIVER | 0x00220000 )
+#define ERRFILE_eepro ( ERRFILE_DRIVER | 0x00230000 )
+#define ERRFILE_etherfabric ( ERRFILE_DRIVER | 0x00240000 )
+#define ERRFILE_legacy ( ERRFILE_DRIVER | 0x00250000 )
+#define ERRFILE_natsemi ( ERRFILE_DRIVER | 0x00260000 )
+#define ERRFILE_pnic ( ERRFILE_DRIVER | 0x00270000 )
+#define ERRFILE_prism2_pci ( ERRFILE_DRIVER | 0x00280000 )
+#define ERRFILE_prism2_plx ( ERRFILE_DRIVER | 0x00290000 )
+#define ERRFILE_rtl8139 ( ERRFILE_DRIVER | 0x002a0000 )
+#define ERRFILE_smc9000 ( ERRFILE_DRIVER | 0x002b0000 )
+#define ERRFILE_tg3 ( ERRFILE_DRIVER | 0x002c0000 )
+
+#define ERRFILE_scsi ( ERRFILE_DRIVER | 0x00700000 )
+
+#define ERRFILE_aoe ( ERRFILE_NET | 0x00000000 )
+#define ERRFILE_arp ( ERRFILE_NET | 0x00010000 )
+#define ERRFILE_dhcpopts ( ERRFILE_NET | 0x00020000 )
+#define ERRFILE_ethernet ( ERRFILE_NET | 0x00030000 )
+#define ERRFILE_icmpv6 ( ERRFILE_NET | 0x00040000 )
+#define ERRFILE_ipv4 ( ERRFILE_NET | 0x00050000 )
+#define ERRFILE_ipv6 ( ERRFILE_NET | 0x00060000 )
+#define ERRFILE_ndp ( ERRFILE_NET | 0x00070000 )
+#define ERRFILE_netdevice ( ERRFILE_NET | 0x00080000 )
+#define ERRFILE_nullnet ( ERRFILE_NET | 0x00090000 )
+#define ERRFILE_tcp ( ERRFILE_NET | 0x000a0000 )
+#define ERRFILE_ftp ( ERRFILE_NET | 0x000b0000 )
+#define ERRFILE_http ( ERRFILE_NET | 0x000c0000 )
+#define ERRFILE_iscsi ( ERRFILE_NET | 0x000d0000 )
+#define ERRFILE_tcpip ( ERRFILE_NET | 0x000e0000 )
+#define ERRFILE_udp ( ERRFILE_NET | 0x000f0000 )
+#define ERRFILE_dhcp ( ERRFILE_NET | 0x00100000 )
+#define ERRFILE_dns ( ERRFILE_NET | 0x00110000 )
+#define ERRFILE_tftp ( ERRFILE_NET | 0x00120000 )
+
+#define ERRFILE_image ( ERRFILE_IMAGE | 0x00000000 )
+#define ERRFILE_elf ( ERRFILE_IMAGE | 0x00010000 )
+#define ERRFILE_script ( ERRFILE_IMAGE | 0x00020000 )
+#define ERRFILE_segment ( ERRFILE_IMAGE | 0x00030000 )
+
+#define ERRFILE_asn1 ( ERRFILE_OTHER | 0x00000000 )
+#define ERRFILE_chap ( ERRFILE_OTHER | 0x00010000 )
+#define ERRFILE_aoeboot ( ERRFILE_OTHER | 0x00020000 )
+#define ERRFILE_autoboot ( ERRFILE_OTHER | 0x00030000 )
+#define ERRFILE_dhcpmgmt ( ERRFILE_OTHER | 0x00040000 )
+#define ERRFILE_imgmgmt ( ERRFILE_OTHER | 0x00050000 )
+#define ERRFILE_pxe_tftp ( ERRFILE_OTHER | 0x00060000 )
+#define ERRFILE_pxe_udp ( ERRFILE_OTHER | 0x00070000 )
+#define ERRFILE_axtls_aes ( ERRFILE_OTHER | 0x00080000 )
+#define ERRFILE_cipher ( ERRFILE_OTHER | 0x00090000 )
+#define ERRFILE_image_cmd ( ERRFILE_OTHER | 0x000a0000 )
+#define ERRFILE_uri_test ( ERRFILE_OTHER | 0x000b0000 )
+
+/** @} */
+
+#endif /* _GPXE_ERRFILE_H */
diff --git a/src/include/gpxe/errortab.h b/src/include/gpxe/errortab.h
index 470f7e79..e9a56768 100644
--- a/src/include/gpxe/errortab.h
+++ b/src/include/gpxe/errortab.h
@@ -7,7 +7,6 @@
*
*/
-#include <errno.h>
#include <gpxe/tables.h>
struct errortab {
diff --git a/src/include/gpxe/iobuf.h b/src/include/gpxe/iobuf.h
index c7451a08..c0dfd434 100644
--- a/src/include/gpxe/iobuf.h
+++ b/src/include/gpxe/iobuf.h
@@ -9,7 +9,6 @@
#include <stdint.h>
#include <assert.h>
-#include <errno.h>
#include <gpxe/list.h>
/**
@@ -162,26 +161,9 @@ static inline size_t iob_tailroom ( struct io_buffer *iobuf ) {
return ( iobuf->end - iobuf->tail );
}
-/**
- * Ensure I/O buffer has sufficient headroom
- *
- * @v iobuf I/O buffer
- * @v len Required headroom
- *
- * This function currently only checks for the required headroom; it
- * does not reallocate the I/O buffer if required. If we ever have a
- * code path that requires this functionality, it's a fairly trivial
- * change to make.
- */
-static inline __attribute__ (( always_inline )) int
-iob_ensure_headroom ( struct io_buffer *iobuf, size_t len ) {
- if ( iob_headroom ( iobuf ) >= len )
- return 0;
- return -ENOBUFS;
-}
-
extern struct io_buffer * alloc_iob ( size_t len );
extern void free_iob ( struct io_buffer *iobuf );
extern void iob_pad ( struct io_buffer *iobuf, size_t min_len );
+extern int iob_ensure_headroom ( struct io_buffer *iobuf, size_t len );
#endif /* _GPXE_IOBUF_H */
diff --git a/src/include/gpxe/ndp.h b/src/include/gpxe/ndp.h
index 2eae2958..db32b0c8 100644
--- a/src/include/gpxe/ndp.h
+++ b/src/include/gpxe/ndp.h
@@ -1,6 +1,5 @@
#include <stdint.h>
#include <byteswap.h>
-#include <errno.h>
#include <string.h>
#include <gpxe/icmp6.h>
#include <gpxe/ip6.h>