Commit Graph

482 Commits

Author SHA1 Message Date
phk
21654c3b17 Initialize the second buffer for mirroring to point to itself and not its
partner.
2003-03-04 10:15:19 +00:00
phk
0ae911eb0e Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
phk
2fb7245efc NO_GEOM cleanup:
Remove cdevsw->d_psize() implementation, we don't need it any more.
2003-03-02 14:42:01 +00:00
phk
e8ab4a65e4 NO_GEOM cleanup:
Retire the "dev_t" centric version of the disk mini-layer.
Remove now unneeded linkage field in dev_t and struct disk.
2003-02-28 10:02:02 +00:00
mux
541937cf73 Cleanup of the d_mmap_t interface.
- Get rid of the useless atop() / pmap_phys_address() detour.  The
  device mmap handlers must now give back the physical address
  without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
  int.  Now we properly pass a vm_offset_t * and expect it to be
  filled by the mmap handler when the mapping was successful.  The
  mmap handler must now return 0 when successful, any other value
  is considered as an error.  Previously, returning -1 was the only
  way to fail.  This change thus accidentally fixes some devices
  which were bogusly returning errno constants which would have been
  considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
  no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with:		alc, phk, jake
Reviewed by:		peter
Compile-tested on:	LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on:	i386
2003-02-25 03:21:22 +00:00
grehan
c2c6624864 Drop down Apple Partition Map code that has been in use by some
ppc developers for a while.

OK'd by:  phk
2003-02-23 01:25:35 +00:00
phk
8f9640b59b NO_GEOM cleanup: Convert CCD(4) to be use "struct disk*" instead of "dev_t"
as "this" handle.
2003-02-21 23:25:43 +00:00
phk
02e550fabb NO_GEOM cleanup:
Retire the "d_dump_t" and use the "dumper_t" type instead.

Dumper_t takes a void * as first arg which is more general than the
dev_t taken by d_dump_t.  (Remember: we could have net-dumpers if
somebody wrote us one!)

Define the convention for GEOM controlled disk devices to be that the
first argument to the dumper function is the struct disk pointer.

Change device drivers accordingly.
2003-02-21 19:00:48 +00:00
phk
9aa946589d NO_GEOM cleanup:
Change the argument to disk_destroy() to be the same struct disk * as
disk_create() takes.

This enables drivers to ignore the (now) bogus dev_t which disk_create()
returns.
2003-02-21 15:13:26 +00:00
phk
05d8d6e23f Add M_WAITOK 2003-02-19 22:51:33 +00:00
imp
cf874b345d Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
tegge
4d5cb6df0d Correctly set bio_data in cloned children when cutting up large requests. 2003-02-12 16:30:46 +00:00
phk
ba1e23916c Implement a handle for efficient implementation of perforations in
lower extremities.

Setting bit 4 in debugflags (sysctl kern.geom.debugflags=16) will
allow any open to succeed on rank#1 providers.  This will generally
correspond to the physical disk devices: ad0, da0, md0 etc.

This fundamentally violates the mechanics of GEOMs autoconfiguration,
and is only provided as a debugging facility, so obviously error
reports on GEOM where this bit is or has been set will not be
accepted.
2003-02-12 09:48:27 +00:00
phk
8bf75a2e40 Implement a bio-taskqueue to reduce number of context switches in
disk I/O processing.

        The intent is that the disk driver in its hardware interrupt
        routine will simply schedule the bio on the task queue with
        a routine to finish off whatever needs done.

        The g_up thread will then schedule this routine, the likely
        outcome of which is a biodone() which queues the bio on
        g_up's regular queue where it will be picked up and processed.

        Compared to the using the regular taskqueue, this saves one
        contextswitch.

Change our scheduling of the g_up and g_down queues to be water-tight,
at the cost of breaking the userland regression test-shims.

Input and ideas from:   scottl
2003-02-11 22:30:26 +00:00
phk
b098c0b196 Announce our ability to do MAXPHYS transfers. 2003-02-11 21:29:53 +00:00
phk
ef9a1b8601 Advertise MAXPHYS upwards, we will split as necessary before we get to the
bottom of things.
2003-02-11 21:24:25 +00:00
phk
9b781d6129 Check disk->d_maxsize/dev->si_iosize_max at open time rather than in strategy.
Printf a warning and use DFLTPHYS if the drive has not set a size.
2003-02-11 21:23:34 +00:00
phk
9c7fdcb565 Make a mutex to stop the race coming into geom_disk's done routine.
Cut up requests into smaller bits if they are longer than the drivers
disk->d_maxsize or dev->si_iosize_max.

