Commit Graph

22 Commits

Author SHA1 Message Date
Ed Schouten
d3ce832719 Remove unit2minor() use from kernel code.
When I changed kern_conf.c three months ago I made device unit numbers
equal to (unneeded) device minor numbers. We used to require
bitshifting, because there were eight bits in the middle that were
reserved for a device major number. Not very long after I turned
dev2unit(), minor(), unit2minor() and minor2unit() into macro's.
The unit2minor() and minor2unit() macro's were no-ops.

We'd better not remove these four macro's from the kernel, because there
is a lot of (external) code that may still depend on them. For now it's
harmless to remove all invocations of unit2minor() and minor2unit().

Reviewed by:	kib
2008-09-26 14:19:52 +00:00
Dag-Erling Smørgrav
2616144e43 Add sbuf_new_auto as a shortcut for the very common case of creating a
completely dynamic sbuf.

Obtained from:	Varnish
MFC after:	2 weeks
2008-08-09 11:14:05 +00:00
Ed Schouten
06d425f92e Remove the distinction between device minor and unit numbers.
Even though we got rid of device major numbers some time ago, device
drivers still need to provide unique device minor numbers to make_dev().
These numbers are only used inside the kernel. They are not related to
device major and minor numbers which are visible in devfs. These are
actually based on the inode number of the device.

It would eventually be nice to remove minor numbers entirely, but we
don't want to be too agressive here.

Because the 8-15 bits of the device number field (si_drv0) are still
reserved for the major number, there is no 1:1 mapping of the device
minor and unit numbers. Because this is now unused, remove the
restrictions on these numbers.

The MAXMAJOR definition was actually used for two purposes. It was used
to convert both the userspace and kernelspace device numbers to their
major/minor pair, which is why it is now named UMINORMASK.

minor2unit() and unit2minor() have now become useless. Both minor() and
dev2unit() now serve the same purpose. We should eventually remove some
of them, at least turning them into macro's. If devfs would become
completely minor number unaware, we could consider using si_drv0 directly,
just like si_drv1 and si_drv2.

Approved by:	philip (mentor)
2008-05-29 12:50:46 +00:00
Poul-Henning Kamp
ea60845d09 Make it possible to specify an initial state for the LED.
Requested by:	Henrik Brix Andersen <henrik@brixandersen.dk>
PR:	112008
2007-04-23 12:42:15 +00:00
Poul-Henning Kamp
3b3f38ed7d Add placeholder mutex argument to new_unrhdr(). 2005-03-07 11:05:47 +00:00
Poul-Henning Kamp
c711aea6ca Make a bunch of malloc types static.
Found by:	src/tools/tools/kernxref
2005-02-10 12:02:37 +00:00
Poul-Henning Kamp
b0a5fd8e7a Better locking.
Add 'u' and 'U' "wait for next UTC second" in sequence mode.
2005-01-29 16:33:51 +00:00
Poul-Henning Kamp
72118ea9fd Remove a pointless check. 2004-07-10 15:38:27 +00:00
Poul-Henning Kamp
f3732fd15b Second half of the dev_t cleanup.
The big lines are:
	NODEV -> NULL
	NOUDEV -> NODEV
	udev_t -> dev_t
	udev2dev() -> findcdev()

Various minor adjustments including handling of userland access to kernel
space struct cdev etc.
2004-06-17 17:16:53 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Maxime Henrion
c5c09c282b - Remove the __FBSDID and put the $FreeBSD$ tag in the comment above,
so that including this file more than once works.
- Fix some style bugs while I'm here.
2004-05-10 11:50:21 +00:00
Poul-Henning Kamp
675d58e870 Fix off by one error. 2004-05-03 11:41:25 +00:00
Poul-Henning Kamp
71f3747e71 Add the ability to avoid repetition of s.... sequences with a '.' 2004-04-27 13:09:21 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Poul-Henning Kamp
d60d18d491 Use standard style for cdevsw initialization. 2004-02-14 20:03:36 +00:00
Poul-Henning Kamp
8a1a55ec29 DUH!
Write 100 times for tomorrow:
	I will never again free(9) a modified pointer.

Pointy Hat:	yeah, yeah, yeah, can you just put it in the pile over there...
2003-12-12 12:17:28 +00:00
Don Lewis
b01a62069f Correct usage of mtx_init() API. This is not a functional change since
the code happened to work because MTX_DEF and NULL are both defined as 0.

Reviewed by:    phk
2003-12-07 23:21:22 +00:00
Poul-Henning Kamp
9491306ad3 Improve semantics of the 'sequence' command to led(4) devices:
use lowercase for off and upper case for on.

Approved by:	re@
2003-11-27 20:23:32 +00:00
Poul-Henning Kamp
7e31c3b7ea Avoid NULL pointer dereference.
Approved by:	re@
2003-11-23 10:22:51 +00:00
Poul-Henning Kamp
899ca00e7d Fix prototypo 2003-11-03 15:58:58 +00:00
Poul-Henning Kamp
8d334233d2 Get word spacing right in morse mode.
Fix a prototype.
2003-11-03 15:45:42 +00:00
Poul-Henning Kamp
c46def32e2 Add a generic LED driver for flashing lamps.
The hardware driver decides the name under /dev/led and provides
the function to turn the lamp on/off.

All leds are serviced by a single timeout which runs at a basic rate
of hz/10.

The LED is controlled by ascii strings as follows.

0	Turn off.
1	Turn on.
f	Flash: _-
f2	Flash: __--
f3	Flash: ___---
f4...f9 etc.
d%d	Digits.  "d12": -__________-_-______________________________
s%s	String, roll your own:
	'a-j' gives on for (1...10)/10 sec.
	'A-J' gives on for (1...10)/10 sec.
	'sAaAbBa': _-_--__-
m%s	Morse
	'.' dot
	'-' dash
	' ' letter space
	'\n' word space

My mdoc skills do not reach to express that.
2003-11-03 09:47:30 +00:00