Commit Graph

160 Commits

Author SHA1 Message Date
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
Poul-Henning Kamp
f4258597dc Add one copy of crc32() and crc32_tab[] in libkern, and remove it two other
places.

Comment out crc32 related definitions in zlib.h, we don't seem to have the
corresponding code in our kernel.
2002-05-29 20:24:09 +00:00
Marcel Moolenaar
bcd46c600a Add support to GEOM for GUID Partition Tables (GPTs). The support
is currently conditional on both the GEOM and GEOM_GPT options to
avoid getting GPT by default and having the MBR and GPT classes
clash.
The correct behaviour of the MBR class would be to back-off (reject)
a MBR if it's a Protective MBR (a MBR with a single partition of type
0xEE that spans the whole disk (as far as the MBR is concerned).
The correct behaviour if the GPT class would be to back-off (reject)
a GPT if there's a MBR that's not a Protective MBR.

At this stage it's inconvenient to destroy a good MBR when working
with GPTs that it's more convenient to have the MBR class back-off
when it detects the GPT signature on disk and have the GPT class
ignore the MBR.

In sys/gpt.h UUIDs (GUIDs) for the following FreeBSD partitions
have been defined:

GPT_ENT_TYPE_FREEBSD
	FreeBSD slice with disklabel. This is the equivalent of
	the well-known FreeBSD MBR partition type.
GPT_ENT_TYPE_FREEBSD_{SWAP|UFS|UFS2|VINUM}
	FreeBSD partitions in the context of disklabel. This is
	speculating on the idea to use the GPT to hold partitions
	instead if slices and removing the fixed (and low) limits
	we have on the number of partitions.

This commit lacks a GPT image for the regression suite.
2002-05-28 09:04:48 +00:00
Poul-Henning Kamp
291daf5735 Add a proof-of-concept encryption class.
"The only hard problem in cryptography is key-management."

All sectors are encrypted with AES in CBC mode using a constant key,
currently compiled in and all zero.

To activate this module, write the magic header on the partition:

	echo "<<FreeBSD-GEOM-AES>>" | dd conv=sync of=/dev/md98

The encrypted device will be one sector shorter and have ".aes"
appended to its name.

Sponsored by: DARPA & NAI Labs.
2002-05-26 18:14:38 +00:00
Poul-Henning Kamp
d4116af4f9 Give the closet-dev_t we hand to the diskdrivers a name. 2002-05-26 17:35:14 +00:00
Poul-Henning Kamp
855f8b26f2 Only clear the spoiled flag if the class had no spoiled method, the spoiled
method may have deallocated the consumer already and modifying free()'ed
memory is bad style.

Sponsored by: DARPA & NAI Labs.
2002-05-26 17:17:25 +00:00
Bruce Evans
ff8cc2eb35 Fixed printf format errors. Most of them are 64-bit daddr_t casualties.
Printing daddr_t's using %d format was always an error, but gcc's
warning about it was ignored for supported 64-bit arches and not printed
for supported 32-bit arches.  Hundreds if not thousands thousands of
previously "fixed" daddr_t printings are now broken on 32-bit machines
by casting daddr_t's to longs.  daddr_t's should be printed using %jd
format, but this fix uses %lld since %j is not implemented in the
kernel yet.

Fixed some nearby format printf errors (style bugs).
2002-05-25 11:05:07 +00:00
Poul-Henning Kamp
07107de9bc Introduce the concept of "magic spaces", and implement them in most of
the relevant classes.

Some methods may implement various "magic spaces", this is reserved
or magic areas on the disk, set a side for various and sundry purposes.
A good example is the BSD disklabel and boot code on i386 which occupies
a total of four magic spaces: boot1, the disklabel, the padding behind
the disklabel and boot2.  The reason we don't simply tell people to
write the appropriate stuff on the underlying device is that (some of)
the magic spaces might be real-time modifiable.  It is for instance
possible to change a disklabel while partitions are open, provided
the open partitions do not get trampled in the process.

Sponsored by:	DARPA & NAI Labs.
2002-05-21 20:33:49 +00:00
Poul-Henning Kamp
3abe4a80a5 Remove the "-class" suffix from classes, they will not be ambiguous.
Sponsored by:	DARPA & NAI Labs.
2002-05-21 19:50:04 +00:00
Poul-Henning Kamp
4b8374a778 Don't grab Giant around malloc(9) and free(9).
Don't grab Giant around wakeup(9).
Don't print verbose messages about each device found in geom_dev.
Various cleanups.

