--- Net2/sys/disklabel.h 2018/04/24 18:03:58 1.1 +++ Net2/sys/disklabel.h 2018/04/24 18:16:59 1.1.1.3 @@ -30,12 +30,17 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)disklabel.h 7.19 (Berkeley) 5/7/91 + * from: @(#)disklabel.h 7.19 (Berkeley) 5/7/91 + * disklabel.h,v 1.5 1993/05/22 09:00:32 deraadt Exp */ +#ifndef _SYS_DISKLABEL_H_ +#define _SYS_DISKLABEL_H_ + /* * Disk description table, see disktab(5) */ + #define _PATH_DISKTAB "/etc/disktab" #define DISKTAB "/etc/disktab" /* deprecated */ @@ -181,6 +186,11 @@ struct disklabel { #define DTYPE_ST506 6 /* ST506 etc. */ #define DTYPE_FLOPPY 10 /* floppy */ +/* d_subtype values: */ +#define DSTYPE_INDOSPART 0x8 /* is inside dos partition */ +#define DSTYPE_DOSPART(s) ((s) & 3) /* dos partition number */ +#define DSTYPE_GEOMETRY 0x10 /* drive params in label */ + #ifdef DKTYPENAMES static char *dktypenames[] = { "unknown", @@ -238,6 +248,7 @@ static char *fstypenames[] = { #define D_BADSECT 0x04 /* supports bad sector forw. */ #define D_RAMDISK 0x08 /* disk emulator */ #define D_CHAIN 0x10 /* can do back-back transfers */ +#define D_DOSPART 0x20 /* within MSDOS partition */ /* * Drive data for SMD. @@ -283,6 +294,43 @@ struct partinfo { struct partition *part; }; +#ifdef i386 +/* DOS partition table -- located in boot block */ + +#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ +#define DOSPARTOFF 446 +#define NDOSPART 4 + +struct dos_partition { + unsigned char dp_flag; /* bootstrap flags */ + unsigned char dp_shd; /* starting head */ + unsigned char dp_ssect; /* starting sector */ + unsigned char dp_scyl; /* starting cylinder */ + unsigned char dp_typ; /* partition type */ +#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ + unsigned char dp_ehd; /* end head */ + unsigned char dp_esect; /* end sector */ + unsigned char dp_ecyl; /* end cylinder */ + unsigned long dp_start; /* absolute starting sector number */ + unsigned long dp_size; /* partition size in sectors */ +} dos_partitions[NDOSPART]; + +#include +struct cpu_disklabel { + struct dos_partition dosparts[NDOSPART]; + struct dkbad bad; +}; + +#endif /* i386 */ + +#if defined(hp300) || defined(mac) || defined(vax) +struct cpu_disklabel { +}; +#endif + +#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ +#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ + /* * Disk-specific ioctls. */ @@ -302,6 +350,32 @@ struct partinfo { #define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */ +#if defined(KERNEL) + +#ifdef i386 +int bounds_check_with_label __P((struct buf *, struct disklabel *, int)); +#endif + +void diskerr __P((struct buf *, char *, char *, int, int, struct disklabel *)); +void disksort __P((struct buf *, struct buf *)); +int dkcksum __P((struct disklabel *)); + +int setdisklabel __P((struct disklabel *, struct disklabel *, u_long, + struct cpu_disklabel *)); +int cpu_setdisklabel __P((struct disklabel *, struct disklabel *, u_long, + struct cpu_disklabel *)); + +char *readdisklabel __P((int, int (*)(), struct disklabel *, + struct cpu_disklabel *)); +char *cpu_readdisklabel __P((int, int (*)(), struct disklabel *, + struct cpu_disklabel *)); + +int writedisklabel __P((int, int (*)(), struct disklabel *, + struct cpu_disklabel *)); +int cpu_writedisklabel __P((int, int (*)(), struct disklabel *, + struct cpu_disklabel *)); + +#endif #endif LOCORE #if !defined(KERNEL) && !defined(LOCORE) @@ -313,3 +387,5 @@ struct disklabel *getdiskbyname __P((con __END_DECLS #endif + +#endif /* !_SYS_DISKLABEL_H_ */