Re: svn commit: r299746 - in head/sys: cddl/dev/dtrace cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 cddl/dev/dtrace/powerpc conf dev/acpica dev/hwpmc dev/hyperv/vmbus dev/xen/control geom/eli kern net s
On 15/05/2016 2:22 AM, John Baldwin wrote: Author: jhb Date: Sat May 14 18:22:52 2016 New Revision: 299746 URL: https://svnweb.freebsd.org/changeset/base/299746 Log: Add an EARLY_AP_STARTUP option to start APs earlier during boot. Currently, Application Processors (non-boot CPUs) are started by MD code at SI_SUB_CPU, but they are kept waiting in a "pen" until SI_SUB_SMP at which point they are released to run kernel threads. SI_SUB_SMP is one of the last SYSINIT levels, so APs don't enter the scheduler and start running threads until fairly late in the boot. This change moves SI_SUB_SMP up to just before software interrupt threads are created allowing the APs to start executing kernel threads much sooner (before any devices are probed). This allows several initialization routines that need to perform initialization on all CPUs to now perform that initialization in one step rather than having to defer the AP initialization to a second SYSINIT run at SI_SUB_SMP. It also permits all CPUs to be available for handling interrupts before any devices are probed. This last feature fixes a problem on with interrupt vector exhaustion. Specifically, in the old model all device interrupts were routed onto the boot CPU during boot. Later after the APs were released at SI_SUB_SMP, interrupts were redistributed across all CPUs. However, several drivers for multiqueue hardware allocate N interrupts per CPU in the system. In a system with many CPUs, just a few drivers doing this could exhaust the available pool of interrupt vectors on the boot CPU as each driver was allocating N * mp_ncpu vectors on the boot CPU. Now, drivers will allocate interrupts on their desired CPUs during boot meaning that only N interrupts are allocated from the boot CPU instead of N * mp_ncpu. Some other bits of code can also be simplified as smp_started is now true much earlier and will now always be true for these bits of code. This removes the need to treat the single-CPU boot environment as a special case. As a transition aid, the new behavior is available under a new kernel option (EARLY_AP_STARTUP). This will allow the option to be turned off if need be during initial testing. I plan to enable this on x86 by default in a followup commit in the next few days and to have all platforms moved over before 11.0. Once the transition is complete, the option will be removed along with the !EARLY_AP_STARTUP code. These changes have only been tested on x86. Other platform maintainers are encouraged to port their architectures over as well. The main things to check for are any uses of smp_started in MD code that can be simplified and SI_SUB_SMP SYSINITs in MD code that can be removed in the EARLY_AP_STARTUP case (e.g. the interrupt shuffling). PR: kern/199321 Reviewed by: markj, gnn, kib Sponsored by:Netflix Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c head/sys/cddl/dev/dtrace/dtrace_load.c head/sys/cddl/dev/dtrace/i386/dtrace_subr.c head/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c head/sys/conf/NOTES head/sys/conf/options head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpi_cpu.c head/sys/dev/hwpmc/hwpmc_mod.c head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/xen/control/control.c head/sys/geom/eli/g_eli.c head/sys/kern/kern_clock.c head/sys/kern/kern_clocksource.c head/sys/kern/kern_cpu.c head/sys/net/netisr.c head/sys/sys/kernel.h head/sys/x86/isa/clock.c head/sys/x86/x86/intr_machdep.c head/sys/x86/x86/local_apic.c head/sys/x86/x86/mca.c head/sys/x86/x86/mp_x86.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c == --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.cSat May 14 18:02:47 2016(r299745) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.cSat May 14 18:22:52 2016(r299746) @@ -246,6 +246,26 @@ static uint64_tnsec_scale; /* See below for the explanation of this macro. */ #define SCALE_SHIFT 28 +static void +dtrace_gethrtime_init_cpu(void *arg) +{ + uintptr_t cpu = (uintptr_t) arg; + + if (cpu == curcpu) + tgt_cpu_tsc = rdtsc(); + else + hst_cpu_tsc = rdtsc(); +} + +#ifdef EARLY_AP_STARTUP +static void +dtrace_gethrtime_init(void *arg) +{ + struct pcpu *pc; + uint64_t tsc_f; + cpuset_t map; + int i; +#else /* * Get the frequency and scale factor as early as possible so that they can be * used for boot-time tracing. @@ -254,6 +274,7 @@ static void dtrace_gethrtime_init_early(void *arg) { uint64_t tsc_f; +#endif /* * Get TSC frequency known at this moment. @@ -282,27 +303,18 @@ dtrace_gethrtime_init_early(void *arg) * (terahertz)
svn commit: r299897 - head/usr.sbin/rpc.lockd
Author: truckman Date: Mon May 16 05:17:43 2016 New Revision: 299897 URL: https://svnweb.freebsd.org/changeset/base/299897 Log: NULL releasedfl after calling deallocate_file_lock() which frees it to avoid a use-after-free error in the debuglog() call at the top of the loop. Reported by: Coverity CID: 1006080 MFC after:1 week Modified: head/usr.sbin/rpc.lockd/lockd_lock.c Modified: head/usr.sbin/rpc.lockd/lockd_lock.c == --- head/usr.sbin/rpc.lockd/lockd_lock.cMon May 16 05:01:44 2016 (r299896) +++ head/usr.sbin/rpc.lockd/lockd_lock.cMon May 16 05:17:43 2016 (r299897) @@ -1600,6 +1600,7 @@ unlock_partialfilelock(const struct file */ deallocate_file_lock(releasedfl); + releasedfl = NULL; } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299896 - in head/contrib/libarchive: cpio libarchive
Author: mm Date: Mon May 16 05:01:44 2016 New Revision: 299896 URL: https://svnweb.freebsd.org/changeset/base/299896 Log: Revert r299576 and MFV r299895: Revert r299576: Fix broken cpio behavior. MFV r299895: Update to vendor git commit 860ec63. MFC after:3 weeks (together with libarchive 3.2.0) Fix broken cpio behavior in pass-through mode with vendor code. > Description of fields to fill in above: 76 columns --| > PR: If and which Problem Report is related. > Submitted by: If someone else sent in the change. > Reported by: If someone else reported the issue. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from:If the change is from a third party. > MFC after:N [day[s]|week[s]|month[s]]. Request a reminder email. > MFH: Ports tree branch name. Request approval for merge. > Relnotes: Set to 'yes' for mention in release notes. > Security: Vulnerability reference (one per line) or description. > Sponsored by: If the change was sponsored by an organization. > Differential Revision:https://reviews.freebsd.org/D### (*full* phabric URL needed). > Empty fields above will be automatically removed. _M libarchive _M libarchive/cpio Mlibarchive/cpio/bsdcpio.1 Mlibarchive/cpio/cpio.c _M libarchive/libarchive Mlibarchive/libarchive/archive_read_support_format_cpio.c Modified: head/contrib/libarchive/cpio/bsdcpio.1 head/contrib/libarchive/cpio/cpio.c head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Directory Properties: head/contrib/libarchive/ (props changed) head/contrib/libarchive/cpio/ (props changed) head/contrib/libarchive/libarchive/ (props changed) Modified: head/contrib/libarchive/cpio/bsdcpio.1 == --- head/contrib/libarchive/cpio/bsdcpio.1 Mon May 16 04:47:32 2016 (r299895) +++ head/contrib/libarchive/cpio/bsdcpio.1 Mon May 16 05:01:44 2016 (r299896) @@ -156,7 +156,8 @@ See above for description. .It Fl Fl insecure (i and p mode only) Disable security checks during extraction or copying. -This allows extraction via symbolic links and path names containing +This allows extraction via symbolic links, absolute paths, +and path names containing .Sq .. in the name. .It Fl J , Fl Fl xz Modified: head/contrib/libarchive/cpio/cpio.c == --- head/contrib/libarchive/cpio/cpio.c Mon May 16 04:47:32 2016 (r299895) +++ head/contrib/libarchive/cpio/cpio.c Mon May 16 05:01:44 2016 (r299896) @@ -171,6 +171,7 @@ main(int argc, char *argv[]) cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER; cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS; cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT; + cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; cpio->extract_flags |= ARCHIVE_EXTRACT_PERM; cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS; cpio->extract_flags |= ARCHIVE_EXTRACT_ACL; @@ -256,6 +257,7 @@ main(int argc, char *argv[]) case OPTION_INSECURE: cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS; cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; break; case 'L': /* GNU cpio */ cpio->option_follow_links = 1; @@ -293,6 +295,7 @@ main(int argc, char *argv[]) "Cannot use both -p and -%c", cpio->mode); cpio->mode = opt; cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; break; case OPTION_PASSPHRASE: cpio->passphrase = cpio->argument; Modified: head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c == --- head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Mon May 16 04:47:32 2016(r299895) +++ head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Mon May 16 05:01:44 2016(r299896) @@ -401,6 +401,11 @@ archive_read_format_cpio_read_header(str /* If this is a symlink, read the link contents. */ if (archive_entry_filetype(entry) == AE_IFLNK) { + if (cpio->entry_bytes_remaining > 1024 * 1024) { +
svn commit: r299895 - in vendor/libarchive/dist: cpio libarchive
Author: mm Date: Mon May 16 04:47:32 2016 New Revision: 299895 URL: https://svnweb.freebsd.org/changeset/base/299895 Log: Update vendor/libarchvie to git commit 860ec63 Integrates my pull request #709 Modified: vendor/libarchive/dist/cpio/cpio.c vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Modified: vendor/libarchive/dist/cpio/cpio.c == --- vendor/libarchive/dist/cpio/cpio.c Mon May 16 04:43:47 2016 (r299894) +++ vendor/libarchive/dist/cpio/cpio.c Mon May 16 04:47:32 2016 (r299895) @@ -295,6 +295,7 @@ main(int argc, char *argv[]) "Cannot use both -p and -%c", cpio->mode); cpio->mode = opt; cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; break; case OPTION_PASSPHRASE: cpio->passphrase = cpio->argument; Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c == --- vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Mon May 16 04:43:47 2016(r299894) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Mon May 16 04:47:32 2016(r299895) @@ -401,6 +401,11 @@ archive_read_format_cpio_read_header(str /* If this is a symlink, read the link contents. */ if (archive_entry_filetype(entry) == AE_IFLNK) { + if (cpio->entry_bytes_remaining > 1024 * 1024) { + archive_set_error(>archive, ENOMEM, + "Rejecting malformed cpio archive: symlink contents exceed 1 megabyte"); + return (ARCHIVE_FATAL); + } h = __archive_read_ahead(a, (size_t)cpio->entry_bytes_remaining, NULL); if (h == NULL) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299894 - head/usr.sbin/ctld
On 16 May, To: src-committ...@freebsd.org wrote: > Author: truckman > Date: Mon May 16 04:43:47 2016 > New Revision: 299894 > URL: https://svnweb.freebsd.org/changeset/base/299894 > > Log: > pdu_delete(request) frees request, so move the call after > login_new_response(request) to avoid a use-after-free error > > Reported by:Coverity > Reviewed by:1331219, 1331220 MFC after: 1 week ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299893 - head/usr.sbin/config
On 16 May, To: src-committ...@freebsd.org wrote: > Author: truckman > Date: Mon May 16 04:39:16 2016 > New Revision: 299893 > URL: https://svnweb.freebsd.org/changeset/base/299893 > > Log: > Don't free fnamebuf before we calling cfgfile_add(). This changes a > use-after-free error into a minor memory leak. > > Reported by:Coverity > CID:1006084 MFC after: 1 week ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299894 - head/usr.sbin/ctld
Author: truckman Date: Mon May 16 04:43:47 2016 New Revision: 299894 URL: https://svnweb.freebsd.org/changeset/base/299894 Log: pdu_delete(request) frees request, so move the call after login_new_response(request) to avoid a use-after-free error Reported by: Coverity Reviewed by: 1331219, 1331220 Modified: head/usr.sbin/ctld/login.c Modified: head/usr.sbin/ctld/login.c == --- head/usr.sbin/ctld/login.c Mon May 16 04:39:16 2016(r299893) +++ head/usr.sbin/ctld/login.c Mon May 16 04:43:47 2016(r299894) @@ -767,10 +767,10 @@ login_wait_transition(struct connection login_send_error(request, 0x02, 0x00); log_errx(1, "got no \"T\" flag after answering AuthMethod"); } - pdu_delete(request); log_debugx("got state transition request"); response = login_new_response(request); + pdu_delete(request); login_set_nsg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION); pdu_send(response); pdu_delete(response); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299893 - head/usr.sbin/config
Author: truckman Date: Mon May 16 04:39:16 2016 New Revision: 299893 URL: https://svnweb.freebsd.org/changeset/base/299893 Log: Don't free fnamebuf before we calling cfgfile_add(). This changes a use-after-free error into a minor memory leak. Reported by: Coverity CID: 1006084 Modified: head/usr.sbin/config/lang.l Modified: head/usr.sbin/config/lang.l == --- head/usr.sbin/config/lang.l Mon May 16 04:03:52 2016(r299892) +++ head/usr.sbin/config/lang.l Mon May 16 04:39:16 2016(r299893) @@ -267,7 +267,8 @@ include(const char *fname, int ateof) asprintf(, "../../conf/%s", fname); if (fnamebuf != NULL) { fp = fopen(fnamebuf, "r"); - free(fnamebuf); + if (fp == NULL) + free(fnamebuf); } } if (fp == NULL) { @@ -275,10 +276,10 @@ include(const char *fname, int ateof) asprintf(, "%s/%s", ipath->path, fname); if (fnamebuf != NULL) { fp = fopen(fnamebuf, "r"); - free(fnamebuf); } if (fp != NULL) break; + free(fnamebuf); } } if (fp == NULL) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299891 - head/sys/dev/bwn
Author: adrian Date: Mon May 16 04:03:43 2016 New Revision: 299891 URL: https://svnweb.freebsd.org/changeset/base/299891 Log: [bwn] use contigmalloc to allocate descriptors. We can't assume malloc() returns physically contiguous memory. Submitted by: Imre VadaszObtained from:DragonflyBSD Modified: head/sys/dev/bwn/if_bwn.c Modified: head/sys/dev/bwn/if_bwn.c == --- head/sys/dev/bwn/if_bwn.c Mon May 16 03:56:24 2016(r299890) +++ head/sys/dev/bwn/if_bwn.c Mon May 16 04:03:43 2016(r299891) @@ -2675,11 +2675,15 @@ bwn_dma_ringsetup(struct bwn_mac *mac, i KASSERT(BWN_TXRING_SLOTS % BWN_TX_SLOTS_PER_FRAME == 0, ("%s:%d: fail", __func__, __LINE__)); - dr->dr_txhdr_cache = - malloc((dr->dr_numslots / BWN_TX_SLOTS_PER_FRAME) * - BWN_HDRSIZE(mac), M_DEVBUF, M_NOWAIT | M_ZERO); - KASSERT(dr->dr_txhdr_cache != NULL, - ("%s:%d: fail", __func__, __LINE__)); + dr->dr_txhdr_cache = contigmalloc( + (dr->dr_numslots / BWN_TX_SLOTS_PER_FRAME) * + BWN_HDRSIZE(mac), M_DEVBUF, M_ZERO, + 0, BUS_SPACE_MAXADDR, 8, 0); + if (dr->dr_txhdr_cache == NULL) { + device_printf(sc->sc_dev, + "can't allocate TX header DMA memory\n"); + goto fail1; + } /* * Create TX ring DMA stuffs @@ -2698,7 +2702,7 @@ bwn_dma_ringsetup(struct bwn_mac *mac, i if (error) { device_printf(sc->sc_dev, "can't create TX ring DMA tag: TODO frees\n"); - goto fail1; + goto fail2; } for (i = 0; i < dr->dr_numslots; i += 2) { @@ -2713,7 +2717,7 @@ bwn_dma_ringsetup(struct bwn_mac *mac, i if (error) { device_printf(sc->sc_dev, "can't create RX buf DMA map\n"); - goto fail1; + goto fail2; } dr->getdesc(dr, i + 1, , ); @@ -2727,7 +2731,7 @@ bwn_dma_ringsetup(struct bwn_mac *mac, i if (error) { device_printf(sc->sc_dev, "can't create RX buf DMA map\n"); - goto fail1; + goto fail2; } } } else { @@ -2767,7 +2771,11 @@ bwn_dma_ringsetup(struct bwn_mac *mac, i return (dr); fail2: - free(dr->dr_txhdr_cache, M_DEVBUF); + if (dr->dr_txhdr_cache != NULL) { + contigfree(dr->dr_txhdr_cache, + (dr->dr_numslots / BWN_TX_SLOTS_PER_FRAME) * + BWN_HDRSIZE(mac), M_DEVBUF); + } fail1: free(dr->dr_meta, M_DEVBUF); fail0: @@ -2785,7 +2793,11 @@ bwn_dma_ringfree(struct bwn_dma_ring **d bwn_dma_free_descbufs(*dr); bwn_dma_free_ringmemory(*dr); - free((*dr)->dr_txhdr_cache, M_DEVBUF); + if ((*dr)->dr_txhdr_cache != NULL) { + contigfree((*dr)->dr_txhdr_cache, + ((*dr)->dr_numslots / BWN_TX_SLOTS_PER_FRAME) * + BWN_HDRSIZE((*dr)->dr_mac), M_DEVBUF); + } free((*dr)->dr_meta, M_DEVBUF); free(*dr, M_DEVBUF); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299892 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Mon May 16 04:03:52 2016 New Revision: 299892 URL: https://svnweb.freebsd.org/changeset/base/299892 Log: hyperv/vmbus: Fix event processing loop indentation. No functional changes. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D6334 Modified: head/sys/dev/hyperv/vmbus/hv_connection.c Modified: head/sys/dev/hyperv/vmbus/hv_connection.c == --- head/sys/dev/hyperv/vmbus/hv_connection.c Mon May 16 04:03:43 2016 (r299891) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Mon May 16 04:03:52 2016 (r299892) @@ -333,25 +333,30 @@ hv_vmbus_on_events(int cpu) * Check events */ for (dword = 0; dword < maxdword; dword++) { - if (recv_interrupt_page[dword]) { + if (recv_interrupt_page[dword] == 0) + continue; + for (bit = 0; bit < HV_CHANNEL_DWORD_LEN; bit++) { - if (synch_test_and_clear_bit(bit, - (uint32_t *) _interrupt_page[dword])) { - struct hv_vmbus_channel *channel; - - rel_id = (dword << 5) + bit; - channel = hv_vmbus_g_connection.channels[rel_id]; - - /* if channel is closed or closing */ - if (channel == NULL || channel->rxq == NULL) - continue; - - if (channel->batched_reading) - hv_ring_buffer_read_begin(>inbound); - taskqueue_enqueue(channel->rxq, >channel_task); - } + if (synch_test_and_clear_bit(bit, + (uint32_t *)_interrupt_page[dword])) { + struct hv_vmbus_channel *channel; + + rel_id = (dword << 5) + bit; + channel = + hv_vmbus_g_connection.channels[rel_id]; + + /* if channel is closed or closing */ + if (channel == NULL || channel->rxq == NULL) + continue; + + if (channel->batched_reading) { + hv_ring_buffer_read_begin( + >inbound); + } + taskqueue_enqueue(channel->rxq, + >channel_task); + } } - } } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299890 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Mon May 16 03:56:24 2016 New Revision: 299890 URL: https://svnweb.freebsd.org/changeset/base/299890 Log: hyperv/vmbus: Simplify event processing For channel0, it will never be processed on event handling path, so there is no need to install it. After skipping in the channel0 installation, we could discard the channel0 check on event handling hot code path. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D6333 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c head/sys/dev/hyperv/vmbus/hv_connection.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon May 16 03:48:00 2016 (r299889) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon May 16 03:56:24 2016 (r299890) @@ -183,7 +183,14 @@ vmbus_channel_process_offer(hv_vmbus_cha * Make sure this is a new offer */ mtx_lock(_vmbus_g_connection.channel_lock); - hv_vmbus_g_connection.channels[relid] = new_channel; + if (relid == 0) { + /* +* XXX channel0 will not be processed; skip it. +*/ + printf("VMBUS: got channel0 offer\n"); + } else { + hv_vmbus_g_connection.channels[relid] = new_channel; + } TAILQ_FOREACH(channel, _vmbus_g_connection.channel_anchor, list_entry) { Modified: head/sys/dev/hyperv/vmbus/hv_connection.c == --- head/sys/dev/hyperv/vmbus/hv_connection.c Mon May 16 03:48:00 2016 (r299889) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Mon May 16 03:56:24 2016 (r299890) @@ -337,15 +337,11 @@ hv_vmbus_on_events(int cpu) for (bit = 0; bit < HV_CHANNEL_DWORD_LEN; bit++) { if (synch_test_and_clear_bit(bit, (uint32_t *) _interrupt_page[dword])) { - rel_id = (dword << 5) + bit; - if (rel_id == 0) { - /* -* Special case - -* vmbus channel protocol msg. -*/ - continue; - } else { - hv_vmbus_channel * channel = hv_vmbus_g_connection.channels[rel_id]; + struct hv_vmbus_channel *channel; + + rel_id = (dword << 5) + bit; + channel = hv_vmbus_g_connection.channels[rel_id]; + /* if channel is closed or closing */ if (channel == NULL || channel->rxq == NULL) continue; @@ -353,7 +349,6 @@ hv_vmbus_on_events(int cpu) if (channel->batched_reading) hv_ring_buffer_read_begin(>inbound); taskqueue_enqueue(channel->rxq, >channel_task); - } } } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299889 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Mon May 16 03:48:00 2016 New Revision: 299889 URL: https://svnweb.freebsd.org/changeset/base/299889 Log: hyperv/vmbus: Simplify event processing While I'm here, remove useless comment and unnecessary return. MFC after:1 week Sponsored by: Microsoft OSTC Differential Revision:https://reviews.freebsd.org/D6332 Modified: head/sys/dev/hyperv/vmbus/hv_connection.c Modified: head/sys/dev/hyperv/vmbus/hv_connection.c == --- head/sys/dev/hyperv/vmbus/hv_connection.c Mon May 16 03:26:16 2016 (r299888) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Mon May 16 03:48:00 2016 (r299889) @@ -300,7 +300,6 @@ hv_vmbus_on_events(int cpu) int rel_id; int maxdword; hv_vmbus_synic_event_flags *event; - /* int maxdword = PAGE_SIZE >> 3; */ KASSERT(cpu <= mp_maxid, ("VMBUS: hv_vmbus_on_events: " "cpu out of range!")); @@ -314,9 +313,12 @@ hv_vmbus_on_events(int cpu) /* * receive size is 1/2 page and divide that by 4 bytes */ - if (synch_test_and_clear_bit(0, >flags32[0])) + if (synch_test_and_clear_bit(0, >flags32[0])) { recv_interrupt_page = hv_vmbus_g_connection.recv_interrupt_page; + } else { + return; + } } else { /* * On Host with Win8 or above, the event page can be @@ -330,36 +332,32 @@ hv_vmbus_on_events(int cpu) /* * Check events */ - if (recv_interrupt_page != NULL) { - for (dword = 0; dword < maxdword; dword++) { - if (recv_interrupt_page[dword]) { - for (bit = 0; bit < HV_CHANNEL_DWORD_LEN; bit++) { - if (synch_test_and_clear_bit(bit, - (uint32_t *) _interrupt_page[dword])) { - rel_id = (dword << 5) + bit; - if (rel_id == 0) { - /* -* Special case - -* vmbus channel protocol msg. -*/ - continue; - } else { - hv_vmbus_channel * channel = hv_vmbus_g_connection.channels[rel_id]; - /* if channel is closed or closing */ - if (channel == NULL || channel->rxq == NULL) - continue; - - if (channel->batched_reading) - hv_ring_buffer_read_begin(>inbound); - taskqueue_enqueue(channel->rxq, >channel_task); - } - } - } - } + for (dword = 0; dword < maxdword; dword++) { + if (recv_interrupt_page[dword]) { + for (bit = 0; bit < HV_CHANNEL_DWORD_LEN; bit++) { + if (synch_test_and_clear_bit(bit, + (uint32_t *) _interrupt_page[dword])) { + rel_id = (dword << 5) + bit; + if (rel_id == 0) { + /* +* Special case - +* vmbus channel protocol msg. +*/ + continue; + } else { + hv_vmbus_channel * channel = hv_vmbus_g_connection.channels[rel_id]; + /* if channel is closed or closing */ + if (channel == NULL || channel->rxq == NULL) + continue; + + if (channel->batched_reading) + hv_ring_buffer_read_begin(>inbound); + taskqueue_enqueue(channel->rxq, >channel_task); + } + } + } } } - - return; } /** ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299888 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon May 16 03:26:16 2016 New Revision: 299888 URL: https://svnweb.freebsd.org/changeset/base/299888 Log: hyperv/hn: Combine per-packet-information parsing. MFC after:1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/netvsc/hv_rndis.h head/sys/dev/hyperv/netvsc/hv_rndis_filter.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon May 16 02:44:22 2016(r299887) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon May 16 03:26:16 2016(r299888) @@ -1291,7 +1291,7 @@ hv_m_append(struct mbuf *m0, int len, c_ */ int netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet, -rndis_tcp_ip_csum_info *csum_info, +const rndis_tcp_ip_csum_info *csum_info, const struct rndis_hash_info *hash_info, const struct rndis_hash_value *hash_value) { Modified: head/sys/dev/hyperv/netvsc/hv_rndis.h == --- head/sys/dev/hyperv/netvsc/hv_rndis.h Mon May 16 02:44:22 2016 (r299887) +++ head/sys/dev/hyperv/netvsc/hv_rndis.h Mon May 16 03:26:16 2016 (r299888) @@ -1085,7 +1085,7 @@ typedef struct rndismp_rx_bufs_info_ { struct hv_vmbus_channel; int netvsc_recv(struct hv_vmbus_channel *chan, -netvsc_packet *packet, rndis_tcp_ip_csum_info *csum_info, +netvsc_packet *packet, const rndis_tcp_ip_csum_info *csum_info, const struct rndis_hash_info *hash_info, const struct rndis_hash_value *hash_value); void netvsc_channel_rollup(struct hv_vmbus_channel *chan); Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c == --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cMon May 16 02:44:22 2016(r299887) +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cMon May 16 03:26:16 2016(r299888) @@ -49,6 +49,22 @@ __FBSDID("$FreeBSD$"); #include "hv_rndis.h" #include "hv_rndis_filter.h" +struct hv_rf_recvinfo { + const ndis_8021q_info *vlan_info; + const rndis_tcp_ip_csum_info*csum_info; + const struct rndis_hash_info*hash_info; + const struct rndis_hash_value *hash_value; +}; + +#define HV_RF_RECVINFO_VLAN0x1 +#define HV_RF_RECVINFO_CSUM0x2 +#define HV_RF_RECVINFO_HASHINF 0x4 +#define HV_RF_RECVINFO_HASHVAL 0x8 +#define HV_RF_RECVINFO_ALL \ + (HV_RF_RECVINFO_VLAN | \ +HV_RF_RECVINFO_CSUM | \ +HV_RF_RECVINFO_HASHINF | \ +HV_RF_RECVINFO_HASHVAL) /* * Forward declarations @@ -433,6 +449,84 @@ hv_rf_receive_indicate_status(rndis_devi } } +static int +hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hv_rf_recvinfo *info) +{ + const rndis_per_packet_info *ppi; + uint32_t mask, len; + + info->vlan_info = NULL; + info->csum_info = NULL; + info->hash_info = NULL; + info->hash_value = NULL; + + if (rpkt->per_pkt_info_offset == 0) + return 0; + + ppi = (const rndis_per_packet_info *) + ((const uint8_t *)rpkt + rpkt->per_pkt_info_offset); + len = rpkt->per_pkt_info_length; + mask = 0; + + while (len != 0) { + const void *ppi_dptr; + uint32_t ppi_dlen; + + if (__predict_false(ppi->size < ppi->per_packet_info_offset)) + return EINVAL; + ppi_dlen = ppi->size - ppi->per_packet_info_offset; + ppi_dptr = (const uint8_t *)ppi + ppi->per_packet_info_offset; + + switch (ppi->type) { + case ieee_8021q_info: + if (__predict_false(ppi_dlen < sizeof(ndis_8021q_info))) + return EINVAL; + info->vlan_info = ppi_dptr; + mask |= HV_RF_RECVINFO_VLAN; + break; + + case tcpip_chksum_info: + if (__predict_false(ppi_dlen < + sizeof(rndis_tcp_ip_csum_info))) + return EINVAL; + info->csum_info = ppi_dptr; + mask |= HV_RF_RECVINFO_CSUM; + break; + + case nbl_hash_value: + if (__predict_false(ppi_dlen < + sizeof(struct rndis_hash_value))) + return EINVAL; + info->hash_value = ppi_dptr; + mask |= HV_RF_RECVINFO_HASHVAL; + break; + + case nbl_hash_info: + if (__predict_false(ppi_dlen < + sizeof(struct rndis_hash_info))) +
svn commit: r299887 - head/usr.sbin/ypldap
Author: araujo Date: Mon May 16 02:44:22 2016 New Revision: 299887 URL: https://svnweb.freebsd.org/changeset/base/299887 Log: Simplify overengineered and buggy code that looked like as if it did some kind of UTF-8 validation, but actually didn't, but instead, for malformed UTF-8 input, caused buffer overruns in some cases and caused skipping of valid ASCII characters in other cases. Obtained from:OpenBSD (cvs 1.32) Modified: head/usr.sbin/ypldap/aldap.c Modified: head/usr.sbin/ypldap/aldap.c == --- head/usr.sbin/ypldap/aldap.cMon May 16 02:42:53 2016 (r299886) +++ head/usr.sbin/ypldap/aldap.cMon May 16 02:44:22 2016 (r299887) @@ -1,6 +1,6 @@ -/* $Id: aldap.c,v 1.30 2012/04/30 21:40:03 jmatthew Exp $ */ -/* $OpenBSD: aldap.c,v 1.30 2012/04/30 21:40:03 jmatthew Exp $ */ /* $FreeBSD$ */ +/* $Id: aldap.c,v 1.32 2016/04/27 10:53:27 schwarze Exp $ */ +/* $OpenBSD: aldap.c,v 1.32 2016/04/27 10:53:27 schwarze Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver@@ -19,6 +19,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include #include #include #include @@ -38,6 +39,7 @@ static struct ber_element *ldap_do_parse struct ber_element *, char **); char **aldap_get_stringset(struct ber_element *); char *utoa(char *); +static int isu8cont(unsigned char); char *parseval(char *, size_t); intaldap_create_page_control(struct ber_element *, int, struct aldap_page_control *); @@ -1161,7 +1163,7 @@ ldap_debug_elements(struct ber_element * #endif /* - * Convert UTF-8 to ASCII. + * Strip UTF-8 down to ASCII without validation. * notes: * non-ASCII characters are displayed as '?' * the argument u should be a NULL terminated sequence of UTF-8 bytes. @@ -1173,41 +1175,27 @@ utoa(char *u) char*str; /* calculate the length to allocate */ - for (len = 0, i = 0; u[i] != '\0'; ) { - if ((u[i] & 0xF0) == 0xF0) - i += 4; - else if ((u[i] & 0xE0) == 0xE0) - i += 3; - else if ((u[i] & 0xC0) == 0xC0) - i += 2; - else - i += 1; - len++; - } + for (len = 0, i = 0; u[i] != '\0'; i++) + if (!isu8cont(u[i])) + len++; if ((str = calloc(len + 1, sizeof(char))) == NULL) return NULL; /* copy the ASCII characters to the newly allocated string */ - for (i = 0, j = 0; u[i] != '\0'; j++) { - if ((u[i] & 0xF0) == 0xF0) { - str[j] = '?'; - i += 4; - } else if ((u[i] & 0xE0) == 0xE0) { - str[j] = '?'; - i += 3; - } else if ((u[i] & 0xC0) == 0xC0) { - str[j] = '?'; - i += 2; - } else { - str[j] = u[i]; - i += 1; - } - } + for (i = 0, j = 0; u[i] != '\0'; i++) + if (!isu8cont(u[i])) + str[j++] = isascii((unsigned char)u[i]) ? u[i] : '?'; return str; } +static int +isu8cont(unsigned char c) +{ + return (c & (0x80 | 0x40)) == 0x80; +} + /* * Parse a LDAP value * notes: @@ -1270,3 +1258,4 @@ aldap_get_errno(struct aldap *a, const c } return (a->err); } + ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299886 - in stable/10: lib/libc/sys sys/kern sys/sys
Author: kib Date: Mon May 16 02:42:53 2016 New Revision: 299886 URL: https://svnweb.freebsd.org/changeset/base/299886 Log: MFC r298982: Add EVFILT_VNODE open, read and close notifications. MFC r298984: Correct wording. Modified: stable/10/lib/libc/sys/kqueue.2 stable/10/sys/kern/vfs_subr.c stable/10/sys/kern/vnode_if.src stable/10/sys/sys/event.h stable/10/sys/sys/vnode.h Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/kqueue.2 == --- stable/10/lib/libc/sys/kqueue.2 Mon May 16 02:35:33 2016 (r299885) +++ stable/10/lib/libc/sys/kqueue.2 Mon May 16 02:42:53 2016 (r299886) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 2, 2016 +.Dd May 3, 2016 .Dt KQUEUE 2 .Os .Sh NAME @@ -359,14 +359,28 @@ Takes a file descriptor as the identifie .Va fflags , and returns when one or more of the requested events occurs on the descriptor. The events to monitor are: -.Bl -tag -width "Dv NOTE_RENAME" +.Bl -tag -width "Dv NOTE_CLOSE_WRITE" +.It Dv NOTE_ATTRIB +The file referenced by the descriptor had its attributes changed. +.It Dv NOTE_CLOSE +A file descriptor referencing the monitored file, was closed. +The closed file descriptor did not have write access. +.It Dv NOTE_CLOSE_WRITE +A file descriptor referencing the monitored file, was closed. +The closed file descriptor has write access. +.Pp +This note, as well as +.Dv NOTE_CLOSE , +are not activated when files are closed forcibly by +.Xr unmount 2 or +.Xr revoke 2 . +Instead, +.Dv NOTE_REVOKE +is sent for such events. .It Dv NOTE_DELETE The .Fn unlink -system call -was called on the file referenced by the descriptor. -.It Dv NOTE_WRITE -A write occurred on the file referenced by the descriptor. +system call was called on the file referenced by the descriptor. .It Dv NOTE_EXTEND For regular file, the file referenced by the descriptor was extended. .Pp @@ -375,20 +389,24 @@ as the result of rename operation. The .Dv NOTE_EXTEND event is not reported when a name is changed inside the directory. -.It Dv NOTE_ATTRIB -The file referenced by the descriptor had its attributes changed. .It Dv NOTE_LINK The link count on the file changed. In particular, the .Dv NOTE_LINK event is reported if a subdirectory was created or deleted inside the directory referenced by the descriptor. +.It Dv NOTE_OPEN +The file referenced by the descriptor was opened. +.It Dv NOTE_READ +A read occurred on the file referenced by the descriptor. .It Dv NOTE_RENAME The file referenced by the descriptor was renamed. .It Dv NOTE_REVOKE Access to the file was revoked via .Xr revoke 2 or the underlying file system was unmounted. +.It Dv NOTE_WRITE +A write occurred on the file referenced by the descriptor. .El .Pp On return, Modified: stable/10/sys/kern/vfs_subr.c == --- stable/10/sys/kern/vfs_subr.c Mon May 16 02:35:33 2016 (r299885) +++ stable/10/sys/kern/vfs_subr.c Mon May 16 02:42:53 2016 (r299886) @@ -4446,6 +4446,45 @@ vop_symlink_post(void *ap, int rc) VFS_KNOTE_LOCKED(a->a_dvp, NOTE_WRITE); } +void +vop_open_post(void *ap, int rc) +{ + struct vop_open_args *a = ap; + + if (!rc) + VFS_KNOTE_LOCKED(a->a_vp, NOTE_OPEN); +} + +void +vop_close_post(void *ap, int rc) +{ + struct vop_close_args *a = ap; + + if (!rc && (a->a_cred != NOCRED || /* filter out revokes */ + (a->a_vp->v_iflag & VI_DOOMED) == 0)) { + VFS_KNOTE_LOCKED(a->a_vp, (a->a_fflag & FWRITE) != 0 ? + NOTE_CLOSE_WRITE : NOTE_CLOSE); + } +} + +void +vop_read_post(void *ap, int rc) +{ + struct vop_read_args *a = ap; + + if (!rc) + VFS_KNOTE_LOCKED(a->a_vp, NOTE_READ); +} + +void +vop_readdir_post(void *ap, int rc) +{ + struct vop_readdir_args *a = ap; + + if (!rc) + VFS_KNOTE_LOCKED(a->a_vp, NOTE_READ); +} + static struct knlist fs_knlist; static void Modified: stable/10/sys/kern/vnode_if.src == --- stable/10/sys/kern/vnode_if.src Mon May 16 02:35:33 2016 (r299885) +++ stable/10/sys/kern/vnode_if.src Mon May 16 02:42:53 2016 (r299886) @@ -121,6 +121,7 @@ vop_mknod { %% openvp L L L +%! openpostvop_open_post vop_open { IN struct vnode *vp; @@ -132,6 +133,7 @@ vop_open { %% close vp L L L +%! close postvop_close_post vop_close { IN struct vnode *vp; @@ -186,6 +188,7 @@ vop_markatime { }; %% readvp L L L +%! readpostvop_read_post vop_read { IN struct vnode *vp; @@ -326,6 +329,7 @@ vop_symlink { %% readdir vp L L L +%! readdir post
svn commit: r299884 - head/usr.sbin/ypldap
Author: araujo Date: Mon May 16 02:35:23 2016 New Revision: 299884 URL: https://svnweb.freebsd.org/changeset/base/299884 Log: When a group contains a non-existent user, make the warning message more helpful by mentioning the group name. Obtained from:OpenBSD (cvs 1.19) Modified: head/usr.sbin/ypldap/ypldap.c Modified: head/usr.sbin/ypldap/ypldap.c == --- head/usr.sbin/ypldap/ypldap.c Mon May 16 02:27:28 2016 (r299883) +++ head/usr.sbin/ypldap/ypldap.c Mon May 16 02:35:23 2016 (r299884) @@ -243,9 +243,8 @@ main_create_user_groups(struct env *env) if ((ue = RB_FIND(user_name_tree, env->sc_user_names_t, )) == NULL) { /* User not found */ - log_warnx("main: user: %s is referenced as a " - "group member, but can't be found in the " - "users map.\n", ukey.ue_line); + log_warnx("main: unknown user %s in group %s\n", + ukey.ue_line, ge->ge_line); if (bp != NULL) *(bp-1) = ','; continue; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299885 - in stable/10/sys: kern sys
Author: kib Date: Mon May 16 02:35:33 2016 New Revision: 299885 URL: https://svnweb.freebsd.org/changeset/base/299885 Log: MFC r287831 (by cem): Note DOOMED vnodes with NOTE_REVOKE. Modified: stable/10/sys/kern/vfs_subr.c stable/10/sys/kern/vnode_if.src stable/10/sys/sys/vnode.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_subr.c == --- stable/10/sys/kern/vfs_subr.c Mon May 16 02:35:23 2016 (r299884) +++ stable/10/sys/kern/vfs_subr.c Mon May 16 02:35:33 2016 (r299885) @@ -4351,6 +4351,15 @@ vop_mknod_post(void *ap, int rc) } void +vop_reclaim_post(void *ap, int rc) +{ + struct vop_reclaim_args *a = ap; + + if (!rc) + VFS_KNOTE_LOCKED(a->a_vp, NOTE_REVOKE); +} + +void vop_remove_post(void *ap, int rc) { struct vop_remove_args *a = ap; @@ -4647,7 +4656,7 @@ filt_vfsread(struct knote *kn, long hint * filesystem is gone, so set the EOF flag and schedule * the knote for deletion. */ - if (hint == NOTE_REVOKE) { + if (hint == NOTE_REVOKE || (hint == 0 && vp->v_type == VBAD)) { VI_LOCK(vp); kn->kn_flags |= (EV_EOF | EV_ONESHOT); VI_UNLOCK(vp); @@ -4676,7 +4685,7 @@ filt_vfswrite(struct knote *kn, long hin * filesystem is gone, so set the EOF flag and schedule * the knote for deletion. */ - if (hint == NOTE_REVOKE) + if (hint == NOTE_REVOKE || (hint == 0 && vp->v_type == VBAD)) kn->kn_flags |= (EV_EOF | EV_ONESHOT); kn->kn_data = 0; @@ -4693,7 +4702,7 @@ filt_vfsvnode(struct knote *kn, long hin VI_LOCK(vp); if (kn->kn_sfflags & hint) kn->kn_fflags |= hint; - if (hint == NOTE_REVOKE) { + if (hint == NOTE_REVOKE || (hint == 0 && vp->v_type == VBAD)) { kn->kn_flags |= EV_EOF; VI_UNLOCK(vp); return (1); Modified: stable/10/sys/kern/vnode_if.src == --- stable/10/sys/kern/vnode_if.src Mon May 16 02:35:23 2016 (r299884) +++ stable/10/sys/kern/vnode_if.src Mon May 16 02:35:33 2016 (r299885) @@ -355,6 +355,7 @@ vop_inactive { %% reclaim vp E E E +%! reclaim postvop_reclaim_post vop_reclaim { IN struct vnode *vp; Modified: stable/10/sys/sys/vnode.h == --- stable/10/sys/sys/vnode.h Mon May 16 02:35:23 2016(r299884) +++ stable/10/sys/sys/vnode.h Mon May 16 02:35:33 2016(r299885) @@ -774,6 +774,7 @@ voidvop_lookup_post(void *a, int rc); void vop_lookup_pre(void *a); void vop_mkdir_post(void *a, int rc); void vop_mknod_post(void *a, int rc); +void vop_reclaim_post(void *a, int rc); void vop_remove_post(void *a, int rc); void vop_rename_post(void *a, int rc); void vop_rename_pre(void *a); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299883 - head/sys/dev/iwm
Author: kevlo Date: Mon May 16 02:27:28 2016 New Revision: 299883 URL: https://svnweb.freebsd.org/changeset/base/299883 Log: Follow-up r298818: hide size of 'bands' array behind a macro. Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon May 16 02:23:58 2016(r299882) +++ head/sys/dev/iwm/if_iwm.c Mon May 16 02:27:28 2016(r299883) @@ -1725,7 +1725,7 @@ iwm_init_channel_map(struct ieee80211com { struct iwm_softc *sc = ic->ic_softc; struct iwm_nvm_data *data = >sc_nvm; - uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; + uint8_t bands[IEEE80211_MODE_BYTES]; memset(bands, 0, sizeof(bands)); /* 1-13: 11b/g channels. */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299882 - in stable/10: lib/libc/sys sys/kern
Author: kib Date: Mon May 16 02:23:58 2016 New Revision: 299882 URL: https://svnweb.freebsd.org/changeset/base/299882 Log: MFC r298922: Issue NOTE_EXTEND when a directory entry is added to or removed from the monitored directory as the result of rename(2) operation. The renames staying in the directory are not reported. Modified: stable/10/lib/libc/sys/kqueue.2 stable/10/sys/kern/vfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/kqueue.2 == --- stable/10/lib/libc/sys/kqueue.2 Mon May 16 02:21:54 2016 (r299881) +++ stable/10/lib/libc/sys/kqueue.2 Mon May 16 02:23:58 2016 (r299882) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 1, 2016 +.Dd May 2, 2016 .Dt KQUEUE 2 .Os .Sh NAME @@ -368,7 +368,13 @@ was called on the file referenced by the .It Dv NOTE_WRITE A write occurred on the file referenced by the descriptor. .It Dv NOTE_EXTEND -The file referenced by the descriptor was extended. +For regular file, the file referenced by the descriptor was extended. +.Pp +For directory, reports that a directory entry was added or removed, +as the result of rename operation. +The +.Dv NOTE_EXTEND +event is not reported when a name is changed inside the directory. .It Dv NOTE_ATTRIB The file referenced by the descriptor had its attributes changed. .It Dv NOTE_LINK Modified: stable/10/sys/kern/vfs_subr.c == --- stable/10/sys/kern/vfs_subr.c Mon May 16 02:21:54 2016 (r299881) +++ stable/10/sys/kern/vfs_subr.c Mon May 16 02:23:58 2016 (r299882) @@ -4375,6 +4375,7 @@ vop_rename_post(void *ap, int rc) VFS_KNOTE_UNLOCKED(a->a_fdvp, hint); VFS_KNOTE_UNLOCKED(a->a_tdvp, hint); } else { + hint |= NOTE_EXTEND; if (a->a_fvp->v_type == VDIR) hint |= NOTE_LINK; VFS_KNOTE_UNLOCKED(a->a_fdvp, hint); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299881 - stable/10/sys/kern
Author: kib Date: Mon May 16 02:21:54 2016 New Revision: 299881 URL: https://svnweb.freebsd.org/changeset/base/299881 Log: MFC r298921: Fix reporting of NOTE_LINK when directory link count changes due to rename removing or adding subdirectory entry. Modified: stable/10/sys/kern/vfs_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_subr.c == --- stable/10/sys/kern/vfs_subr.c Mon May 16 01:38:24 2016 (r299880) +++ stable/10/sys/kern/vfs_subr.c Mon May 16 02:21:54 2016 (r299881) @@ -4365,10 +4365,26 @@ void vop_rename_post(void *ap, int rc) { struct vop_rename_args *a = ap; + long hint; if (!rc) { - VFS_KNOTE_UNLOCKED(a->a_fdvp, NOTE_WRITE); - VFS_KNOTE_UNLOCKED(a->a_tdvp, NOTE_WRITE); + hint = NOTE_WRITE; + if (a->a_fdvp == a->a_tdvp) { + if (a->a_tvp != NULL && a->a_tvp->v_type == VDIR) + hint |= NOTE_LINK; + VFS_KNOTE_UNLOCKED(a->a_fdvp, hint); + VFS_KNOTE_UNLOCKED(a->a_tdvp, hint); + } else { + if (a->a_fvp->v_type == VDIR) + hint |= NOTE_LINK; + VFS_KNOTE_UNLOCKED(a->a_fdvp, hint); + + if (a->a_fvp->v_type == VDIR && a->a_tvp != NULL && + a->a_tvp->v_type == VDIR) + hint &= ~NOTE_LINK; + VFS_KNOTE_UNLOCKED(a->a_tdvp, hint); + } + VFS_KNOTE_UNLOCKED(a->a_fvp, NOTE_RENAME); if (a->a_tvp) VFS_KNOTE_UNLOCKED(a->a_tvp, NOTE_DELETE); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299880 - head/lib/libc/resolv
Author: truckman Date: Mon May 16 01:38:24 2016 New Revision: 299880 URL: https://svnweb.freebsd.org/changeset/base/299880 Log: Since rdata is only used as an argument to the immediately following call to res_nopt_rdata(), revert r299879 and fix CID 603941 by moving rdata = [n]; inside the if block. Reported by: Coverity CID: 603941 Modified: head/lib/libc/resolv/res_query.c Modified: head/lib/libc/resolv/res_query.c == --- head/lib/libc/resolv/res_query.cMon May 16 01:30:32 2016 (r299879) +++ head/lib/libc/resolv/res_query.cMon May 16 01:38:24 2016 (r299880) @@ -135,12 +135,10 @@ again: if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 && (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) { n = res_nopt(statp, n, buf, sizeof(buf), anslen); - if (n > 0) { + if (n > 0 && (statp->options & RES_NSID) != 0U) { rdata = [n]; - if ((statp->options & RES_NSID) != 0U) { - n = res_nopt_rdata(statp, n, buf, sizeof(buf), - rdata, NS_OPT_NSID, 0, NULL); - } + n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata, + NS_OPT_NSID, 0, NULL); } } #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299879 - head/lib/libc/resolv
Author: truckman Date: Mon May 16 01:30:32 2016 New Revision: 299879 URL: https://svnweb.freebsd.org/changeset/base/299879 Log: Likely a false positive ... but make sure that -1 can't be used as an array index by splitting up a test. Reported by: Coverity CID: 603941 MFC after:1 week Modified: head/lib/libc/resolv/res_query.c Modified: head/lib/libc/resolv/res_query.c == --- head/lib/libc/resolv/res_query.cMon May 16 01:12:56 2016 (r299878) +++ head/lib/libc/resolv/res_query.cMon May 16 01:30:32 2016 (r299879) @@ -135,10 +135,12 @@ again: if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 && (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) { n = res_nopt(statp, n, buf, sizeof(buf), anslen); - rdata = [n]; - if (n > 0 && (statp->options & RES_NSID) != 0U) { - n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata, - NS_OPT_NSID, 0, NULL); + if (n > 0) { + rdata = [n]; + if ((statp->options & RES_NSID) != 0U) { + n = res_nopt_rdata(statp, n, buf, sizeof(buf), + rdata, NS_OPT_NSID, 0, NULL); + } } } #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299878 - head/usr.sbin/kldxref
Author: araujo Date: Mon May 16 01:12:56 2016 New Revision: 299878 URL: https://svnweb.freebsd.org/changeset/base/299878 Log: Use NULL instead of 0 for pointers. MFC after:2 weeks. Modified: head/usr.sbin/kldxref/kldxref.c Modified: head/usr.sbin/kldxref/kldxref.c == --- head/usr.sbin/kldxref/kldxref.c Mon May 16 01:11:02 2016 (r299877) +++ head/usr.sbin/kldxref/kldxref.c Mon May 16 01:12:56 2016 (r299878) @@ -494,7 +494,7 @@ parse_entry(struct mod_metadata *md, con ptr = *(char **)(walker + elt->pe_offset); buffer[0] = '\0'; - if (ptr != 0) { + if (ptr != NULL) { EF_SEG_READ(ef, (Elf_Off)ptr, sizeof(buffer), buffer); buffer[sizeof(buffer) - 1] = '\0'; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299877 - head/usr.bin/gprof
Author: araujo Date: Mon May 16 01:11:02 2016 New Revision: 299877 URL: https://svnweb.freebsd.org/changeset/base/299877 Log: Use NULL instead of 0 for pointers. MFC after:2 weeks Modified: head/usr.bin/gprof/aout.c head/usr.bin/gprof/arcs.c head/usr.bin/gprof/gprof.c Modified: head/usr.bin/gprof/aout.c == --- head/usr.bin/gprof/aout.c Mon May 16 00:36:12 2016(r299876) +++ head/usr.bin/gprof/aout.c Mon May 16 01:11:02 2016(r299877) @@ -132,7 +132,7 @@ getsymtab(FILE *nfile, const char *filen errx( 1 , "%s: no symbols" , filename ); askfor = nname + 1; nl = (nltype *) calloc( askfor , sizeof(nltype) ); -if (nl == 0) +if (nl == NULL) errx( 1 , "no room for %zu bytes of symbol table" , askfor * sizeof(nltype) ); @@ -173,7 +173,7 @@ gettextspace(FILE *nfile) { textspace = (u_char *) malloc( xbuf.a_text ); -if ( textspace == 0 ) { +if ( textspace == NULL ) { warnx("no room for %u bytes of text space: can't do -c" , xbuf.a_text ); return; Modified: head/usr.bin/gprof/arcs.c == --- head/usr.bin/gprof/arcs.c Mon May 16 00:36:12 2016(r299876) +++ head/usr.bin/gprof/arcs.c Mon May 16 01:11:02 2016(r299877) @@ -376,7 +376,7 @@ cyclelink(void) * i.e. it is origin 1, not origin 0. */ cyclenl = (nltype *) calloc( ncycle + 1 , sizeof( nltype ) ); -if ( cyclenl == 0 ) +if ( cyclenl == NULL ) errx( 1 , "no room for %zu bytes of cycle headers" , ( ncycle + 1 ) * sizeof( nltype ) ); /* @@ -479,7 +479,7 @@ cycleanalyze(void) continue; done = FALSE; cyclestack = (arctype **) calloc( size + 1 , sizeof( arctype *) ); - if ( cyclestack == 0 ) + if ( cyclestack == NULL ) errx( 1, "no room for %zu bytes of cycle stack" , ( size + 1 ) * sizeof( arctype * ) ); # ifdef DEBUG @@ -592,7 +592,7 @@ addcycle(arctype **stkstart, arctype **s } clp = (cltype *) calloc( 1 , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); -if ( clp == 0 ) { +if ( clp == NULL ) { warnx( "no room for %zu bytes of subcycle storage" , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); return( FALSE ); Modified: head/usr.bin/gprof/gprof.c == --- head/usr.bin/gprof/gprof.c Mon May 16 00:36:12 2016(r299876) +++ head/usr.bin/gprof/gprof.c Mon May 16 01:11:02 2016(r299877) @@ -407,7 +407,7 @@ readsamples(FILE *pfile) if (samples == 0) { samples = (double *) calloc(nsamples, sizeof(double)); - if (samples == 0) + if (samples == NULL) errx(0, "no room for %d sample pc's", nsamples); } for (i = 0; i < nsamples; i++) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299876 - head/sbin/quotacheck
Author: araujo Date: Mon May 16 00:36:12 2016 New Revision: 299876 URL: https://svnweb.freebsd.org/changeset/base/299876 Log: For pointers use NULL instead of 0. MFC after:2 weeks. Modified: head/sbin/quotacheck/quotacheck.c Modified: head/sbin/quotacheck/quotacheck.c == --- head/sbin/quotacheck/quotacheck.c Mon May 16 00:35:39 2016 (r299875) +++ head/sbin/quotacheck/quotacheck.c Mon May 16 00:36:12 2016 (r299876) @@ -543,7 +543,7 @@ lookup(u_long id, int type) { struct fileusage *fup; - for (fup = fuhead[type][id & (FUHASH-1)]; fup != 0; fup = fup->fu_next) + for (fup = fuhead[type][id & (FUHASH-1)]; fup != NULL; fup = fup->fu_next) if (fup->fu_id == id) return (fup); return (NULL); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299875 - head/sbin/ping6
Author: araujo Date: Mon May 16 00:35:39 2016 New Revision: 299875 URL: https://svnweb.freebsd.org/changeset/base/299875 Log: For pointers use NULL instead of 0. MFC after:2 weeks. Modified: head/sbin/ping6/ping6.c Modified: head/sbin/ping6/ping6.c == --- head/sbin/ping6/ping6.c Mon May 16 00:34:48 2016(r299874) +++ head/sbin/ping6/ping6.c Mon May 16 00:35:39 2016(r299875) @@ -916,7 +916,7 @@ main(int argc, char *argv[]) errx(1, "can't initialize rthdr"); #else /* old advanced API */ if ((scmsgp = (struct cmsghdr *)inet6_rthdr_init(scmsgp, - IPV6_RTHDR_TYPE_0)) == 0) + IPV6_RTHDR_TYPE_0)) == NULL) errx(1, "can't initialize rthdr"); #endif /* USE_RFC2292BIS */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299874 - head/sbin/init
Author: araujo Date: Mon May 16 00:34:48 2016 New Revision: 299874 URL: https://svnweb.freebsd.org/changeset/base/299874 Log: For pointers use NULL instead of 0. MFC after:2 weeks. Modified: head/sbin/init/init.c Modified: head/sbin/init/init.c == --- head/sbin/init/init.c Mon May 16 00:25:24 2016(r299873) +++ head/sbin/init/init.c Mon May 16 00:34:48 2016(r299874) @@ -328,7 +328,7 @@ invalid: if (kenv(KENV_GET, "init_script", kenv_value, sizeof(kenv_value)) > 0) { state_func_t next_transition; - if ((next_transition = run_script(kenv_value)) != 0) + if ((next_transition = run_script(kenv_value)) != NULL) initial_transition = (state_t) next_transition; } @@ -909,7 +909,7 @@ single_user(void) write_stderr(banner); for (;;) { clear = getpass("Password:"); - if (clear == 0 || *clear == '\0') + if (clear == NULL || *clear == '\0') _exit(0); password = crypt(clear, pp->pw_passwd); bzero(clear, _PASSWORD_LEN); @@ -1022,7 +1022,7 @@ runcom(void) { state_func_t next_transition; - if ((next_transition = run_script(_PATH_RUNCOM)) != 0) + if ((next_transition = run_script(_PATH_RUNCOM)) != NULL) return next_transition; runcom_mode = AUTOBOOT; /* the default */ @@ -1208,7 +1208,7 @@ construct_argv(char *command) char **argv = (char **) malloc(((strlen(command) + 1) / 2 + 1) * sizeof (char *)); - if ((argv[argc++] = strk(command)) == 0) { + if ((argv[argc++] = strk(command)) == NULL) { free(argv); return (NULL); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299873 - head/sbin/ifconfig
Author: truckman Date: Mon May 16 00:25:24 2016 New Revision: 299873 URL: https://svnweb.freebsd.org/changeset/base/299873 Log: Use strlcpy() instead of strncpy() when copying ifname to ensure that it is NUL terminated. Additional NUL padding is not required for short names. Use sizeof(destination) in a few places instead of IFNAMSIZ. Cast afp->af_ridreq and afp->af_addreq to make the intent of the code more obvious. Reported by: Coverity CID: 1009628, 1009630, 1009631, 1009632, 1009633, 1009635, 1009638 CID: 1009639, 1009640, 1009641, 1009642, 1009643, 1009644, 1009645 CID: 1009646, 1009647, 1010049, 1010050, 1010051, 1010052, 1010053 CID: 1010054, 1011293, 1011294, 1011295, 1011296, 1011297, 1011298 CID: 1011299, 1305821, 1351720, 1351721 MFC after:1 week Modified: head/sbin/ifconfig/af_inet.c head/sbin/ifconfig/af_inet6.c head/sbin/ifconfig/af_nd6.c head/sbin/ifconfig/ifclone.c head/sbin/ifconfig/ifconfig.c head/sbin/ifconfig/iffib.c head/sbin/ifconfig/ifgre.c head/sbin/ifconfig/ifieee80211.c head/sbin/ifconfig/ifmac.c head/sbin/ifconfig/ifmedia.c Modified: head/sbin/ifconfig/af_inet.c == --- head/sbin/ifconfig/af_inet.cSun May 15 23:15:10 2016 (r299872) +++ head/sbin/ifconfig/af_inet.cMon May 16 00:25:24 2016 (r299873) @@ -151,7 +151,7 @@ in_status_tunnel(int s) const struct sockaddr *sa = (const struct sockaddr *) _addr; memset(, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, name, IFNAMSIZ); + strlcpy(ifr.ifr_name, name, IFNAMSIZ); if (ioctl(s, SIOCGIFPSRCADDR, (caddr_t)) < 0) return; @@ -176,7 +176,7 @@ in_set_tunnel(int s, struct addrinfo *sr struct in_aliasreq addreq; memset(, 0, sizeof(addreq)); - strncpy(addreq.ifra_name, name, IFNAMSIZ); + strlcpy(addreq.ifra_name, name, IFNAMSIZ); memcpy(_addr, srcres->ai_addr, srcres->ai_addr->sa_len); memcpy(_dstaddr, dstres->ai_addr, dstres->ai_addr->sa_len); Modified: head/sbin/ifconfig/af_inet6.c == --- head/sbin/ifconfig/af_inet6.c Sun May 15 23:15:10 2016 (r299872) +++ head/sbin/ifconfig/af_inet6.c Mon May 16 00:25:24 2016 (r299873) @@ -184,7 +184,7 @@ in6_status(int s __unused, const struct if (sin == NULL) return; - strncpy(ifr6.ifr_name, ifr.ifr_name, sizeof(ifr.ifr_name)); + strlcpy(ifr6.ifr_name, ifr.ifr_name, sizeof(ifr.ifr_name)); if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { warn("socket(AF_INET6,SOCK_DGRAM)"); return; @@ -423,7 +423,7 @@ in6_status_tunnel(int s) const struct sockaddr *sa = (const struct sockaddr *) _ifr.ifr_addr; memset(_ifr, 0, sizeof(in6_ifr)); - strncpy(in6_ifr.ifr_name, name, IFNAMSIZ); + strlcpy(in6_ifr.ifr_name, name, sizeof(in6_ifr.ifr_name)); if (ioctl(s, SIOCGIFPSRCADDR_IN6, (caddr_t)_ifr) < 0) return; @@ -450,7 +450,7 @@ in6_set_tunnel(int s, struct addrinfo *s struct in6_aliasreq in6_addreq; memset(_addreq, 0, sizeof(in6_addreq)); - strncpy(in6_addreq.ifra_name, name, IFNAMSIZ); + strlcpy(in6_addreq.ifra_name, name, sizeof(in6_addreq.ifra_name)); memcpy(_addreq.ifra_addr, srcres->ai_addr, srcres->ai_addr->sa_len); memcpy(_addreq.ifra_dstaddr, dstres->ai_addr, dstres->ai_addr->sa_len); Modified: head/sbin/ifconfig/af_nd6.c == --- head/sbin/ifconfig/af_nd6.c Sun May 15 23:15:10 2016(r299872) +++ head/sbin/ifconfig/af_nd6.c Mon May 16 00:25:24 2016(r299873) @@ -74,7 +74,7 @@ setnd6flags(const char *dummyaddr __unus int error; memset(, 0, sizeof(nd)); - strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); + strlcpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); error = ioctl(s, SIOCGIFINFO_IN6, ); if (error) { warn("ioctl(SIOCGIFINFO_IN6)"); @@ -99,7 +99,7 @@ setnd6defif(const char *dummyaddr __unus int error; memset(, 0, sizeof(ndifreq)); - strncpy(ndifreq.ifname, ifr.ifr_name, sizeof(ndifreq.ifname)); + strlcpy(ndifreq.ifname, ifr.ifr_name, sizeof(ndifreq.ifname)); if (d < 0) { if (isnd6defif(s)) { @@ -126,7 +126,7 @@ isnd6defif(int s) int error; memset(, 0, sizeof(ndifreq)); - strncpy(ndifreq.ifname, ifr.ifr_name, sizeof(ndifreq.ifname)); + strlcpy(ndifreq.ifname, ifr.ifr_name, sizeof(ndifreq.ifname)); ifindex = if_nametoindex(ndifreq.ifname); error = ioctl(s, SIOCGDEFIFACE_IN6, (caddr_t)); @@ -146,7 +146,7 @@ nd6_status(int s) int isdefif;
svn commit: r299872 - head/sys/fs/fuse
Author: rmacklem Date: Sun May 15 23:15:10 2016 New Revision: 299872 URL: https://svnweb.freebsd.org/changeset/base/299872 Log: Fix fuse for "cp" of a mode 0444 file to the file system. When "cp" of a file with read-only (mode 0444) to a fuse mounted file system was attempted it would fail with EACCES. This was because fuse would attempt to open the file WRONLY and the open would fail. This patch changes the fuse_vnop_open() to test for an extant read-write open and use that, if it is available. This makes the "cp" of a read-only file to the fuse mounted file system work ok. There are simpler ways to fix this than adding the fuse_filehandle_validrw() function, but this function is useful for future patches related to exporting a fuse filesystem via NFS. MFC after:2 weeks Modified: head/sys/fs/fuse/fuse_file.c head/sys/fs/fuse/fuse_file.h head/sys/fs/fuse/fuse_vnops.c Modified: head/sys/fs/fuse/fuse_file.c == --- head/sys/fs/fuse/fuse_file.cSun May 15 22:36:55 2016 (r299871) +++ head/sys/fs/fuse/fuse_file.cSun May 15 23:15:10 2016 (r299872) @@ -216,6 +216,28 @@ fuse_filehandle_valid(struct vnode *vp, return FUFH_IS_VALID(fufh); } +/* + * Check for a valid file handle, first the type requested, but if that + * isn't valid, try for FUFH_RDWR. + * Return the FUFH type that is valid or FUFH_INVALID if there are none. + * This is a variant of fuse_filehandle_vaild() analogous to + * fuse_filehandle_getrw(). + */ +fufh_type_t +fuse_filehandle_validrw(struct vnode *vp, fufh_type_t fufh_type) +{ + struct fuse_vnode_data *fvdat = VTOFUD(vp); + struct fuse_filehandle *fufh; + + fufh = >fufh[fufh_type]; + if (FUFH_IS_VALID(fufh) != 0) + return (fufh_type); + fufh = >fufh[FUFH_RDWR]; + if (FUFH_IS_VALID(fufh) != 0) + return (FUFH_RDWR); + return (FUFH_INVALID); +} + int fuse_filehandle_get(struct vnode *vp, fufh_type_t fufh_type, struct fuse_filehandle **fufhp) Modified: head/sys/fs/fuse/fuse_file.h == --- head/sys/fs/fuse/fuse_file.hSun May 15 22:36:55 2016 (r299871) +++ head/sys/fs/fuse/fuse_file.hSun May 15 23:15:10 2016 (r299872) @@ -137,6 +137,7 @@ fuse_filehandle_xlate_to_oflags(fufh_typ } int fuse_filehandle_valid(struct vnode *vp, fufh_type_t fufh_type); +fufh_type_t fuse_filehandle_validrw(struct vnode *vp, fufh_type_t fufh_type); int fuse_filehandle_get(struct vnode *vp, fufh_type_t fufh_type, struct fuse_filehandle **fufhp); int fuse_filehandle_getrw(struct vnode *vp, fufh_type_t fufh_type, Modified: head/sys/fs/fuse/fuse_vnops.c == --- head/sys/fs/fuse/fuse_vnops.c Sun May 15 22:36:55 2016 (r299871) +++ head/sys/fs/fuse/fuse_vnops.c Sun May 15 23:15:10 2016 (r299872) @@ -1153,7 +1153,7 @@ fuse_vnop_open(struct vop_open_args *ap) fuse_open_flags = FOPEN_DIRECT_IO; } - if (fuse_filehandle_valid(vp, fufh_type)) { + if (fuse_filehandle_validrw(vp, fufh_type) != FUFH_INVALID) { fuse_vnode_open(vp, fuse_open_flags, td); return 0; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299870 - head/sys/contrib/ipfilter/netinet
In message <201605152235.u4fmzblj014...@repo.freebsd.org>, Cy Schubert writes: > Author: cy > Date: Sun May 15 22:35:11 2016 > New Revision: 299870 > URL: https://svnweb.freebsd.org/changeset/base/299870 > > Log: > Make subsequent code reachable. > > Reported by:Coverity CID 1354625 > MFC after: 3 days Ignore the MFC. It's not required. -- Cheers, Cy Schubertor FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299871 - in head/sys: arm/allwinner boot/fdt/dts/arm
Author: jmcneill Date: Sun May 15 22:36:55 2016 New Revision: 299871 URL: https://svnweb.freebsd.org/changeset/base/299871 Log: Add Allwinner A83T thermal sensor controller support. The A83T thermal sensor controller has three sensors. Sensor 0 corresponds to CPU cluster 0, sensor 1 to CPU cluster 1, and sensor 2 to the GPU. This driver exports the temperature sensor readings via sysctl. Calibration data is obtained from SRAM found in the Secure ID module. Reviewed by: manu Differential Revision:https://reviews.freebsd.org/D6378 Added: head/sys/arm/allwinner/aw_sid.c (contents, props changed) head/sys/arm/allwinner/aw_sid.h (contents, props changed) head/sys/arm/allwinner/aw_thermal.c (contents, props changed) Modified: head/sys/arm/allwinner/files.allwinner head/sys/boot/fdt/dts/arm/a83t.dtsi Added: head/sys/arm/allwinner/aw_sid.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/allwinner/aw_sid.c Sun May 15 22:36:55 2016 (r299871) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2016 Jared McNeill+ * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Allwinner secure ID controller + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#defineSID_SRAM0x200 +#defineSID_THERMAL_CALIB0 (SID_SRAM + 0x34) +#defineSID_THERMAL_CALIB1 (SID_SRAM + 0x38) + +static struct ofw_compat_data compat_data[] = { + { "allwinner,sun8i-a83t-sid", 1 }, + { NULL, 0 } +}; + +struct aw_sid_softc { + struct resource *res; +}; + +static struct aw_sid_softc *aw_sid_sc; + +static struct resource_spec aw_sid_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +#defineRD4(sc, reg)bus_read_4((sc)->res, (reg)) +#defineWR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) + +static int +aw_sid_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Allwinner Secure ID Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +aw_sid_attach(device_t dev) +{ + struct aw_sid_softc *sc; + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, aw_sid_spec, >res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + return (ENXIO); + } + + aw_sid_sc = sc; + + return (0); +} + +int +aw_sid_read_tscalib(uint32_t *calib0, uint32_t *calib1) +{ + struct aw_sid_softc *sc; + + sc = aw_sid_sc; + if (sc == NULL) + return (ENXIO); + + *calib0 = RD4(sc, SID_THERMAL_CALIB0); + *calib1 = RD4(sc, SID_THERMAL_CALIB1); + + return (0); +} + +static device_method_t aw_sid_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, aw_sid_probe), + DEVMETHOD(device_attach,aw_sid_attach), + + DEVMETHOD_END +}; + +static driver_t aw_sid_driver = { + "aw_sid", + aw_sid_methods, + sizeof(struct aw_sid_softc), +}; + +static devclass_t aw_sid_devclass; + +EARLY_DRIVER_MODULE(aw_sid, simplebus, aw_sid_driver, aw_sid_devclass, 0, 0, +BUS_PASS_RESOURCE + BUS_PASS_ORDER_FIRST); +MODULE_VERSION(aw_sid, 1); Added: head/sys/arm/allwinner/aw_sid.h
svn commit: r299870 - head/sys/contrib/ipfilter/netinet
Author: cy Date: Sun May 15 22:35:11 2016 New Revision: 299870 URL: https://svnweb.freebsd.org/changeset/base/299870 Log: Make subsequent code reachable. Reported by: Coverity CID 1354625 MFC after:3 days Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c == --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun May 15 22:31:03 2016(r299869) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun May 15 22:35:11 2016(r299870) @@ -1165,17 +1165,20 @@ INLINE int ipf_checkv6sum(fin) fr_info_t *fin; { - if ((fin->fin_flx & FI_NOCKSUM) != 0) + if ((fin->fin_flx & FI_NOCKSUM) != 0) { DT(ipf_checkv6sum_fi_nocksum); return 0; + } - if ((fin->fin_flx & FI_SHORT) != 0) + if ((fin->fin_flx & FI_SHORT) != 0) { DT(ipf_checkv6sum_fi_short); return 1; + } - if (fin->fin_cksum != FI_CK_NEEDED) + if (fin->fin_cksum != FI_CK_NEEDED) { DT(ipf_checkv6sum_fi_ck_needed); return (fin->fin_cksum > FI_CK_NEEDED) ? 0 : -1; + } if (ipf_checkl4sum(fin) == -1) { fin->fin_flx |= FI_BAD; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299869 - head/usr.sbin/route6d
Author: truckman Date: Sun May 15 22:31:03 2016 New Revision: 299869 URL: https://svnweb.freebsd.org/changeset/base/299869 Log: Use strlcpy() instead of strncpy() when copying ifname to ensure that it is NUL terminated. Additional NUL padding is not required for short names. Reported by: Coverity CID: 1009974 MFC after:1 week Modified: head/usr.sbin/route6d/route6d.c Modified: head/usr.sbin/route6d/route6d.c == --- head/usr.sbin/route6d/route6d.c Sun May 15 22:17:41 2016 (r299868) +++ head/usr.sbin/route6d/route6d.c Sun May 15 22:31:03 2016 (r299869) @@ -1592,7 +1592,7 @@ ifconfig1(const char *name, if (IN6_IS_ADDR_SITELOCAL(>sin6_addr) && !lflag) return (-1); ifr.ifr_addr = *sin6; - strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCGIFNETMASK_IN6, (char *)) < 0) { syslog(LOG_INFO, "ioctl: SIOCGIFNETMASK_IN6"); return (-1); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299867 - head/usr.sbin/rtadvd
On 15 May, To: src-committ...@freebsd.org wrote: > On 15 May, To: src-committ...@freebsd.org wrote: >> Author: truckman >> Date: Sun May 15 22:06:21 2016 >> New Revision: 299867 >> URL: https://svnweb.freebsd.org/changeset/base/299867 >> >> Log: >> Use strlcpy() instead of strncpy() when copying ifname to ensure >> that it is NUL terminated. Additional NUL padding is not required >> for short names. >> >> MFC after: 1 week >> >> Modified: >> head/usr.sbin/rtadvd/config.c >> head/usr.sbin/rtadvd/if.c > > Reported by: Coverity > CID: 974860 Also CID: 1009972, 1009973 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299868 - head/usr.sbin/rtsold
Author: truckman Date: Sun May 15 22:17:41 2016 New Revision: 299868 URL: https://svnweb.freebsd.org/changeset/base/299868 Log: Use strlcpy() instead of strncpy() when copying ifname to ensure that it is NUL terminated. Additional NUL padding is not required for short names. Reported by: Coverity CID: 99186, 991864, 991865 MFC after:1 week Modified: head/usr.sbin/rtsold/if.c Modified: head/usr.sbin/rtsold/if.c == --- head/usr.sbin/rtsold/if.c Sun May 15 22:06:21 2016(r299867) +++ head/usr.sbin/rtsold/if.c Sun May 15 22:17:41 2016(r299868) @@ -82,7 +82,7 @@ interface_up(char *name) int s; memset(, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); memset(, 0, sizeof(nd)); strlcpy(nd.ifname, name, sizeof(nd.ifname)); @@ -180,7 +180,7 @@ interface_status(struct ifinfo *ifinfo) /* get interface flags */ memset(, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(ifsock, SIOCGIFFLAGS, ) < 0) { warnmsg(LOG_ERR, __func__, "ioctl(SIOCGIFFLAGS) on %s: %s", ifname, strerror(errno)); @@ -196,7 +196,7 @@ interface_status(struct ifinfo *ifinfo) if (!ifinfo->mediareqok) goto active; memset(, 0, sizeof(ifmr)); - strncpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name)); + strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name)); if (ioctl(ifsock, SIOCGIFMEDIA, (caddr_t)) < 0) { if (errno != EINVAL) { @@ -396,7 +396,7 @@ get_llflag(const char *name) continue; memset(, 0, sizeof(ifr6)); - strncpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name)); + strlcpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name)); memcpy(_ifru.ifru_addr, sin6, sin6->sin6_len); if (ioctl(s, SIOCGIFAFLAG_IN6, ) < 0) { warnmsg(LOG_ERR, __func__, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299867 - head/usr.sbin/rtadvd
On 15 May, To: src-committ...@freebsd.org wrote: > Author: truckman > Date: Sun May 15 22:06:21 2016 > New Revision: 299867 > URL: https://svnweb.freebsd.org/changeset/base/299867 > > Log: > Use strlcpy() instead of strncpy() when copying ifname to ensure > that it is NUL terminated. Additional NUL padding is not required > for short names. > > MFC after: 1 week > > Modified: > head/usr.sbin/rtadvd/config.c > head/usr.sbin/rtadvd/if.c Reported by:Coverity CID:974860 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299867 - head/usr.sbin/rtadvd
Author: truckman Date: Sun May 15 22:06:21 2016 New Revision: 299867 URL: https://svnweb.freebsd.org/changeset/base/299867 Log: Use strlcpy() instead of strncpy() when copying ifname to ensure that it is NUL terminated. Additional NUL padding is not required for short names. MFC after:1 week Modified: head/usr.sbin/rtadvd/config.c head/usr.sbin/rtadvd/if.c Modified: head/usr.sbin/rtadvd/config.c == --- head/usr.sbin/rtadvd/config.c Sun May 15 21:45:04 2016 (r299866) +++ head/usr.sbin/rtadvd/config.c Sun May 15 22:06:21 2016 (r299867) @@ -640,7 +640,7 @@ getconfig_free_pfx: exit(1); } memset(, 0, sizeof(ndi)); - strncpy(ndi.ifname, ifi->ifi_ifname, sizeof(ndi.ifname)); + strlcpy(ndi.ifname, ifi->ifi_ifname, sizeof(ndi.ifname)); if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)) < 0) syslog(LOG_INFO, "<%s> ioctl:SIOCGIFINFO_IN6 at %s: %s", __func__, ifi->ifi_ifname, strerror(errno)); Modified: head/usr.sbin/rtadvd/if.c == --- head/usr.sbin/rtadvd/if.c Sun May 15 21:45:04 2016(r299866) +++ head/usr.sbin/rtadvd/if.c Sun May 15 22:06:21 2016(r299867) @@ -387,7 +387,7 @@ update_ifinfo_nd_flags(struct ifinfo *if } /* ND flags */ memset(, 0, sizeof(nd)); - strncpy(nd.ifname, ifi->ifi_ifname, + strlcpy(nd.ifname, ifi->ifi_ifname, sizeof(nd.ifname)); error = ioctl(s, SIOCGIFINFO_IN6, (caddr_t)); if (error) { @@ -516,7 +516,7 @@ update_ifinfo(struct ifilist_head_t *ifi if (ifi->ifi_phymtu == 0) { memset(, 0, sizeof(ifr)); ifr.ifr_addr.sa_family = AF_INET6; - strncpy(ifr.ifr_name, ifi->ifi_ifname, + strlcpy(ifr.ifr_name, ifi->ifi_ifname, sizeof(ifr.ifr_name)); error = ioctl(s, SIOCGIFMTU, (caddr_t)); if (error) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299866 - head/usr.sbin/lmcconfig
Author: truckman Date: Sun May 15 21:45:04 2016 New Revision: 299866 URL: https://svnweb.freebsd.org/changeset/base/299866 Log: Use strlcpy() instead of strncpy() when copying ifname to ensure that it is NUL terminated. Additional NUL padding is not required for short names. Reported by: Coverity CID: 974852 MFC after:1 week Modified: head/usr.sbin/lmcconfig/lmcconfig.c Modified: head/usr.sbin/lmcconfig/lmcconfig.c == --- head/usr.sbin/lmcconfig/lmcconfig.c Sun May 15 21:37:36 2016 (r299865) +++ head/usr.sbin/lmcconfig/lmcconfig.c Sun May 15 21:45:04 2016 (r299866) @@ -222,7 +222,7 @@ call_driver(unsigned long cmd, struct io { int error = 0; - strncpy(iohdr->ifname, ifname, sizeof(iohdr->ifname)); + strlcpy(iohdr->ifname, ifname, sizeof(iohdr->ifname)); iohdr->cookie = NGM_LMC_COOKIE; iohdr->iohdr = iohdr; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299865 - head/sys/net
Author: truckman Date: Sun May 15 21:37:36 2016 New Revision: 299865 URL: https://svnweb.freebsd.org/changeset/base/299865 Log: When handling SIOCSIFNAME ensure that the new interface name is NUL terminated. Reject the rename attempt if the name is too long. MFC after:1 week Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Sun May 15 20:04:43 2016(r299864) +++ head/sys/net/if.c Sun May 15 21:37:36 2016(r299865) @@ -2375,6 +2375,11 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, return (error); if (new_name[0] == '\0') return (EINVAL); + if (new_name[IFNAMSIZ-1] != '\0') { + new_name[IFNAMSIZ-1] = '\0'; + if (strlen(new_name) == IFNAMSIZ-1) + return (EINVAL); + } if (ifunit(new_name) != NULL) return (EEXIST); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299864 - in head/sys: cam/scsi modules/cam modules/tcp/fastpath netinet/tcp_stacks
Author: markj Date: Sun May 15 20:04:43 2016 New Revision: 299864 URL: https://svnweb.freebsd.org/changeset/base/299864 Log: opt_kdtrace.h is not needed for SDT probes as of r258541. Modified: head/sys/cam/scsi/scsi_pass.c head/sys/modules/cam/Makefile head/sys/modules/tcp/fastpath/Makefile head/sys/netinet/tcp_stacks/fastpath.c Modified: head/sys/cam/scsi/scsi_pass.c == --- head/sys/cam/scsi/scsi_pass.c Sun May 15 17:25:31 2016 (r299863) +++ head/sys/cam/scsi/scsi_pass.c Sun May 15 20:04:43 2016 (r299864) @@ -28,8 +28,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_kdtrace.h" - #include #include #include Modified: head/sys/modules/cam/Makefile == --- head/sys/modules/cam/Makefile Sun May 15 17:25:31 2016 (r299863) +++ head/sys/modules/cam/Makefile Sun May 15 20:04:43 2016 (r299864) @@ -11,7 +11,6 @@ SRCS= opt_cam.h SRCS+= opt_ada.h SRCS+= opt_scsi.h SRCS+= opt_cd.h -SRCS+= opt_kdtrace.h SRCS+= opt_pt.h SRCS+= opt_sa.h SRCS+= opt_ses.h Modified: head/sys/modules/tcp/fastpath/Makefile == --- head/sys/modules/tcp/fastpath/Makefile Sun May 15 17:25:31 2016 (r299863) +++ head/sys/modules/tcp/fastpath/Makefile Sun May 15 20:04:43 2016 (r299864) @@ -7,7 +7,7 @@ KMOD= fastpath SRCS= fastpath.c -SRCS+= opt_ipfw.h opt_inet.h opt_inet6.h opt_ipsec.h opt_kdtrace.h +SRCS+= opt_ipfw.h opt_inet.h opt_inet6.h opt_ipsec.h SRCS+= opt_tcpdebug.h # Modified: head/sys/netinet/tcp_stacks/fastpath.c == --- head/sys/netinet/tcp_stacks/fastpath.c Sun May 15 17:25:31 2016 (r299863) +++ head/sys/netinet/tcp_stacks/fastpath.c Sun May 15 20:04:43 2016 (r299864) @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" -#include "opt_kdtrace.h" #include "opt_tcpdebug.h" #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299863 - head/sys/boot/fdt/dts/arm
Author: jmcneill Date: Sun May 15 17:25:31 2016 New Revision: 299863 URL: https://svnweb.freebsd.org/changeset/base/299863 Log: Enable SATA power regulator at boot on Sinovoip BananaPi BPI-M3. Modified: head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts Modified: head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts == --- head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts Sun May 15 16:43:47 2016(r299862) +++ head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts Sun May 15 17:25:31 2016(r299863) @@ -37,6 +37,15 @@ status = "okay"; }; +_ahci_5v { + gpio = < 3 25 GPIO_ACTIVE_HIGH>;/* PD25 */ + status = "okay"; +}; + +_pwr_pin_a { + allwinner,pins = "PD25"; +}; + _usb1_vbus { gpio = < 3 24 GPIO_ACTIVE_HIGH>;/* PD24 */ status = "okay"; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299839 - head/etc/rc.d
On Sun, 2016-05-15 at 04:38 +, Garrett Cooper wrote: > Author: ngie > Date: Sun May 15 04:38:50 2016 > New Revision: 299839 > URL: https://svnweb.freebsd.org/changeset/base/299839 > > Log: > Make FILESYSTEMS, dumpon, and var not depend on zfs and zvol > > Make zfs and zvol come before all of the items that depended on > them > previously > I'm trying to figure out why these changes are needed. rcorder works just fine when a requirement has no providers (yes, it whines, but that's why /etc/rc invokes it with 2>/dev/null). If FILESYSTEMS requires zfs and nothing provides zfs, then it's as if the requirement weren't in the list at all. The manpage for rcorder is wrong, the DIAGNOSTICS section implies that rcorder will abort on a missing requirement, but it doesn't. Changing requirements to BEFOREs seems like it has a lot of potential for messing with peoples' out-of-tree customizations. (And for some reason I've always had the impression that BEFORE was to be avoided in the base rc files, but I can't remember why I think that.) -- Ian ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299862 - head/sys/arm/allwinner
Author: jmcneill Date: Sun May 15 16:43:47 2016 New Revision: 299862 URL: https://svnweb.freebsd.org/changeset/base/299862 Log: Reduce complexity of RSB by always using polling mode. Unfortunately gpiobus methods can be called with non-sleepable locks held. Reviewed by: mmel Modified: head/sys/arm/allwinner/aw_rsb.c head/sys/arm/allwinner/axp81x.c Modified: head/sys/arm/allwinner/aw_rsb.c == --- head/sys/arm/allwinner/aw_rsb.c Sun May 15 15:56:48 2016 (r299861) +++ head/sys/arm/allwinner/aw_rsb.c Sun May 15 16:43:47 2016 (r299862) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -100,7 +99,6 @@ static struct ofw_compat_data compat_dat static struct resource_spec rsb_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, - { SYS_RES_IRQ, 0, RF_ACTIVE }, { -1, 0 } }; @@ -125,12 +123,11 @@ static const struct { }; struct rsb_softc { - struct resource *res[2]; + struct resource *res; struct mtx mtx; clk_t clk; hwreset_t rst; device_tiicbus; - void*ih; int busy; uint32_tstatus; uint16_tcur_addr; @@ -141,8 +138,8 @@ struct rsb_softc { #defineRSB_LOCK(sc)mtx_lock(&(sc)->mtx) #defineRSB_UNLOCK(sc) mtx_unlock(&(sc)->mtx) #defineRSB_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED) -#defineRSB_READ(sc, reg) bus_read_4((sc)->res[0], (reg)) -#defineRSB_WRITE(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) +#defineRSB_READ(sc, reg) bus_read_4((sc)->res, (reg)) +#defineRSB_WRITE(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) static phandle_t rsb_get_node(device_t bus, device_t dev) @@ -202,34 +199,24 @@ static int rsb_start(device_t dev) { struct rsb_softc *sc; - int error, retry, polling; + int error, retry; sc = device_get_softc(dev); - polling = cold || !THREAD_CAN_SLEEP(); RSB_ASSERT_LOCKED(sc); - /* Enable interrupts */ - if (!polling) - RSB_WRITE(sc, RSB_INTE, INT_MASK); - /* Start the transfer */ RSB_WRITE(sc, RSB_CTRL, GLOBAL_INT_ENB | START_TRANS); /* Wait for transfer to complete */ - if (polling) { - error = ETIMEDOUT; - for (retry = RSB_I2C_TIMEOUT; retry > 0; retry--) { - sc->status |= RSB_READ(sc, RSB_INTS); - if ((sc->status & INT_TRANS_OVER) != 0) { - error = 0; - break; - } - DELAY((1000 * hz) / RSB_I2C_TIMEOUT); + error = ETIMEDOUT; + for (retry = RSB_I2C_TIMEOUT; retry > 0; retry--) { + sc->status |= RSB_READ(sc, RSB_INTS); + if ((sc->status & INT_TRANS_OVER) != 0) { + error = 0; + break; } - } else { - error = mtx_sleep(sc, >mtx, 0, "i2ciowait", - RSB_I2C_TIMEOUT); + DELAY((1000 * hz) / RSB_I2C_TIMEOUT); } if (error == 0 && (sc->status & INT_TRANS_OVER) == 0) { device_printf(dev, "transfer error, status 0x%08x\n", @@ -237,9 +224,6 @@ rsb_start(device_t dev) error = EIO; } - /* Disable interrupts */ - RSB_WRITE(sc, RSB_INTE, 0); - return (error); } @@ -389,23 +373,6 @@ done: return (error); } -static void -rsb_intr(void *arg) -{ - struct rsb_softc *sc; - uint32_t val; - - sc = arg; - - RSB_LOCK(sc); - val = RSB_READ(sc, RSB_INTS); - RSB_WRITE(sc, RSB_INTS, val); - sc->status |= val; - if ((sc->status & INT_MASK) != 0) - wakeup(sc); - RSB_UNLOCK(sc); -} - static int rsb_probe(device_t dev) { @@ -443,19 +410,12 @@ rsb_attach(device_t dev) } } - if (bus_alloc_resources(dev, rsb_spec, sc->res) != 0) { + if (bus_alloc_resources(dev, rsb_spec, >res) != 0) { device_printf(dev, "cannot allocate resources for device\n"); error = ENXIO; goto fail; } - error = bus_setup_intr(dev, sc->res[1], INTR_TYPE_MISC | INTR_MPSAFE, - NULL, rsb_intr, sc, >ih); - if (error != 0) { - device_printf(dev, "cannot setup interrupt handler\n"); - goto fail; - } - sc->iicbus = device_add_child(dev, "iicbus", -1); if (sc->iicbus == NULL) { device_printf(dev, "cannot add iicbus child device\n"); @@ -468,9 +428,7 @@ rsb_attach(device_t dev) return
svn commit: r299861 - head/sys/boot/fdt/dts/arm
Author: jmcneill Date: Sun May 15 15:56:48 2016 New Revision: 299861 URL: https://svnweb.freebsd.org/changeset/base/299861 Log: Add gpio-leds for Sinovoip BananaPi BPI-M3. The green LED on the board is wired to AXP813 GPIO0 and the blue LED is wired to AXP813 GPIO1. Modified: head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts Modified: head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts == --- head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts Sun May 15 15:54:41 2016(r299860) +++ head/sys/boot/fdt/dts/arm/sinovoip-bpi-m3.dts Sun May 15 15:56:48 2016(r299861) @@ -104,5 +104,23 @@ reg = <0x3a3>; interrupt-parent = <_intc>; interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + gpio-controller; + #gpio-cells = <1>; + }; +}; + +/ { + leds { + compatible = "gpio-leds"; + + green_led { + gpios = < 0>;/* AXP PMIC GPIO0 */ + label = "green_led"; + }; + + blue_led { + gpios = < 1>;/* AXP PMIC GPIO1 */ + label = "blue_led"; + }; }; }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299860 - head/sys/arm/allwinner
Author: jmcneill Date: Sun May 15 15:54:41 2016 New Revision: 299860 URL: https://svnweb.freebsd.org/changeset/base/299860 Log: Add support for the AXP813/AXP818 power key and GPIO pins. Modified: head/sys/arm/allwinner/axp81x.c Modified: head/sys/arm/allwinner/axp81x.c == --- head/sys/arm/allwinner/axp81x.c Sun May 15 15:52:34 2016 (r299859) +++ head/sys/arm/allwinner/axp81x.c Sun May 15 15:54:41 2016 (r299860) @@ -40,20 +40,51 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include #include +#include + #include #include #include "iicbus_if.h" +#include "gpio_if.h" #defineAXP_ICTYPE 0x03 #defineAXP_POWERBAT0x32 #define AXP_POWERBAT_SHUTDOWN (1 << 7) +#defineAXP_IRQEN1 0x40 +#defineAXP_IRQEN2 0x41 +#defineAXP_IRQEN3 0x42 +#defineAXP_IRQEN4 0x43 +#defineAXP_IRQEN5 0x44 +#define AXP_IRQEN5_POKSIRQ (1 << 4) +#defineAXP_IRQEN6 0x45 +#defineAXP_IRQSTAT50x4c +#define AXP_IRQSTAT5_POKSIRQ (1 << 4) +#defineAXP_GPIO0_CTRL 0x90 +#defineAXP_GPIO1_CTRL 0x92 +#define AXP_GPIO_FUNC (0x7 << 0) +#define AXP_GPIO_FUNC_SHIFT0 +#define AXP_GPIO_FUNC_DRVLO0 +#define AXP_GPIO_FUNC_DRVHI1 +#define AXP_GPIO_FUNC_INPUT2 +#defineAXP_GPIO_SIGBIT 0x94 +#defineAXP_GPIO_PD 0x97 + +static const struct { + const char *name; + uint8_t ctrl_reg; +} axp81x_pins[] = { + { "GPIO0", AXP_GPIO0_CTRL }, + { "GPIO1", AXP_GPIO1_CTRL }, +}; static struct ofw_compat_data compat_data[] = { { "x-powers,axp813",1 }, @@ -61,11 +92,23 @@ static struct ofw_compat_data compat_dat { NULL, 0 } }; +static struct resource_spec axp81x_spec[] = { + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0 } +}; + struct axp81x_softc { + struct resource *res; uint16_taddr; - struct intr_config_hook enum_hook; + void*ih; + device_tgpiodev; + struct mtx mtx; + int busy; }; +#defineAXP_LOCK(sc)mtx_lock(&(sc)->mtx) +#defineAXP_UNLOCK(sc) mtx_unlock(&(sc)->mtx) + static int axp81x_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) { @@ -124,6 +167,267 @@ axp81x_shutdown(void *devp, int howto) axp81x_write(dev, AXP_POWERBAT, AXP_POWERBAT_SHUTDOWN); } +static void +axp81x_intr(void *arg) +{ + struct axp81x_softc *sc; + device_t dev; + uint8_t val; + int error; + + dev = arg; + sc = device_get_softc(dev); + + error = axp81x_read(dev, AXP_IRQSTAT5, , 1); + if (error != 0) + return; + + if (val != 0) { + if ((val & AXP_IRQSTAT5_POKSIRQ) != 0) { + if (bootverbose) + device_printf(dev, "Power button pressed\n"); + shutdown_nice(RB_POWEROFF); + } + /* Acknowledge */ + axp81x_write(dev, AXP_IRQSTAT5, val); + } +} + +static device_t +axp81x_gpio_get_bus(device_t dev) +{ + struct axp81x_softc *sc; + + sc = device_get_softc(dev); + + return (sc->gpiodev); +} + +static int +axp81x_gpio_pin_max(device_t dev, int *maxpin) +{ + *maxpin = nitems(axp81x_pins) - 1; + + return (0); +} + +static int +axp81x_gpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + if (pin >= nitems(axp81x_pins)) + return (EINVAL); + + snprintf(name, GPIOMAXNAME, "%s", axp81x_pins[pin].name); + + return (0); +} + +static int +axp81x_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + if (pin >= nitems(axp81x_pins)) + return (EINVAL); + + *caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; + + return (0); +} + +static int +axp81x_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct axp81x_softc *sc; + uint8_t data, func; + int error; + + if (pin >= nitems(axp81x_pins)) + return (EINVAL); + + sc = device_get_softc(dev); + + AXP_LOCK(sc); + THREAD_SLEEPING_OK(); + error = axp81x_read(dev, axp81x_pins[pin].ctrl_reg, , 1); + if (error == 0) { + func = (data & AXP_GPIO_FUNC) >> AXP_GPIO_FUNC_SHIFT; + if (func == AXP_GPIO_FUNC_INPUT) + *flags = GPIO_PIN_INPUT; + else if (func == AXP_GPIO_FUNC_DRVLO || + func ==
svn commit: r299859 - head/sys/arm/allwinner
Author: jmcneill Date: Sun May 15 15:52:34 2016 New Revision: 299859 URL: https://svnweb.freebsd.org/changeset/base/299859 Log: Allow RSB to be used from interrupt handlers. The driver uses polling mode if cold or !THREAD_CAN_SLEEP() and now implements the bus_* interface. Modified: head/sys/arm/allwinner/aw_rsb.c Modified: head/sys/arm/allwinner/aw_rsb.c == --- head/sys/arm/allwinner/aw_rsb.c Sun May 15 15:31:44 2016 (r299858) +++ head/sys/arm/allwinner/aw_rsb.c Sun May 15 15:52:34 2016 (r299859) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -201,21 +202,22 @@ static int rsb_start(device_t dev) { struct rsb_softc *sc; - int error, retry; + int error, retry, polling; sc = device_get_softc(dev); + polling = cold || !THREAD_CAN_SLEEP(); RSB_ASSERT_LOCKED(sc); /* Enable interrupts */ - if (!cold) + if (!polling) RSB_WRITE(sc, RSB_INTE, INT_MASK); /* Start the transfer */ RSB_WRITE(sc, RSB_CTRL, GLOBAL_INT_ENB | START_TRANS); /* Wait for transfer to complete */ - if (cold) { + if (polling) { error = ETIMEDOUT; for (retry = RSB_I2C_TIMEOUT; retry > 0; retry--) { sc->status |= RSB_READ(sc, RSB_INTS); @@ -482,6 +484,17 @@ static device_method_t rsb_methods[] = { DEVMETHOD(device_probe, rsb_probe), DEVMETHOD(device_attach,rsb_attach), + /* Bus interface */ + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr,bus_generic_teardown_intr), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource), + DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), + DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + /* OFW methods */ DEVMETHOD(ofw_bus_get_node, rsb_get_node), ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299858 - head/sys/arm/nvidia
Author: mmel Date: Sun May 15 15:31:44 2016 New Revision: 299858 URL: https://svnweb.freebsd.org/changeset/base/299858 Log: TEGRA: Also attach gpioc to tegra_gpio driver. Forgotten in r299854. Modified: head/sys/arm/nvidia/tegra_gpio.c Modified: head/sys/arm/nvidia/tegra_gpio.c == --- head/sys/arm/nvidia/tegra_gpio.cSun May 15 15:26:19 2016 (r299857) +++ head/sys/arm/nvidia/tegra_gpio.cSun May 15 15:31:44 2016 (r299858) @@ -895,4 +895,7 @@ EARLY_DRIVER_MODULE(tegra_gpio, simplebu extern devclass_t ofwgpiobus_devclass; extern driver_t ofw_gpiobus_driver; EARLY_DRIVER_MODULE(ofw_gpiobus, tegra_gpio, ofw_gpiobus_driver, -ofwgpiobus_devclass, 0, 0, BUS_PASS_BUS); +ofwgpiobus_devclass, 0, 0, BUS_PASS_BUS); +extern devclass_t gpioc_devclass; +extern driver_t gpioc_driver; +DRIVER_MODULE(gpioc, tegra_gpio, gpioc_driver, gpioc_devclass, 0, 0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299857 - stable/9/sys/contrib/ipfilter/netinet
Author: cy Date: Sun May 15 15:26:19 2016 New Revision: 299857 URL: https://svnweb.freebsd.org/changeset/base/299857 Log: Fix: IP Filter bug 1835705: It is impossible to delete a state using SIOCDELST ioctl. This is a direct commit to the stable/9 branch because this patch was already included in the ipfilter 5.1.2 import in r254562. It was ultimately included in ipfilter 4.1.29 (whereas stable/9 uses 4.1.28). Obtained from:ipfilter CVS repo: ip_state.c r1.13 Modified: stable/9/sys/contrib/ipfilter/netinet/ip_state.c Modified: stable/9/sys/contrib/ipfilter/netinet/ip_state.c == --- stable/9/sys/contrib/ipfilter/netinet/ip_state.cSun May 15 15:14:46 2016(r299856) +++ stable/9/sys/contrib/ipfilter/netinet/ip_state.cSun May 15 15:26:19 2016(r299857) @@ -421,7 +421,7 @@ caddr_t data; if ((sp->is_p == st.is_p) && (sp->is_v == st.is_v) && !bcmp((caddr_t)>is_src, (caddr_t)_src, sizeof(st.is_src)) && - !bcmp((caddr_t)>is_dst, (caddr_t)_src, + !bcmp((caddr_t)>is_dst, (caddr_t)_dst, sizeof(st.is_dst)) && !bcmp((caddr_t)>is_ps, (caddr_t)_ps, sizeof(st.is_ps))) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299856 - head/sys/arm/nvidia
Author: mmel Date: Sun May 15 15:14:46 2016 New Revision: 299856 URL: https://svnweb.freebsd.org/changeset/base/299856 Log: TEGRA: Don't use common name 'iicb' for tegra specific IIC driver. Using commn name for different drivers breaks generic kernel creation. Modified: head/sys/arm/nvidia/tegra_i2c.c Modified: head/sys/arm/nvidia/tegra_i2c.c == --- head/sys/arm/nvidia/tegra_i2c.c Sun May 15 15:13:56 2016 (r299855) +++ head/sys/arm/nvidia/tegra_i2c.c Sun May 15 15:14:46 2016 (r299856) @@ -800,5 +800,9 @@ static device_method_t tegra_i2c_methods DEFINE_CLASS_0(iichb, tegra_i2c_driver, tegra_i2c_methods, sizeof(struct tegra_i2c_softc)); static devclass_t tegra_i2c_devclass; -EARLY_DRIVER_MODULE(iichb, simplebus, tegra_i2c_driver, tegra_i2c_devclass, 0, -0, 73); +EARLY_DRIVER_MODULE(tegra_iic, simplebus, tegra_i2c_driver, tegra_i2c_devclass, +0, 0, 73); +extern devclass_t ofwiicbus_devclass; +extern driver_t ofw_iicbus_driver; +EARLY_DRIVER_MODULE(ofw_iicbus, tegra_iic, ofw_iicbus_driver, +ofwiicbus_devclass, 0, 0, BUS_PASS_BUS); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299855 - head/sys/dev/ofw
Author: mmel Date: Sun May 15 15:13:56 2016 New Revision: 299855 URL: https://svnweb.freebsd.org/changeset/base/299855 Log: OFWIICBUS: Make ofwiicbus_devclass externaly visible. It's needed for binding of iic controllers. Modified: head/sys/dev/ofw/ofw_iicbus.c Modified: head/sys/dev/ofw/ofw_iicbus.c == --- head/sys/dev/ofw/ofw_iicbus.c Sun May 15 14:47:50 2016 (r299854) +++ head/sys/dev/ofw/ofw_iicbus.c Sun May 15 15:13:56 2016 (r299855) @@ -76,7 +76,7 @@ struct ofw_iicbus_devinfo { struct ofw_bus_devinfo opd_obdinfo; }; -static devclass_t ofwiicbus_devclass; +devclass_t ofwiicbus_devclass; DEFINE_CLASS_1(iicbus, ofw_iicbus_driver, ofw_iicbus_methods, sizeof(struct iicbus_softc), iicbus_driver); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299854 - head/sys/arm/nvidia
Author: mmel Date: Sun May 15 14:47:50 2016 New Revision: 299854 URL: https://svnweb.freebsd.org/changeset/base/299854 Log: TEGRA: Don't use common name 'gpio' for tegra specific GPIO driver. Using commn name for different drivers breaks generic kernel creation. Modified: head/sys/arm/nvidia/tegra_gpio.c Modified: head/sys/arm/nvidia/tegra_gpio.c == --- head/sys/arm/nvidia/tegra_gpio.cSun May 15 14:43:52 2016 (r299853) +++ head/sys/arm/nvidia/tegra_gpio.cSun May 15 14:47:50 2016 (r299854) @@ -883,7 +883,7 @@ static device_method_t tegra_gpio_method }; static driver_t tegra_gpio_driver = { - "gpio", + "tegra_gpio", tegra_gpio_methods, sizeof(struct tegra_gpio_softc), }; @@ -891,3 +891,8 @@ static devclass_t tegra_gpio_devclass; EARLY_DRIVER_MODULE(tegra_gpio, simplebus, tegra_gpio_driver, tegra_gpio_devclass, 0, 0, 70); + +extern devclass_t ofwgpiobus_devclass; +extern driver_t ofw_gpiobus_driver; +EARLY_DRIVER_MODULE(ofw_gpiobus, tegra_gpio, ofw_gpiobus_driver, +ofwgpiobus_devclass, 0, 0, BUS_PASS_BUS); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299853 - head/sys/dev/gpio
Author: mmel Date: Sun May 15 14:43:52 2016 New Revision: 299853 URL: https://svnweb.freebsd.org/changeset/base/299853 Log: OFWGPIOBUS: Make ofwgpiobus_devclass externaly visible. It's needed for binding of gpio controllers. Modified: head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/ofw_gpiobus.c == --- head/sys/dev/gpio/ofw_gpiobus.c Sun May 15 14:39:41 2016 (r299852) +++ head/sys/dev/gpio/ofw_gpiobus.c Sun May 15 14:43:52 2016 (r299853) @@ -569,7 +569,7 @@ static device_method_t ofw_gpiobus_metho DEVMETHOD_END }; -static devclass_t ofwgpiobus_devclass; +devclass_t ofwgpiobus_devclass; DEFINE_CLASS_1(gpiobus, ofw_gpiobus_driver, ofw_gpiobus_methods, sizeof(struct gpiobus_softc), gpiobus_driver); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299852 - head/sys/dev/bwn
Author: adrian Date: Sun May 15 14:39:41 2016 New Revision: 299852 URL: https://svnweb.freebsd.org/changeset/base/299852 Log: [bwn] remove N-PHY registers for now. I've submitted an alternative proposal to -core about just importing the (converted) GPL PHY code in an alternate directory under sys/gnu/ so I don't have to rewrite it all to be BSD licenced. Deleted: head/sys/dev/bwn/if_bwn_phy_n_regs.h ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299851 - head/sys/arm/arm
Author: manu Date: Sun May 15 13:20:59 2016 New Revision: 299851 URL: https://svnweb.freebsd.org/changeset/base/299851 Log: Allow arm generic_timer code to be included even if not present in the SoC. Reviewed by: andrew Approved by: cognet (mentor) Differential Revision:https://reviews.freebsd.org/D6372 Modified: head/sys/arm/arm/generic_timer.c Modified: head/sys/arm/arm/generic_timer.c == --- head/sys/arm/arm/generic_timer.cSun May 15 13:17:05 2016 (r299850) +++ head/sys/arm/arm/generic_timer.cSun May 15 13:20:59 2016 (r299851) @@ -214,7 +214,8 @@ static void tmr_setup_user_access(void *arg __unused) { - smp_rendezvous(NULL, setup_user_access, NULL, NULL); + if (arm_tmr_sc != NULL) + smp_rendezvous(NULL, setup_user_access, NULL, NULL); } SYSINIT(tmr_ua, SI_SUB_SMP, SI_ORDER_SECOND, tmr_setup_user_access, NULL); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299850 - in head/usr.bin/xinstall: . tests
Author: jilles Date: Sun May 15 13:17:05 2016 New Revision: 299850 URL: https://svnweb.freebsd.org/changeset/base/299850 Log: install: When preserving timestamps, also copy the nanoseconds part. Modified: head/usr.bin/xinstall/tests/install_test.sh head/usr.bin/xinstall/xinstall.c Modified: head/usr.bin/xinstall/tests/install_test.sh == --- head/usr.bin/xinstall/tests/install_test.sh Sun May 15 08:36:12 2016 (r299849) +++ head/usr.bin/xinstall/tests/install_test.sh Sun May 15 13:17:05 2016 (r299850) @@ -64,6 +64,12 @@ copy_to_nonexistent_backup_safe_body() { copy_to_nonexistent_with_opts -b -B.bak -S } +atf_test_case copy_to_nonexistent_preserving +copy_to_nonexistent_preserving_body() { + copy_to_nonexistent_with_opts -p + [ ! testf -ot copyf ] || atf_fail "bad timestamp 2" +} + copy_self_with_opts() { printf 'test\n123\r456\r\n789\0z' >testf printf 'test\n123\r456\r\n789\0z' >testf2 @@ -307,6 +313,7 @@ atf_init_test_cases() { atf_add_test_case copy_to_nonexistent_safe_comparing atf_add_test_case copy_to_nonexistent_backup atf_add_test_case copy_to_nonexistent_backup_safe + atf_add_test_case copy_to_nonexistent_preserving atf_add_test_case copy_self atf_add_test_case copy_self_safe atf_add_test_case copy_self_comparing Modified: head/usr.bin/xinstall/xinstall.c == --- head/usr.bin/xinstall/xinstall.cSun May 15 08:36:12 2016 (r299849) +++ head/usr.bin/xinstall/xinstall.cSun May 15 13:17:05 2016 (r299850) @@ -131,7 +131,7 @@ static void do_symlink(const char *, con static voidmakelink(const char *, const char *, const struct stat *); static voidinstall(const char *, const char *, u_long, u_int); static voidinstall_dir(char *); -static voidmetadata_log(const char *, const char *, struct timeval *, +static voidmetadata_log(const char *, const char *, struct timespec *, const char *, const char *, off_t); static int parseid(const char *, id_t *); static voidstrip(const char *); @@ -722,7 +722,7 @@ static void install(const char *from_name, const char *to_name, u_long fset, u_int flags) { struct stat from_sb, temp_sb, to_sb; - struct timeval tvb[2]; + struct timespec tsb[2]; int devnull, files_match, from_fd, serrno, target; int tempcopy, temp_fd, to_fd; char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN]; @@ -857,11 +857,9 @@ install(const char *from_name, const cha * Need to preserve target file times, though. */ if (to_sb.st_nlink != 1) { - tvb[0].tv_sec = to_sb.st_atime; - tvb[0].tv_usec = 0; - tvb[1].tv_sec = to_sb.st_mtime; - tvb[1].tv_usec = 0; - (void)utimes(tempfile, tvb); + tsb[0] = to_sb.st_atim; + tsb[1] = to_sb.st_mtim; + (void)utimensat(AT_FDCWD, tempfile, tsb, 0); } else { files_match = 1; (void)unlink(tempfile); @@ -916,11 +914,9 @@ install(const char *from_name, const cha * Preserve the timestamp of the source file if necessary. */ if (dopreserve && !files_match && !devnull) { - tvb[0].tv_sec = from_sb.st_atime; - tvb[0].tv_usec = 0; - tvb[1].tv_sec = from_sb.st_mtime; - tvb[1].tv_usec = 0; - (void)utimes(to_name, tvb); + tsb[0] = from_sb.st_atim; + tsb[1] = from_sb.st_mtim; + (void)utimensat(AT_FDCWD, to_name, tsb, 0); } if (fstat(to_fd, _sb) == -1) { @@ -989,7 +985,7 @@ install(const char *from_name, const cha if (!devnull) (void)close(from_fd); - metadata_log(to_name, "file", tvb, NULL, digestresult, to_sb.st_size); + metadata_log(to_name, "file", tsb, NULL, digestresult, to_sb.st_size); free(digestresult); } @@ -1301,7 +1297,7 @@ again: * or to allow integrity checks to be performed. */ static void -metadata_log(const char *path, const char *type, struct timeval *tv, +metadata_log(const char *path, const char *type, struct timespec *ts, const char *slink, const char *digestresult, off_t size) { static const char extra[] = { ' ', '\t', '\n', '\\', '#', '\0' }; @@ -1355,9 +1351,9 @@ metadata_log(const char *path, const cha } if (*type == 'f') /* type=file */ fprintf(metafp, " size=%lld", (long long)size); - if (tv != NULL &&
svn commit: r299849 - head/sys/dev/isp
Author: trasz Date: Sun May 15 08:36:12 2016 New Revision: 299849 URL: https://svnweb.freebsd.org/changeset/base/299849 Log: Remove NULL checks after M_WAITOK allocations from isp(4). MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/isp/isp_pci.c head/sys/dev/isp/isp_sbus.c Modified: head/sys/dev/isp/isp_pci.c == --- head/sys/dev/isp/isp_pci.c Sun May 15 08:34:59 2016(r299848) +++ head/sys/dev/isp/isp_pci.c Sun May 15 08:36:12 2016(r299849) @@ -1593,11 +1593,6 @@ isp_pci_mbxdma(ispsoftc_t *isp) len = isp->isp_maxcmds * sizeof (struct isp_pcmd); isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); - if (isp->isp_osinfo.pcmd_pool == NULL) { - isp_prt(isp, ISP_LOGERR, "cannot allocate pcmds"); - ISP_LOCK(isp); - return (1); - } if (isp->isp_osinfo.sixtyfourbit) { nsegs = ISP_NSEG64_MAX; @@ -1614,12 +1609,6 @@ isp_pci_mbxdma(ispsoftc_t *isp) len = sizeof (isp_hdl_t) * isp->isp_maxcmds; isp->isp_xflist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); - if (isp->isp_xflist == NULL) { - free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); - ISP_LOCK(isp); - isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array"); - return (1); - } for (len = 0; len < isp->isp_maxcmds - 1; len++) { isp->isp_xflist[len].cmd = >isp_xflist[len+1]; } Modified: head/sys/dev/isp/isp_sbus.c == --- head/sys/dev/isp/isp_sbus.c Sun May 15 08:34:59 2016(r299848) +++ head/sys/dev/isp/isp_sbus.c Sun May 15 08:36:12 2016(r299849) @@ -448,19 +448,8 @@ isp_sbus_mbxdma(ispsoftc_t *isp) len = sizeof (struct isp_pcmd) * isp->isp_maxcmds; isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); - if (isp->isp_osinfo.pcmd_pool == NULL) { - isp_prt(isp, ISP_LOGERR, "cannot alloc pcmd pool"); - ISP_LOCK(isp); - return (1); - } - len = sizeof (isp_hdl_t *) * isp->isp_maxcmds; isp->isp_xflist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); - if (isp->isp_xflist == NULL) { - isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array"); - ISP_LOCK(isp); - return (1); - } for (len = 0; len < isp->isp_maxcmds - 1; len++) { isp->isp_xflist[len].cmd = >isp_xflist[len+1]; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299848 - head/sys/fs/nfsclient
Author: trasz Date: Sun May 15 08:34:59 2016 New Revision: 299848 URL: https://svnweb.freebsd.org/changeset/base/299848 Log: Make it possible to reroot into NFS. This means one can have eg an NFSv4 root over WiFi: boot from md_root (small rootfs image preloaded by loader(8)), setup WiFi, and then reroot into the actual root, over NFS. Note that it's currently limited to NFSv4, and due to problems with nfsuserd(8) it requres a workaround on the server side: one needs to set the vfs.nfsd.enable_stringtouid=1 sysctl and not run nfsuserd(8) on either the server or the client side. Reviewed by: rmacklem@ MFC after:1 month Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D6347 Modified: head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c == --- head/sys/fs/nfsclient/nfs_clvfsops.cSun May 15 07:02:34 2016 (r299847) +++ head/sys/fs/nfsclient/nfs_clvfsops.cSun May 15 08:34:59 2016 (r299848) @@ -741,6 +741,101 @@ static const char *nfs_opts[] = { "from" NULL }; /* + * Parse the "from" mountarg, passed by the generic mount(8) program + * or the mountroot code. This is used when rerooting into NFS. + * + * Note that the "hostname" is actually a "hostname:/share/path" string. + */ +static int +nfs_mount_parse_from(struct vfsoptlist *opts, char **hostnamep, +struct sockaddr_in **sinp, char *dirpath, size_t dirpathsize, int *dirlenp) +{ + char nam[MNAMELEN + 1]; + char *delimp, *hostp, *spec; + int error, have_bracket = 0, offset, rv, speclen; + struct sockaddr_in *sin; + size_t len; + + error = vfs_getopt(opts, "from", (void **), ); + if (error != 0) + return (error); + + /* +* This part comes from sbin/mount_nfs/mount_nfs.c:getnfsargs(). +*/ +if (*spec == '[' && (delimp = strchr(spec + 1, ']')) != NULL && +*(delimp + 1) == ':') { +hostp = spec + 1; +spec = delimp + 2; +have_bracket = 1; +} else if ((delimp = strrchr(spec, ':')) != NULL) { +hostp = spec; +spec = delimp + 1; +} else if ((delimp = strrchr(spec, '@')) != NULL) { +printf("%s: path@server syntax is deprecated, " + "use server:path\n", __func__); +hostp = delimp + 1; +} else { +printf("%s: no : nfs-name\n", __func__); +return (EINVAL); +} +*delimp = '\0'; + +/* + * If there has been a trailing slash at mounttime it seems + * that some mountd implementations fail to remove the mount + * entries from their mountlist while unmounting. + */ +for (speclen = strlen(spec); +speclen > 1 && spec[speclen - 1] == '/'; +speclen--) +spec[speclen - 1] = '\0'; +if (strlen(hostp) + strlen(spec) + 1 > MNAMELEN) { +printf("%s: %s:%s: name too long", __func__, hostp, spec); +return (EINVAL); +} + /* Make both '@' and ':' notations equal */ + if (*hostp != '\0') { + len = strlen(hostp); + offset = 0; + if (have_bracket) + nam[offset++] = '['; + memmove(nam + offset, hostp, len); + if (have_bracket) + nam[len + offset++] = ']'; + nam[len + offset++] = ':'; + memmove(nam + len + offset, spec, speclen); + nam[len + speclen + offset] = '\0'; + } + + /* +* XXX: IPv6 +*/ + sin = malloc(sizeof(*sin), M_SONAME, M_WAITOK); + rv = inet_pton(AF_INET, hostp, >sin_addr); + if (rv != 1) { + printf("%s: cannot parse '%s', inet_pton() returned %d\n", + __func__, hostp, rv); + free(sin, M_SONAME); + return (EINVAL); + } + + sin->sin_len = sizeof(*sin); + sin->sin_family = AF_INET; + /* +* XXX: hardcoded port number. +*/ + sin->sin_port = htons(2049); + + *hostnamep = strdup(nam, M_NEWNFSMNT); + *sinp = sin; + strlcpy(dirpath, spec, dirpathsize); + *dirlenp = strlen(dirpath); + + return (0); +} + +/* * VFS Operations. * * mount system call @@ -785,17 +880,20 @@ nfs_mount(struct mount *mp) int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; int minvers = 0; - int dirlen, has_nfs_args_opt, krbnamelen, srvkrbnamelen; + int dirlen, has_nfs_args_opt, has_nfs_from_opt, + krbnamelen, srvkrbnamelen; size_t hstlen; has_nfs_args_opt = 0; + has_nfs_from_opt = 0;
svn commit: r299847 - head/sys/dev/bwn
Author: adrian Date: Sun May 15 07:02:34 2016 New Revision: 299847 URL: https://svnweb.freebsd.org/changeset/base/299847 Log: [bwn] add DUALPHY; this may be useful for PHY-N and later dual-phy probing. Obtained from:Landon FullerModified: head/sys/dev/bwn/if_bwnreg.h Modified: head/sys/dev/bwn/if_bwnreg.h == --- head/sys/dev/bwn/if_bwnreg.hSun May 15 06:11:40 2016 (r299846) +++ head/sys/dev/bwn/if_bwnreg.hSun May 15 07:02:34 2016 (r299847) @@ -108,6 +108,7 @@ #defineBWN_TGSHIGH_HAVE_2GHZ 0x0001 #defineBWN_TGSHIGH_HAVE_5GHZ 0x0002 +#defineBWN_TGSHIGH_DUALPHY 0x0008 #defineBWN_PHYTYPE_A 0x00 #defineBWN_PHYTYPE_B 0x01 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r299778 - head/usr.sbin/bsnmpd/tools/libbsnmptools
On Sat, May 14, 2016 at 4:22 PM, Garrett Cooperwrote: > Author: ngie > Date: Sat May 14 23:22:38 2016 > New Revision: 299778 > URL: https://svnweb.freebsd.org/changeset/base/299778 > > Log: > Use a consistent errno save/restore pattern before running strtoul This is begging to be reduced to a subroutine for the common expression. Best, Conrad > > - Save errno > - Set errno to 0 > - Call strtoul > - Test errno (optional, but many calls to strtoul did this afterwards) > > Some of the code was setting errno = 0 after calling strtoul, not setting > errno = 0, or setting errno to saved_errno after the call, but before the > test. These all have unwanted behavioral side-effects, depending on the > initial value of errno and whether or not the input to strtoul was correct > or incorrect. > > MFC after: 3 weeks > Sponsored by: EMC / Isilon Storage Division > > Modified: > head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c > > Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c > == > --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat May 14 23:22:19 > 2016(r299777) > +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat May 14 23:22:38 > 2016(r299778) > @@ -364,6 +364,7 @@ snmp_date2asn_oid(char *str, struct asn_ > /* 'MM-' */ > ptr = endptr + 1; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0) > goto error; > @@ -377,6 +378,7 @@ snmp_date2asn_oid(char *str, struct asn_ > /* 'DD,' */ > ptr = endptr + 1; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0) > goto error; > @@ -390,6 +392,7 @@ snmp_date2asn_oid(char *str, struct asn_ > /* 'HH:' */ > ptr = endptr + 1; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0) > goto error; > @@ -403,6 +406,7 @@ snmp_date2asn_oid(char *str, struct asn_ > /* 'MM:' */ > ptr = endptr + 1; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0) > goto error; > @@ -416,6 +420,7 @@ snmp_date2asn_oid(char *str, struct asn_ > /* 'SS.' */ > ptr = endptr + 1; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0) > goto error; > @@ -429,6 +434,7 @@ snmp_date2asn_oid(char *str, struct asn_ > /* 'M(mseconds),' */ > ptr = endptr + 1; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0) > goto error; > @@ -454,6 +460,7 @@ snmp_date2asn_oid(char *str, struct asn_ > /* 'HH:' */ > ptr = endptr + 1; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0) > goto error; > @@ -467,6 +474,7 @@ snmp_date2asn_oid(char *str, struct asn_ > /* 'MM' - last one - ignore endptr here. */ > ptr = endptr + 1; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0) > goto error; > @@ -725,6 +733,7 @@ snmp_ntp_ts2asn_oid(char *str, struct as > > ptr = str; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0 || (v / 1000) > 9) { > warnx("Integer value %s not supported", str); > @@ -749,6 +758,7 @@ snmp_ntp_ts2asn_oid(char *str, struct as > > ptr = endptr + 1; > saved_errno = errno; > + errno = 0; > v = strtoul(ptr, , 10); > if (errno != 0 || (v / 1000) > 9) { > warnx("Integer value %s not supported", str); > @@ -776,6 +786,7 @@ parse_ntp_ts(struct snmp_value *sv, char > uint8_t ntp_ts[SNMP_NTP_TS_OCTETS]; > > saved_errno = errno; > + errno = 0; > v = strtoul(val, , 10); > if (errno != 0 || (v / 1000) > 9) { > errno = saved_errno; > @@ -797,6 +808,7 @@ parse_ntp_ts(struct snmp_value *sv, char > val = endptr + 1; > > saved_errno = errno; > + errno = 0; > v = strtoul(val, , 10); > if (errno != 0 || (v / 1000) > 9) { > errno = saved_errno; > @@ -879,8 +891,8 @@ snmp_bridgeid2oct(char *str, struct asn_ > ptr = str; > /* Read the priority. */ > saved_errno = errno; > - v = strtoul(ptr, , 10); > errno = 0; > + v = strtoul(ptr, , 10); > > if (v > SNMP_MAX_BRIDGE_PRIORITY || errno != 0 || *endptr != '.') { > errno = saved_errno; > @@ -897,6 +909,7 @@ snmp_bridgeid2oct(char *str, struct asn_ > ptr = endptr + 1; > for (i = 0;
Re: svn commit: r299751 - head/sys/dev/bwn
On 14 May 2016 at 18:33, Conrad Meyerwrote: > On Sat, May 14, 2016 at 12:52 PM, Adrian Chadd wrote: >> Author: adrian >> Date: Sat May 14 19:52:04 2016 >> New Revision: 299751 >> URL: https://svnweb.freebsd.org/changeset/base/299751 >> >> Log: >> [bwn] migrate sqrt and add another couple of util routines. >> >> ... >> >> +unsigned int >> +bwn_sqrt(struct bwn_mac *mac, unsigned int x) >> +{ >> + /* Table holding (10 * sqrt(x)) for x between 1 and 256. */ >> + static uint8_t sqrt_table[256] = { >> + 10, 14, 17, 20, 22, 24, 26, 28, >> ... >> + }; >> + >> + if (x == 0) >> + return (0); >> + if (x >= 256) { >> + unsigned int tmp; >> + >> + for (tmp = 0; x >= (2 * tmp) + 1; x -= (2 * tmp++) + 1) >> + /* do nothing */ ; >> + return (tmp); > > Does this approximation method have a name? "whatever the broadcom driver requires". >> + } >> + return (sqrt_table[x - 1] / 10); > > Why do we store the table as 10*sqrt() if we're just going to divide > every entry by ten? no idea, I just shuffled the code around so newer PHY code can use it! -a ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299846 - head/sys/dev/bwn
Author: adrian Date: Sun May 15 06:11:40 2016 New Revision: 299846 URL: https://svnweb.freebsd.org/changeset/base/299846 Log: [bwn] commit the N-PHY register set. Obtained from:Linux b43 (register definitions.) Added: head/sys/dev/bwn/if_bwn_phy_n_regs.h (contents, props changed) Added: head/sys/dev/bwn/if_bwn_phy_n_regs.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/bwn/if_bwn_phy_n_regs.hSun May 15 06:11:40 2016 (r299846) @@ -0,0 +1,904 @@ +/*- + * Copyright (c) 2016 Adrian Chadd+ * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer, + *without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + *redistribution must be conditioned upon including a substantially + *similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ +#ifndef__IF_BWN_PHY_N_REGS_H__ +#define__IF_BWN_PHY_N_REGS_H__ + +/* N-PHY registers. */ + +#defineBWN_NPHY_BBCFG BWN_PHY_N(0x001) /* BB config */ +#define BWN_NPHY_BBCFG_RSTCCA 0x4000 /* Reset CCA */ +#define BWN_NPHY_BBCFG_RSTRX 0x8000 /* Reset RX */ +#defineBWN_NPHY_CHANNELBWN_PHY_N(0x005) /* Channel */ +#defineBWN_NPHY_TXERR BWN_PHY_N(0x007) /* TX error */ +#defineBWN_NPHY_BANDCTLBWN_PHY_N(0x009) /* Band control */ +#define BWN_NPHY_BANDCTL_5GHZ 0x0001 /* Use the 5GHz band */ +#defineBWN_NPHY_4WI_ADDR BWN_PHY_N(0x00B) /* Four-wire bus address */ +#defineBWN_NPHY_4WI_DATAHI BWN_PHY_N(0x00C) /* Four-wire bus data high */ +#defineBWN_NPHY_4WI_DATALO BWN_PHY_N(0x00D) /* Four-wire bus data low */ +#defineBWN_NPHY_BIST_STAT0 BWN_PHY_N(0x00E) /* Built-in self test status 0 */ +#defineBWN_NPHY_BIST_STAT1 BWN_PHY_N(0x00F) /* Built-in self test status 1 */ + +#defineBWN_NPHY_C1_DESPWR BWN_PHY_N(0x018) /* Core 1 desired power */ +#defineBWN_NPHY_C1_CCK_DESPWR BWN_PHY_N(0x019) /* Core 1 CCK desired power */ +#defineBWN_NPHY_C1_BCLIPBKOFF BWN_PHY_N(0x01A) /* Core 1 barely clip backoff */ +#defineBWN_NPHY_C1_CCK_BCLIPBKOFF BWN_PHY_N(0x01B) /* Core 1 CCK barely clip backoff */ +#defineBWN_NPHY_C1_CGAINI BWN_PHY_N(0x01C) /* Core 1 compute gain info */ +#define BWN_NPHY_C1_CGAINI_GAINBKOFF 0x001F /* Gain backoff */ +#define BWN_NPHY_C1_CGAINI_GAINBKOFF_SHIFT 0 +#define BWN_NPHY_C1_CGAINI_CLIPGBKOFF 0x03E0 /* Clip gain backoff */ +#define BWN_NPHY_C1_CGAINI_CLIPGBKOFF_SHIFT5 +#define BWN_NPHY_C1_CGAINI_GAINSTEP0x1C00 /* Gain step */ +#define BWN_NPHY_C1_CGAINI_GAINSTEP_SHIFT 10 +#define BWN_NPHY_C1_CGAINI_CL2DETECT 0x2000 /* Clip 2 detect mask */ +#defineBWN_NPHY_C1_CCK_CGAINI BWN_PHY_N(0x01D) /* Core 1 CCK compute gain info */ +#define BWN_NPHY_C1_CCK_CGAINI_GAINBKOFF 0x001F /* Gain backoff */ +#define BWN_NPHY_C1_CCK_CGAINI_CLIPGBKOFF 0x01E0 /* CCK barely clip gain backoff */ +#defineBWN_NPHY_C1_MINMAX_GAIN BWN_PHY_N(0x01E) /* Core 1 min/max gain */ +#define BWN_NPHY_C1_MINGAIN0x00FF /* Minimum gain */ +#define BWN_NPHY_C1_MINGAIN_SHIFT 0 +#define BWN_NPHY_C1_MAXGAIN
svn commit: r299845 - head/sbin/routed
Author: pfg Date: Sun May 15 06:06:22 2016 New Revision: 299845 URL: https://svnweb.freebsd.org/changeset/base/299845 Log: routed(8): Use arc4random_uniform instead of arc4random. Use arc4random_uniform() when the desired random number upper bound is not a power of two. While here, we don't need srandom() and friends anymore. Obtained from:OpenBSD (CVS rev. 1.20) Modified: head/sbin/routed/main.c Modified: head/sbin/routed/main.c == --- head/sbin/routed/main.c Sun May 15 06:00:13 2016(r299844) +++ head/sbin/routed/main.c Sun May 15 06:06:22 2016(r299845) @@ -303,11 +303,6 @@ usage: pidfile(0); #endif mypid = getpid(); -#ifdef __FreeBSD__ - srandomdev(); -#else - srandom((int)(clk.tv_sec ^ clk.tv_usec ^ mypid)); -#endif /* prepare socket connected to the kernel. */ @@ -826,8 +821,8 @@ intvl_random(struct timeval *tp,/* put { tp->tv_sec = (time_t)(hi == lo ? lo - : (lo + arc4random() % ((hi - lo; - tp->tv_usec = arc4random() % 100; + : (lo + arc4random_uniform(1 + hi - lo))); + tp->tv_usec = arc4random_uniform(100); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r299844 - head/etc/rc.d
Author: ngie Date: Sun May 15 06:00:13 2016 New Revision: 299844 URL: https://svnweb.freebsd.org/changeset/base/299844 Log: Make hostid_save depend on hostid MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/etc/rc.d/hostid_save Modified: head/etc/rc.d/hostid_save == --- head/etc/rc.d/hostid_save Sun May 15 05:45:54 2016(r299843) +++ head/etc/rc.d/hostid_save Sun May 15 06:00:13 2016(r299844) @@ -4,7 +4,7 @@ # # PROVIDE: hostid_save -# REQUIRE: root +# REQUIRE: hostid root # KEYWORD: nojail . /etc/rc.subr ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"