summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_diskmbr.c
Commit message (Collapse)AuthorAgeFilesLines
* Make diskerr() always log with printf.phk2000-11-261-2/+2
|
* Separate the struct bio related stuff out of <sys/buf.h> intophk2000-05-051-0/+1
| | | | | | | | | | | | | | | <sys/bio.h>. <sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall not be made a nested include according to bdes teachings on the subject of nested includes. Diskdrivers and similar stuff below specfs::strategy() should no longer need to include <sys/buf.> unless they need caching of data. Still a few bogus uses of struct buf to track down. Repocopy by: peter
* s/biowait/bufwait/gphk2000-04-291-2/+2
| | | | Prodded by: several.
* Complete the bio/buf divorce for all code below devfs::strategyphk2000-04-151-2/+2
| | | | | | | | | | Exceptions: Vinum untouched. This means that it cannot be compiled. Greg Lehey is on the case. CCD not converted yet, casts to struct buf (still safe) atapi-cd casts to struct buf to examine B_PHYS
* diff, patch and cvs didn't like these three last time around, try again.phk2000-03-201-2/+2
|
* Remove B_READ, B_WRITE and B_FREEBUF and replace them with a newphk2000-03-201-2/+2
| | | | | | | | | | | | | | | | | | | | | field in struct buf: b_iocmd. The b_iocmd is enforced to have exactly one bit set. B_WRITE was bogusly defined as zero giving rise to obvious coding mistakes. Also eliminate the redundant struct buf flag B_CALL, it can just as efficiently be done by comparing b_iodone to NULL. Should you get a panic or drop into the debugger, complaining about "b_iocmd", don't continue. It is likely to write on your disk where it should have been reading. This change is a step in the direction towards a stackable BIO capability. A lot of this patch were machine generated (Thanks to style(9) compliance!) Vinum users: Greg has not had time to test this yet, be careful.
* Don't permit generation of non-physical disk addresses.bde2000-01-281-20/+59
| | | | | | | | | | | | | | | | | | | subr_diskmbr.c: Don't "helpfully" enlarge our idea of the disk size to cover all the primary slices. Instead, truncate or discard slices that don't seem to be on the disk. The enlargement was a hack for disks that don't report their size (e.g., MFM disks). It is just wrong in general. wd.c: In CHS mode, limit the disk size so that cylinder numbers >= 65536 cannot occur. This normally only affects disks larger than 33.8GB. CHS mode accesses to addresses above the limit are now properly broken (an error is returned instead of garbage for reads and disk corruption for writes). PR: 15611 Reviewed by: readers of freebsd-bugs did not respond to a request for review
* Quick fix for stack overflow when there are more than about 25 slices.bde2000-01-271-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using recursion to traverse the recursive data structure for extended partitions was never good, but when slice support was implemented in 1995, the recursion worked for the default maximum number of slices (32), and standard fdisk utilities didn't support creating more than the default number. Even then, corrupt extended partitions could cause endless recursion, because we attempt to check all slices, even ones which we don't turn into devices. The recursion has succumbed to creeping features. The stack requirements for each level had grown to 204 bytes on i386's. Most of the growth was caused by adding a 64-byte copy of the DOSpartition table to each frame. The kernel stack size has shrunk to about 5K on i386's. Most of the shrinkage was caused by the growth of `struct sigacts' by 2388 bytes to support 128 signals. Linux fdisk (a 1997 version at least) can now create 60 slices (4 standard ones, 56 for logical drives within extended partitions, and it seems to be leaving room to map the 4 BSD partitions on my test drive), and Linux (2.2.29 and 2.3.35 at least) now reports all these slices at boot time. The fix limits the recursion to 16 levels (4 + 16 slices) and recovers 32 bytes per level caused by gcc pessimizing for space. Switching to a static buffer doesn't cause any problems due to recursion, since the buffer is not passed down. Using a static buffer is wrong in general because it requires the giant lock to protect it. However, this problem is small compared with using a static buffer for dsname(). We sometimes neglect to copy the result of dsname() before sleeping. Also fixed slice names when we find more than MAX_SLICES (32) slices. The number of the last slice found was not passed passed recursively. The limit on the recursion now prevents finding more than 32 slices with a standard extended partition data structure anyway.
* Improved English in the messages printed by diskerr().bde2000-01-261-16/+15
| | | | Fixed some formatting bugs.
* Fix a warning.dfr1999-11-091-1/+1
|
* Removed diskerr()'s unused d_name arg and updated callers. This fixesbde1999-09-131-4/+2
| | | | | | warnings caused by the arg having the wrong type (not const enough). The arg was also wrong (a full name instead of a short one) for calls from from subr_diskmbr.c and pc98/diskslice_machdep.c.
* Fixed style bugs in rev.1.36-1.39.bde1999-09-041-37/+28
|
* Merge alpha and pc98 changes into i386 MBR handling code and replace allphk1999-08-291-6/+54
| | | | three copies with one copy in MI land.
* We don't need to pass the diskname argument all over the diskslice/labelphk1999-08-281-14/+14
| | | | code, we can find the name from any convenient dev_t
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Spring cleaning around strategy and disklabels/slices:phk1999-08-141-17/+13
| | | | | | | | | | | | | | Introduce BUF_STRATEGY(struct buf *, int flag) macro, and use it throughout. please see comment in sys/conf.h about the flag argument. Remove strategy argument from all the diskslice/label/bad144 implementations, it should be found from the dev_t. Remove bogus and unused strategy1 routines. Remove open/close arguments from dssize(). Pick them up from dev_t. Remove unused and unfinished setgeom support from diskslice/label/bad144 code.
* Convert buffer locking from using the B_BUSY and B_WANTED flags to usingmckusick1999-06-261-3/+3
| | | | | | | lockmgr locks. This commit should be functionally equivalent to the old semantics. That is, all buffer locking is done with LK_EXCLUSIVE requests. Changes to take advantage of LK_SHARED and LK_RECURSIVE will be done in future commits.
* Divorce "dev_t" from the "major|minor" bitmap, which is now calledphk1999-05-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | udev_t in the kernel but still called dev_t in userland. Provide functions to manipulate both types: major() umajor() minor() uminor() makedev() umakedev() dev2udev() udev2dev() For now they're functions, they will become in-line functions after one of the next two steps in this process. Return major/minor/makedev to macro-hood for userland. Register a name in cdevsw[] for the "filedescriptor" driver. In the kernel the udev_t appears in places where we have the major/minor number combination, (ie: a potential device: we may not have the driver nor the device), like in inodes, vattr, cdevsw registration and so on, whereas the dev_t appears where we carry around a reference to a actual device. In the future the cdevsw and the aliased-from vnode will be hung directly from the dev_t, along with up to two softc pointers for the device driver and a few houskeeping bits. This will essentially replace the current "alias" check code (same buck, bigger bang). A little stunt has been provided to try to catch places where the wrong type is being used (dev_t vs udev_t), if you see something not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if it makes a difference. If it does, please try to track it down (many hands make light work) or at least try to reproduce it as simply as possible, and describe how to do that. Without DEVT_FASCIST I belive this patch is a no-op. Stylistic/posixoid comments about the userland view of the <sys/*.h> files welcome now, from userland they now contain the end result. Next planned step: make all dev_t's refer to the same devsw[] which means convert BLK's to CHR's at the perimeter of the vnodes and other places where they enter the game (bootdev, mknod, sysctl).
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-281-5/+5
| | | | kernel compile
* Examine all occurrences of sprintf(), strcat(), and str[n]cpy()archie1998-12-041-2/+2
| | | | | | | | | | | | | | for possible buffer overflow problems. Replaced most sprintf()'s with snprintf(); for others cases, added terminating NUL bytes where appropriate, replaced constants like "16" with sizeof(), etc. These changes include several bug fixes, but most changes are for maintainability's sake. Any instance where it wasn't "immediately obvious" that a buffer overflow could not occur was made safer. Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Mike Spengler <mks@networkcs.com>
* The machine dependent disk slice manager does not recognizephk1998-08-101-3/+6
| | | | | | | | | | | DOS partition type 15 (Extended DOS, LBA) as a container for DOS logical volumes, so the appropriate slices (e.g. sd1s5) are not initialized. PR: 7549 PR: 4120 Reviewed by: phk Submitted by: Jim Mattson <jmattson@sonic.net>
* Don't pass the label to diskerr(), since the label is being constructedbde1998-07-251-3/+3
| | | | | and may be invalid. In particular, d_secpercyl may be 0, and diskerr() divides by it.
* Moved allocation of the slices struct to the right place. Initializebde1998-07-201-28/+9
| | | | | everything in it (the devsw pointers were not initialized early or at all for the !DEVFS case, but this was harmless on i386's).
* Fixed printf format errors.bde1998-07-111-3/+3
|
* In all such uses of struct buf: 's/b_un.b_addr/b_data/g'phk1997-12-021-4/+4
|
* Hide the `no magic' babble behind bootverbose, since it has proven tojoerg1997-09-271-5/+7
| | | | be too much magic for 99.9 % of the users.
* Avoid division by 0 in check_part(). (It occurred when max_nsectors == 0.bde1997-04-191-8/+11
| | | | | | | This case is clearly an error, but we keep calling check_part() to get diagnostics.) Fixed nearby indentation and commenting bugs.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Don't clobber max_ncyls, ending up guessing thetotal number of cylinders asbde1996-11-041-6/+10
| | | | | | | | the number in the 4th slot. Fixes PR 1893. Should be in 2.1.5 and 2.2.
* Don't include <sys/conf.h> for the kernel in disk-related headers.bde1996-09-201-1/+2
| | | | | | | | | | It is needed for implementation details but very little of it is needed for the interface. Include it in the few places that didn't already include it. Include <sys/ioccom.h> in <sys/disklabel.h> (as already in <sys/diskslice.h>) so that all the disk-related headers are almost self-sufficient.
* Removed now-unused #includes of <machine/cpu.h>. They were for bootverbosebde1996-04-071-2/+1
| | | | being declared in the wrong place.
* More b_flags fixes.dyson1996-03-021-3/+3
|
* Fix a bug that b_flags was getting unnecessarily modified bydyson1996-03-011-4/+4
| | | | | the slice code. The effect up to now has been insignficant, but improved buffer allocation code will break with this problem.
* Remove unused functions and variables, make things static, and other cleanups.phk1995-10-281-3/+1
|
* Don't clip d_ncylinders to value used by partitions.jkh1995-08-231-2/+2
|
* Properly initialize the d_ncylinders field to the maximum number ofjkh1995-08-231-1/+2
| | | | cylinders.
* Make the "information" slice printfs if(bootverbose).phk1995-05-181-10/+13
| | | | Fix the message about Ontrack.
* Fix style inconsistencies in the last few commits.bde1995-05-071-30/+28
|
* When past cyl 1024 it's ok if CHS is (0xff,0xff,0xff).phk1995-05-011-3/+7
| | | | It's actually recommended it seems...
* Remove the slice for the first 63 sectors for the OnTrack case, it's uselessphk1995-04-201-12/+2
| | | | and nobody care about it anyway.
* Added support for disks which "OnTrack Disk Manager" has munged.phk1995-04-201-19/+58
| | | | | I suggest you do all partitioning using the OnTrack SW, to avoid confusing it.
* Add more compatibility cruft:bde1995-03-251-19/+69
| | | | | | | | | | | | | | | | | | - ignore the partition table if it is identical with the bogus one in /usr/src/sys/i386/boot/biosboot/start.S. Honoring the bogus size field was fatal. The error is detected but other compatibilty cruft weakens the error handling too much for this case. - weaken the partition entry checking to allow the following treatments of C/H/S addresses when C should be >= 1024: (1) allow C = 1023, H = max, S = max. (2) allow C to be correct modulo 1024. Other compatibilty cruft weakens the error handling to allow all C/H/S addresses, but there too many errors were reported. Improve error messages: - print C/H/S addresses if relevant. - distinguish primary partition table from extended partition tables. - don't use diskerr() except for i/o errors.
* Fix support for extended partitions (forgot to release the buffer).bde1995-03-151-3/+7
|
* Support extended DOSpartitions.bde1995-03-041-51/+181
| | | | | | | | Accept even suspicious partitions. Moved most handling of the compatibility slice to dsopen(). Report i/o errors.
* Use dsname() to get consistent names.bde1995-02-221-16/+19
|
* Don't generate any errors here other than EIO. An invalid partitionbde1995-02-211-14/+10
| | | | table is not an error, it just causes a smaller slice table.
* Add compatibility cruft.bde1995-02-161-30/+54
| | | | | | | | | | | | | | | | | | | | | | | | | Slice 0 is now for the first BSD slice. The first BSD slice is the first DOSpartition with id 0xa5 or the whole disk if their are no DOSpartitions (except the latter is not yet implemented). Existing partitions on it work the same as in 2.0 except the 'd' partition is no longer special and partitions are relative to the skice. Slice 1 is now for the whole disk and gets a read-only label describing the disk. Previously, slice 0 was for the whole disk and there was no label on it. Slices 2-31 are for DOSpartitions. Slice 0 is an alias for one of these if there is a BSD slice. Previously, slices 1-31 were for DOSpartitions. diskslice_machdep.c: Expand whole disk slice to include all DOSpartitions. More work is required for >1024 cylinders and to rewrite the label iff the driver is unsure about the geometry. subr_diskslice.c: New function dsisopen() to help handle media changes.
* Fixed $Id$phk1995-01-231-1/+1
|
* Change an 0 to WHOLE_DISK_SLICE.bde1994-12-301-1/+1
|
OpenPOWER on IntegriCloud