Properly handle the race condition when using g_clone_bio() is used
without having the single-threadedness of g_down/g_up secure locking.
2003-02-11 18:32:31 +00:00
phk
75f224dcec Don't divide by zero if there is no stripewidth specified. 2003-02-11 15:23:41 +00:00
phk
dc511a8940 Typo in last commit. 2003-02-11 15:20:34 +00:00
phk
fd7ea6d48a Better names for struct disk elements: d_maxsize, d_stripeoffset
and d_stripesisze;

Introduce si_stripesize and si_stripeoffset in struct cdev so we
can make the visible to clustering code.

Add stripesize and stripeoffset to providers.

DTRT with stripesize and stripeoffset in various places in GEOM.
2003-02-11 14:57:34 +00:00
phk
b2fb118970 Propagate DISKFLAG_CANDELETE from struct disk to G_PF_CANDELETE on the
provider.
2003-02-11 14:12:06 +00:00
phk
8405552698 Wrap a long line. 2003-02-11 14:09:48 +00:00
phk
064989983a Don't short-circuit zero-length requests of they are BIO_[SG]ETATTR. 2003-02-11 13:13:10 +00:00
phk
ab4aed671a Use the SI_CANDELETE flag on the dev_t rather than the D_CANFREE flag
on the cdevsw to determine ability to handle the BIO_DELETE request.
2003-02-11 12:49:58 +00:00
phk
a61961945a Unconditionally make our provider with G_PF_CANDELETE. 2003-02-11 12:37:04 +00:00
phk
18e25b25db Propagate G_PF_CANDELETE to our own providers from the provider we attach to. 2003-02-11 12:36:33 +00:00
phk
41af143abe Introduce flag field and G_PF_CANDELETE field on providers. 2003-02-11 11:55:40 +00:00
phk
47f258f8be Remove another printf which does not say anything we didn't already know. 2003-02-11 11:02:27 +00:00
phk
89a4ec072e Turn the "updating" flag (back) into two sequence number fields at
either ends of the structure so we have a way to determine if a
snapshot is consistent.
2003-02-11 11:01:26 +00:00
phk
1ce699ee2a Remove a debugging printf. 2003-02-11 10:59:43 +00:00
phk
ee425616b7 Update the statistics collection code to track busy time instead of
idle time.

Statistics now default to "on" and can be turned off with
        sysctl kern.geom.collectstats=0

Performance impact of statistics collection is on the order of
800 nsec per consumer/provider set on a 700MHz Athlon.
2003-02-09 17:04:57 +00:00
phk
384af30f63 Put the name of the /dev entry in the .h file, userland will need it. 2003-02-08 14:50:27 +00:00
phk
04a4ba381f Move the g_stat struct to its own .h file, we will export it to other code.
Insted of embedding a struct g_stat in consumers and providers, merely
include a pointer.

Remove a couple of <sys/time.h> includes now unneeded.

Add a special allocator for struct g_stat.  This allocator will allocate
entire pages and hand out g_stat functions from there.  The "id" field
indicates free/used status.

Add "/dev/geom.stats" device driver whic exports the pages from the
allocator to userland with mmap(2) in read-only mode.

This mmap(2) interface should be considered a non-public interface and
the functions in libgeom (not yet committed) should be used to access
the statistics data.
2003-02-08 13:03:57 +00:00
phk
15f4f6a52b Move #defines of major/minor to internal header file so other bits can
share and coordinate with geom_dev.
2003-02-08 12:30:12 +00:00
phk
e8f2dea5dd Commit the correct copy of the g_stat structure.
Add debug.sizeof.g_stat sysctl.

Set the id field of the g_stat when we create consumers and providers.

Remove biocount from consumer, we will use the counters in the g_stat
structure instead.  Replace one field which will need to be atomically
manipulated with two fields which will not (stat.nop and stat.nend).

Change add companion field to bio_children: bio_inbed for the exact
same reason.

Don't output the biocount in the confdot output.

Fix KASSERT in g_io_request().

Add sysctl kern.geom.collectstats defaulting to off.

