summaryrefslogtreecommitdiffstats
path: root/sys/sys/disk.h
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-09-20 19:36:05 +0000
committerphk <phk@FreeBSD.org>2002-09-20 19:36:05 +0000
commit57a346a21312d7f99ca28aee15ab6091be10cbd7 (patch)
tree47b5afae3623c1371d19a0478c850d8e6a08d07b /sys/sys/disk.h
parent2fb7a39c0fdc17568c3b60cf37e5f3c2d6dff5e4 (diff)
downloadFreeBSD-src-57a346a21312d7f99ca28aee15ab6091be10cbd7.zip
FreeBSD-src-57a346a21312d7f99ca28aee15ab6091be10cbd7.tar.gz
(This commit touches about 15 disk device drivers in a very consistent
and predictable way, and I apologize if I have gotten it wrong anywhere, getting prior review on a patch like this is not feasible, considering the number of people involved and hardware availability etc.) If struct disklabel is the messenger: kill the messenger. Inside struct disk we had a struct disklabel which disk drivers used to communicate certain metrics to the disklayer above (GEOM or the disk mini-layer). This commit changes this communication to use four explicit fields instead. Amongst the benefits is that the fields do not get overwritten by wrong or bogus on-disk disklabels. Once that is clear, <sys/disk.h> which is included in the drivers no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in, the few places that needs them, have gotten explicit #includes for them. The disklabel inside struct disk is now only for internal use in the disk mini-layer, so instead of embedding it, we malloc it as we need it. This concludes (modulus any mistakes) the series of disklabel related commits. I belive it all amounts to a NOP for all the rest of you :-) Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/sys/disk.h')
-rw-r--r--sys/sys/disk.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/sys/disk.h b/sys/sys/disk.h
index 43a1ae3..e5c62c8 100644
--- a/sys/sys/disk.h
+++ b/sys/sys/disk.h
@@ -16,13 +16,6 @@
#include <sys/ioccom.h>
#ifdef _KERNEL
-#ifndef _SYS_DISKSLICE_H_
-#include <sys/diskslice.h>
-#endif /* _SYS_DISKSLICE_H_ */
-
-#ifndef _SYS_DISKLABEL
-#include <sys/disklabel.h>
-#endif /* _SYS_DISKLABEL */
#include <sys/queue.h>
@@ -31,8 +24,15 @@ struct disk {
u_int d_dsflags;
struct cdevsw *d_devsw;
dev_t d_dev;
+
+ /* These four fields must be valid while opened */
+ u_int d_sectorsize;
+ off_t d_mediasize;
+ u_int d_fwsectors;
+ u_int d_fwheads;
+
struct diskslices *d_slice;
- struct disklabel d_label;
+ struct disklabel *d_label;
LIST_ENTRY(disk) d_list;
void *d_softc;
};
OpenPOWER on IntegriCloud