summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Validate the main MBR minimally; if it does not have the AA55 thingy we mustderaadt2009-05-151-7/+11
| | | | | | 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
* initialize d_npartitions to MAXPARTITIONS always; ok krwderaadt2009-05-131-2/+2
|
* Discovering an extended MBR partition and setting 'wander' to 1krw2009-05-031-5/+6
| | | | | | | | | 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@
* use a static and unique string as the disk lock name, so if we're waitingdlg2009-03-281-2/+2
| | | | | | | on the disk lock we can find that code rather than wondering where "sd0" gets passed to tsleep. ok deraadt@
* two more consistency checks for a disklabel, to prevent havoc laterotto2009-02-091-3/+7
| | | | on; prompted by Thorsten Glaser; ok miod@ krw@
* Relax sanity check so any two-byte jmp followed by a NOP, or anykrw2008-11-211-5/+20
| | | | | | | | | | | 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@
* If partoffp is non-NULL then readdoslabel() is just looking for thekrw2008-08-251-10/+16
| | | | | | | | 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@
* simplification, and repair findblkmajor for name## lookups; ok krwderaadt2008-08-221-7/+11
|
* Admit b_blkno means block number; a block is DEV_BSIZE (a.k.a.krw2008-08-081-10/+13
| | | | | | | | | | | | | | | | | | | | | | 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@
* allow to install and boot the OpenBSD A6 partition and disklabel in anreyk2008-06-251-7/+15
| | | | | | | | | | | | 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@
* Bring biomem diff back into the tree after the nfs_bio.c fix went in.deraadt2008-06-121-3/+3
| | | | ok thib beck art
* back out biomem diff since it is not right yet. Doing very largederaadt2008-06-111-3/+3
| | | | | | | | 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.
* Fix buffer cache pending read statistics by ensuring we can identifybeck2008-06-101-2/+2
| | | | | | | | 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@
* Buffer cache revampbeck2008-06-101-2/+2
| | | | | | | | | | | | | | | | 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
* Make rd act more like a 'normal' disk device, allowing the elimination ofkrw2008-05-231-26/+5
| | | | | | | | | | | '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@
* Compare device names consistantly in parsedisk().krw2008-04-071-2/+2
| | | | ok deraadt@
* nope, sorry, the miod/naddy raidframe change breaks almost all ramdisks.deraadt2008-03-311-3/+6
| | | | | | | | | | 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
* Refine "netboot" interface group semantics to indicate the interface wederaadt2008-03-311-1/+15
| | | | | | | 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
* Do not do the ``swap generic'' behaviour if rootdev != NODEV when enteringmiod2008-03-301-2/+2
| | | | | setroot(), as this neuters RAIDframe autoconfiguration; found the hard way by naddy@
* setroot() is supposed to be safe in all cases, so kill the special casesderaadt2008-03-231-4/+1
| | | | for RB_DFLTROOT; ok miod
* protect the disk statistics with a mutex.dlg2007-12-231-3/+9
| | | | ok tedu@ kettenis@
* panic on negative blkno or size; ok kettenis@ deraadt@otto2007-12-161-1/+4
|
* Make disklabel aware of NTFS.jsing2007-11-091-1/+6
| | | | ok miod@ krw@
* Use M_ZERO in a few more places to shave bytes from the kernel.art2007-09-071-6/+4
| | | | eyeballed and ok dlg@
* Move some printf's about disklabel disksize and RAW_PART size/offsetkrw2007-08-051-15/+13
| | | | | | | under #ifdef DEBUG. Adjust the verbiage. Some minor tweaks while in the area. ok deraadt@
* Use d_partitions[DISKPART(dev)] rather that d_partitions +krw2007-08-051-2/+2
| | | | | | DISKPART(dev). Thus making the idiom the same everywhere. pointed out by deraadt@
* use daddr64_t for size in bounds_check_with_label(); prompted by miod@;otto2007-06-251-2/+2
| | | | ok deraadt@
* b_cylinder does not need to be set on the callpath down into drivers.deraadt2007-06-201-19/+6
| | | | cpu_disklabel can go away, since nothing anymore needs to use it; ok miod
* significantly simplified disklabel infrastructure. MBR handling becomes MIderaadt2007-06-171-44/+350
| | | | | | | | 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
* when we change fields in the label to version 1, fix the checksum (but onlyderaadt2007-06-101-4/+15
| | | | if it was ok beforehands)
* blocks/sectors != blocks/blocks. Fix calculation of b_cylinder inkrw2007-06-091-8/+6
| | | | | bounds_check_with_label(). Tweak error path to eliminate duplicate code.
* The differences in the last non-homogeneous bounds_check_with_label()krw2007-06-091-1/+47
| | | | | | | | 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@
* silently whack wrong-sized C partitionsderaadt2007-06-091-6/+3
|
* handle C non-0 start after doing v1 converstion.. sighderaadt2007-06-091-8/+8
|
* by hand i carefully found that all the differences in setdisklabel()deraadt2007-06-091-1/+55
| | | | | implimentations were simply either missing code, or spacing and such. setdisklabel() can become MI now.
* be even more forceful with RAW_PART (and note this is the wrong, and temporary, placederaadt2007-06-091-2/+6
|
* push RAW_PART to 0 if it is non-zero, and bitchderaadt2007-06-091-1/+6
|
* fix format strings for block #'s now that they are 64 bit; ok tedu (whoderaadt2007-06-061-3/+4
| | | | also spotted one more)
* now that all partition size/offsets are potentially 64-bit, change thederaadt2007-06-061-6/+6
| | | | | | | 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
* oopsderaadt2007-06-061-2/+2
|
* even more problems with disk size consistancy checksderaadt2007-06-061-2/+2
|
* use six new macros to access & store the 48-bit disklabel fields relatedderaadt2007-06-051-13/+16
| | | | | to size. tested on almost all machines, double checked by miod and krw next comes the type handling surrounding these values
* disable a part of the label validation because some Sun systemsderaadt2007-06-041-2/+5
| | | | have contradictory information in their cyl-based labels
* Rename cvtdisklabelv1 -> disklabeltokernlabel. It does more than justkrw2007-06-021-3/+5
| | | | | | | | convert version 0 to version 1 disklabels. Suggested by deraadt@. ok deraadt@ otto@
* Add two constraints to V1 disklabels:krw2007-06-011-15/+28
| | | | | | | | | | 1) All partitions must start before the end of the disk. 2) All partitions must end at or before the end of the disk. Partitions not satisfying these constraints will be truncated and marked FS_UNUSED. ok otto@ deraadt@
* Updated disklabel format to support larger disks and partitions. Weotto2007-05-291-1/+26
| | | | | | | | | | | free room in struct partition by packing fragment size and fragments/block more tighlty and use the resulting space to make offset and size 48 bits. For the disk part we use spare fields in struct disklabel. Kernel converts in-mem copy of the on-disk label if needed, disklabel(8) writes new version. We are careful to only change fields not used by bootloaders. Conception of basic scheme by deraadt. ok deraadt@ krw@
* Dont write to the string passed to parsedisk(), ok deraadt@drahn2007-05-181-8/+8
|
* in case of pre-configured nfs, we must assume that the bootdv is the rootdvderaadt2007-05-181-1/+2
|
* now that setroot() prints nice things like:deraadt2007-05-151-1/+3
| | | | | | | root on sd0a swap on sd0b dump on sd0b we can skip printing: rootdev=0x400 rrootdev=0xd00 rawdev=0xd02 ok miod, no objections from other lazy slackers
* also print where (primary) swap and dumps are; ok miodderaadt2007-05-101-4/+13
|