1 - fdisk -l inside xen guest shows no disks
2 - "sfdisk -l" tries to open partitions
4 --- util-linux-2.13-pre6/fdisk/sfdisk.c.isfull 2006-06-12 13:31:46.000000000 +0200
5 +++ util-linux-2.13-pre6/fdisk/sfdisk.c 2006-06-12 13:31:47.000000000 +0200
11 -is_probably_full_disk(char *name) {
12 - struct hd_geometry geometry;
15 - fd = open(name, O_RDONLY);
17 - i = ioctl(fd, HDIO_GETGEO, &geometry);
20 - return (fd >= 0 && i == 0 && geometry.start == 0);
23 #define PROC_PARTITIONS "/proc/partitions"
24 static FILE *procf = NULL;
26 --- util-linux-2.13-pre6/fdisk/common.h.isfull 2004-09-06 20:07:11.000000000 +0200
27 +++ util-linux-2.13-pre6/fdisk/common.h 2006-06-12 13:31:47.000000000 +0200
29 extern struct systypes i386_sys_types[];
31 extern char *partname(char *dev, int pno, int lth);
32 +extern int is_probably_full_disk(char *name);
34 int disksize(int fd, unsigned long long *sectors);
35 --- util-linux-2.13-pre6/fdisk/partname.c.isfull 2002-07-07 14:16:43.000000000 +0200
36 +++ util-linux-2.13-pre6/fdisk/partname.c 2006-06-12 13:32:54.000000000 +0200
41 +#include <sys/types.h>
42 +#include <sys/stat.h>
48 partname(char *dev, int pno, int lth) {
49 return partnamebf(dev, pno, lth, 0, NULL);
53 +is_probably_full_disk(char *name) {
55 + struct hd_geometry geometry;
58 + fd = open(name, O_RDONLY);
60 + i = ioctl(fd, HDIO_GETGEO, &geometry);
64 + return (fd >= 0 && geometry.start == 0);
66 + * "silly heuristic" is still so sexy for us, because
67 + * for example Xen doesn't implement HDIO_GETGEO for virtual
68 + * block devices (/dev/xvda).
69 + * -- kzak@redhat.com (23-Feb-2006)
72 + /* silly heuristic */
75 + return !isdigit(name[-1]);
78 --- util-linux-2.13-pre6/fdisk/fdisk.c.isfull 2006-06-12 13:31:47.000000000 +0200
79 +++ util-linux-2.13-pre6/fdisk/fdisk.c 2006-06-12 13:31:47.000000000 +0200
85 -is_probably_full_disk(char *name) {
87 - struct hd_geometry geometry;
90 - fd = open(name, O_RDONLY);
92 - i = ioctl(fd, HDIO_GETGEO, &geometry);
95 - return (fd >= 0 && i == 0 && geometry.start == 0);
97 - /* silly heuristic */
100 - return !isdigit(name[-1]);
105 get_partition_table_geometry(void) {
106 unsigned char *bufp = MBRbuffer;