Commit Graph

204 Commits

Author SHA1 Message Date
Poul-Henning Kamp
0cc3011d52 Implement the "kern.disks" sysctl in GEOM.
This makes "mdconfig -l" work again.

Sponsored by:	DARPA & NAI Labs.
2002-10-04 10:15:26 +00:00
Poul-Henning Kamp
8be2bc5c6f Properly conditionalize a debugging printf.
Sponsored by:	DARPA & NAI Labs.
2002-10-04 10:06:19 +00:00
Poul-Henning Kamp
29c211954b Move GEOM's sysctls under kern.geom.
Sponsored by:	DARPA & NAI Labs.
2002-10-02 07:51:02 +00:00
Poul-Henning Kamp
a4319fd03d Put some failing ioctl related printfs under a suitable debug flag.
Sponsored by:	DARPA & NAI Labs.
2002-10-02 07:48:39 +00:00
Poul-Henning Kamp
0a2ece0481 Use the canonical root:operator 0640 for GEOM disk devices.
Spotted by:	brooks
Sponsored by:	DARPA & NAI Labs.
2002-10-01 19:33:09 +00:00
Poul-Henning Kamp
2fcf0b5c37 Don't restrict device drivers ability to sleep in the ioctl method, this
is actually entirely legal.

Do bio's with ioctls in them in a g_call_me() function.

Sponsored by:	DARPA & NAI Labs
2002-10-01 18:42:32 +00:00
Poul-Henning Kamp
e9a848359b Include <sys/diskmbr.h> instead of <sys/disklabel.h>
Sponsored by:	DARPA & NAI Labs.
2002-10-01 14:05:06 +00:00
Poul-Henning Kamp
3a24c28f37 Don the asbestos underwear and add the code which lets DIOCWDINFO
write modified disklabels back to disk.

Sponsored by:	DARPA & NAI Labs.
2002-09-30 08:59:59 +00:00
Poul-Henning Kamp
72840432e0 Retire g_io_fail() and let g_io_deliver() take an error argument instead.
Sponsored by:	DARPA & NAI Labs.
2002-09-30 08:54:46 +00:00
Poul-Henning Kamp
90b1cd5615 Introduce g_write_data() function.
Sponsored by:	DARPA & NAI Labs
2002-09-30 08:50:47 +00:00
Poul-Henning Kamp
5b3317e9e6 Add missing g_enc_le2().
Sponsored by:	DARPA & NAI Labs.
2002-09-30 08:47:46 +00:00
Poul-Henning Kamp
5dcf28b202 Disable the g_sanity() check unless people ask for it in the debugflags.
Sponsored by:	DARPA & NAI Labs.
2002-09-30 08:46:29 +00:00
Poul-Henning Kamp
cd4f50fbb8 Make sure we don't loose our topology lock in a call_me() handler.
Sponsored by:	DARPA & NAI Labs.
2002-09-30 08:27:29 +00:00
Poul-Henning Kamp
079a527a3d Zero the local-variable mutexes before we call mtx_init() on them,
failing to do this may lead mtx_init() to belive they have already
been initialized.

Detected by:	Marc Recht <marc@informatik.uni-bremen.de>
2002-09-28 19:38:29 +00:00
Poul-Henning Kamp
4ae677009e Style, whitespace and lint fixes.
Sponsored by:	DARPA & NAI Labs.
2002-09-28 11:57:20 +00:00
Poul-Henning Kamp
eadf0ffdce Void functions cannot use return(foo) even if foo is also returning void.
Sponsored by:	DARPA & NAI Labs.
2002-09-28 11:43:20 +00:00
Poul-Henning Kamp
852f392456 First confirmed kill from my Flexelint license: Check return value
of g_clone_bio().

Detected by:	http://www.gimpel.com/html/flex.htm
Sponsored by:	DARPA & NAI Labs.
2002-09-28 08:16:50 +00:00
Poul-Henning Kamp
3d3816e633 Extensively rework the geom_bsd method, put a lot of comments in, betting
that this will make people use this for their future copy&paste operations.

Rework the detection of raw-disk offsets in disklabels.  This actually
unearthed a number of bugs in the (now) previous version.

Also accept labels which don't have a magic RAW_PART, provided they don't
confuse us too much.

Change the order of our sanity-checks on labels found on disks to be more
robust.

Check against MAXPARTITIONS in our sanity-check and reject disklabels
we cannot cope with.

Create new g_bsd_modify() function to implment disklabel modifying
ioctls.

