File: arch-freebsd.c

package info (click to toggle)
diskscan 0.14.1-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 800 kB
  • ctags: 465
  • sloc: ansic: 3,696; sh: 3,565; python: 155; makefile: 41
file content (21 lines) | stat: -rw-r--r-- 378 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "config.h"
#include "arch.h"

#include <sys/disk.h>
#include <sys/ioctl.h>
#include <sys/types.h>

#include "arch-posix.c"

int disk_dev_read_cap(disk_dev_t *dev, uint64_t *size_bytes, uint64_t *sector_size)
{
	if (ioctl(dev->fd, DIOCGMEDIASIZE, size_bytes) < 0) {
		return -1;
	}

	if (ioctl(dev->fd, DIOCGSECTORSIZE, sector_size) < 0) {
		return -1;
	}

	return 0;
}