3 * Based on sizeup() in mkfs.c.
9 #include <machine/partition.h>
10 #include <minix/partition.h>
11 #include <minix/u64.h>
12 #include <sys/ioc_disk.h>
22 unsigned long sizeup(char *);
24 int main(int argc
, char *argv
[])
27 fprintf(stderr
, "Usage: %s <device>\n", argv
[0]);
31 printf("%lu\n", sizeup(argv
[1]));
36 unsigned long sizeup(device
)
40 struct partition entry
;
43 if ((fd
= open(device
, O_RDONLY
)) == -1) {
44 perror("sizeup open");
47 if (ioctl(fd
, DIOCGETP
, &entry
) == -1) {
48 perror("sizeup ioctl");
52 d
= div64u(entry
.size
, 512);