Commit Graph

325 Commits

Author SHA1 Message Date
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