xref: /openbsd-src/sbin/fdisk/disk.h (revision 4e1ee0786f11cc571bd0be17d38e46f635c719fc)
1 /*	$OpenBSD: disk.h,v 1.31 2021/07/26 13:05:14 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 #ifndef _DISK_H
20 #define _DISK_H
21 
22 struct disk {
23 	struct prt	 dk_bootprt;
24 	char		*dk_name;
25 	int		 dk_fd;
26 	uint32_t	 dk_cylinders;
27 	uint32_t	 dk_heads;
28 	uint32_t	 dk_sectors;
29 	uint32_t	 dk_size;
30 };
31 
32 /* Align partition starts/sizes on 32K-byte boundaries. */
33 #define	BLOCKALIGNMENT	64
34 
35 void		 DISK_open(const char *, const int);
36 void		 DISK_printgeometry(const char *);
37 char		*DISK_readsectors(const uint64_t, const uint32_t);
38 int		 DISK_writesectors(const char *, const uint64_t,
39 	const uint32_t);
40 
41 extern struct disk		disk;
42 extern struct disklabel		dl;
43 
44 #endif /* _DISK_H */
45