xref: /openbsd/sbin/fdisk/disk.h (revision adf35c80)
1 /*	$OpenBSD: disk.h,v 1.33 2022/04/25 17:10:09 krw Exp $	*/
2 
3 /*
4  * Copyright (c) 1997 Tobias Weingartner
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 struct disk {
20 	struct prt	 dk_bootprt;
21 	char		*dk_name;
22 	int		 dk_fd;
23 	uint32_t	 dk_cylinders;
24 	uint32_t	 dk_heads;
25 	uint32_t	 dk_sectors;
26 	uint32_t	 dk_size;
27 };
28 
29 /* Align partition starts/sizes on 32K-byte boundaries. */
30 #define	BLOCKALIGNMENT	64
31 
32 void		 DISK_open(const char *, const int);
33 void		 DISK_printgeometry(const char *);
34 int		 DISK_readbytes(void *, const uint64_t, const size_t);
35 int		 DISK_writebytes(const void *, const uint64_t, const size_t);
36 
37 extern struct disk		disk;
38 extern struct disklabel		dl;
39