Module Name: src Committed By: tnn Date: Sat Mar 7 23:20:19 UTC 2020
Modified Files: src/sys/kern: subr_tftproot.c Log Message: clean trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/kern/subr_tftproot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/subr_tftproot.c diff -u src/sys/kern/subr_tftproot.c:1.23 src/sys/kern/subr_tftproot.c:1.24 --- src/sys/kern/subr_tftproot.c:1.23 Sun Jan 20 21:26:13 2019 +++ src/sys/kern/subr_tftproot.c Sat Mar 7 23:20:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_tftproot.c,v 1.23 2019/01/20 21:26:13 bad Exp $ */ +/* $NetBSD: subr_tftproot.c,v 1.24 2020/03/07 23:20:19 tnn Exp $ */ /*- * Copyright (c) 2007 Emmanuel Dreyfus, all rights reserved. @@ -14,14 +14,14 @@ * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Emmanuel Dreyfus - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written + * 4. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written * permission. * - * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -39,7 +39,7 @@ #include "opt_md.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.23 2019/01/20 21:26:13 bad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.24 2020/03/07 23:20:19 tnn Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -65,8 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: subr_tftproo #include <nfs/nfsdiskless.h> #include <nfs/nfs_var.h> -/* - * Copied from <lib/libsa/tftp.h> +/* + * Copied from <lib/libsa/tftp.h> */ #define SEGSIZE 512 /* data segment size */ @@ -134,7 +134,7 @@ tftproot_dhcpboot(device_t bootdv) if (strcmp(rootspec, ifp->if_xname) == 0) break; pserialize_read_exit(s); - } + } if ((ifp == NULL) && (bootdv != NULL && device_class(bootdv) == DV_IFNET)) { @@ -167,12 +167,12 @@ tftproot_dhcpboot(device_t bootdv) nd->nd_nomount = 1; if ((error = nfs_boot_init(nd, l)) != 0) { - DPRINTF(("%s():%d nfs_boot_init returned %d\n", + DPRINTF(("%s():%d nfs_boot_init returned %d\n", __func__, __LINE__, error)); goto out; } - /* + /* * Strip leading "tftp:" */ #define PREFIX "tftp:" @@ -189,7 +189,7 @@ tftproot_dhcpboot(device_t bootdv) trh.trh_block = 1; if ((error = tftproot_getfile(&trh, l)) != 0) { - DPRINTF(("%s():%d tftproot_getfile returned %d\n", + DPRINTF(("%s():%d tftproot_getfile returned %d\n", __func__, __LINE__, error)); goto out; } @@ -203,7 +203,7 @@ out: return error; } -static int +static int tftproot_getfile(struct tftproot_handle *trh, struct lwp *l) { struct socket *so = NULL; @@ -218,7 +218,7 @@ tftproot_getfile(struct tftproot_handle char *cp; if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, l, NULL)) != 0) { - DPRINTF(("%s():%d socreate returned %d\n", + DPRINTF(("%s():%d socreate returned %d\n", __func__, __LINE__, error)); goto out; } @@ -227,7 +227,7 @@ tftproot_getfile(struct tftproot_handle * Set timeout */ if ((error = nfs_boot_setrecvtimo(so))) { - DPRINTF(("%s():%d SO_RCVTIMEO failed %d\n", + DPRINTF(("%s():%d SO_RCVTIMEO failed %d\n", __func__, __LINE__, error)); goto out; } @@ -244,7 +244,7 @@ tftproot_getfile(struct tftproot_handle namelen = strlen(trh->trh_nd->nd_bootfile) + 1; packetlen = sizeof(tftp->th_opcode) + namelen + sizeof(octetstr); if (packetlen > MSIZE) { - DPRINTF(("%s():%d boot filename too long (%ld bytes)\n", + DPRINTF(("%s():%d boot filename too long (%ld bytes)\n", __func__, __LINE__, (long)namelen)); error = E2BIG; goto out; @@ -265,10 +265,10 @@ tftproot_getfile(struct tftproot_handle cp += namelen; (void)strncpy(cp, octetstr, sizeof(octetstr)); - /* + /* * Perform the file transfer */ - printf("tftproot: download %s:%s ", + printf("tftproot: download %s:%s ", inet_ntoa(sin.sin_addr), trh->trh_nd->nd_bootfile); do { @@ -281,19 +281,19 @@ tftproot_getfile(struct tftproot_handle if ((trh->trh_block % TFTPROOT_PROGRESS) == 0) twiddle(); - /* - * Send the packet and receive the answer. + /* + * Send the packet and receive the answer. * We get the sender address here, which should be * the same server with a different port */ if ((error = nfs_boot_sendrecv(so, &sin, NULL, m_outbuf, tftproot_recv, NULL, &m_serv, trh, l)) != 0) { - DPRINTF(("%s():%d sendrecv failed %d\n", + DPRINTF(("%s():%d sendrecv failed %d\n", __func__, __LINE__, error)); goto out; } - /* + /* * Accommodate the packet length for acks. * This is really needed only on first pass */ @@ -320,17 +320,17 @@ tftproot_getfile(struct tftproot_handle */ if ((error = (*so->so_send)(so, mtod(m_serv, struct sockaddr *), NULL, m_outbuf, NULL, 0, l)) != 0) { - DPRINTF(("%s():%d tftproot: sosend returned %d\n", + DPRINTF(("%s():%d tftproot: sosend returned %d\n", __func__, __LINE__, error)); } /* Freed by the protocol */ m_outbuf = NULL; - /* - * And use it as the root ramdisk. + /* + * And use it as the root ramdisk. */ - DPRINTF(("%s():%d RAMdisk loaded: %ld@%p\n", + DPRINTF(("%s():%d RAMdisk loaded: %ld@%p\n", __func__, __LINE__, trh->trh_len, trh->trh_base)); md_root_setconf(trh->trh_base, trh->trh_len); @@ -361,7 +361,7 @@ tftproot_recv(struct mbuf **mp, void *ct * Check for short packet */ if (m->m_pkthdr.len < hdrlen) { - DPRINTF(("%s():%d short reply (%d bytes)\n", + DPRINTF(("%s():%d short reply (%d bytes)\n", __func__, __LINE__, m->m_pkthdr.len)); return -1; } @@ -370,7 +370,7 @@ tftproot_recv(struct mbuf **mp, void *ct * Check for packet too large for being a TFTP packet */ if (m->m_pkthdr.len > hdrlen + SEGSIZE) { - DPRINTF(("%s():%d packet too big (%d bytes)\n", + DPRINTF(("%s():%d packet too big (%d bytes)\n", __func__, __LINE__, m->m_pkthdr.len)); return -1; } @@ -417,7 +417,7 @@ tftproot_recv(struct mbuf **mp, void *ct } default: - DPRINTF(("%s():%d unexpected tftp reply opcode %d\n", + DPRINTF(("%s():%d unexpected tftp reply opcode %d\n", __func__, __LINE__, ntohs(tftp->th_opcode))); return -1; break; @@ -427,7 +427,7 @@ tftproot_recv(struct mbuf **mp, void *ct * Check for last packet, which does not fill the whole space */ if (m->m_pkthdr.len < hdrlen + SEGSIZE) { - DPRINTF(("%s():%d last chunk (%d bytes)\n", + DPRINTF(("%s():%d last chunk (%d bytes)\n", __func__, __LINE__, m->m_pkthdr.len)); trh->trh_flags |= TRH_FINISHED; } @@ -439,13 +439,13 @@ tftproot_recv(struct mbuf **mp, void *ct return -1; } - /* + /* * Grow the receiving buffer to accommodate new data */ newlen = trh->trh_len + (m->m_pkthdr.len - hdrlen); - if ((trh->trh_base = realloc(trh->trh_base, + if ((trh->trh_base = realloc(trh->trh_base, newlen, M_TEMP, M_WAITOK)) == NULL) { - DPRINTF(("%s():%d failed to realloc %ld bytes\n", + DPRINTF(("%s():%d failed to realloc %ld bytes\n", __func__, __LINE__, (long)newlen)); return -1; }