Index: /usr/src/sys/boot/i386/libi386/pxe.c =================================================================== --- /usr/src/sys/boot/i386/libi386/pxe.c +++ /usr/src/sys/boot/i386/libi386/pxe.c @@ -179,12 +179,12 @@ pxenv_p = NULL; return (0); } - - /* + + /* * do byte checksum: * add up each byte in the structure, the total should be 0 */ - checksum = 0; + checksum = 0; checkptr = (uint8_t *) pxenv_p; for (counter = 0; counter < pxenv_p->Length; counter++) checksum += *checkptr++; @@ -194,7 +194,6 @@ return (0); } - /* * PXENV+ passed, so use that if !PXE is not available or * the checksum fails. @@ -221,15 +220,15 @@ } printf("\nPXE version %d.%d, real mode entry point ", - (uint8_t) (pxenv_p->Version >> 8), - (uint8_t) (pxenv_p->Version & 0xFF)); + (uint8_t) (pxenv_p->Version >> 8), + (uint8_t) (pxenv_p->Version & 0xFF)); if (pxe_call == bangpxe_call) printf("@%04x:%04x\n", - pxe_p->EntryPointSP.segment, - pxe_p->EntryPointSP.offset); + pxe_p->EntryPointSP.segment, + pxe_p->EntryPointSP.offset); else printf("@%04x:%04x\n", - pxenv_p->RMEntry.segment, pxenv_p->RMEntry.offset); + pxenv_p->RMEntry.segment, pxenv_p->RMEntry.offset); gci_p = (t_PXENV_GET_CACHED_INFO *) scratch_buffer; bzero(gci_p, sizeof(*gci_p)); @@ -248,7 +247,7 @@ static int pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size, - char *buf, size_t *rsize) + char *buf, size_t *rsize) { return (EIO); } @@ -256,26 +255,26 @@ static int pxe_open(struct open_file *f, ...) { - va_list args; - char *devname; /* Device part of file name (or NULL). */ - char temp[FNAME_SIZE]; - int error = 0; - int i; - - va_start(args, f); - devname = va_arg(args, char*); - va_end(args); + va_list args; + char *devname; /* Device part of file name (or NULL). */ + char temp[FNAME_SIZE]; + int error = 0; + int i; + + va_start(args, f); + devname = va_arg(args, char*); + va_end(args); - /* On first open, do netif open, mount, etc. */ - if (pxe_opens == 0) { + /* On first open, do netif open, mount, etc. */ + if (pxe_opens == 0) { /* Find network interface. */ if (pxe_sock < 0) { - pxe_sock = netif_open(devname); - if (pxe_sock < 0) { + pxe_sock = netif_open(devname); + if (pxe_sock < 0) { printf("pxe_open: netif_open() failed\n"); return (ENXIO); - } - if (pxe_debug) + } + if (pxe_debug) printf("pxe_open: netif_open() succeeded\n"); } if (rootip.s_addr == 0) { @@ -313,8 +312,8 @@ setenv("boot.netif.gateway", inet_ntoa(gateip), 1); setenv("boot.netif.server", inet_ntoa(rootip), 1); if (bootplayer.Hardware == ETHER_TYPE) { - sprintf(temp, "%6D", bootplayer.CAddr, ":"); - setenv("boot.netif.hwaddr", temp, 1); + sprintf(temp, "%6D", bootplayer.CAddr, ":"); + setenv("boot.netif.hwaddr", temp, 1); } if (intf_mtu != 0) { char mtu[16]; @@ -336,14 +335,14 @@ setenv("pxeboot.ip", inet_ntoa(myip), 1); if (bootplayer.Hardware == ETHER_TYPE) { - sprintf(temp, "%6D", bootplayer.CAddr, ":"); - setenv("pxeboot.hwaddr", temp, 1); + sprintf(temp, "%6D", bootplayer.CAddr, ":"); + setenv("pxeboot.hwaddr", temp, 1); } } - } - pxe_opens++; - f->f_devdata = &pxe_sock; - return (error); + } + pxe_opens++; + f->f_devdata = &pxe_sock; + return (error); } static int @@ -351,35 +350,35 @@ { #ifdef PXE_DEBUG - if (pxe_debug) + if (pxe_debug) printf("pxe_close: opens=%d\n", pxe_opens); #endif - /* On last close, do netif close, etc. */ - f->f_devdata = NULL; - /* Extra close call? */ - if (pxe_opens <= 0) + /* On last close, do netif close, etc. */ + f->f_devdata = NULL; + /* Extra close call? */ + if (pxe_opens <= 0) return (0); - pxe_opens--; - /* Not last close? */ - if (pxe_opens > 0) + pxe_opens--; + /* Not last close? */ + if (pxe_opens > 0) return(0); - if (netproto == NET_NFS) { + if (netproto == NET_NFS) { /* get an NFS filehandle for our root filesystem */ pxe_setnfshandle(rootpath); - } + } - if (pxe_sock >= 0) { + if (pxe_sock >= 0) { #ifdef PXE_DEBUG if (pxe_debug) - printf("pxe_close: calling netif_close()\n"); + printf("pxe_close: calling netif_close()\n"); #endif netif_close(pxe_sock); pxe_sock = -1; - } - return (0); + } + return (0); } static int @@ -394,7 +393,7 @@ return (1); if (verbose) { snprintf(line, sizeof(line), " pxe0: %s:%s\n", - inet_ntoa(rootip), rootpath); + inet_ntoa(rootip), rootpath); } else { snprintf(line, sizeof(line), " pxe0:\n"); } @@ -406,9 +405,9 @@ { #ifdef PXE_DEBUG t_PXENV_UNLOAD_STACK *unload_stack_p = - (t_PXENV_UNLOAD_STACK *)scratch_buffer; + (t_PXENV_UNLOAD_STACK *)scratch_buffer; t_PXENV_UNDI_SHUTDOWN *undi_shutdown_p = - (t_PXENV_UNDI_SHUTDOWN *)scratch_buffer; + (t_PXENV_UNDI_SHUTDOWN *)scratch_buffer; #endif if (pxe_call == NULL) @@ -419,15 +418,15 @@ #ifdef PXE_DEBUG if (pxe_debug && undi_shutdown_p->Status != 0) printf("pxe_cleanup: UNDI_SHUTDOWN failed %x\n", - undi_shutdown_p->Status); + undi_shutdown_p->Status); #endif pxe_call(PXENV_UNLOAD_STACK); -#ifdef PXE_DEBUG +#ifdef PXE_DEBUG if (pxe_debug && unload_stack_p->Status != 0) printf("pxe_cleanup: UNLOAD_STACK failed %x\n", - unload_stack_p->Status); + unload_stack_p->Status); #endif } @@ -449,18 +448,18 @@ /* structure truncated here */ }; extern struct nfs_iodesc nfs_root_node; -extern int rpc_port; +extern int rpc_port; static void pxe_rpcmountcall() { struct iodesc *d; - int error; + int error; if (!(d = socktodesc(pxe_sock))) return; - d->myport = htons(--rpc_port); - d->destip = rootip; + d->myport = htons(--rpc_port); + d->destip = rootip; if ((error = nfs_getrootfh(d, rootpath, nfs_root_node.fh)) != 0) printf("NFS MOUNT RPC error: %d\n", error); nfs_root_node.iodesc = d; @@ -511,10 +510,10 @@ if (!(d = socktodesc(pxe_sock))) return; - d->myport = htons(--rpc_port); - d->destip = rootip; + d->myport = htons(--rpc_port); + d->destip = rootip; if ((error = nfs_getrootfh(d, rootpath, &nfs_root_node.fhsize, - nfs_root_node.fh)) != 0) { + nfs_root_node.fh)) != 0) { printf("NFS MOUNT RPC error: %d\n", error); nfs_root_node.fhsize = 0; } @@ -578,13 +577,13 @@ if (pxe_debug) printf("bangpxe_call %x\n", func); #endif - + bzero(&v86, sizeof(v86)); bzero(data_buffer, sizeof(data_buffer)); __bangpxeseg = pxe_p->EntryPointSP.segment; __bangpxeoff = pxe_p->EntryPointSP.offset; - + v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; v86.edx = VTOPSEG(scratch_buffer); v86.eax = VTOPOFF(scratch_buffer); @@ -594,7 +593,6 @@ v86.ctl = V86_FLAGS; } - time_t getsecs(void) { @@ -609,7 +607,6 @@ return 1; } - static int pxe_netif_probe(struct netif *nif, void *machdep_hint) { @@ -666,7 +663,7 @@ { t_PXENV_UDP_WRITE *udpwrite_p = (t_PXENV_UDP_WRITE *)scratch_buffer; bzero(udpwrite_p, sizeof(*udpwrite_p)); - + udpwrite_p->ip = h->destip.s_addr; udpwrite_p->dst_port = h->destport; udpwrite_p->src_port = h->myport; @@ -699,10 +696,10 @@ { t_PXENV_UDP_READ *udpread_p = (t_PXENV_UDP_READ *)scratch_buffer; struct udphdr *uh = NULL; - + uh = (struct udphdr *) pkt - 1; bzero(udpread_p, sizeof(*udpread_p)); - + udpread_p->dest_ip = h->myip.s_addr; udpread_p->d_port = h->myport; udpread_p->buffer_size = len;