diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-10-11 08:09:11 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-10-11 08:09:11 +0000 |
commit | a80f7fc9097ba24759ebf724cd9da531cf34ca95 (patch) | |
tree | 2324c1d0f5f14e3b2450f41ef1e231a4a55f7605 | |
parent | 6c03ade535f4445bf318c2b10eb4ff7684b17500 (diff) | |
download | xen-a80f7fc9097ba24759ebf724cd9da531cf34ca95.tar.gz xen-a80f7fc9097ba24759ebf724cd9da531cf34ca95.tar.bz2 xen-a80f7fc9097ba24759ebf724cd9da531cf34ca95.zip |
bitkeeper revision 1.501.1.2 (3f87baa7GCRi_yatMEUW36MM6ZAyEQ)
xen_refresh_dev.c:
new file
-rw-r--r-- | .rootkeys | 1 | ||||
-rw-r--r-- | extras/mini-os/Makefile | 1 | ||||
-rw-r--r-- | tools/misc/xen_refresh_dev.c | 49 |
3 files changed, 51 insertions, 0 deletions
@@ -184,6 +184,7 @@ 3f13d81eQ9Vz-h-6RDGFkNR9CRP95g tools/misc/xen_nat_enable 3f13d81e6Z6806ihYYUw8GVKNkYnuw tools/misc/xen_nat_enable.README 3f1668d4F29Jsw0aC0bJEIkOBiagiQ tools/misc/xen_read_console.c +3f87ba90EUVPQLVOlFG0sW89BCwouQ tools/misc/xen_refresh_dev.c 3f72f1bdJPsV3JCnBqs9ddL9tr6D2g xen/COPYING 3f841450eJvqAD1Dldc0_aOweGiglQ xen/GUEST_CHANGES 3ddb79bcbOVHh38VJzc97-JEGD4dJQ xen/Makefile diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile index f437cf2f58..18ae585db7 100644 --- a/extras/mini-os/Makefile +++ b/extras/mini-os/Makefile @@ -35,6 +35,7 @@ $(TARGET): hypervisor-ifs head.o $(OBJS) clean: find . -type f -name '*.o' | xargs rm -f rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz + find . -type l | xargs rm -f %.o: %.c $(HDRS) Makefile $(CC) $(CFLAGS) -c $< -o $@ diff --git a/tools/misc/xen_refresh_dev.c b/tools/misc/xen_refresh_dev.c new file mode 100644 index 0000000000..b9ea025c1f --- /dev/null +++ b/tools/misc/xen_refresh_dev.c @@ -0,0 +1,49 @@ +/****************************************************************************** + * xen_refresh_dev.c + * + * Refresh our view of a block device by rereading its partition table. This + * is necessary to synchronise with VBD attaches and unattaches in Xen. + * Currently there's no automatic plumbing of attach/unattach requests. + * + * Copyright (c) 2003, K A Fraser + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/ioctl.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <fcntl.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> +#include <sys/mount.h> /* BLKRRPART */ + +int main(int argc, char **argv) +{ + int fd; + + if ( argc != 2 ) + { + fprintf(stderr, "xen_refresh_dev <blkdev>\ne.g., /dev/xvda\n"); + return 1; + } + + if ( (fd = open(argv[1], O_RDWR)) == -1 ) + { + fprintf(stderr, "Error opening %s: %s (%d)\n", + argv[1], strerror(errno), errno); + return 1; + } + + if ( ioctl(fd, BLKRRPART) == -1 ) + { + fprintf(stderr, "Error executing BLKRRPART on %s: %s (%d)\n", + argv[1], strerror(errno), errno); + return 1; + } + + close(fd); + + return 0; +} |