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/ioc_disk.h>
24 /*================================================================
25 * minix_sizeup - determine device size
26 *===============================================================*/
27 int minix_sizeup(device
, bytes
)
32 struct partition entry
;
35 if ((fd
= open(device
, O_RDONLY
)) == -1) {
37 perror("sizeup open");
40 if (ioctl(fd
, DIOCGETP
, &entry
) == -1) {
41 perror("sizeup ioctl");
42 if(fstat(fd
, &st
) < 0) {
44 entry
.size
= cvu64(0);
46 entry
.size
= cvu64(st
.st_size
);