Lines 63-68
Link Here
|
63 |
#endif |
63 |
#endif |
64 |
#endif |
64 |
#endif |
65 |
|
65 |
|
|
|
66 |
#ifdef LCF_EVMS |
67 |
struct evms_get_bmap_t { |
68 |
__u64 rsector; |
69 |
__u32 dev; |
70 |
int status; |
71 |
}; |
72 |
|
73 |
struct evms_version_t { |
74 |
__u32 major; |
75 |
__u32 minor; |
76 |
__u32 patch; |
77 |
}; |
78 |
|
79 |
#ifndef EVMS_GET_BMAP |
80 |
#define EVMS_GET_BMAP _IOWR(MAJOR_EVMS, 0xC7, struct evms_get_bmap_t) |
81 |
#endif |
82 |
#ifndef EVMS_GET_IOCTL_VERSION |
83 |
#define EVMS_GET_IOCTL_VERSION _IOR(MAJOR_EVMS, 0x0, struct evms_version_t) |
84 |
#endif |
85 |
#endif |
86 |
|
66 |
#ifndef HDIO_GETGEO |
87 |
#ifndef HDIO_GETGEO |
67 |
#define HDIO_GETGEO HDIO_REQ |
88 |
#define HDIO_GETGEO HDIO_REQ |
68 |
#endif |
89 |
#endif |
Lines 345-350
Link Here
|
345 |
#endif |
366 |
#endif |
346 |
|
367 |
|
347 |
|
368 |
|
|
|
369 |
#ifdef LCF_EVMS |
370 |
void evms_bmap(struct evms_get_bmap_t *ebm) |
371 |
{ |
372 |
DEVICE dev; |
373 |
static int evms_fd = -1; |
374 |
static dev_t evms_last_dev = 0; |
375 |
|
376 |
if (ebm->dev != evms_last_dev) { |
377 |
char evms_blk[] = "/dev/evms/block_device"; |
378 |
struct evms_version_t evms_ver; |
379 |
|
380 |
// Open the EVMS device |
381 |
if (evms_fd != -1) |
382 |
close(evms_fd); |
383 |
|
384 |
evms_fd = open(evms_blk, O_RDONLY); |
385 |
if (evms_fd < 0) |
386 |
die("Can't open EVMS block device %s.\n", evms_blk); |
387 |
|
388 |
// Get EVMS ioctl version number. |
389 |
if (ioctl(evms_fd, EVMS_GET_IOCTL_VERSION, &evms_ver) < 0) |
390 |
die("EVMS_GET_IOCTL_VERSION failed on %s.\n", evms_blk); |
391 |
|
392 |
// Check that the ioctl version is >= 7.1.0 |
393 |
if (evms_ver.major < 7 || |
394 |
(evms_ver.major == 7 && evms_ver.minor < 1)) |
395 |
die("EVMS ioctl version %d.%d.%d does not support booting.\n", |
396 |
evms_ver.major, evms_ver.minor, evms_ver.patch); |
397 |
close(evms_fd); |
398 |
|
399 |
evms_fd = dev_open(&dev, ebm->dev, O_RDONLY); |
400 |
if (evms_fd < 0) |
401 |
die("Can't open EVMS block device %#x\n", ebm->dev); |
402 |
evms_last_dev = ebm->dev; |
403 |
} |
404 |
|
405 |
if (ioctl(evms_fd, EVMS_GET_BMAP, ebm) < 0) { |
406 |
perror(__FUNCTION__); |
407 |
pdie("EVMS_GET_BMAP error or ioctl unsupported. Can't have image on EVMS volume.\n"); |
408 |
} |
409 |
} |
410 |
#endif |
411 |
|
412 |
|
348 |
static void geo_query_dev(GEOMETRY *geo,int device,int all) |
413 |
static void geo_query_dev(GEOMETRY *geo,int device,int all) |
349 |
{ |
414 |
{ |
350 |
DEVICE dev; |
415 |
DEVICE dev; |
Lines 622-627
Link Here
|
622 |
device = geo->base_dev = lbmA.lv_dev; |
687 |
device = geo->base_dev = lbmA.lv_dev; |
623 |
} |
688 |
} |
624 |
#endif |
689 |
#endif |
|
|
690 |
|
691 |
#ifdef LCF_EVMS |
692 |
if (MAJOR(device) == MAJOR_EVMS) { |
693 |
struct evms_get_bmap_t ebm; |
694 |
|
695 |
ebm.rsector = 0; |
696 |
ebm.dev = device; |
697 |
ebm.status = 0; |
698 |
|
699 |
evms_bmap(&ebm); |
700 |
|
701 |
device = geo->base_dev = ebm.dev; |
702 |
} |
703 |
#endif |
704 |
|
625 |
/* Find underlying device for MD RAID */ |
705 |
/* Find underlying device for MD RAID */ |
626 |
if (MAJOR(device) == MD_MAJOR) { |
706 |
if (MAJOR(device) == MD_MAJOR) { |
627 |
char mdxxx[16]; |
707 |
char mdxxx[16]; |
Lines 824-831
Link Here
|
824 |
block = lbm.lv_block; |
904 |
block = lbm.lv_block; |
825 |
} |
905 |
} |
826 |
#endif |
906 |
#endif |
|
|
907 |
|
908 |
#ifdef LCF_EVMS |
909 |
if (MAJOR(geo->dev) == MAJOR_EVMS) { |
910 |
struct evms_get_bmap_t ebm; |
911 |
|
912 |
ebm.rsector = block * geo->spb; |
913 |
ebm.dev = geo->dev; |
914 |
ebm.status = 0; |
915 |
|
916 |
evms_bmap(&ebm); |
917 |
if (ebm.dev != geo->base_dev) |
918 |
die("EVMS boot volume cannot be on multiple disks.\n"); |
919 |
sector = ebm.rsector + ((offset/SECTOR_SIZE) % geo->spb) + geo->start; |
920 |
} |
921 |
else { |
922 |
sector = block*geo->spb+((offset/SECTOR_SIZE) % geo->spb); |
923 |
sector += geo->start; |
924 |
} |
925 |
#else |
827 |
sector = block*geo->spb+((offset/SECTOR_SIZE) % geo->spb); |
926 |
sector = block*geo->spb+((offset/SECTOR_SIZE) % geo->spb); |
828 |
sector += geo->start; |
927 |
sector += geo->start; |
|
|
928 |
#endif |
829 |
/* Always use CHS addressing on floppies: JRC */ |
929 |
/* Always use CHS addressing on floppies: JRC */ |
830 |
if ((geo->device & 0x80) && (linear || lba32)) { |
930 |
if ((geo->device & 0x80) && (linear || lba32)) { |
831 |
addr->device = geo->device | (linear ? LINEAR_FLAG : (LBA32_FLAG|LBA32_NOCOUNT)) |
931 |
addr->device = geo->device | (linear ? LINEAR_FLAG : (LBA32_FLAG|LBA32_NOCOUNT)) |