Skip to content

Commit

Permalink
Misc fixes captured on NetBSD. (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmind committed May 28, 2020
1 parent c9c94a1 commit 749ce43
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
branches:
only: master

language: c

compiler:
Expand Down
12 changes: 6 additions & 6 deletions src/kern/npf_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@
/*
* NPF configuration loading mechanism.
*
* The main operations on the configuration are:
* The main operations on the configuration are the following:
* 1) Read access, primarily from the npf_packet_handler() function.
* 2) Write access on particular set, mainly rule or table updates.
* 2) Write access on a particular set, mainly rule or table updates.
* 3) Deletion of the configuration after the reload operation.
*
* Synchronization
*
* For (1) case, EBR is used to allow concurrent access to the
* configuration set (ruleset, etc). It guarantees that the
* For the (1) case, EBR is used to allow concurrent access to
* the configuration set (ruleset, etc). It guarantees that the
* configuration will not be destroyed while accessing it.
*
* Writers, i.e. cases (2) and (3) use mutual exclusion and when
* necessary the writer-side barrier of the EBR.
* For the cases (2) and (3), mutual exclusion (npf_t::config_lock)
* is used with, when necessarya, the writer-side barrier of EBR.
*/

#ifdef _KERNEL
Expand Down
2 changes: 1 addition & 1 deletion src/kern/npf_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ npf_init(void)
error = npfk_sysinit(nworkers);
if (error)
return error;
npf = npfk_create(0, NULL, &kern_ifops);
npf = npfk_create(0, NULL, &kern_ifops, NULL);
npf_setkernctx(npf);
npf_pfil_register(true);

Expand Down
2 changes: 1 addition & 1 deletion src/npfctl/npf_show.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ scan_marks(npf_conf_info_t *ctx, const struct mark_keyword_mapent *mk,
* otherwise we just need to note the mark.
*/
ctx->curmark = m;
CTASSERT(BM_COUNT < (sizeof(uint64_t) * CHAR_BIT));
assert(BM_COUNT < (sizeof(uint64_t) * CHAR_BIT));
ctx->seen_marks = UINT64_C(1) << m;
assert(mk->fwords == nwords);

Expand Down
2 changes: 1 addition & 1 deletion src/npfctl/npf_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ npfvar_get_data(const npfvar_t *vp, unsigned type, size_t idx)
if (el && NPFVAR_TYPE(el->e_type) != NPFVAR_TYPE(type)) {
yyerror("variable '%s' element %zu "
"is of type '%s' rather than '%s'", vp->v_key,
npfvar_type(el->e_type), npfvar_type(type));
idx, npfvar_type(el->e_type), npfvar_type(type));
return NULL;
}
return el->e_data;
Expand Down
3 changes: 2 additions & 1 deletion src/npftest/libnpftest/npf_gc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#ifdef _KERNEL
#include <sys/types.h>
#include <sys/kmem.h>
#endif

#include "npf.h"
Expand Down Expand Up @@ -232,7 +233,7 @@ run_worker_tests(npf_t *npf)
npf_worker_signal(test_npf);

npf_ebr_destroy(test_npf->ebr);
free(test_npf); // npfk_destroy()
kmem_free(test_npf, sizeof(npf_t)); // npfk_destroy()
}

/*
Expand Down

0 comments on commit 749ce43

Please sign in to comment.