debuggers.hg

changeset 593:83633bb4e30d

bitkeeper revision 1.309 (3f0bd25fPW7xLRFTd6zoyvGk-MalrQ)

Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/users/sos22/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/groups/xeno/users/sos22/dont_use_this/xeno.bk
author sos22@labyrinth.cl.cam.ac.uk
date Wed Jul 09 08:29:19 2003 +0000 (2003-07-09)
parents 2a6cc141dd5c c6fbb3f58de1
children c013c04b116d
files BitKeeper/etc/ignore tools/internal/xi_phys_grant.c tools/internal/xi_phys_probe.c tools/internal/xi_phys_revoke.c
line diff
     1.1 --- a/BitKeeper/etc/ignore	Tue Jul 08 15:21:05 2003 +0000
     1.2 +++ b/BitKeeper/etc/ignore	Wed Jul 09 08:29:19 2003 +0000
     1.3 @@ -433,3 +433,6 @@ xenolinux-2.4.21-sparse/arch/xeno/driver
     1.4  xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_physdisk_proc.c~
     1.5  xen/drivers/block/xen_block.c~
     1.6  xen/drivers/block/xen_physdisk.c~
     1.7 +tools/internal/xi_phys_grant.c~
     1.8 +tools/internal/xi_phys_probe.c~
     1.9 +tools/internal/xi_phys_revoke.c~
     2.1 --- a/tools/internal/xi_phys_grant.c	Tue Jul 08 15:21:05 2003 +0000
     2.2 +++ b/tools/internal/xi_phys_grant.c	Wed Jul 09 08:29:19 2003 +0000
     2.3 @@ -10,40 +10,41 @@
     2.4  
     2.5  int main(int argc, char *argv[])
     2.6  {
     2.7 -  xp_disk_t buf;
     2.8 -  int fd;
     2.9 -  char *strbuf;
    2.10 +    xp_disk_t buf;
    2.11 +    int fd;
    2.12 +    char *strbuf;
    2.13  
    2.14 -  if (argc != 7) {
    2.15 -    fprintf(stderr, "Usage: xi_physdev_grant <r/rw> <domain> <device> <start sector> <n_sectors> <partition>\n");
    2.16 -    return 1;
    2.17 -  }
    2.18 +    if (argc != 7) {
    2.19 +	fprintf(stderr,
    2.20 +		"Usage: xi_physdev_grant <r/rw> <domain> <device> <start sector> <n_sectors> <partition>\n");
    2.21 +	return 1;
    2.22 +    }
    2.23  
    2.24 -  buf.mode = 0;
    2.25 -  if (argv[1][0] == 'r')
    2.26 -    buf.mode |= 1;
    2.27 -  else if (argv[1][0] == 'w')
    2.28 -    buf.mode |= 2;
    2.29 -  if (argv[1][1] == 'r')
    2.30 -    buf.mode |= 1;
    2.31 -  else if (argv[1][1] == 'w')
    2.32 -    buf.mode |= 2;
    2.33 -  
    2.34 -  buf.device = atol(argv[3]);
    2.35 -  buf.start_sect = atol(argv[4]);
    2.36 -  buf.n_sectors = atol(argv[5]);
    2.37 -  buf.partition = atol(argv[6]);
    2.38 +    buf.mode = 0;
    2.39 +    if (argv[1][0] == 'r')
    2.40 +	buf.mode |= 1;
    2.41 +    else if (argv[1][0] == 'w')
    2.42 +	buf.mode |= 2;
    2.43 +    if (argv[1][1] == 'r')
    2.44 +	buf.mode |= 1;
    2.45 +    else if (argv[1][1] == 'w')
    2.46 +	buf.mode |= 2;
    2.47  
    2.48 -  asprintf(&strbuf, "/proc/xeno/dom%s/phd", argv[2]);
    2.49 -  fd = open(strbuf, O_WRONLY);
    2.50 -  if (fd < 0) {
    2.51 -    fprintf(stderr, "Can\'t open %s: %s.\n", strbuf, strerror(errno));
    2.52 -    return 1;
    2.53 -  }
    2.54 -  free(strbuf);
    2.55 +    buf.device = atol(argv[3]);
    2.56 +    buf.start_sect = atol(argv[4]);
    2.57 +    buf.n_sectors = atol(argv[5]);
    2.58 +    buf.partition = atol(argv[6]);
    2.59  
    2.60 -  write(fd, &buf, sizeof(buf));
    2.61 -  close(fd);
    2.62 +    asprintf(&strbuf, "/proc/xeno/dom%s/phd", argv[2]);
    2.63 +    fd = open(strbuf, O_WRONLY);
    2.64 +    if (fd < 0) {
    2.65 +	fprintf(stderr, "Can\'t open %s: %s.\n", strbuf, strerror(errno));
    2.66 +	return 1;
    2.67 +    }
    2.68 +    free(strbuf);
    2.69  
    2.70 -  return 0;
    2.71 +    write(fd, &buf, sizeof(buf));
    2.72 +    close(fd);
    2.73 +
    2.74 +    return 0;
    2.75  }
     3.1 --- a/tools/internal/xi_phys_probe.c	Tue Jul 08 15:21:05 2003 +0000
     3.2 +++ b/tools/internal/xi_phys_probe.c	Wed Jul 09 08:29:19 2003 +0000
     3.3 @@ -10,43 +10,41 @@
     3.4  
     3.5  int main(int argc, char *argv[])
     3.6  {
     3.7 -  physdisk_probebuf_t buf;
     3.8 -  int fd;
     3.9 -  int x;
    3.10 -  char *strbuf;
    3.11 +    physdisk_probebuf_t buf;
    3.12 +    int fd;
    3.13 +    int x;
    3.14 +    char *strbuf;
    3.15  
    3.16 -  if (argc != 2) {
    3.17 -    fprintf(stderr, "Usage: xi_phys_probe <domain_nr>\n");
    3.18 -    return 1;
    3.19 -  }
    3.20 +    if (argc != 2) {
    3.21 +	fprintf(stderr, "Usage: xi_phys_probe <domain_nr>\n");
    3.22 +	return 1;
    3.23 +    }
    3.24  
    3.25 -  asprintf(&strbuf, "/proc/xeno/dom%s/phd", argv[1]);
    3.26 -  fd = open(strbuf, O_RDONLY);
    3.27 -  if (fd < 0) {
    3.28 -    fprintf(stderr, "Can\'t open %s: %s.\n", strbuf, strerror(errno));
    3.29 -    return 1;
    3.30 -  }
    3.31 -  free(strbuf);
    3.32 +    asprintf(&strbuf, "/proc/xeno/dom%s/phd", argv[1]);
    3.33 +    fd = open(strbuf, O_RDONLY);
    3.34 +    if (fd < 0) {
    3.35 +	fprintf(stderr, "Can\'t open %s: %s.\n", strbuf, strerror(errno));
    3.36 +	return 1;
    3.37 +    }
    3.38 +    free(strbuf);
    3.39  
    3.40 -  memset(&buf, 0, sizeof(buf));
    3.41 -  buf.n_aces = PHYSDISK_MAX_ACES_PER_REQUEST;
    3.42 -  do {
    3.43 +    memset(&buf, 0, sizeof(buf));
    3.44      buf.n_aces = PHYSDISK_MAX_ACES_PER_REQUEST;
    3.45 -    read(fd, &buf, sizeof(buf));
    3.46 -    if (!buf.n_aces)
    3.47 -      break;
    3.48 +    do {
    3.49 +	buf.n_aces = PHYSDISK_MAX_ACES_PER_REQUEST;
    3.50 +	read(fd, &buf, sizeof(buf));
    3.51 +	if (!buf.n_aces)
    3.52 +	    break;
    3.53  
    3.54 -    for (x = 0; x < buf.n_aces; x++) {
    3.55 -      char read = ( buf.entries[x].mode & 1 ? 'r' : ' ' );
    3.56 -      char write = ( buf.entries[x].mode & 2 ? 'w' : ' ' );
    3.57 -      printf("%x %x %lx %lx %c%c\n", buf.entries[x].device,
    3.58 -	     buf.entries[x].partition,
    3.59 -	     buf.entries[x].start_sect,
    3.60 -	     buf.entries[x].n_sectors,
    3.61 -	     read,
    3.62 -	     write);
    3.63 -    }
    3.64 -    buf.start_ind += buf.n_aces;
    3.65 -  } while (buf.n_aces == PHYSDISK_MAX_ACES_PER_REQUEST);
    3.66 -  return 0;
    3.67 +	for (x = 0; x < buf.n_aces; x++) {
    3.68 +	    char read = (buf.entries[x].mode & 1 ? 'r' : ' ');
    3.69 +	    char write = (buf.entries[x].mode & 2 ? 'w' : ' ');
    3.70 +	    printf("%x %x %lx %lx %c%c\n", buf.entries[x].device,
    3.71 +		   buf.entries[x].partition,
    3.72 +		   buf.entries[x].start_sect,
    3.73 +		   buf.entries[x].n_sectors, read, write);
    3.74 +	}
    3.75 +	buf.start_ind += buf.n_aces;
    3.76 +    } while (buf.n_aces == PHYSDISK_MAX_ACES_PER_REQUEST);
    3.77 +    return 0;
    3.78  }
     4.1 --- a/tools/internal/xi_phys_revoke.c	Tue Jul 08 15:21:05 2003 +0000
     4.2 +++ b/tools/internal/xi_phys_revoke.c	Wed Jul 09 08:29:19 2003 +0000
     4.3 @@ -10,30 +10,31 @@
     4.4  
     4.5  int main(int argc, char *argv[])
     4.6  {
     4.7 -  xp_disk_t buf;
     4.8 -  int fd;
     4.9 -  char *strbuf;
    4.10 +    xp_disk_t buf;
    4.11 +    int fd;
    4.12 +    char *strbuf;
    4.13  
    4.14 -  if (argc != 5) {
    4.15 -    fprintf(stderr, "Usage: xi_physdev_revoke <domain> <device> <start sector> <n_sectors>\n");
    4.16 -    return 1;
    4.17 -  }
    4.18 -
    4.19 -  buf.device = atol(argv[2]);
    4.20 -  buf.mode = 0;
    4.21 -  buf.start_sect = atol(argv[3]);
    4.22 -  buf.n_sectors = atol(argv[4]);
    4.23 +    if (argc != 5) {
    4.24 +	fprintf(stderr,
    4.25 +		"Usage: xi_physdev_revoke <domain> <device> <start sector> <n_sectors>\n");
    4.26 +	return 1;
    4.27 +    }
    4.28  
    4.29 -  asprintf(&strbuf, "/proc/xeno/dom%s/phd", argv[1]);
    4.30 -  fd = open(strbuf, O_WRONLY);
    4.31 -  if (fd < 0) {
    4.32 -    fprintf(stderr, "Can\'t open %s: %s.\n", strbuf, strerror(errno));
    4.33 -    return 1;
    4.34 -  }
    4.35 -  free(strbuf);
    4.36 +    buf.device = atol(argv[2]);
    4.37 +    buf.mode = 0;
    4.38 +    buf.start_sect = atol(argv[3]);
    4.39 +    buf.n_sectors = atol(argv[4]);
    4.40  
    4.41 -  write(fd, &buf, sizeof(buf));
    4.42 -  close(fd);
    4.43 +    asprintf(&strbuf, "/proc/xeno/dom%s/phd", argv[1]);
    4.44 +    fd = open(strbuf, O_WRONLY);
    4.45 +    if (fd < 0) {
    4.46 +	fprintf(stderr, "Can\'t open %s: %s.\n", strbuf, strerror(errno));
    4.47 +	return 1;
    4.48 +    }
    4.49 +    free(strbuf);
    4.50  
    4.51 -  return 0;
    4.52 +    write(fd, &buf, sizeof(buf));
    4.53 +    close(fd);
    4.54 +
    4.55 +    return 0;
    4.56  }