Sponsored by: DARPA & NAI Labs.
2002-05-20 10:03:15 +00:00
Poul-Henning Kamp
32768501bb Generalize a bit: we don't need separate functions to find the i386 and
alpha disklabels, just one function which is told where to look.

Sponsored by: DARPA & NAI Labs.
2002-05-19 19:00:25 +00:00
Poul-Henning Kamp
faefe44cff Include needed #include for regression tests.
Sponsored by: DARPA & NAI Labs.
2002-05-19 18:59:39 +00:00
Poul-Henning Kamp
77068a7fe2 Retire the bogus uses of the disklabel field d_sbsize and begin to
initialize it to zero so we don't have to have everbody and their
aunt including FFS specific header files.

Sponsored by: DARPA & NAI Labs.
2002-05-12 20:49:41 +00:00
Poul-Henning Kamp
50d866ce0f Fix a {} bug which doesn't have any effect yet.
Spotted by:	jake
2002-04-27 07:07:37 +00:00
Poul-Henning Kamp
f6424ee53f Improve the cross-references in the XML output.
Explained by:	des
Sponsored by:	DARPA & NAI Labs.
2002-04-24 21:02:28 +00:00
Poul-Henning Kamp
078c6f01f9 Make specific provisions for the kernel simulator used in the regression
tests, other userland programs may need to include <geom/geom.h>.

Sponsored by:	DARPA & NAI Labs.
2002-04-24 12:53:12 +00:00
Poul-Henning Kamp
53705e35ae Implement the GEOMGETCONF ioctl which returns vital stats for the
current device in XML in an sbuf.

Sponsored by:	DARPA & NAI Labs
2002-04-23 19:54:02 +00:00
Poul-Henning Kamp
2285b09474 All in a days work: make a function static. 2002-04-23 19:03:03 +00:00
Poul-Henning Kamp
7d590cc46f Introduce some serious paranoia to try to catch a memory overwrite problem
as early as possible.

Sponsored by:	DARPA & NAI Labs
2002-04-23 11:48:45 +00:00
Poul-Henning Kamp
efb9df5cef Protect against multitple #includes of this file. 2002-04-22 19:54:17 +00:00
Poul-Henning Kamp
95c24b31df Make kernel dumps work with GEOM.
Notice that if the device on which the dump is set is destroyed for
any reason, the dump setting is lost.  This in particular will
happen in the case of spoilage.  For instance if you set dump on
ad0s1b and open ad0 for writing, ad0s* will be spoilt and the dump
setting lost.  See geom(4) for more about spoiling.

Sponsored by: DARPA & NAI Labs.
2002-04-19 09:24:12 +00:00
Poul-Henning Kamp
50cbb62eab Make life easier for reference-vector generatorts in tools/regression/geom
by including a FreeBSD friendly CVS identifier in the XML output.

Sponsored by: DARPA & NAI Labs.
2002-04-19 09:21:27 +00:00
Poul-Henning Kamp
1bdb20a68e Implement DIOCGFRONTSTUFF ioctl which reports how many bytes from the start
of the device magic stuff might occupy.

Sponsored by: DARPA & NAI Labs.
2002-04-09 15:43:32 +00:00
Poul-Henning Kamp
c7b1a1d1c3 Various stylistic nit picking.
Sponsored by: DARPA & NAI Labs.
2002-04-09 15:17:59 +00:00
Poul-Henning Kamp
a4ef1c5f92 Introduce the convenience function g_getattr() and make it DWIM.
Sponsored by: DARPA & NAI Labs.
2002-04-09 15:13:42 +00:00
Poul-Henning Kamp
0d3f37a804 Constifixation of attribute argument to g_io_[gs]etattr()
Sponsored by:	DARPA & NAI Labs
2002-04-09 15:12:05 +00:00
Poul-Henning Kamp
2dd527b3ac Move generic disk ioctls from <sys/disklabel.h> to <sys/disk.h>.
Sponsored by:	DARPA & NAI Labs
2002-04-08 09:20:07 +00:00
Poul-Henning Kamp
1265c0ce2b In reverence of the 3rd X11 development rule:
3.The only thing worse than generalizing from one example
	is generalizing from no examples at all.

Remove the fwcylinders attribute before anybody gets the idea that we
alone have squared the circle.

