summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown2010-11-30 01:22:49 +0100
committerMichael Brown2011-01-10 04:39:26 +0100
commit6cee8904d1d26cd3503018e9514b8671a9b0a860 (patch)
treec7aa6a5cc3b6ba870d6a54fe92ebe99ee4c046a7 /src/include/ipxe
parent[hermon] Fix incorrectly-padded sense_port structure (diff)
downloadipxe-6cee8904d1d26cd3503018e9514b8671a9b0a860.tar.gz
ipxe-6cee8904d1d26cd3503018e9514b8671a9b0a860.tar.xz
ipxe-6cee8904d1d26cd3503018e9514b8671a9b0a860.zip
[dhcp] Remove redundant length fields in struct dhcp_packet
The max_len field is never used, and the len field is used only by dhcp_tx(). Remove these two fields, and perform the necessary trivial calculation in dhcp_tx() instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/dhcppkt.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/include/ipxe/dhcppkt.h b/src/include/ipxe/dhcppkt.h
index 5709cc7d1..b004800d8 100644
--- a/src/include/ipxe/dhcppkt.h
+++ b/src/include/ipxe/dhcppkt.h
@@ -22,10 +22,6 @@ struct dhcp_packet {
struct refcnt refcnt;
/** The DHCP packet contents */
struct dhcphdr *dhcphdr;
- /** Maximum length of the DHCP packet buffer */
- size_t max_len;
- /** Used length of the DHCP packet buffer */
- size_t len;
/** DHCP options */
struct dhcp_options options;
/** Settings interface */
@@ -54,6 +50,16 @@ dhcppkt_put ( struct dhcp_packet *dhcppkt ) {
ref_put ( &dhcppkt->refcnt );
}
+/**
+ * Get used length of DHCP packet
+ *
+ * @v dhcppkt DHCP packet
+ * @ret len Used length
+ */
+static inline int dhcppkt_len ( struct dhcp_packet *dhcppkt ) {
+ return ( offsetof ( struct dhcphdr, options ) + dhcppkt->options.len );
+}
+
extern int dhcppkt_store ( struct dhcp_packet *dhcppkt, unsigned int tag,
const void *data, size_t len );
extern int dhcppkt_fetch ( struct dhcp_packet *dhcppkt, unsigned int tag,