Collect the following raw statistics conditioned on this sysctl:

    for each consumer and provider {
        total number of operations started.
        total number of operations completed.
        time last operation completed.
        sum of idle-time.
        for each of BIO_READ, BIO_WRITE and BIO_DELETE {
            number of operations completed.
            number of bytes completed.
            number of ENOMEM errors.
            number of other errors.
            sum of transaction time.
        }
    }

API for getting hold of these statistics data not included yet.
2003-02-07 23:08:24 +00:00
phk
329bf7c30c Fix some sleep strings to make more sense. 2003-02-07 21:53:55 +00:00
phk
7a3625aca3 Add the new statistics structure, put one in consumers and providers.
include <sys/time.h> as necessary.
2003-02-07 21:43:34 +00:00
phk
0d87d64253 Rename bio_linkage to the more obvious bio_parent.
Add bio_t0 timestamp, and include <sys/time.h> where needed
2003-02-07 21:09:51 +00:00
gordon
56209777d7 Add some comments about the deficiencies of this module. I had hoped to get
around to addressing them some more, but Real Life (tm) has gotten in the
way.
2003-02-07 17:50:33 +00:00
phk
63f412ef74 Check return value of g_clone_bio(). 2003-02-06 22:00:47 +00:00
phk
84f57209a4 Experimentally don't let go of Giant in geom_disk's done.
We may actually be increasing Giant contention doing so because the
actual stuff we do is very cheap.

Also I am not convinced there is not a tiny window for a race here.
2003-02-06 21:50:39 +00:00
phk
ef9c55f6aa Put the checks we perform on a bio before calling ::start in their
own function, handle all validation and truncation at the time we
process the bio instead of when it gets scheduled.
2003-02-06 21:01:36 +00:00
phk
82db7fddb8 Implement the new "struct disk" centered API for device drivers.
This commit should not change anything as no device drivers use the
new API yet.
2003-02-05 21:13:08 +00:00
phk
9d6d3f1673 Pave the road to removing the fixed size limit on device nodes:
Change the si_name of dev_t's to be a char * and put a private buffer for
holding the name at then end of the struct.

Initialize si_name to point to the private buffer.

Put a KASSERT in geom_disk to prevent overrun on the fake dev_t we still
have to generate for the disk_drivers.
2003-02-04 10:32:40 +00:00
gordon
8329fa8951 Correct a comment. GEOM modules do not create /dev entries. They create
providers.

Pointed out by:	phk
2003-02-03 17:21:43 +00:00
gordon
7ec55e9926 Add the GEOM module that makes volume labels useful. A kernel compiled with
this will cause volume labels to be exposed in /dev/vol/<volname>. Currently,
there is no conflict resolution if more than one FS has the same volume name.

Reviewed by:	phk
2003-02-03 17:14:29 +00:00
phk
53aec1a3a4 Add a bio_disk pointer for use between geom_disk and the device drivers. 2003-02-02 11:59:54 +00:00
phk
f9d517f0ed Eliminate the sc_openmask, ccdopen() and ccdclose() functions, we
can use the flag maintained by geom_disk.c

Having only a strategy method to intialize, don't waste space using
a cdevsw structure to do so.
2003-02-01 11:17:22 +00:00
phk
cfd92eb694 Move configuration of geom/providers into its own function in preparation
for adding on-the-fly config interface.
2003-02-01 08:28:43 +00:00
phk
b1d44eed4c Remove commented out g_enc_dos_partition(). We won't be needing it. 2003-01-31 21:18:41 +00:00
phk
9d1b9f3c00 Add a rudimentary class for slicing Apple partitioned disks.
More work is needed on this, stakeholders please contact me.

Not quite asked for by:	rwatson
2003-01-31 16:27:07 +00:00
phk
10368fffb1 Add some agility to the disk_create() API:
Make passing the methods in a cdevsw structure optional.

Move "CANFREE" and "NOGIANT" flags into struct disk instead of the
cdevsw which may or may not be there.

Rename CANFREE to CANDELETE to match BIO_DELETE operation.

Add "OPEN" flag so drivers don't have to provide open/close methods
just to maintain such a flag.

Add temporary stopgap include of <sys/conf.h> to <sys/disk.h> until
the files which have them in the other order are fixed.

Add KASSERTS to make sure we don't get fed too many NULL pointers.

