* [PATCHv2 1/1] net: Exclude code based on selected protocol
@ 2009-12-24 14:05 Sanjeev Premi
0 siblings, 0 replies; only message in thread
From: Sanjeev Premi @ 2009-12-24 14:05 UTC (permalink / raw)
To: barebox
Exclude the code for TFTP/NFS if either of the
protocols is not selected.
Signed-off-by: Sanjeev Premi <premi@ti.com>
---
commands/net.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/commands/net.c b/commands/net.c
index df06227..3d49e36 100644
--- a/commands/net.c
+++ b/commands/net.c
@@ -37,7 +37,9 @@
#include <libbb.h>
#include <libgen.h>
+#if defined(CONFIG_NET_NFS) || defined(CONFIG_NET_TFTP)
static int netboot_common (proto_t, cmd_tbl_t *, int , char *[]);
+#endif
void netboot_update_env(void)
{
@@ -77,6 +79,7 @@ void netboot_update_env(void)
setenv ("domain", NetOurNISDomain);
}
+#ifdef CONFIG_NET_TFTP
static int do_tftpb (cmd_tbl_t *cmdtp, int argc, char *argv[])
{
return netboot_common (TFTP, cmdtp, argc, argv);
@@ -92,6 +95,8 @@ BAREBOX_CMD_START(tftp)
BAREBOX_CMD_HELP(cmd_tftp_help)
BAREBOX_CMD_END
+#endif
+
/**
* @page tftp_command tftp
*
@@ -157,9 +162,14 @@ BAREBOX_CMD_END
int net_store_fd;
+#ifdef CONFIG_NET_TFTP
extern void TftpStart(char *); /* Begin TFTP get */
+#endif
+#ifdef CONFIG_NET_NFS
extern void NfsStart(char *);
+#endif
+#if defined(CONFIG_NET_NFS) || defined(CONFIG_NET_TFTP)
static int
netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
{
@@ -188,11 +198,15 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
goto out;
switch (proto) {
+#ifdef CONFIG_NET_TFTP
case TFTP:
TftpStart(remotefile);
break;
+#endif
+#ifdef CONFIG_NET_NFS
case NFS:
NfsStart(remotefile);
+#endif
default:
break;
}
@@ -209,6 +223,7 @@ out:
close(net_store_fd);
return rcode;
}
+#endif /* defined(CONFIG_NET_NFS) || defined(CONFIG_NET_TFTP) */
#ifdef CONFIG_NET_CDP
--
1.6.2.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-12-24 14:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-24 14:05 [PATCHv2 1/1] net: Exclude code based on selected protocol Sanjeev Premi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox