1. 24 Sep, 2021 1 commit
  2. 24 Nov, 2019 1 commit
    • Li-Wen Hsu's avatar
      Fix gcc build · b9e5cb05
      Li-Wen Hsu authored
      We have -Werror=strict-overflow so gcc complains:
      
      In file included from /tmp/obj/workspace/src/amd64.amd64/tmp/usr/include/bitstring.h:36:0,
                       from /workspace/src/tests/sys/sys/bitstring_test.c:34:
      /workspace/src/tests/sys/sys/bitstring_test.c: In function 'bit_ffc_at_test':
      /workspace/src/sys/sys/bitstring.h:239:5: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow]
        if (_start >= _nbits) {
           ^
      
      Disable assuming overflow of signed integer will never happen by specifying
      -fno-strict-overflow
      
      Sponsored by:	The FreeBSD Foundation
      b9e5cb05
  3. 14 Sep, 2019 1 commit
    • Edward Tomasz Napierala's avatar
      Introduce arb(3), the Array-based Red-Black Tree macros: similar · fad4b12b
      Edward Tomasz Napierala authored
      to the traditional tree(3) RB trees, but using an array (preallocated,
      linear chunk of memory) to store the tree.
      
      This avoids allocation overhead, improves memory locality,
      and makes it trivially easy to share/transfer/copy the entire tree
      without the need for marshalling.  The downside is that the size
      is fixed at initialization time; there is no mechanism to resize
      it.
      
      This is one of the dependencies for the new stats(3) framework
      (https://reviews.freebsd.org/D20477).
      
      Reviewed by:	bcr (man pages), markj
      Discussed with:	cem
      MFC after:	2 weeks
      Sponsored by:	Klara Inc, Netflix
      Obtained from:	Netflix
      Differential Revision:	https://reviews.freebsd.org/D20324
      fad4b12b
  4. 27 Aug, 2019 1 commit
  5. 10 May, 2019 1 commit
  6. 04 May, 2016 2 commits
    • Enji Cooper's avatar
      Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed · 430f7286
      Enji Cooper authored
      after r298107
      
      Summary of changes:
      
      - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
        namespacing is kept with FILES appropriately, and that this shouldn't need
        to be repeated if the namespace changes -- only the definition of PACKAGE
        needs to be changed
      - Allow PACKAGE to be overridden by callers instead of forcing it to always be
        `tests`. In the event we get to the point where things can be split up
        enough in the base system, it would make more sense to group the tests
        with the blocks they're a part of, e.g. byacc with byacc-tests, etc
      - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
        previously.
      - Remove unnecessary TESTSPACKAGE definitions; this has been elided into
        bsd.tests.mk
      - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
        ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
      - Fix installation of files under data/ subdirectories in lib/libc/tests/hash
        and lib/libc/tests/net/getaddrinfo
      - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)
      
      Document the proposed changes in share/examples/tests/tests/... via examples
      so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
      replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
      of communicating that info.
      
      MFC after: never probably
      X-MFC with: r298107
      PR: 209114
      Relnotes: yes
      Tested with: buildworld, installworld, checkworld; buildworld, packageworld
      Sponsored by: EMC / Isilon Storage Division
      430f7286
    • Alan Somers's avatar
      Improve performance and functionality of the bitstring(3) api · 8907f744
      Alan Somers authored
      Two new functions are provided, bit_ffs_at() and bit_ffc_at(), which allow
      for efficient searching of set or cleared bits starting from any bit offset
      within the bit string.
      
      Performance is improved by operating on longs instead of bytes and using
      ffsl() for searches within a long. ffsl() is a compiler builtin in both
      clang and gcc for most architectures, converting what was a brute force
      while loop search into a couple of instructions.
      
      All of the bitstring(3) API continues to be contained in the header file.
      Some of the functions are large enough that perhaps they should be uninlined
      and moved to a library, but that is beyond the scope of this commit.
      
      sys/sys/bitstring.h:
              Convert the majority of the existing bit string implementation from
              macros to inline functions.
      
              Properly protect the implementation from inadvertant macro expansion
              when included in a user's program by prefixing all private
              macros/functions and local variables with '_'.
      
              Add bit_ffs_at() and bit_ffc_at(). Implement bit_ffs() and
              bit_ffc() in terms of their "at" counterparts.
      
              Provide a kernel implementation of bit_alloc(), making the full API
              usable in the kernel.
      
              Improve code documenation.
      
      share/man/man3/bitstring.3:
              Add pre-exisiting API bit_ffc() to the synopsis.
      
              Document new APIs.
      
              Document the initialization state of the bit strings
              allocated/declared by bit_alloc() and bit_decl().
      
              Correct documentation for bitstr_size(). The original code comments
              indicate the size is in bytes, not "elements of bitstr_t". The new
              implementation follows this lead. Only hastd assumed "elements"
              rather than bytes and it has been corrected.
      
      etc/mtree/BSD.tests.dist:
      tests/sys/Makefile:
      tests/sys/sys/Makefile:
      tests/sys/sys/bitstring.c:
              Add tests for all existing and new functionality.
      
      include/bitstring.h
      	Include all headers needed by sys/bitstring.h
      
      lib/libbluetooth/bluetooth.h:
      usr.sbin/bluetooth/hccontrol/le.c:
              Include bitstring.h instead of sys/bitstring.h.
      
      sbin/hastd/activemap.c:
              Correct usage of bitstr_size().
      
      sys/dev/xen/blkback/blkback.c
              Use new bit_alloc.
      
      sys/kern/subr_unit.c:
              Remove hard-coded assumption that sizeof(bitstr_t) is 1.  Get rid of
              unrb.busy, which caches the number of bits set in unrb.map.  When
              INVARIANTS are disabled, nothing needs to know that information.
              callapse_unr can be adapted to use bit_ffs and bit_ffc instead.
              Eliminating unrb.busy saves memory, simplifies the code, and
              provides a slight speedup when INVARIANTS are disabled.
      
      sys/net/flowtable.c:
              Use the new kernel implementation of bit-alloc, instead of hacking
              the old libc-dependent macro.
      
      sys/sys/param.h
              Update __FreeBSD_version to indicate availability of new API
      
      Submitted by:   gibbs, asomers
      Reviewed by:    gibbs, ngie
      MFC after:      4 weeks
      Sponsored by:   Spectra Logic Corp
      Differential Revision:  https://reviews.freebsd.org/D6004
      8907f744
  7. 02 Feb, 2016 1 commit
  8. 18 Oct, 2015 1 commit
  9. 12 Oct, 2015 1 commit
  10. 09 Oct, 2014 1 commit