Implement DIOCSDINFO and DIOCWDINFO with the provision that the latter
still not writes your change back to disk.  I didn't have the nerves
for that yet.

In the start routine, use g_call_me() for complex ioctls to prevent
sleeping.

Sponsored by:   DARPA & NAI Labs.
2002-09-27 21:54:37 +00:00
Poul-Henning Kamp
5a6baf5457 Add the new g_slice_config() call, which can add/delete/change a slice,
with support for trying, doing and forcing.

This will eventually replace g_slice_addslice() which gets changed from
grabbing topology to requing it in this commit as well.

Sponsored by:   DARPA & NAI Labs.
2002-09-27 21:37:11 +00:00
Poul-Henning Kamp
b1937dd1ca Make the UP/DOWN threads hold on to their own private mutex while doing
work.

This prevents people from sleeping in the UP/DOWN I/O path by mistake
or design (doing so almost invariably result in deadlocks since it
stalls all I/O processing in the given direction.

Sponsored by:   DARPA & NAI Labs.
2002-09-27 21:24:40 +00:00
Poul-Henning Kamp
8ac8480b86 Correctly en/decode MAXPARTITIONS partitions.
Sponsored by:	DARPA & NAI Labs.
2002-09-27 21:19:47 +00:00
Poul-Henning Kamp
d4c4a6f165 Setattr should not retry on EBUSY, we could get EBUSY back because
a disklabel modification tries to change an open device, and no
counter-examples exists.

Be less facist about when we can do Setattr, the openmodes of devices
are so loosely managed that the "exclusive" count is almost useless.

Sponsored by:   DARPA & NAI Labs.
2002-09-27 21:12:47 +00:00
Poul-Henning Kamp
9169e8004d Various no-ops:
Add a __unused.

Make the 2byte decoder functions return 16 bits for the benefits
of picky lints.

No need to grab giant around a tsleep() when we have a timeout.

Sponsored by:	DARPA & NAI Labs.
2002-09-27 21:05:05 +00:00
Poul-Henning Kamp
f3bbbfe2df Correctly calculate size of PC98 slices.
Sponsored by:	DARPA & NAI Labs.
2002-09-27 20:56:21 +00:00
Poul-Henning Kamp
a1bd3ee20c Allocate bio's with M_NOWAIT and let the caller deal with the problems.
Sponsored by:	DARPA & NAI Labs.
2002-09-27 20:53:47 +00:00
Poul-Henning Kamp
beece77a2d Add checks for g_clone_bio() returning NULL, it will be possible RSN.
Sponsored by:	DARPA & NAI Labs.
2002-09-27 20:47:23 +00:00
Poul-Henning Kamp
346cd5fe2d Implement g_call_me() as a way for geom methods to schedule operations
to be performed in the event-thread.

To do this, we need to lock the eventlist with g_eventlock (nee g_doorlock),
since g_call_me() being called from the UP/DOWN paths will not be able to
aquire g_topology_lock.

This also means that for now these events are not referenced on any
particular consumer/provider/geom.

For UP/DOWN path use, this will not become a problem since the access()
function will make sure we drain any bio's before we dismantle.

Sponsored by:   DARPA & NAI Labs.
2002-09-27 20:38:36 +00:00
Poul-Henning Kamp
e615b0fd93 Ok, include also the two tests which actually does effect the claims
of the last commit message.

Sponsored by:	DARPA & NAI Labs.
2002-09-27 20:30:27 +00:00
Poul-Henning Kamp
ed0ff8e52d Hook into the shutdown EVENTHANDLER and stop tasting things after we
get notified to make things settle a bit faster.

Sponsored by:	DARPA & NAI Labs.
2002-09-27 20:23:35 +00:00
Poul-Henning Kamp
903e43fe66 Rename the doorlock to eventlock, it gets to protect a bit more in the future.
Sponsored by:	DARPA & NAI Labs.
2002-09-27 20:18:16 +00:00
Jeff Roberson
37ab0e0d81 - Use vrefcnt() instead of v_usecount. 2002-09-25 02:42:43 +00:00
Poul-Henning Kamp
7812d86f03 (This commit touches about 15 disk device drivers in a very consistent
and predictable way, and I apologize if I have gotten it wrong anywhere,
getting prior review on a patch like this is not feasible, considering
the number of people involved and hardware availability etc.)

If struct disklabel is the messenger: kill the messenger.

Inside struct disk we had a struct disklabel which disk drivers used to
communicate certain metrics to the disklayer above (GEOM or the disk
mini-layer).  This commit changes this communication to use four
explicit fields instead.

Amongst the benefits is that the fields do not get overwritten by
wrong or bogus on-disk disklabels.

Once that is clear, <sys/disk.h> which is included in the drivers
no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in,
the few places that needs them, have gotten explicit #includes for
them.

The disklabel inside struct disk is now only for internal use in
the disk mini-layer, so instead of embedding it, we malloc it as
we need it.

This concludes (modulus any mistakes) the series of disklabel related
commits.

I belive it all amounts to a NOP for all the rest of you :-)