Clear our geom's softc pointer before we wither.
2003-01-30 20:34:23 +00:00
phk
8fe9dd24e0 NO_GEOM cleanup: Remove sys/disklabel.h include. 2003-01-30 19:55:19 +00:00
phk
837e7af52d NO_GEOM cleanup: retire disk_invalidate() 2003-01-30 19:43:50 +00:00
phk
bcf1d466fe NO_GEOM cleanup: Mark the last arg to disk_create() as unused. 2003-01-30 11:39:36 +00:00
phk
89099a65fb Add code to repsect the D_NOGIANT flag, should the disk device driver set it.
NO_GEOM cleanup:        remove ifdefs.

Still untested.
2003-01-29 19:47:25 +00:00
phk
15d50f061e Sort these functions as the author instructed. 2003-01-29 18:37:29 +00:00
phk
d12257b0f6 Mark some args unused so this compiles in userland. 2003-01-28 09:48:09 +00:00
phk
188cb3f63b Use a void * to carry the private data for return-call'ed ioctl requests.
Amongst other things this avoids a complex workaround in the userland
regression bits.
2003-01-28 09:47:50 +00:00
phk
f71e2dab31 Implement DIOCBSDBB ioctl which overwrites first BBSIZE bytes of BSD
labeled disk.

This is complicated by the fact that BBSIZE is greater than the
PAGE_SIZE limit ioctl inflicts on arguments which are automatically
copied in.

As long as we don't need access to userland memory (copyin/out) we
can deal with the ioctl using g_callme() which executes it from the
GEOM event thread.

Once we need copyin/out, we need to return the bio with EDIRIOCTL
in order to make geom_dev call us back in the original process context
where copyin will work.

Unfortunately, that results in us getting called with Giant, so
we have to DROP_GIANT/PICKUP_GIANT around the code where we diddle
GEOMs internals.

Sometimes you just can't win...

... But it does make geom_bsd.c an almost complete example of the
GEOM beastiarium.
2003-01-26 21:54:36 +00:00
alfred
bf8e8a6e8f Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
phk
dc9137bbd9 disk_dev_synth() is a NO_GEOM hack. 2003-01-20 11:29:07 +00:00
phk
9241d94016 Remove need for <sys/diskslice.h> but retain numerical compatibilty just in case. 2003-01-20 11:23:00 +00:00
phk
b9e99ecd32 Finally give CCD the disk mini-layer treatment:
CAUTION:

        Previously CCD would be different from all other disks in
        the system in that there were no "ccd0" device, only a
        "ccd0c" device.

        This is no longer so after this commit.  If you access a
        ccd device through the "/dev/ccd0c" device _and_ have not
        actually put a BSD disklabel on the device, you will have
        to use the name "/dev/ccd0".  If your CCD device contains
        a BSD disklabel there should be no difference.

        You need to recompile ccdconfig(8) using the changed
        src/sys/sys/ccdvar.h for the -g "show me" option to work.

        I have run the regression test I created before I started
        overhauling CCD and it flags no problems, but this code
        is mildly evil, so take care.  If you would cry if you lost
        what's on CCD, make a back before you upgrade.

Create separate cdevsw for the /dev/ccd.ctl device.

Remove the cloning function, the disk-minilayer will do all naming
for us.

Remove the ccdunit and ccdpart functions and carry the softc pointer
in the relevant dev_t's and structures.

Release all memory when a CCD device is unconfigured, previously
the softc would linger behind.

Remove all traces of BSD disklabel fiddling code.

Remove ccdpsize, the disk mini-layer does this for us.

Don't allocate memory with M_WAITOK in ccdstrategy().

Remove boundary checks which the disk mini-layer does for us.

Don't allocate space for more than 2 ccdbuf, RAID was never implemented.

NB: I have not tried to address any of the preexisting ailments of CCD.
2003-01-19 15:00:58 +00:00
phk
10e76c3f14 Unifdef -UDEBUG on the CCD driver. The debugging is mostly useless
and can be added back selectively, should anybody start to interest
themselves for the internal workings of ccd.

