summaryrefslogtreecommitdiff
path: root/sys/kern/subr_disk.c
AgeCommit message (Collapse)Author
2009-06-17Revert bufq's. this is inline with the major midlayer reverts thatThordur I. Bjornsson
have been going on. this appears to bring us back to stable state. lots of testing by oga and ariane and my self.
2009-06-14Don't mess with the bounds in the lp if *partoffp is non-NULL, since thisTheo de Raadt
indicates that writedisklabel is trying to find the location for writing the label. If the lp is messed with, an invalid checksum is written. done with miod and kettenis, lots of moaning and gnashing of teeth, etc
2009-06-05Clamp the ending bound to the size of the disk. This makes disklabel -ATheo de Raadt
still do the right thing if the MBR has a lie in it
2009-06-04Recycle four ancient fields in the disklabel structure, replacing them withTheo de Raadt
bounds information, ie. the zone of the disk that OpenBSD can use. Have each pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out this area and pass it up to userland. Then, delete all the same disk parsing code from disklabel(8) since the kernel passes it up. Lots and lots of - signs in the disklabel(8) code. Tested on as many platforms as possible, the fallout will be repaired as time goes on. To test, use disklabel -d <drive> and validate that the bounds do not overlap any boot blocks. This same information is used by disklabel -A... OK for the concept from krw, miod, and drahn
2009-06-03add a flexible buffer queue (bufq) api, based on the never usedThordur I. Bjornsson
one by tedu@. It doesn't do anything smart yet, it just uses plain old disksort. we also keep the old method of queueing bufs since some miods have crazy MD drivers that need some love. ok beck@, art@ tested by many on many archs.
2009-06-03Add a callback specifically for softraid. If you touch this kittens willMarco Peereboom
be murdered and theo will visit with a 2x4. ok deraadt
2009-06-03remove the never used bufq_ code.Thordur I. Bjornsson
ok oga@ 'dance for me' blambert@
2009-05-15Validate the main MBR minimally; if it does not have the AA55 thingy we mustTheo de Raadt
not read garbage values as partitions... which we then put into the spoofed label... and which would lead disklabel -A to make surprising decisions. earlier versions which did too much validation tested by many
2009-05-13initialize d_npartitions to MAXPARTITIONS always; ok krwTheo de Raadt
2009-05-03Discovering an extended MBR partition and setting 'wander' to 1Kenneth R Westerback
should not stop the spoofing process. Setting 'wander' means when we are done with this MBR, read the next one. Problem noted and fix tested by Nick Guenther. ok weingart@ (I think), deraadt@
2009-03-28use a static and unique string as the disk lock name, so if we're waitingDavid Gwynne
on the disk lock we can find that code rather than wondering where "sd0" gets passed to tsleep. ok deraadt@
2009-02-09two more consistency checks for a disklabel, to prevent havoc laterOtto Moerbeek
on; prompted by Thorsten Glaser; ok miod@ krw@
2008-11-21Relax sanity check so any two-byte jmp followed by a NOP, or anyKenneth R Westerback
three-byte jmp will be acceptable as the preamble to a FAT boot sector for the purposes of spoofing an 'i' partition. Problem noted most recently by mbalmer@. Fixes mbalmer@, fkr@ and jmc@'s Nokia E71 phones. "seems silly" tedu@ "disgusting" deraadt@ "makes sense" fkr@ ok jmc@ "looks ok" weingart@
2008-08-25If partoffp is non-NULL then readdoslabel() is just looking for theKenneth R Westerback
correct address to write the passed label. Don't spoof partitions while looking for the address, as this could result in an invalid label being written out. "That looks right" deraadt@ "Looks good to me" miod@
2008-08-22simplification, and repair findblkmajor for name## lookups; ok krwTheo de Raadt
2008-08-08Admit b_blkno means block number; a block is DEV_BSIZE (a.k.a.Kenneth R Westerback
512) bytes; ffs is inextricably tied to using b_blkno and disklabel always uses sectorsize units. Thus use DEV_BSIZE units for all fields describing ffs filesystems and convert to/from sectors where required. This enables the creation and use of ffs filesystems on non-512 byte sectorsize devices. This diff allows i386 and sgi (the two test platforms) to find disklabels that are not on a sectorsize boundary. Same change to further archs coming. This is a no-op on 512-byte sectorsize devices. This work triggered by jsing@'s need to create ffs filesystems on sgi cdroms so we can create cdrom install media for sgi. sgi testing by jsing@ ok jsing@ pedro@ "looks sane" beck@ weingart@
2008-06-25allow to install and boot the OpenBSD A6 partition and disklabel in anReyk Floeter
extended DOS partition. the concept of extended partitions is very simple, it is just another mbr at the partition offset (well, the standard "EBR" is a linked list with a few limitations, but this diff works with both variants). this diff has been in the snapshots for a while. with input from weingart@ and krw@ ok deraadt@
2008-06-12Bring biomem diff back into the tree after the nfs_bio.c fix went in.Theo de Raadt
ok thib beck art
2008-06-11back out biomem diff since it is not right yet. Doing very largeTheo de Raadt
file copies to nfsv2 causes the system to eventually peg the console. On the console ^T indicates that the load is increasing rapidly, ddb indicates many calls to getbuf, there is some very slow nfs traffic making none (or extremely slow) progress. Eventually some machines seize up entirely.
2008-06-10Fix buffer cache pending read statistics by ensuring we can identifyBob Beck
biowait() reads that do *not* come from the buffer cache - we use the B_RAW flag to identify these at art's suggestion - since it makes sense and the flag was not being used. this just flags all these buffers with B_RAW - biodone already ignores returned buffers marked B_RAW. ok art@
2008-06-10Buffer cache revampBob Beck
1) remove multiple size queues, introduced as a stopgap. 2) decouple pages containing data from their mappings 3) only keep buffers mapped when they actually have to be mapped (right now, this is when buffers are B_BUSY) 4) New functions to make a buffer busy, and release the busy flag (buf_acquire and buf_release) 5) Move high/low water marks and statistics counters into a structure 6) Add a sysctl to retrieve buffer cache statistics Tested in several variants and beat upon by bob and art for a year. run accidentally on henning's nfs server for a few months... ok deraadt@, krw@, art@ - who promises to be around to deal with any fallout
2008-05-23Make rd act more like a 'normal' disk device, allowing the elimination ofKenneth R Westerback
'fakerootdev' hackery. This allows us to bring back miod@'s r1.70 subr_disk.c change to avoid the GENERIC dance when rootdev has been initialized. This in turn re-enables raidframe root devices. Add a nice panic if rootdev can't be initialized, displaying the name of the device that didn't work rather than just blowing up by de-referencing NULL. ok deraadt@
2008-04-07Compare device names consistantly in parsedisk().Kenneth R Westerback
ok deraadt@
2008-03-31nope, sorry, the miod/naddy raidframe change breaks almost all ramdisks.Theo de Raadt
the basic idea is that ramdisks boot the same way as swap generic -- this commit also improves the comment in that area. in this case the one outlier is raidframe, and those who use it will no longer be able to put off repairing it -- raidframe must follow the same setroot() / bootdv API that everything else in the system uses. debugged with krw
2008-03-31Refine "netboot" interface group semantics to indicate the interface weTheo de Raadt
booted from to the most precision; preferring the boot device, or if that is not known, the root device discussed with miod and reyk tested by beck
2008-03-30Do not do the ``swap generic'' behaviour if rootdev != NODEV when enteringMiod Vallat
setroot(), as this neuters RAIDframe autoconfiguration; found the hard way by naddy@
2008-03-23setroot() is supposed to be safe in all cases, so kill the special casesTheo de Raadt
for RB_DFLTROOT; ok miod
2007-12-23protect the disk statistics with a mutex.David Gwynne
ok tedu@ kettenis@
2007-12-16panic on negative blkno or size; ok kettenis@ deraadt@Otto Moerbeek
2007-11-09Make disklabel aware of NTFS.Joel Sing
ok miod@ krw@
2007-09-07Use M_ZERO in a few more places to shave bytes from the kernel.Artur Grabowski
eyeballed and ok dlg@
2007-08-05Move some printf's about disklabel disksize and RAW_PART size/offsetKenneth R Westerback
under #ifdef DEBUG. Adjust the verbiage. Some minor tweaks while in the area. ok deraadt@
2007-08-05Use d_partitions[DISKPART(dev)] rather that d_partitions +Kenneth R Westerback
DISKPART(dev). Thus making the idiom the same everywhere. pointed out by deraadt@
2007-06-25use daddr64_t for size in bounds_check_with_label(); prompted by miod@;Otto Moerbeek
ok deraadt@
2007-06-20b_cylinder does not need to be set on the callpath down into drivers.Theo de Raadt
cpu_disklabel can go away, since nothing anymore needs to use it; ok miod
2007-06-17significantly simplified disklabel infrastructure. MBR handling becomes MITheo de Raadt
to support hotplug media on most architectures. disklabel setup and verification done using new helper functions. Disklabels must *always* have a correct checksum now. Same code paths are used to learn on-disk location disklabels, to avoid new errors sneaking in. Tested on almost all cases, testing help from todd, kettenis, krw, otto, dlg, robert, gwk, drahn
2007-06-10when we change fields in the label to version 1, fix the checksum (but onlyTheo de Raadt
if it was ok beforehands)
2007-06-09blocks/sectors != blocks/blocks. Fix calculation of b_cylinder inKenneth R Westerback
bounds_check_with_label(). Tweak error path to eliminate duplicate code.
2007-06-09The differences in the last non-homogeneous bounds_check_with_label()Kenneth R Westerback
routines (alpha, vax) prove to be not worth keeping. Move bounds_check_with_label() into the MI world. Eliminate unreliable and almost certainly useless checks for overwriting a disklabel. After discussion with deraadt@
2007-06-09silently whack wrong-sized C partitionsTheo de Raadt
2007-06-09handle C non-0 start after doing v1 converstion.. sighTheo de Raadt
2007-06-09by hand i carefully found that all the differences in setdisklabel()Theo de Raadt
implimentations were simply either missing code, or spacing and such. setdisklabel() can become MI now.
2007-06-09be even more forceful with RAW_PART (and note this is the wrong, and ↵Theo de Raadt
temporary, place
2007-06-09push RAW_PART to 0 if it is non-zero, and bitchTheo de Raadt
2007-06-06fix format strings for block #'s now that they are 64 bit; ok tedu (whoTheo de Raadt
also spotted one more)
2007-06-06now that all partition size/offsets are potentially 64-bit, change theTheo de Raadt
type of all variables to daddr64_t. this includes the APIs for XXsize() and XXdump(), all range checks inside bio drivers, internal variables for disklabel handling, and even uvm's swap offsets. re-read numerous times by otto, miod, krw, thib to look for errors
2007-06-06oopsTheo de Raadt
2007-06-06even more problems with disk size consistancy checksTheo de Raadt
2007-06-05use six new macros to access & store the 48-bit disklabel fields relatedTheo de Raadt
to size. tested on almost all machines, double checked by miod and krw next comes the type handling surrounding these values
2007-06-04disable a part of the label validation because some Sun systemsTheo de Raadt
have contradictory information in their cyl-based labels