Sponsored by:   DARPA & NAI Labs.
2002-09-20 19:36:05 +00:00
Poul-Henning Kamp
af820f158f Remove unneeded #include <sys/disklabel.h>
Sponsored by:	DARPA & NAI Labs.
2002-09-20 17:00:24 +00:00
Poul-Henning Kamp
46714777f5 Retire now unused DIOCGDVIRGIN kludge.
Sponsored by:	DARPA & NAI Labs.
2002-09-20 09:31:14 +00:00
Poul-Henning Kamp
c51f3753df "Fix" printf format issues by using %j
Sponsored by:	DARPA & NAI Labs.
2002-09-13 11:41:25 +00:00
Poul-Henning Kamp
53706245bb Use biowait() rather than DIY.
Sponsored by:	DARPA & NAI Labs
2002-09-13 11:39:11 +00:00
Poul-Henning Kamp
85b62edb84 Add a couple more of the big/little-endian conversion routines and make
them visible from userland, if need be.

I wish that the C language contained this as part of struct definintions,
but failing that, I would settle for an agreed upon set of functions for
packing/unpacking integers in various sizes from byte-streams which may
have unfriendly alignment.

This really belongs in <sys/endian.h> I guess.
2002-09-13 10:33:10 +00:00
Maxime Henrion
2dfbcdd46d Fix another two printf() format errors which weren't warned
about because the bio_blknos were bogusly casted to long long.
2002-09-13 09:37:44 +00:00
Maxime Henrion
92faa7b50f Fix another printf() format error which wasn't warned about
because the bio_blkno was bogusly casted to an int.
2002-09-13 09:19:55 +00:00
Maxime Henrion
f368af933d Fix a printf() format error on 64 bits architectures.
Also fix some style bugs on the same line.
2002-09-13 09:16:06 +00:00
Poul-Henning Kamp
fbbdde85f8 Deal with a new exteded MBR paritition type
Submitted by:	Michal Mertl <mime@traveller.cz>
2002-09-08 15:13:33 +00:00
Poul-Henning Kamp
4fbd12689a Remove "magicspace". It looks good on paper, it doesn't work in practice.
Sponsored by: DARPA & NAI Labs.
2002-09-06 08:50:28 +00:00
Poul-Henning Kamp
02945fefb7 Don't respect the O_EXCL flag, we don't get it back on close so we cannot
correctly track it.

Spotted by:	peter
Sponsored by:	DARPA & NAI Labs.
2002-09-06 07:57:29 +00:00
Marcel Moolenaar
c2926e2329 Use 'p' as the partition specifier instead of 's'. We continue to use
's' for compatibility partitions (ie partitions with a BSD disklabel).
Partition numbers continue to start with 1.
Example /etc/fstab:
	# Device        Mountpoint      FStype          Options	...
	/dev/da0p1      /efi            msdos           rw	...
	/dev/da0p2      /               ufs             rw	...
	/dev/da0p3      none            swap            sw	...
2002-08-24 22:42:16 +00:00
Julian Elischer
f04af82768 Don't use the static thread.. it is going away. 2002-06-29 07:47:20 +00:00
Poul-Henning Kamp
77f6a083fc Add two new submodes to the AES encryption method.
This method is now suitable for encrypting swap spaces.

Sponsored by:	DARPA & NAI Labs.
2002-06-28 21:25:15 +00:00
Poul-Henning Kamp
11b2dcdbbe Put geom_gpt.c under the GEOM option instead of having a special GEOM_GPT
option for it.
2002-06-10 18:49:41 +00:00
Poul-Henning Kamp
503abe4540 Improve some on the naming.
Submitted by:	iedowse
2002-06-09 10:57:34 +00:00
Poul-Henning Kamp
678735da39 Change the registration of magic spaces so it does its own memory management.
Sponsored by: DARPA & NAI Labs.
2002-06-05 20:30:36 +00:00
Marcel Moolenaar
fd8706be29 Add compile time asserts for the size of struct gpt_hdr and struct
gpt_ent. Use offsetof() for struct gpt_hdr to exclude padding.
2002-05-30 06:33:07 +00:00