This commit will make the diffs for the following commits much more
readable.
2003-01-19 14:35:38 +00:00
phk
1a85c3746b Inline now trivial functions getccdbuf() and putccdbuf().
Fix another trivial memory-leak.
2003-01-18 12:23:49 +00:00
phk
5bbadf161c Fix minor memory-leak. 2003-01-18 11:33:06 +00:00
phk
d5b262df48 Use the M_CCD malloc bucket instead of M_DEVBUF.
Don't keep a private freelist of a low number of trivially small structures.
2003-01-18 11:04:41 +00:00
phk
577399eeab Inline trivial function ccdintr() into its one caller ccdiodone().
Only call ccdfind() once in ccdiodone() and cache the result.
2003-01-18 10:44:17 +00:00
phk
961794d713 Sanitize the copyright section a bit: We do not need two copies of the
four-clause BSD license in the file, one will do.
2003-01-18 10:08:27 +00:00
phk
62c9659f0c Find places to store the previously implicityly passed unit number in
the three configuration ioctls which need a unit number.

Add a "ccd.ctl" device for config operations.

Implement ioctls on ccd.ctl which rely on the explicityly passed
unit numbers.

Update ccdconfig to use the new ccd.ctl interface.

Add code to the kernel to detect old ccdconfig binaries, and whine
about it.

Add code to ccdconfig to detect old kernels, and whine about it.

These two compatibility measures will be retained only for a limited
period since they are in the way of GEOM'ification of ccd.
2003-01-17 14:53:53 +00:00
phk
e9184d11f9 Add a very simple but functional GEOM mirror class.
This is committed more as an instructive tool than as a production
facility, but this will change over time.
2003-01-14 22:44:48 +00:00
phk
aaa8136387 Now that we have non-geom_disk based drivers, we need to cover for those,
in case they return EOPNOTSUPP on an ioctl.

Found by:	jhb
2003-01-14 21:31:00 +00:00
phk
e67e97880d Always issue ioctls as BIO_GEATTR requests. The direction of data copies on
ioctls are no reliable indication of the ioctls "set" or "get" nature or if
such simplistic categories can even be applied.

MFC candidate:	boot0cfg issue.
2003-01-13 11:34:35 +00:00
phk
6ef829cd7d Remove g_silence(). It does not do anything anymore. 2003-01-13 08:46:32 +00:00
phk
672b19058d Fix typo. 2003-01-13 08:44:03 +00:00
phk
83f3fce109 Don't restrict MBR sectorsize to 512 bytes.
Test data provided by:	Andrey Koklin <aka@veco.ru>
2003-01-11 12:30:51 +00:00
jhb
03f0bdefde Output the fstype of each partition in a disklabel in the configuration
text similar to the way that the MBR module dumps its slice types.
2003-01-10 19:44:14 +00:00
phk
158843e06d BSD disklabels expose the controling label though the 'c' partition, and
some trick is necessary to prevent further BSD geoms from attaching to
that.  Our old trick was to make sure we don't attach to a geom from
the "BSD" class, but this doesn't work if an intermediary geom obscures
this fact.  Instead, calculate the MD5 checksum of the label we target
and ask if anybody below us loves that label.  If they do we don't.

Coded by:       gordon.
2003-01-06 20:10:41 +00:00
phk
d68eff9b1b In userland case include <errno.h>, not <err.h>. This is needed to make
the src/tools/regression/geom stuff compile.
2003-01-06 20:05:45 +00:00
nyan
864080610e Rename the dos_partition structure for pc98 to pc98_partition. 2003-01-04 08:50:48 +00:00
phk
dd55faeb5e Remove CCDF_SWAP and CCDF_PARITY, they have never been implemented. 2003-01-03 08:57:40 +00:00
nyan
fac5fc844d MFMBR: Add ioctls for writing an IPL and a boot menu. 2003-01-03 07:13:36 +00:00
phk
bfabff54fe Remove unused second argument from BIO_STRATEGY() 2003-01-03 05:51:11 +00:00
phk
bc7a07d94c Optimize the size of the work-items by letting the mapping function
decide the largest size which stays inside the zone and does not
collide with a lock sector.
2003-01-02 19:29:49 +00:00
phk
8fa3036bdb Update si_bsize_phys on open.
MFC candidate.
2003-01-02 09:38:22 +00:00
schweikh
86f7487fb6 Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
phk
78a7deb4bb Implement ioctls for tampering with sector0. 2002-12-29 14:59:24 +00:00
phk
27cb79fe10 Remove the "ascii" attribute from the sysctls so that "sysctl -a" will
skip them.
2002-12-27 07:58:59 +00:00
phk
516da34ba8 white-space changes 2002-12-26 21:02:50 +00:00
phk
2e1375146e Use a mutex assert to document our locking circumstances. 2002-12-26 20:48:22 +00:00
phk
3d7762dd22 We should not need to hold Giant for sbuf operations any more. 2002-12-26 20:46:30 +00:00
phk
3e75022eb7 Add an XXX comment to explain the predicament. 2002-12-26 20:45:37 +00:00
phk
0989bb3e91 Don't forget our topology lock in the MBREXT case. 2002-12-19 12:01:19 +00:00
phk
790740dde5 Solve another bug in the mapping code: correctly skip lock sectors.
Make sure sector zero is protected if it contains metadata.

