15 #include <minix/config.h>
16 #include <minix/const.h>
17 #include <minix/type.h>
18 #include <minix/minlib.h>
19 #include <minix/partition.h>
20 #include <sys/ioctl.h>
21 #include <sys/ioc_disk.h>
25 /*================================================================
26 * minix_sizeup - determine device size
27 *===============================================================*/
28 int minix_sizeup(device
, bytes
)
33 struct part_geom entry
;
36 if ((fd
= open(device
, O_RDONLY
)) == -1) {
38 perror("sizeup open");
41 if (ioctl(fd
, DIOCGETP
, &entry
) == -1) {
42 perror("sizeup ioctl");
43 if(fstat(fd
, &st
) < 0) {
45 entry
.size
= ((u64_t
)(0));
47 entry
.size
= ((u64_t
)(st
.st_size
));