Sun May 10 18:55:22 2015 UTC ()
mtod mbuf to sockaddr * for so_send().


(rtr)
diff -r1.14 -r1.15 src/sys/kern/subr_tftproot.c

cvs diff -r1.14 -r1.15 src/sys/kern/subr_tftproot.c (expand / switch to unified diff)

--- src/sys/kern/subr_tftproot.c 2015/03/27 07:18:11 1.14
+++ src/sys/kern/subr_tftproot.c 2015/05/10 18:55:22 1.15
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: subr_tftproot.c,v 1.14 2015/03/27 07:18:11 hikaru Exp $ */ 1/* $NetBSD: subr_tftproot.c,v 1.15 2015/05/10 18:55:22 rtr Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Emmanuel Dreyfus, all rights reserved. 4 * Copyright (c) 2007 Emmanuel Dreyfus, all rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34/* 34/*
35 * Download the root RAMdisk through TFTP at root mount time 35 * Download the root RAMdisk through TFTP at root mount time
36 */ 36 */
37 37
38#include "opt_tftproot.h" 38#include "opt_tftproot.h"
39#include "opt_md.h" 39#include "opt_md.h"
40 40
41#include <sys/cdefs.h> 41#include <sys/cdefs.h>
42__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.14 2015/03/27 07:18:11 hikaru Exp $"); 42__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.15 2015/05/10 18:55:22 rtr Exp $");
43 43
44#include <sys/param.h> 44#include <sys/param.h>
45#include <sys/types.h> 45#include <sys/types.h>
46#include <sys/vnode.h> 46#include <sys/vnode.h>
47#include <sys/mount.h> 47#include <sys/mount.h>
48#include <sys/lwp.h> 48#include <sys/lwp.h>
49#include <sys/kmem.h> 49#include <sys/kmem.h>
50#include <sys/mbuf.h> 50#include <sys/mbuf.h>
51#include <sys/timevar.h> 51#include <sys/timevar.h>
52#include <sys/socketvar.h> 52#include <sys/socketvar.h>
53 53
54#include <net/if.h> 54#include <net/if.h>
55 55
@@ -310,27 +310,27 @@ tftproot_getfile(struct tftproot_handle  @@ -310,27 +310,27 @@ tftproot_getfile(struct tftproot_handle
310 if (trh->trh_flags & TRH_FINISHED) 310 if (trh->trh_flags & TRH_FINISHED)
311 break; 311 break;
312 312
313 trh->trh_block++; 313 trh->trh_block++;
314 } while (1/* CONSTCOND */); 314 } while (1/* CONSTCOND */);
315 315
316 printf("\n"); 316 printf("\n");
317 317
318 /* 318 /*
319 * Ack the last block. so_send frees m_outbuf, therefore 319 * Ack the last block. so_send frees m_outbuf, therefore
320 * we do not want to free it ourselves. 320 * we do not want to free it ourselves.
321 * Ignore errors, as we already have the whole file. 321 * Ignore errors, as we already have the whole file.
322 */ 322 */
323 if ((error = (*so->so_send)(so, m_serv, NULL,  323 if ((error = (*so->so_send)(so, mtod(m_serv, struct sockaddr *), NULL,
324 m_outbuf, NULL, 0, l)) != 0) 324 m_outbuf, NULL, 0, l)) != 0)
325 DPRINTF(("%s():%d tftproot: sosend returned %d\n",  325 DPRINTF(("%s():%d tftproot: sosend returned %d\n",
326 __func__, __LINE__, error)); 326 __func__, __LINE__, error));
327 else 327 else
328 m_outbuf = NULL; 328 m_outbuf = NULL;
329 329
330 /*  330 /*
331 * And use it as the root ramdisk.  331 * And use it as the root ramdisk.
332 */ 332 */
333 DPRINTF(("%s():%d RAMdisk loaded: %ld@%p\n",  333 DPRINTF(("%s():%d RAMdisk loaded: %ld@%p\n",
334 __func__, __LINE__, trh->trh_len, trh->trh_base)); 334 __func__, __LINE__, trh->trh_len, trh->trh_base));
335 md_root_setconf(trh->trh_base, trh->trh_len); 335 md_root_setconf(trh->trh_base, trh->trh_len);
336 mdattach(0); 336 mdattach(0);