2
* ioctl based topology -- gathers topology information
4
* Copyright (C) 2009 Karel Zak <kzak@redhat.com>
6
* This file may be redistributed under the terms of the
7
* GNU Lesser General Public License.
14
#include <sys/types.h>
22
* ioctl topology values
24
static struct topology_val {
28
/* functions to set probing result */
29
int (*set_ulong)(blkid_probe, unsigned long);
30
int (*set_int)(blkid_probe, int);
33
{ BLKALIGNOFF, NULL, blkid_topology_set_alignment_offset },
34
{ BLKIOMIN, blkid_topology_set_minimum_io_size },
35
{ BLKIOOPT, blkid_topology_set_optimal_io_size },
36
{ BLKPBSZGET, blkid_topology_set_physical_sector_size }
37
/* we read BLKSSZGET in topology.c */
40
static int probe_ioctl_tp(blkid_probe pr,
41
const struct blkid_idmag *mag __attribute__((__unused__)))
45
for (i = 0; i < ARRAY_SIZE(topology_vals); i++) {
46
struct topology_val *val = &topology_vals[i];
50
if (ioctl(pr->fd, val->ioc, &data) == -1)
54
rc = val->set_int(pr, (int) data);
56
rc = val->set_ulong(pr, (unsigned long) data);
68
const struct blkid_idinfo ioctl_tp_idinfo =
71
.probefunc = probe_ioctl_tp,
72
.magics = BLKID_NONE_MAGIC