Date: Fri, 26 Dec 2003 16:53:29 -0800 (PST) From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 44378 for review Message-ID: <200312270053.hBR0rTFg007005@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=44378 Change 44378 by sam@sam_ebb on 2003/12/26 16:53:14 IFC Affected files ... .. //depot/projects/netperf+sockets/sys/compat/ndis/kern_ndis.c#5 integrate .. //depot/projects/netperf+sockets/sys/compat/ndis/ndis_var.h#5 integrate .. //depot/projects/netperf+sockets/sys/compat/ndis/subr_ndis.c#5 integrate .. //depot/projects/netperf+sockets/sys/compat/ndis/subr_pe.c#4 integrate .. //depot/projects/netperf+sockets/sys/dev/acpica/acpi.c#7 integrate .. //depot/projects/netperf+sockets/sys/dev/gem/if_gem_pci.c#2 integrate .. //depot/projects/netperf+sockets/sys/dev/if_ndis/if_ndis.c#5 integrate .. //depot/projects/netperf+sockets/sys/dev/sio/sio_puc.c#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/bootsect.h#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/bpb.h#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/denode.h#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/direntry.h#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/fat.h#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_conv.c#3 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_denode.c#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_fat.c#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_iconv.c#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_lookup.c#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_vfsops.c#3 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_vnops.c#2 integrate .. //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfsmount.h#2 integrate .. //depot/projects/netperf+sockets/sys/kern/kern_event.c#3 integrate .. //depot/projects/netperf+sockets/sys/kern/kern_subr.c#2 integrate .. //depot/projects/netperf+sockets/sys/kern/sched_4bsd.c#3 integrate .. //depot/projects/netperf+sockets/sys/kern/syscalls.master#6 integrate .. //depot/projects/netperf+sockets/sys/kern/uipc_syscalls.c#5 integrate .. //depot/projects/netperf+sockets/sys/net/if.c#4 integrate .. //depot/projects/netperf+sockets/sys/netinet6/ip6_fw.c#3 integrate .. //depot/projects/netperf+sockets/sys/pc98/pc98/sio.c#3 integrate .. //depot/projects/netperf+sockets/sys/pci/if_sis.c#5 integrate .. //depot/projects/netperf+sockets/sys/pci/if_sisreg.h#3 integrate .. //depot/projects/netperf+sockets/sys/sparc64/pci/psycho.c#2 integrate .. //depot/projects/netperf+sockets/sys/sparc64/sbus/sbus.c#2 integrate .. //depot/projects/netperf+sockets/sys/sparc64/sparc64/bus_machdep.c#2 integrate .. //depot/projects/netperf+sockets/sys/sparc64/sparc64/db_trace.c#2 integrate .. //depot/projects/netperf+sockets/sys/sparc64/sparc64/dump_machdep.c#2 integrate .. //depot/projects/netperf+sockets/sys/sparc64/sparc64/ofw_machdep.c#2 integrate .. //depot/projects/netperf+sockets/sys/sys/_null.h#4 integrate .. //depot/projects/netperf+sockets/sys/sys/sysproto.h#6 integrate .. //depot/projects/netperf+sockets/sys/sys/systm.h#3 integrate .. //depot/projects/netperf+sockets/sys/sys/uio.h#2 integrate .. //depot/projects/netperf+sockets/sys/vm/vm_fault.c#3 integrate .. //depot/projects/netperf+sockets/sys/vm/vm_map.c#3 integrate Differences ... ==== //depot/projects/netperf+sockets/sys/compat/ndis/kern_ndis.c#5 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.11 2003/12/25 06:04:39 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.15 2003/12/26 07:01:05 wpaul Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -352,10 +352,9 @@ sc = p->np_softc; returnfunc = sc->ndis_chars.nmc_return_packet_func; adapter = sc->ndis_block.nmb_miniportadapterctx; - if (returnfunc == NULL) - ndis_free_packet(p); - else + if (returnfunc != NULL) returnfunc(adapter, p); + return; } @@ -654,12 +653,37 @@ struct ndis_softc *sc; ndis_handle adapter; __stdcall ndis_sendmulti_handler sendfunc; + int i, idx; + struct ifnet *ifp; + struct mbuf *m; + ndis_packet *p; sc = arg; adapter = sc->ndis_block.nmb_miniportadapterctx; sendfunc = sc->ndis_chars.nmc_sendmulti_func; sendfunc(adapter, packets, cnt); + for (i = 0; i < cnt; i++) { + p = packets[i]; + if (p->np_oob.npo_status == NDIS_STATUS_PENDING) + continue; + idx = p->np_txidx; + m = p->np_m0; + ifp = &sc->arpcom.ac_if; + if (sc->ndis_sc) + bus_dmamap_unload(sc->ndis_ttag, sc->ndis_tmaps[idx]); + sc->ndis_txarray[idx] = NULL; + sc->ndis_txpending++; + m_freem(m); + ndis_free_packet(p); + if (p->np_oob.npo_status == NDIS_STATUS_SUCCESS) + ifp->if_opackets++; + else + ifp->if_oerrors++; + ifp->if_timer = 0; + ifp->if_flags &= ~IFF_OACTIVE; + } + return(0); } @@ -753,7 +777,6 @@ __stdcall ndis_halt_handler haltfunc; struct ifnet *ifp; struct ndis_timer_entry *ne; - struct callout_handle *ch; sc = arg; ifp = &sc->arpcom.ac_if; @@ -781,9 +804,7 @@ while (!TAILQ_EMPTY(&sc->ndis_block.nmb_timerlist)) { ne = TAILQ_FIRST(&sc->ndis_block.nmb_timerlist); TAILQ_REMOVE(&sc->ndis_block.nmb_timerlist, ne, link); - ch = &ne->nte_ch; - if (ch->callout != NULL) - untimeout(ch->callout->c_func, ch->callout->c_arg, *ch); + callout_stop(&ne->nte_ch); free(ne, M_DEVBUF); } ==== //depot/projects/netperf+sockets/sys/compat/ndis/ndis_var.h#5 (text+ko) ==== @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.6 2003/12/25 06:04:39 wpaul Exp $ + * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.9 2003/12/26 03:31:34 wpaul Exp $ */ #ifndef _NDIS_VAR_H_ @@ -1001,7 +1001,7 @@ typedef struct ndis_reference ndis_reference; struct ndis_timer_entry { - struct callout_handle nte_ch; + struct callout nte_ch; ndis_miniport_timer *nte_timer; TAILQ_ENTRY(ndis_timer_entry) link; }; ==== //depot/projects/netperf+sockets/sys/compat/ndis/subr_ndis.c#5 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.13 2003/12/25 00:40:02 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.16 2003/12/26 03:31:34 wpaul Exp $"); /* * This file implements a translation layer between the BSD networking @@ -62,6 +62,7 @@ #include <sys/socket.h> #include <sys/sysctl.h> #include <sys/timespec.h> +#include <sys/smp.h> #include <net/if.h> #include <net/if_arp.h> @@ -150,6 +151,7 @@ uint32_t, uint32_t, void *); __stdcall static void ndis_read_netaddr(ndis_status *, void **, uint32_t *, ndis_handle); +__stdcall static ndis_status ndis_mapreg_cnt(uint32_t, uint32_t *); __stdcall static ndis_status ndis_alloc_mapreg(ndis_handle, uint32_t, uint8_t, uint32_t, uint32_t); __stdcall static void ndis_free_mapreg(ndis_handle); @@ -242,6 +244,7 @@ __stdcall static void ndis_map_file(ndis_status *, void **, ndis_handle); __stdcall static void ndis_unmap_file(ndis_handle); __stdcall static void ndis_close_file(ndis_handle); +__stdcall static u_int8_t ndis_cpu_cnt(void); __stdcall static void dummy(void); @@ -883,7 +886,7 @@ block = (ndis_miniport_block *)handle; ne = malloc(sizeof(struct ndis_timer_entry), M_DEVBUF, M_NOWAIT); - callout_handle_init(&ne->nte_ch); + callout_init(&ne->nte_ch, CALLOUT_MPSAFE); TAILQ_INSERT_TAIL(&block->nmb_timerlist, ne, link); ne->nte_timer = timer; @@ -927,7 +930,7 @@ ndis_miniport_timer *timer; uint32_t msecs; { - struct callout_handle *ch; + struct callout *ch; struct timeval tv; tv.tv_sec = 0; @@ -936,8 +939,7 @@ ch = timer->nmt_dpc.nk_deferredctx; timer->nmt_dpc.nk_sysarg2 = ndis_timercall; timer->nmt_ktimer.nk_header.dh_sigstate = TRUE; - *ch = timeout((timeout_t *)timer->nmt_dpc.nk_sysarg2, (void *)timer, - tvtohz(&tv)); + callout_reset(ch, tvtohz(&tv), timer->nmt_dpc.nk_sysarg2, timer); return; } @@ -947,7 +949,7 @@ void *arg; { ndis_miniport_timer *timer; - struct callout_handle *ch; + struct callout *ch; __stdcall ndis_timer_function timerfunc; struct timeval tv; @@ -964,8 +966,7 @@ ch = timer->nmt_dpc.nk_deferredctx; timer->nmt_ktimer.nk_header.dh_sigstate = TRUE; timer->nmt_dpc.nk_sysarg2 = ndis_tick; - *ch = timeout((timeout_t *)timer->nmt_dpc.nk_sysarg2, timer, - tvtohz(&tv)); + callout_reset(ch, tvtohz(&tv), timer->nmt_dpc.nk_sysarg2, timer); return; } @@ -975,7 +976,7 @@ ndis_miniport_timer *timer; uint32_t msecs; { - struct callout_handle *ch; + struct callout *ch; struct timeval tv; tv.tv_sec = 0; @@ -985,8 +986,7 @@ ch = timer->nmt_dpc.nk_deferredctx; timer->nmt_dpc.nk_sysarg2 = ndis_tick; timer->nmt_ktimer.nk_header.dh_sigstate = TRUE; - *ch = timeout((timeout_t *)timer->nmt_dpc.nk_sysarg2, timer, - tvtohz(&tv)); + callout_reset(ch, tvtohz(&tv), timer->nmt_dpc.nk_sysarg2, timer); return; } @@ -996,10 +996,10 @@ ndis_miniport_timer *timer; uint8_t *cancelled; { - struct callout_handle *ch; + struct callout *ch; ch = timer->nmt_dpc.nk_deferredctx; - untimeout(ch->callout->c_func, ch->callout->c_arg, *ch); + callout_stop(ch); *cancelled = timer->nmt_ktimer.nk_header.dh_sigstate; return; @@ -1089,6 +1089,15 @@ } __stdcall static ndis_status +ndis_mapreg_cnt(bustype, cnt) + uint32_t bustype; + uint32_t *cnt; +{ + *cnt = 64; + return(NDIS_STATUS_SUCCESS); +} + +__stdcall static ndis_status ndis_alloc_mapreg(adapter, dmachannel, dmasize, physmapneeded, maxmap) ndis_handle adapter; uint32_t dmachannel; @@ -2252,6 +2261,16 @@ return; } +__stdcall static uint8_t +ndis_cpu_cnt() +{ +#ifdef SMP + return(mp_ncpus); +#else + return(1); +#endif +}; + __stdcall static void dummy() { @@ -2260,6 +2279,7 @@ } image_patch_table ndis_functbl[] = { + { "NdisSystemProcessorCount", (FUNC)ndis_cpu_cnt }, { "NdisUnchainBufferAtBack", (FUNC)ndis_unchain_tailbuf, }, { "NdisGetFirstBufferFromPacket", (FUNC)ndis_firstbuf }, { "NdisGetFirstBufferFromPacketSafe", (FUNC)ndis_firstbuf_safe }, @@ -2309,8 +2329,9 @@ { "NdisMRegisterIoPortRange", (FUNC)ndis_register_ioport }, { "NdisMDeregisterIoPortRange", (FUNC)ndis_deregister_ioport }, { "NdisReadNetworkAddress", (FUNC)ndis_read_netaddr }, + { "NdisQueryMapRegisterCount", (FUNC)ndis_mapreg_cnt }, { "NdisMAllocateMapRegisters", (FUNC)ndis_alloc_mapreg }, - { "NdisMFreeMapRegisters", (FUNC)ndis_free_mapreg }, + { "NdisMFreeMapRegisters", (FUNC)ndis_free_mapreg }, { "NdisMAllocateSharedMemory", (FUNC)ndis_alloc_sharedmem }, { "NdisMMapIoSpace", (FUNC)ndis_map_iospace }, { "NdisMUnmapIoSpace", (FUNC)ndis_unmap_iospace }, ==== //depot/projects/netperf+sockets/sys/compat/ndis/subr_pe.c#4 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_pe.c,v 1.2 2003/12/24 21:21:18 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_pe.c,v 1.3 2003/12/26 03:31:34 wpaul Exp $"); /* * This file contains routines for relocating and dynamically linking @@ -520,7 +520,7 @@ fptr = (vm_offset_t *)pe_translate_addr(imgbase, imp_desc.iid_import_address_table_addr); - while (nptr != 0 && pe_translate_addr(imgbase, *nptr) != 0) { + while (nptr != NULL && pe_translate_addr(imgbase, *nptr)) { fname = (char *)pe_translate_addr(imgbase, (*nptr) + 2); func = pe_functbl_match(functbl, fname); if (func) ==== //depot/projects/netperf+sockets/sys/dev/acpica/acpi.c#7 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.111 2003/12/23 18:47:31 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpi.c,v 1.112 2003/12/26 15:42:13 jhb Exp $ */ #include "opt_acpi.h" @@ -1216,10 +1216,10 @@ return (FALSE); devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; - if ((devinfo->Valid & ACPI_VALID_HID) != 0) { - if (strcmp(hid, devinfo->HardwareId.Value) == 0) + if ((devinfo->Valid & ACPI_VALID_HID) != 0 && + strcmp(hid, devinfo->HardwareId.Value) == 0) ret = TRUE; - } else if ((devinfo->Valid & ACPI_VALID_CID) != 0) { + else if ((devinfo->Valid & ACPI_VALID_CID) != 0) { for (i = 0; i < devinfo->CompatibilityId.Count; i++) { if (strcmp(hid, devinfo->CompatibilityId.Id[i].Value) == 0) { ret = TRUE; ==== //depot/projects/netperf+sockets/sys/dev/gem/if_gem_pci.c#2 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/gem/if_gem_pci.c,v 1.12 2003/09/02 20:24:42 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/gem/if_gem_pci.c,v 1.13 2003/12/26 05:36:08 obrien Exp $"); /* * PCI bindings for Sun GEM ethernet controllers. @@ -126,7 +126,7 @@ { 0x2bad108e, GEM_SUN_GEM, "Sun GEM Gigabit Ethernet Adaptor" }, { 0x0021106b, GEM_APPLE_GMAC, "Apple GMAC Ethernet Adaptor" }, { 0x0024106b, GEM_APPLE_GMAC, "Apple GMAC2 Ethernet Adaptor" }, - { 0, NULL } + { 0, 0, NULL } }; /* ==== //depot/projects/netperf+sockets/sys/dev/if_ndis/if_ndis.c#5 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.13 2003/12/25 09:44:49 wpaul Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.15 2003/12/26 07:01:05 wpaul Exp $"); #include "opt_bdg.h" @@ -633,6 +633,21 @@ /* * A frame has been uploaded: pass the resulting mbuf chain up to * the higher level protocols. + * + * When handling received NDIS packets, the 'status' field in the + * out-of-band portion of the ndis_packet has special meaning. In the + * most common case, the underlying NDIS driver will set this field + * to NDIS_STATUS_SUCCESS, which indicates that it's ok for us to + * take posession of it. We then change the status field to + * NDIS_STATUS_PENDING to tell the driver that we now own the packet, + * and that we will return it at some point in the future via the + * return packet handler. + * + * If the driver hands us a packet with a status of NDIS_STATUS_RESOURCES, + * this means the driver is running out of packet/buffer resources and + * wants to maintain ownership of the packet. In this case, we have to + * copy the packet data into local storage and let the driver keep the + * packet. */ __stdcall static void ndis_rxeof(adapter, packets, pktcnt) @@ -644,7 +659,7 @@ ndis_miniport_block *block; ndis_packet *p; struct ifnet *ifp; - struct mbuf *m0; + struct mbuf *m0, *m; int i; block = (ndis_miniport_block *)adapter; @@ -657,8 +672,18 @@ p->np_softc = sc; if (ndis_ptom(&m0, p)) { printf ("ndis%d: ptom failed\n", sc->ndis_unit); - ndis_return_packet(sc, p); + if (p->np_oob.npo_status == NDIS_STATUS_SUCCESS) + ndis_return_packet(sc, p); } else { + if (p->np_oob.npo_status == NDIS_STATUS_RESOURCES) { + m = m_dup(m0, M_DONTWAIT); + m_freem(m0); + if (m == NULL) + ifp->if_ierrors++; + else + m0 = m; + } else + p->np_oob.npo_status = NDIS_STATUS_PENDING; m0->m_pkthdr.rcvif = ifp; ifp->if_ipackets++; (*ifp->if_input)(ifp, m0); @@ -1048,6 +1073,12 @@ ndis_media_state linkstate; int error, len; + ifmr->ifm_status = IFM_AVALID; + ifmr->ifm_active = IFM_ETHER; + + if (!(ifp->if_flags & IFF_UP)) + return; + sc = ifp->if_softc; len = sizeof(linkstate); @@ -1058,9 +1089,6 @@ error = ndis_get_info(sc, OID_GEN_LINK_SPEED, (void *)&media_info, &len); - ifmr->ifm_status = IFM_AVALID; - ifmr->ifm_active = IFM_ETHER; - if (linkstate == nmc_connected) ifmr->ifm_status |= IFM_ACTIVE; ==== //depot/projects/netperf+sockets/sys/dev/sio/sio_puc.c#2 (text+ko) ==== @@ -24,10 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/sio/sio_puc.c,v 1.6 2003/08/24 18:03:44 obrien Exp $"); - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/sio/sio_puc.c,v 1.6 2003/08/24 18:03:44 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/sio/sio_puc.c,v 1.7 2003/12/26 04:30:01 imp Exp $"); #include <sys/param.h> #include <sys/systm.h> ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/bootsect.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/bootsect.h,v 1.10 2002/10/21 19:00:50 jhb Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/bootsect.h,v 1.11 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: bootsect.h,v 1.9 1997/11/17 15:36:17 ws Exp $ */ /* ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/bpb.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/bpb.h,v 1.9 2001/11/28 16:56:42 jhb Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/bpb.h,v 1.10 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: bpb.h,v 1.7 1997/11/17 15:36:24 ws Exp $ */ /* ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/denode.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/denode.h,v 1.25 2003/06/24 22:11:20 jmg Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/denode.h,v 1.27 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: denode.h,v 1.25 1997/11/17 15:36:28 ws Exp $ */ /*- @@ -160,6 +160,7 @@ u_long de_FileSize; /* size of file in bytes */ struct fatcache de_fc[FC_SIZE]; /* fat cache */ u_quad_t de_modrev; /* Revision level for lease. */ + struct lockf *de_lockf; /* lockf */ }; /* ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/direntry.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/direntry.h,v 1.18 2003/09/27 01:18:27 bde Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/direntry.h,v 1.19 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: direntry.h,v 1.14 1997/11/17 15:36:32 ws Exp $ */ /*- ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/fat.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/fat.h,v 1.11 2002/03/19 22:20:10 alfred Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/fat.h,v 1.13 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: fat.h,v 1.12 1997/11/17 15:36:36 ws Exp $ */ /*- @@ -99,5 +99,6 @@ int freeclusterchain(struct msdosfsmount *pmp, u_long startchain); int extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp, int flags); void fc_purge(struct denode *dep, u_int frcn); +int markvoldirty(struct msdosfsmount *pmp, int dirty); #endif /* _KERNEL */ ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_conv.c#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_conv.c,v 1.35 2003/12/08 08:32:20 fjoe Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_conv.c,v 1.36 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: msdosfs_conv.c,v 1.25 1997/11/17 15:36:40 ws Exp $ */ /*- ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_denode.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_denode.c,v 1.71 2003/10/05 02:43:29 jeff Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_denode.c,v 1.72 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */ /*- ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_fat.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_fat.c,v 1.32 2003/03/04 00:04:42 jeff Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_fat.c,v 1.34 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: msdosfs_fat.c,v 1.28 1997/11/17 15:36:49 ws Exp $ */ /*- @@ -1106,3 +1106,70 @@ return (0); } + +/* [2753891] + * Routine to mark a FAT16 or FAT32 volume as "clean" or "dirty" by manipulating the upper bit + * of the FAT entry for cluster 1. Note that this bit is not defined for FAT12 volumes, which + * are always assumed to be dirty. + * + * The fatentry() routine only works on cluster numbers that a file could occupy, so it won't + * manipulate the entry for cluster 1. So we have to do it here. The code is ripped from + * fatentry(), and tailored for cluster 1. + * + * Inputs: + * pmp The MS-DOS volume to mark + * dirty Non-zero if the volume should be marked dirty; zero if it should be marked clean. + * + * Result: + * 0 Success + * EROFS Volume is read-only + * ? (other errors from called routines) + */ +int markvoldirty(struct msdosfsmount *pmp, int dirty) +{ + int error; + u_long bn, bo, bsize, byteoffset; + u_long fatval; + struct buf *bp; + + /* FAT12 does not support a "clean" bit, so don't do anything */ + if (FAT12(pmp)) + return 0; + + /* Can't change the bit on a read-only filesystem */ + if (pmp->pm_flags & MSDOSFSMNT_RONLY) + return EROFS; + + /* Fetch the block containing the FAT entry */ + byteoffset = FATOFS(pmp, 1); /* Find the location of cluster 1 */ + fatblock(pmp, byteoffset, &bn, &bsize, &bo); + + error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp); + if (error) { + brelse(bp); + return (error); + } + + /* Get the current value of the FAT entry and set/clear the high bit */ + if (FAT32(pmp)) { + /* FAT32 uses bit 27 */ + fatval = getulong(&bp->b_data[bo]); + if (dirty) + fatval &= 0xF7FFFFFF; /* dirty means clear the "clean" bit */ + else + fatval |= 0x08000000; /* clean means set the "clean" bit */ + putulong(&bp->b_data[bo], fatval); + } + else { + /* Must be FAT16; use bit 15 */ + fatval = getushort(&bp->b_data[bo]); + if (dirty) + fatval &= 0x7FFF; /* dirty means clear the "clean" bit */ + else + fatval |= 0x8000; /* clean means set the "clean" bit */ + putushort(&bp->b_data[bo], fatval); + } + + /* Write out the modified FAT block immediately */ + return bwrite(bp); +} ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_iconv.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/fs/msdosfs/msdosfs_iconv.c,v 1.1 2003/09/26 20:26:23 fjoe Exp $"); +__FBSDID("$FreeBSD: src/sys/fs/msdosfs/msdosfs_iconv.c,v 1.2 2003/12/26 17:24:37 trhodes Exp $"); #include <sys/param.h> #include <sys/kernel.h> ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_lookup.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_lookup.c,v 1.39 2003/09/26 20:26:23 fjoe Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_lookup.c,v 1.40 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: msdosfs_lookup.c,v 1.37 1997/11/17 15:36:54 ws Exp $ */ /*- ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_vfsops.c#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_vfsops.c,v 1.111 2003/11/05 04:30:06 kan Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_vfsops.c,v 1.113 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */ /*- @@ -209,6 +209,11 @@ VOP_UNLOCK(devvp, 0, td); } pmp->pm_flags &= ~MSDOSFSMNT_RONLY; + + /* [2753891] Now that the volume is modifiable, mark it dirty */ + error = markvoldirty(pmp, 1); + if (error) + return error; } if (args.fspec == 0) { #ifdef __notyet__ /* doesn't work correctly with current mountd XXX */ @@ -609,8 +614,12 @@ */ if (ronly) pmp->pm_flags |= MSDOSFSMNT_RONLY; - else + else { + /* [2753891] Mark the volume dirty while it is mounted read/write */ + if ((error = markvoldirty(pmp, 1)) != 0) + goto error_exit; pmp->pm_fmod = 1; + } mp->mnt_data = (qaddr_t) pmp; mp->mnt_stat.f_fsid.val[0] = dev2udev(dev); mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; @@ -667,6 +676,13 @@ msdosfs_iconv->close(pmp->pm_u2d); } pmp->pm_devvp->v_rdev->si_mountpoint = NULL; + + /* [2753891] If the volume was mounted read/write, mark it clean now */ + if ((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0) { + error = markvoldirty(pmp, 0); + if (error && !(flags & FORCECLOSE)) + return (error); + } #ifdef MSDOSFS_DEBUG { struct vnode *vp = pmp->pm_devvp; ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfs_vnops.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_vnops.c,v 1.143 2003/10/18 14:10:24 phk Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/msdosfs_vnops.c,v 1.145 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */ /*- @@ -63,6 +63,7 @@ #include <sys/malloc.h> #include <sys/dirent.h> #include <sys/signalvar.h> +#include <sys/lockf.h> #include <vm/vm.h> #include <vm/vm_extern.h> @@ -101,6 +102,7 @@ static int msdosfs_strategy(struct vop_strategy_args *); static int msdosfs_print(struct vop_print_args *); static int msdosfs_pathconf(struct vop_pathconf_args *ap); +static int msdosfs_advlock(struct vop_advlock_args *); /* * Some general notes: @@ -1836,6 +1838,23 @@ /* NOTREACHED */ } +/* + * Advisory record locking support + */ +static int +msdosfs_advlock(ap) + struct vop_advlock_args /* { + struct vnode *a_vp; + u_char a_id; + int a_op; + struct flock *a_fl; + int a_flags; + } */ *ap; +{ + struct denode *ip = VTODE(ap->a_vp); + + return (lf_advlock(ap, &(ip->de_lockf), ip->de_FileSize)); +} /* Global vfs data structures for msdosfs */ vop_t **msdosfs_vnodeop_p; @@ -1865,6 +1884,7 @@ { &vop_strategy_desc, (vop_t *) msdosfs_strategy }, { &vop_symlink_desc, (vop_t *) msdosfs_symlink }, { &vop_write_desc, (vop_t *) msdosfs_write }, + { &vop_advlock_desc, (vop_t *) msdosfs_advlock }, { NULL, NULL } }; static struct vnodeopv_desc msdosfs_vnodeop_opv_desc = ==== //depot/projects/netperf+sockets/sys/fs/msdosfs/msdosfsmount.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/fs/msdosfs/msdosfsmount.h,v 1.29 2003/09/26 20:26:23 fjoe Exp $ */ +/* $FreeBSD: src/sys/fs/msdosfs/msdosfsmount.h,v 1.30 2003/12/26 17:24:37 trhodes Exp $ */ /* $NetBSD: msdosfsmount.h,v 1.17 1997/11/17 15:37:07 ws Exp $ */ /*- ==== //depot/projects/netperf+sockets/sys/kern/kern_event.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_event.c,v 1.65 2003/11/14 18:49:01 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_event.c,v 1.66 2003/12/25 23:42:36 dwmalone Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -395,7 +395,6 @@ fp->f_flag = FREAD | FWRITE; fp->f_type = DTYPE_KQUEUE; fp->f_ops = &kqueueops; - TAILQ_INIT(&kq->kq_head); fp->f_data = kq; FILE_UNLOCK(fp); fdrop(fp, td); ==== //depot/projects/netperf+sockets/sys/kern/kern_subr.c#2 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_subr.c,v 1.77 2003/10/02 15:00:55 nectar Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_subr.c,v 1.78 2003/12/26 05:54:35 alfred Exp $"); #include "opt_zero.h" @@ -448,7 +448,8 @@ } int -copyinfrom(const void *src, void *dst, size_t len, int seg) +copyinfrom(const void * __restrict src, void * __restrict dst, size_t len, + int seg) { int error = 0; @@ -466,7 +467,8 @@ } int -copyinstrfrom(const void *src, void *dst, size_t len, size_t *copied, int seg) +copyinstrfrom(const void * __restrict src, void * __restrict dst, size_t len, + size_t * __restrict copied, int seg) { int error = 0; ==== //depot/projects/netperf+sockets/sys/kern/sched_4bsd.c#3 (text+ko) ==== @@ -37,13 +37,14 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.28 2003/11/09 13:45:54 bde Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.29 2003/12/26 17:07:29 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/ktr.h> #include <sys/lock.h> +#include <sys/kthread.h> #include <sys/mutex.h> #include <sys/proc.h> #include <sys/resourcevar.h> @@ -80,11 +81,11 @@ static int sched_quantum; /* Roundrobin scheduling quantum in ticks. */ #define SCHED_QUANTUM (hz / 10) /* Default sched quantum */ -static struct callout schedcpu_callout; static struct callout roundrobin_callout; static void roundrobin(void *arg); -static void schedcpu(void *arg); +static void schedcpu(void); +static void schedcpu_thread(void *dummy); static void sched_setup(void *dummy); static void maybe_resched(struct thread *td); static void updatepri(struct ksegrp *kg); @@ -244,7 +245,7 @@ */ /* ARGSUSED */ static void -schedcpu(void *arg) +schedcpu(void) { register fixpt_t loadfac = loadfactor(averunnable.ldavg[0]); struct thread *td; @@ -348,7 +349,20 @@ mtx_unlock_spin(&sched_lock); } /* end of process loop */ sx_sunlock(&allproc_lock); - callout_reset(&schedcpu_callout, hz, schedcpu, NULL); +} + +/* + * Main loop for a kthread that executes schedcpu once a second. + */ +static void +schedcpu_thread(void *dummy) +{ + int nowake; + + for (;;) { + schedcpu(); + tsleep(&nowake, curthread->td_priority, "-", hz); + } } /* @@ -407,12 +421,13 @@ sched_quantum = SCHED_QUANTUM; hogticks = 2 * sched_quantum; - callout_init(&schedcpu_callout, CALLOUT_MPSAFE); callout_init(&roundrobin_callout, 0); /* Kick off timeout driven events by calling first time. */ roundrobin(NULL); - schedcpu(NULL); + + /* Kick off schedcpu kernel process. */ + kthread_create(schedcpu_thread, NULL, NULL, 0, 0, "schedcpu"); } /* External interfaces start here */ ==== //depot/projects/netperf+sockets/sys/kern/syscalls.master#6 (text+ko) ==== @@ -1,4 +1,4 @@ - $FreeBSD: src/sys/kern/syscalls.master,v 1.164 2003/12/24 19:09:45 alfred Exp $ + $FreeBSD: src/sys/kern/syscalls.master,v 1.165 2003/12/26 05:58:16 alfred Exp $ ; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; ; System call name/number master file. @@ -80,14 +80,14 @@ 27 MSTD { int recvmsg(int s, struct msghdr *msg, int flags); } 28 MSTD { int sendmsg(int s, struct msghdr *msg, int flags); } 29 MSTD { int recvfrom(int s, caddr_t buf, size_t len, int flags, \ - struct sockaddr * from, \ - __socklen_t * fromlenaddr); } -30 MSTD { int accept(int s, struct sockaddr * name, \ - __socklen_t *anamelen); } -31 MSTD { int getpeername(int fdes, struct sockaddr * asa, \ - __socklen_t *alen); } -32 MSTD { int getsockname(int fdes, struct sockaddr * asa, \ - __socklen_t *alen); } + struct sockaddr * __restrict from, \ + __socklen_t * __restrict fromlenaddr); } +30 MSTD { int accept(int s, struct sockaddr * __restrict name, \ + __socklen_t * __restrict anamelen); } +31 MSTD { int getpeername(int fdes, struct sockaddr * __restrict asa, \ + __socklen_t * __restrict alen); } +32 MSTD { int getsockname(int fdes, struct sockaddr * __restrict asa, \ + __socklen_t * __restrict alen); } 33 STD { int access(char *path, int flags); } 34 STD { int chflags(char *path, int flags); } 35 STD { int fchflags(int fd, int flags); } ==== //depot/projects/netperf+sockets/sys/kern/uipc_syscalls.c#5 (text+ko) ==== ==== //depot/projects/netperf+sockets/sys/net/if.c#4 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if.c 8.5 (Berkeley) 1/9/95 - * $FreeBSD: src/sys/net/if.c,v 1.173 2003/10/31 18:32:08 brooks Exp $ + * $FreeBSD: src/sys/net/if.c,v 1.174 2003/12/26 18:09:35 green Exp $ */ #include "opt_compat.h" @@ -1229,7 +1229,7 @@ struct ifnet * ifunit(const char *name) { - char namebuf[IFNAMSIZ + 1]; + char namebuf[IFNAMSIZ + sizeof("net")]; /* XXX net_cdevsw.d_name */ struct ifnet *ifp; dev_t dev; @@ -1241,7 +1241,7 @@ * XXX * Devices should really be known as /dev/fooN, not /dev/net/fooN. */ - snprintf(namebuf, IFNAMSIZ, "%s/%s", net_cdevsw.d_name, name); + snprintf(namebuf, sizeof(namebuf), "%s/%s", net_cdevsw.d_name, name); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &ifnet, if_link) { dev = ifdev_byindex(ifp->if_index); ==== //depot/projects/netperf+sockets/sys/netinet6/ip6_fw.c#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/netinet6/ip6_fw.c,v 1.29 2003/10/31 18:32:12 brooks Exp $ */ +/* $FreeBSD: src/sys/netinet6/ip6_fw.c,v 1.30 2003/12/25 23:39:27 dwmalone Exp $ */ /* $KAME: ip6_fw.c,v 1.21 2001/01/24 01:25:32 itojun Exp $ */ /* @@ -810,6 +810,8 @@ *m = 0; break; } + if (tcp->th_flags & TH_SYN) + ack++; seq = 0; flags = TH_RST|TH_ACK; } >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312270053.hBR0rTFg007005>