Lower WARNS for gbde to 3 on non-i386 archs.  rijndael-fst is evil
but appearntly does the right thing and passes the test-vectors.

MFC Candidate.
2002-12-18 22:11:54 +00:00
phk
761d063e80 Fix two blunders in the mapping functions which can lead to corrupt data,
for request sizes larger than the sectorsize or for multi-key setups.

See warning mailed to current@ for details of recovery.

Found by:	Marcus Reid <marcus@blazingdot.com>
2002-12-18 19:57:27 +00:00
phk
4052863334 Balk at unaligned requests.
MFC candidate.
2002-12-18 19:53:59 +00:00
phk
51c494ca74 Add a check for negative offset locations and return EINVAL for them. 2002-12-17 21:31:58 +00:00
phk
ebfad8464d Don't mangle geometry for pc98, this will happen in the ata driver. 2002-12-17 15:50:51 +00:00
phk
8a25281415 Remember to hold topology lock when we change things.
Spotted by:	kuriyama
2002-12-17 09:44:10 +00:00
phk
ef296549a5 Constify the dumpconf() function. 2002-12-17 07:22:48 +00:00
phk
3cf4280261 Get rid of g_slice_addslice() and use g_slice_config() instead.
Tested with:	i386 + src/tools/regression/geom
2002-12-16 23:08:48 +00:00
phk
cd9caf5281 Constification and some s/int/u_int/ changes. 2002-12-16 22:33:27 +00:00
phk
0d6813c06f Add a couple of KASSERTS, just in case. 2002-12-13 22:04:45 +00:00
phk
43d82ce26d Don't interpret the hotspots relative to all slices on a slicer, but
relative to the parent device.
2002-12-13 21:31:13 +00:00
phk
39fb253bb1 Fix spelling in comment. 2002-12-13 21:10:59 +00:00
sos
71edc5e4eb Add support for the PC98 platform to the ATA driver.
This mostly consists of functionality to serialize accesses to
the two ATA channels (which can also be used to "fix" certain
PCI based controllers).
Add support for Acard controllers.
Enable the ATA driver in PC98 GENERIC, and add device hints.
Update man page with latest support.

The PC98 core team has kindly provided me with a PC98
machine that made this all possible, thanks to all that
contributed to that effort, without that this would
probably newer have been possible..

Approved by: re@
2002-12-03 20:20:44 +00:00
phk
bf720d1bf7 Use the hotspot code to prevent people from overwriting their disklabel
with stuff which would ruin the day for any open parititons.

Approved by:	re
2002-12-02 20:23:54 +00:00
phk
7b3238944a Add a simplified version of the hot-spot code to enable us to protect
in-band disklabels from in-band vandalism.

Approve by:	re
2002-12-02 19:59:25 +00:00
phk
7c627ee994 Use more mnemonic argument names in the access functions.
Sponsored by:	DARPA & NAI Labs
Approved by:	re (blanket)
2002-12-01 15:54:39 +00:00
phk
f3c2bbdee1 Fix a cut&past-o.
Spotted by:	yar
Approved by:	re (blanket)
2002-12-01 15:53:31 +00:00
phk
d2f5accf6d Conceiveably, there may exist an algorithm which can tell if a sequence of bytes
are the output of AES/128/CBC or ARC4RANDOM.  Encrypt the random data with which
we wipe when we get a BIO_DELETE to make such an algorithm useful.

Sponsored by:	DARPA & NAI Labs
Approved by:	re (blanket)
2002-12-01 15:50:48 +00:00
phk
2e45221c26 Use unsigned for an index.
Sponsored by:	DARPA & NAI Labs.
Approved by:	re (blanket).
2002-12-01 15:47:49 +00:00
phk
8411a44a2f Remember to update the providers idea of its size when we reconfigure
a slice child.