Sponsored by:	DARPA & NAI Labs.
2002-04-08 08:00:40 +00:00
John Baldwin
6008862bc2 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
Poul-Henning Kamp
2fccec19e9 Centralize EOF handling and improve access controls for bio scheduling.
Sponsored by:	DARPA & NAI Labs
2002-04-04 09:58:20 +00:00
Poul-Henning Kamp
07d77fc610 Move access and orphan member functions from class to geom.
Sponsored by: DARPA & NAI Labs
2002-04-04 09:54:13 +00:00
Poul-Henning Kamp
2654e1fc4e s/classs/classes/ to fixup grammer after the previous global renaming.
Sponsored by: DARPA & NAI Labs
2002-04-04 09:41:47 +00:00
Poul-Henning Kamp
408ab1b875 Retire the bogus ioctl DIOCGPART in toto.
Once again we can notice that badly thought out hacks ferment and infect
far more code than initially expected.

Sponsored by:	DARPA and NAI Labs.
2002-04-02 11:52:13 +00:00
Poul-Henning Kamp
ffee6e99f6 One less user of the bogus DIOCGPART ioctl. 2002-04-02 11:17:37 +00:00
Poul-Henning Kamp
05660ba819 Initialize a field to cater for ata-raid 2002-04-02 10:09:16 +00:00
Poul-Henning Kamp
81661c94b6 Here follows the new kernel dumping infrastructure.
Caveats:

The new savecore program is not complete in the sense that it emulates
enough of the old savecores features to do the job, but implements none
of the options yet.

I would appreciate if a userland hacker could help me out getting savecore
to do what we want it to do from a users point of view, compression,
email-notification, space reservation etc etc.  (send me email if
you are interested).

Currently, savecore will scan all devices marked as "swap" or "dump" in
/etc/fstab _or_ any devices specified on the command-line.

All architectures but i386 lack an implementation of dumpsys(), but
looking at the i386 version it should be trivial for anybody familiar
with the platform(s) to provide this function.

Documentation is quite sparse at this time, more to come.

Details:

ATA and SCSI drivers should work as the dump formatting code has been
removed.  The IDA, TWE and AAC have not yet been converted.

Dumpon now opens the device and uses ioctl(DIOCGKERNELDUMP) to set
the device as dumpdev.  To implement the "off" argument, /dev/null
is used as the device.

Savecore will fail if handed any options since they are not (yet)
implemented.  All devices marked "dump" or "swap" in /etc/fstab
will be scanned and dumps found will be saved to diskfiles
named from the MD5 hash of the header record.  The header record
is dumped in readable format in the .info file.  The kernel
is not saved.  Only complete dumps will be saved.

All maintainer rights for this code are disclaimed: feel free to
improve and extend.

Sponsored by:   DARPA, NAI Labs
2002-03-31 22:37:00 +00:00
Poul-Henning Kamp
6ede0acccc Remove bogus ccddump() function in favour of the standard nodump. 2002-03-29 21:12:11 +00:00
Poul-Henning Kamp
fd503e698c Complete an incomplete cut&paste operation. 2002-03-28 22:00:24 +00:00
Poul-Henning Kamp
d93b7c5dcd Add preliminary PC98 class to GEOM.
I have not been able to find very much information about the PC98
extended partition layout so this is gleaned from the source in
our pc98 architecture.  Corrections and patched very welcome.

Sponsored by: DARPA and NAI Labs.
2002-03-28 21:38:38 +00:00
Poul-Henning Kamp
4c0a424c67 In the absense of any smarter way to do this, cast various printf
arguments to silence printf format warnings.
2002-03-28 10:09:24 +00:00
Poul-Henning Kamp
b7cb368d31 Calculate the checksum the right place for alpha. The fact that this
worked for the beast disklabel only goes to show how weak a simple
parity really is.
2002-03-27 21:16:49 +00:00
Poul-Henning Kamp
b1876192f0 Eliminate some thread pointers which do not make sense anymore.
Split private parts of geom.h into geom_int.h.  The latter should
never be included in class implemtations.
2002-03-26 22:07:38 +00:00
Poul-Henning Kamp
e805e8f0e8 Cave in to tradition and rename "methods" to "classes". 2002-03-26 21:40:06 +00:00
Poul-Henning Kamp
d306122d60 Push BIO_FORMAT into a local hack inside the floppy drivers where
it belongs.
2002-03-26 19:16:37 +00:00
Poul-Henning Kamp
7f7563188c Make the BSD method width/endian agnostic and support alpha
architecture labels as well.

Sponsored by: DARPA, NAI Labs.
2002-03-24 14:27:31 +00:00