NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-sparc64/46652 (sparc ofwboot.net fails to load kernel via tftp)



Ok, tftp requires own initialization (net_sock in of->f_devdata),
but the previous code (using int**) was a bit confusing.

How about passing (struct open_file *) as
lib/libsa/tftp.c:tftp_open() does?

---
Izumi Tsutsui

Index: net.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/stand/ofwboot/net.c,v
retrieving revision 1.7
diff -u -p -r1.7 net.c
--- net.c       21 May 2011 15:50:42 -0000      1.7
+++ net.c       4 Jul 2012 11:39:38 -0000
@@ -181,13 +181,14 @@ net_mountroot_bootp(void)
 }
 
 int
-net_tftp_bootp(struct of_dev *op)
+net_tftp_bootp(struct open_file *f)
 {
 
        net_mountroot_bootp();
        if (myip.s_addr == 0)
                return(ENOENT);
 
+       f->f_devdata = &netdev_sock;
        return (0);
 }
 
Index: net.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/stand/ofwboot/net.h,v
retrieving revision 1.2
diff -u -p -r1.2 net.h
--- net.h       21 May 2011 15:50:42 -0000      1.2
+++ net.h       4 Jul 2012 11:39:38 -0000
@@ -34,7 +34,7 @@
 
 int    net_open(struct of_dev *);
 int    net_close(struct of_dev *);
-int    net_tftp_bootp(struct of_dev *);
+int    net_tftp_bootp(struct open_file *);
 int    net_mountroot(void);
 
 #endif /* _OFWBOOT_NET_H */
Index: ofdev.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/stand/ofwboot/ofdev.c,v
retrieving revision 1.32
diff -u -p -r1.32 ofdev.c
--- ofdev.c     1 Jun 2011 11:42:18 -0000       1.32
+++ ofdev.c     4 Jul 2012 11:39:38 -0000
@@ -536,7 +536,7 @@ open_again:
                if (!strncmp(*file,"/tftp:",6)) {
                        *file += 6;
                        memcpy(&file_system[0], &file_system_tftp, sizeof 
file_system[0]);
-                       if (net_tftp_bootp(of->f_devdata)) {
+                       if (net_tftp_bootp(of)) {
                                net_close(&ofdev);
                                goto bad;
                        }

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index