Approved by:	re
2002-11-20 20:12:52 +00:00
phk
65d6c06a91 Do not call the dumpconf method unless there is one.
Compare pointers with NULL.

Partially submitted by:	Christian Carstensen <cc@gate5.de>
Approved by:	re
2002-11-20 18:10:42 +00:00
nyan
86cc001c1b Save a slice name on the disk and print it at g_pc98_dumpconf(). 2002-11-17 13:56:37 +00:00
phk
38900b3ee3 Remove harmless but irritating printf. 2002-11-08 15:35:16 +00:00
phk
875ed4eea7 Always recalculate the SRM checksum if the label is at 64 bytes offset.
Tested by:	jhb
2002-11-08 15:31:34 +00:00
nyan
bf0b83376e Fix to support pc98.
It is mostly merged from MBR specific part.

Reviewed by:	phk
2002-11-07 16:42:37 +00:00
phk
ad8a01f928 Straighten up the geom.ctl config interface definitions.
Sponsored by:	DARPA & NAI Labs
2002-11-06 20:05:15 +00:00
phk
a500538d00 Polish a bit here and there.
Reenable the geom.ctl device so people can play with gbde.

Sponsored by:	DARPA & NAI Labs
2002-11-04 09:31:02 +00:00
phk
16874ad923 Run a revision on the GBDE encryption facility.
Replace ARC4 with SHA2-512.
Change lock-structure encoding to use random ordering rather for obscurity.
Encrypt lock-structure with AES/256 instead of AES/128.
Change kkey derivation to be MD5 hash based.
Watch for malloc(M_NOWAIT) failures and ditch our cache when they happen.
Remove clause 3 of the license with NAI Labs consent.

Many thanks to "Lucky Green" <shamrock@cypherpunks.to> and "David
Wagner" <daw@cs.berkeley.edu>, for code reading, inputs and
suggestions.

This code has still not been stared at for 10 years by a gang of
hard-core cryptographers.  Discretion advised.

NB: These changes result in the on-disk format changing: dump/restore needed.

Sponsored by:   DARPA & NAI Labs.
2002-11-04 09:27:01 +00:00
phk
278d4201b7 Reject slices where begin == end.
Remove clause 3 from the license with NAI Labs consent.

Sponsored by:	DARPA & NAI Labs
2002-11-04 06:30:38 +00:00
phk
a5e8ff61bf Remove clause 3 in the license with NAI's consent.
Reject slices with type==0.
Diddle the bootverbose printfs.

Sponsored by:	DARPA & NAI Labs
2002-11-04 06:29:05 +00:00
marcel
b737405ed3 Remove the GEOM_GPT hack. We now check for partition type 0xEE and
skip those. This handles the Protective MBR (PMBR) which consists
of a single partition of type 0xEE that covers the whole disk and
as such protects the GPT partitioning. We allow other partitions to
be present besides partitions of type 0xEE and as such interpret
partition type 0xEE as a "hands-off" partition only.

While here, fix g_mbrext_dumpconf to test if indent is NULL and
dump the data in a form that libdisk can grok. Change the logic
in g_mbr_dumpconf to match that of g_mbrext_dumpconf. This does
not change the output, but prevents a NULL-pointer dereference
when indent == NULL && pp == NULL.
2002-11-02 12:01:12 +00:00
marcel
3ff7b03806 Fix dumpconf so libdisk can grok its output. We weren't checking
if indent was NULL. Consequently we always emitted the XML format.
2002-11-02 11:45:54 +00:00
phk
982f8bb0ad malloc(9) with M_NOWAIT seems to return NULL a lot more than I would have
expected under -current.  This is a problem for GEOM because the up/down
threads cannot sleep waiting for memory to become free.  The reason they
cannot sleep is that paging things out to disk may be the only way we can
clear up some RAM.  Nice catch-22 there.

Implement a rudimentary ENOMEM recovery strategy:  If an I/O request
fails with an error code of ENOMEM, schedule it for a retry, and
tell the down-thread to sleep hz/10 to get other parts of the system
a chance to free up some memory, in particular the up-path in GEOM.

All caches should probably start to monitor malloc(9) failures using the new
malloc_last_fail() function, and release when it indicates congestion.

