aboutsummaryrefslogtreecommitdiffstats
path: root/core/fs/pxe/core.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2013-03-28 14:14:20 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2013-03-28 14:14:20 -0700
commit66d551acdb0d516f43702983184483687c2128e4 (patch)
tree61c263c4bb15a192909c6f2928cd430ffaf31f52 /core/fs/pxe/core.c
parenta107cb3b6fa219cf5f65bef366c9b00b108e9a3a (diff)
downloadsyslinux-66d551acdb0d516f43702983184483687c2128e4.tar.gz
syslinux-66d551acdb0d516f43702983184483687c2128e4.tar.xz
syslinux-66d551acdb0d516f43702983184483687c2128e4.zip
pxe: disentangle the legacy and lwip stacks without #ifdef
Disentangle the dependencies via the legacy and the lwip stacks. Now there are no more #ifdefs (except for a single one in pxelinux.asm) and the only difference between the pxelinux and lpxelinux archives are which files are included. To make this happen: 1. Replace the private part of the socket structure with a union. 2. Move the list of URL methods into a stack-dependent file. Reported-by: Josh Triplett <josh@joshtriplett.org> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'core/fs/pxe/core.c')
-rw-r--r--core/fs/pxe/core.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/core/fs/pxe/core.c b/core/fs/pxe/core.c
index 9246f669..e330ba82 100644
--- a/core/fs/pxe/core.c
+++ b/core/fs/pxe/core.c
@@ -6,6 +6,13 @@
#include <net.h>
#include "pxe.h"
+const struct url_scheme url_schemes[] = {
+ { "tftp", tftp_open, 0 },
+ { "http", http_open, O_DIRECTORY },
+ { "ftp", ftp_open, O_DIRECTORY },
+ { NULL, NULL, 0 },
+};
+
/**
* Open a socket
*
@@ -16,7 +23,7 @@
*/
int net_core_open(struct pxe_pvt_inode *socket, enum net_core_proto proto)
{
- struct net_private *priv = &socket->private;
+ struct net_private_lwip *priv = &socket->net.lwip;
enum netconn_type type;
int err;
@@ -53,7 +60,7 @@ int net_core_open(struct pxe_pvt_inode *socket, enum net_core_proto proto)
*/
void net_core_close(struct pxe_pvt_inode *socket)
{
- struct net_private *priv = &socket->private;
+ struct net_private_lwip *priv = &socket->net.lwip;
if (priv->conn) {
netconn_delete(priv->conn);
@@ -71,7 +78,7 @@ void net_core_close(struct pxe_pvt_inode *socket)
void net_core_connect(struct pxe_pvt_inode *socket, uint32_t ip,
uint16_t port)
{
- struct net_private *priv = &socket->private;
+ struct net_private_lwip *priv = &socket->net.lwip;
struct ip_addr addr;
addr.addr = ip;
@@ -85,7 +92,7 @@ void net_core_connect(struct pxe_pvt_inode *socket, uint32_t ip,
*/
void net_core_disconnect(struct pxe_pvt_inode *socket)
{
- struct net_private *priv = &socket->private;
+ struct net_private_lwip *priv = &socket->net.lwip;
netconn_disconnect(priv->conn);
}
@@ -102,7 +109,7 @@ void net_core_disconnect(struct pxe_pvt_inode *socket)
int net_core_recv(struct pxe_pvt_inode *socket, void *buf, uint16_t *buf_len,
uint32_t *src_ip, uint16_t *src_port)
{
- struct net_private *priv = &socket->private;
+ struct net_private_lwip *priv = &socket->net.lwip;
struct netbuf *nbuf;
u16_t nbuf_len;
int err;
@@ -138,7 +145,7 @@ int net_core_recv(struct pxe_pvt_inode *socket, void *buf, uint16_t *buf_len,
*/
void net_core_send(struct pxe_pvt_inode *socket, const void *data, size_t len)
{
- struct netconn *conn = socket->private.conn;
+ struct netconn *conn = socket->net.lwip.conn;
struct netbuf *nbuf;
void *pbuf;
int err;