Commit Graph

360 Commits

Author SHA1 Message Date
andvar ee56ea231b fix various typos in comments. 2022-01-25 22:01:34 +00:00
riastradh 6e2481d7c4 ieee1394: Need kernel lock around config_found. 2021-12-20 19:56:42 +00:00
msaitoh b237bd2922 s/transcat/transact/ in comment. 2021-12-05 08:17:21 +00:00
msaitoh 6ecef65d01 availabe -> available in comment. 2021-12-05 02:21:08 +00:00
msaitoh 94f62ba6c0 s/avaliable/available/ 2021-11-10 16:08:17 +00:00
andvar 3940c5da3c follow fcambus steps by fixing typos for "unknown" in few more error messages. 2021-10-04 20:48:05 +00:00
andvar 8324be4c9b fix some more typos in comments/log messages, improve wording as well. 2021-08-21 11:55:24 +00:00
andvar 16e91b5f21 s/helt/held+s/eroneously/erroneously/+s/splitted/split/+s/recommented/recommended/ 2021-08-21 09:59:45 +00:00
thorpej c7fb772b85 Merge thorpej-cfargs2. 2021-08-07 16:18:40 +00:00
andvar 7991f5a7b8 Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
2021-07-24 21:31:31 +00:00
thorpej 2685996b0e Merge thorpej-cfargs branch:
Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
  actually needed.
- Don't be explicit about what interface attribute is attaching if
  the device only has one.  (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
  situations, making is visibly easier to see when indirect config is
  in play, and allowing for future change in semantics.  (As of now,
  this is just a wrapper around config_match(), but that is an
  implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance.  This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
2021-04-24 23:36:23 +00:00
mrg af083385c6 convert union member from [0] array to [3] array, so that attempts
to access these members later will  work.

does not affect size of the structure or layout in any other way.
2021-04-12 09:22:21 +00:00
thorpej 72f872d2b2 Adopt <net/if_stats.h>. 2020-01-29 06:17:07 +00:00
chs d47bcd296c in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
2019-11-10 21:16:21 +00:00
joerg 213b3c28ff Fix operand priority of bit op vs ternary operator. 2019-10-28 18:38:43 +00:00
msaitoh e86a0551d8 Use unsigned to avoid undefined behavior. Found by kUBSan. 2019-10-15 18:20:44 +00:00
maxv c07e170550 Remove unused assignment. Found by the lgtm bot. 2019-09-23 06:53:09 +00:00
msaitoh 39c3181ae1 s/recieve/receive/ 2019-05-28 08:59:33 +00:00
jakllsch 83286ae20c Fix fwdma_free() for when bus_dmamap_unload() clobbers the dmamap.
Prevents KASSERTs on detaches of sbp(4) and fwohci(4) on amd64.

We should pass the dmamem segs around seperately, not in loaded dmamap...
2018-12-13 16:38:26 +00:00
maxv 5c98710094 Remove the 't' argument from m_tag_find(). 2018-11-15 10:23:55 +00:00
riastradh d1579b2d70 Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)
2018-09-03 16:29:22 +00:00
sevan 82043fb060 Listed UniNorth device is in fact the UniNorth 2 interface, rename.
https://pci-ids.ucw.cz/read/PC/106b/0031
2018-03-31 14:50:45 +00:00
maxv b76f52ce46 memory leak, found by Mootja; it seems that we should check the return
value of 'fw_bindadd' in several other places, but whatever
2017-06-25 12:39:27 +00:00
riastradh fa99ca920a Let's try initializing the pointers *before* dereferencing them!
Oops.
2016-11-21 01:19:35 +00:00
riastradh ed4a54337c KASSERT(mutex_owner(...)) ---> KASSERT(mutex_owned(...))
If this is not correct, then there's something bogus in this code
anyway, so better to fail early.

Final part of PR kern/47114.
2016-11-20 22:56:13 +00:00
riastradh 1ebf7dd190 Kill some more tsleep.
And no, surrounding tsleep by mutex_exit/mutex_enter does not fix
problems even if the LOCKDEBUG panic symptom goes away...
2016-11-20 22:47:39 +00:00
riastradh da248a6bc3 Defer initialization of isodma channels until we know how many.
Should fix a bug I introduced four years ago in:
https://mail-index.netbsd.org/source-changes/2012/08/04/msg036211.html
2016-11-20 22:36:45 +00:00
ozaki-r d938d837b3 Introduce m_set_rcvif and m_reset_rcvif
The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
2016-06-10 13:27:10 +00:00
joerg c1bb8c29b0 No reason not to make the string const. 2014-11-21 23:37:25 +00:00
snj f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
christos 32693e8fdf ran sed too agressively. 2014-09-21 18:03:47 +00:00
christos 4afc391a9b fix cut-n-paste, use arrays instead of separate variables to avoid code
duplication.
2014-09-21 17:10:00 +00:00
dholland f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland 8c70ef39af Add d_discard to all struct bdevsw instances I could find.
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
2014-07-25 08:02:18 +00:00
htodd e4ef43c25c Fix build. 2014-03-28 04:09:19 +00:00
christos e85af085ed Deal with snprintf more gracefully. 2014-03-28 02:16:47 +00:00
dholland a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
pooka 4f6fb3bf35 Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
2014-02-25 18:30:08 +00:00
christos 5db9fd6992 add missing ifdefs 2013-10-16 17:40:55 +00:00
christos 11beb626a3 Pass the device name in, so we can debug what deferred drivers did not work. 2013-10-12 16:49:00 +00:00
martin fc72d19c3b Remove unused variables 2013-09-15 13:52:23 +00:00
martin 444987700c Make it compilable with gcc 4.8.1 2013-09-12 20:16:51 +00:00
kiyohara d00b1fbba5 Add '\n' to tail of printing string. 2013-04-07 07:42:20 +00:00
riastradh d237c30a6a ...and be sure to config_pending_decr if kthread_create fails.
This error branch looks suspect, though.  Shouldn't we bail at this
point rather than blithely try to proceed?
2012-08-05 02:47:52 +00:00
riastradh 17be18e233 Restore config pending stuff, adjusted to avoid the race.
Leave a note about what this code probably should look like for
anyone who comes rummaging around with the intent to really fix it.
I would do that myself if I had time and resources to test this at
the moment, and more comfort with our firewire stack, but I don't.
2012-08-05 02:36:16 +00:00
riastradh 934b1cc688 Fix error branches and config pending races in firewire init.
This way, if anything fails, it just fails; you don't panic.  This can
happen if suspending and resuming of firewire is broken (e.g., as I
encountered in PR kern/44581).
2012-08-04 03:55:43 +00:00
dsl e05eb71de5 Remove everything to do with 'struct malloc_type' and the malloc link_set.
To make code in 'external' (etc) still compile, MALLOC_DECLARE() still
  has to generate something of type 'struct malloc_type *', with
  normal optimisation gcc generates a compile-time 0.
MALLOC_DEFINE() and friends have no effect.
Fix one or two places where the code would no longer compile.
2012-04-29 20:27:31 +00:00
dsl fc04895e7b Change to consistently use M_FW for all malloc/free.
It probably doesn't matter any more, but the code doesn't appear to
have matched its mallocs and frees - so the stats would have been awol.
2012-04-29 18:31:40 +00:00
uebayasi c8c01f2329 Put back #include "ioconf.h" per popular demand. 2011-07-31 13:51:53 +00:00
uebayasi 3f383b9dd4 Declare cfdrivers using extern rather than including ioconf.h. 2011-05-25 16:33:37 +00:00