Sponsored by:	DARPA & NAI Labs.
2002-11-02 11:08:07 +00:00
phk
e0f89bf346 Make this compile in the userland shims again.
Sponsored by:	DARPA & NAI Labs
2002-11-01 15:57:55 +00:00
phk
72c30b5844 Add KASSERT for bio_cmd validity here as well. Various hacks still
bypass specfs.
2002-11-01 15:56:26 +00:00
phk
594d92f0f9 Spruce up bootverbose output a bit.
Allow extended partitions to have flag=0x80
2002-10-31 22:18:49 +00:00
phk
c82a18684b Change the kkey generation cherry-picker to use MD5.
Sponsored by:	DARPA & NAI Labs
2002-10-30 22:13:54 +00:00
phk
36b357552e Add the remaning part of the new libdisk interaction.
WARNING:  This is not a published interface, it is a stopgap measure for
WARNING:  libdisk so we can get 5.0-R out of the door.

Sponsored by:	DARPA & NAI Labs
2002-10-28 22:43:54 +00:00
phk
bddb286f46 Add support for the new libdisk interaction.
Sponsored by:	DARPA & NAI Labs.
2002-10-28 22:42:20 +00:00
phk
35eae04ebb Fix a bug in the cherry-picker kkey generator routine.
WARNING:  You need to backup and restore the _unencrypted_ contents
WARNING:  of your GBDE disks when you take this update!

Sponsored by:	DARPA & NAI Labs.
2002-10-28 11:06:58 +00:00
phk
e3283252f9 Add more compatibility junk. 2002-10-28 07:50:47 +00:00
phk
4772146a86 Don't truncate on large disks. 2002-10-27 10:17:38 +00:00
phk
fe41e143c1 Make geom_mbr.c optional on PC98, use GEOM_MBR option to include it.
Disable check for supposedly magic "IPL1" string for PC98 labels, its
thaumaturgical power is in doubt.
2002-10-26 20:17:59 +00:00
phk
b7e23599cf Reduce the GEOM verbosity under bootverbose to something more sufferable.
This is not quite the set of information I would want, but the tree where
I have the "correct" version is messed up with conflicts.

Sponsored by:	DARPA & NAI Labs.
2002-10-25 20:09:45 +00:00
phk
1f3b3d6f9d Add a g_dev_print() function which prints all the /dev entries GEOM
know about.
2002-10-25 18:42:42 +00:00
phk
01399b8c20 Loose the g_dev_clone() noise. 2002-10-25 17:00:15 +00:00
phk
291992383a Use a better test to prevent tasting geom.ctl so we don't screw the
regression tests.
2002-10-24 21:32:49 +00:00
phk
75576547f2 Don't taste the first provider, it's /dev/geom.ctl and it's not going
to taste like anything we like anyway.
2002-10-24 19:20:28 +00:00
phk
b691eae4b5 No need to specify CTLTYPE_INT when we use SYSCTL_INT. 2002-10-20 22:46:50 +00:00
phk
af63f9546a Now that the sectorsize and mediasize are properties of the provider,
don't take the detour over the I/O path to discover them using getattr(),
we can just pick them out directly.

Do note though, that for now they are only valid after the first open
of the underlying disk device due compatibility with the old disk_create()
API.  This will change in the future so they will always be valid.

Sponsored by:   DARPA & NAI Labs.
2002-10-20 20:28:24 +00:00
phk
f0693daa1f The g_id*() functions are not needed in the userland test-suite so
#ifdef _KERNEL them rather than deal with a copyin simulation.

Sponsored by:	DARPA & NAI Labs
2002-10-20 20:08:44 +00:00
phk
5df21f9258 Make the sectorsize a property of providers so we can include it in the XML
output.

Sponsored by:	DARPA & NAI Labs
2002-10-20 19:18:07 +00:00
phk
536319e740 Use %jd instead of %lld now that we have it. 2002-10-20 18:48:12 +00:00
phk
6128ce4ca2 It makes more sense for the fwheads and fwsectors properties to be in
the provider stanza rather than the geom stanza.
2002-10-20 18:46:25 +00:00
phk
78bcfbf6c0 Include fwsectors and gfwheads in the XML output for the disks we know.
Sponsored by:	DARPA & NAI Labs.
2002-10-20 18:09:01 +00:00