summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* remove uneeded proc.h includesjsg2014-09-141-2/+1
| | | | ok mpi@ kspillner@
* Recognize EFI protective and system partitions. Do not put disklabel entriesmiod2014-08-301-2/+4
| | | | | | | for the protective ones when creating a fake label, but do, for the system ones, so that we may eventually copy boot code to them. From Markus Mueller
* Initial support to read GPT partition tables in the kernel, if option GPT.miod2014-07-131-1/+323
| | | | | | | Contributed by Markus Mueller; code based upon Bitrig's GPT support, with stricter GPT structures validation and support for alternate header places. ok deraadt@ jsing@ krw@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-2/+2
| | | | after discussions with beck deraadt kettenis.
* Remove the temporary dospartoff work around.jsing2014-07-121-19/+1
| | | | | | From Markus Mueller. ok krw@ miod@ tedu@
* reboot(9): Add MI reboot entry functionuebayasi2014-07-111-3/+3
| | | | | | | | Now, for kernel to "reboot" (reboot, halt, or shutdown), MD boot(9) is called in some places. This change introduces a new MI function reboot(9) which is simply a wrapper to call MD boot(9). OK kettenis@ deraadt@
* this doesnt talk to uvm directly, so doesnt need uvm_extern.hdlg2014-07-021-2/+1
| | | | deraadt says go ahead
* When a disklabel is read from a MBR partitioned disk, don'tkrw2014-01-241-2/+5
| | | | | | | | replace the OpenBSD bounds with the A6 MBR partition limits. Thus preserving any changes the user makes with the 'b' command in disklabel. Reported, tested & ok blambert@, ok deraadt@
* Delete spurious if statement.krw2014-01-231-4/+1
| | | | ok phessler@ deraadt@ jsing@ guenther@
* Write disklabel in correct spot on devices with non-512-byte sectors.krw2014-01-221-14/+39
| | | | | | | | For now and until 5.5 is cut, also read from current/incorrect spot so people don't immediately lose their existing disklabels on such devices. Problem spotted by David Vasek.
* bzero -> memsettedu2014-01-211-11/+11
|
* now that all the direct users of disksort have been removed, we can nowdlg2013-11-201-97/+1
| | | | | | | | | | | | | | | | safely remove disksort. most hardware and pretty much all of the kernel has moved to logical block addressing when dealing with disks, so the assumptions disksort was built against arent useful these days. it also has bad edge cases with lots of sequential writes being able to starve other io requests in the system. these issues have been addressed by becks nscan implementation, which disksort was previously deprecated in favour of. this removes the guts of disksort and the bufq wrapper around it. ok miod@
* panic expects a format stringderaadt2013-11-181-2/+2
|
* Sprinkle (long long) casts where %lld is being used to print daddr_tkrw2013-11-011-9/+10
| | | | | | variables. Some random whitespace/knf repairs encountered on the way. ok miod@ on inspection, feedback & more suggestions from millert@
* KNF a long line.krw2013-10-201-2/+3
|
* Use daddr_t * instead of int * for the partoffp parameter tokrw2013-10-191-2/+2
| | | | | | | | | | | | readdoslabel(). Ditto all the MD variables whose addresses are passed to readdoslabel() via partoffp. Fix some 512-byte block vs disk sector confusion in hppa and sgi. All the DL_GETxxxxx() defines return disk sector values. All DL_SETxxxx() take disk sector values. These changes should be no-ops until a drive using non-512-byte-sectors is encountered. ok deraadt@
* Display correct values (i.e. blocks where blocks are meant) inkrw2013-10-141-6/+6
| | | | diskerr() messages by doing DL_SECTOBLK() dance repeatedly.
* disk sizes, partition sizes and partition offsets are u_int64_tkrw2013-10-071-5/+5
| | | | | values rather than daddr_t values. So use u_int64_t to store them and %llu to print them in checkdisklabel().
* When a partition is changing to UNUSED, we try to save kernel-setkrw2013-09-031-9/+4
| | | | | | | | | | | | values for the p_fragblock and p_cpg fields. But we were saving the info for open partitions only. Instead, look at all partitions. And stop discarding the new partition type. In addition to general betterness, this lets you change the RAW_PART partition (a.k.a. 'c') to UNUSED. This problem was pointed out by Federico Giannici via misc@. ok otto@
* Uncomment kprintf format attributes for sys/kernsyl2013-08-081-2/+2
| | | | tested on vax (gcc3) ok miod@
* don't use empty format stringsf2013-07-031-3/+2
| | | | | | this is necessary to enable -Wformat or -Wno-error=format ok deraadt@
* final removal of daddr64_t. daddr_t has been 64 bit for a long enoughderaadt2013-06-111-5/+5
| | | | | test period; i think 3 years ago the last bugs fell out. ok otto beck others
* When attaching disks, feed the disklabel's checksum toblambert2013-04-241-2/+4
| | | | | | | | the random pool as unique-esque-but-not-secret data. inspired by conversations with tedu@/deraadt@ ok deraadt@
* Comment out recently added __attribute__((__format__(__kprintf__))) annotationsmiod2013-02-171-2/+2
| | | | | | in MI code; gcc 2.95 does not accept such annotation for function pointer declarations, only function prototypes. To be uncommented once gcc 2.95 bites the dust.
* Add explicit __attribute__ ((__format__(__kprintf__)))) to the functions andmiod2013-02-091-2/+2
| | | | | | function pointer arguments which are {used as,} wrappers around the kernel printf function. No functional change.
* Tweak FAT detection/usage. Recognize 'bare' FAT media that lackskrw2012-04-071-8/+13
| | | | | | | | | | the 0x55aa signature. Don't try FAT detection if we have found an OpenBSD MBR partition. Don't try to read a disklabel from 'bare' FAT media. There can't be one. Finally, don't allow the writing of a disklabel on 'bare' FAT media. There is no safe spot for it, and splatting it in the middle of the FAT structures has not proved helpful.
* Some whitespace/paren tweaks. Rename the mbr testing variable fromkrw2012-03-311-6/+6
| | | | 'fattest' to 'mbrtest'. No change to .o.
* DUIDs are only valid when booting off of a disk, so make sure we arephessler2012-02-101-15/+18
| | | | | | actually doing so before using them OK deraadt@, krw@
* When disklabels can't be read before attempting to mount root, makekrw2012-01-211-3/+9
| | | | | | | the message less scary and print out the failing devices to improve troubleshooting. ok jsing@
* Do not wait for DKF_OPENED to be set if we never actually created ajsing2012-01-211-2/+3
| | | | | | | | callback for this disk. Fixes an issue found by krw on macppc. ok krw@
* Ensure that all disk attach callbacks have completed before attemptingjsing2012-01-161-2/+16
| | | | | | to locate the root via DUID. ok krw@
* Always set DKF_OPENED in the disk attach callback.jsing2012-01-131-5/+7
|
* Restore previous behaviour - only print the DUID if we used it tojsing2012-01-131-4/+4
| | | | select root.
* If the DUID of the boot disk has not been provided, attempt to locate itjsing2012-01-111-1/+13
| | | | | | | | | | | via the boot device. This allows root on softraid to work on most architectures. For architectures that cannot clearly identify their boot device, the DUID of the boot disk can still be passed from the boot loader, as is already done for amd64 and i386. Based on a suggestion from kettenis@ ok krw@
* Move softraid root mapping to later in the boot process - this will allowjsing2012-01-111-1/+9
| | | | us to play some tricks in setroot().
* Avoid the use of an invalid disklabel by setting a DK_LABELVALID flagjsing2011-12-281-5/+11
| | | | | | | | | if we correctly read and validated the disklabel. Always check that this flag is set before using the DUID from the disklabel. Discussed with deraadt@ ok krw@
* An all-zero DUID is considered to be a blank DUID - ensure that we do notjsing2011-12-281-4/+5
| | | | | | generate one. ok krw@
* Move the prototype for disk_readlabel to the .h file so that hibernatederaadt2011-09-211-2/+1
| | | | | can get at it. ok jsing
* Do not use the `hh' modifier in printf format strings, as the kernel printfmiod2011-09-181-4/+4
| | | | | implementation does not support it and handles it as `h'. ok jsing@
* No need to byte-swap d_checksum just before setting it to zero.krw2011-07-261-2/+1
| | | | ok matthew@
* On several archs (e.g. hppa, sgi, macppc) readdoslabel() is called after an attempt tokrw2011-07-061-2/+3
| | | | | read a native label fails. Reset B_ERROR/b_error on buf to ensure any i/o failure on that first attempt is forgiven. A la the dkcsum() fix to recover from a disk error.
* Eliminate redundant buf validation checks in xxstrategy() methods nowmatthew2011-07-061-2/+2
| | | | | | | | | | | | that they're implemented consistently in bounds_check_with_label(). Also, per krw's request, change bounds_check_with_label() to return 0 if the checks succeed, and change the drivers to test == -1 instead of <= 0. (Man page update to follow; intentionally omitting arch/vax/mba/hp.c from this commit because it doesn't even build currently and miod@ promises to kill it soon.) ok krw@
* Add checks for sector-alignment and whole number of sectors tomatthew2011-07-051-17/+24
| | | | | | bounds_check_with_label() and generally cleanup the code while here. ok krw@ ("I like this a *lot*"); "i like it" tedu@
* Refactor some common open/close/detach disk driver code intomatthew2011-06-301-1/+58
| | | | | | subr_disk.c. For now just the MI disk drivers. ok deraadt@, krw@; jsing@ liked the approach too
* Minor cleanup for disk_lock() and disk_unlock().matthew2011-06-191-7/+3
| | | | ok deraadt@
* Add disk_lock_nointr() as a way to acquire the disk lock without beingmatthew2011-06-191-1/+7
| | | | | | interrupted by signals. ok deraadt@
* Kill the "lockname" argument to disk_construct().matthew2011-06-191-3/+3
| | | | ok deraadt@
* Get rid of the wlabel argument to bounds_check_with_label(). It'smatthew2011-06-031-2/+2
| | | | | | | | | never done anything in OpenBSD and just clutters disk drivers with silly flag handling. More cleanup to follow. ok deraadt@, millert@; no objections krw@
* Add device_ref/device_unref calls to prevent a possible use-after-freematthew2011-06-011-1/+6
| | | | | | | | | issue in disk_attach_callback. Assumes that the struct disk is part of the driver's softc, but this is always true in practice. Still other scary use-after-free races lying around here though... ok jsing@, deraadt@
* spacesmarco2011-04-281-4/+4
|