direct-io.hg
changeset 516:f8d8a9307804
bitkeeper revision 1.283 (3f094288pNoSBSaFk_QayYrITerstw)
Add support for imaginary/virtual/whatever you want to call them partition tables used by raw disks
Change diskno data type back, changing it was a silly idea.
Add support for imaginary/virtual/whatever you want to call them partition tables used by raw disks
Change diskno data type back, changing it was a silly idea.
author | rac61@labyrinth.cl.cam.ac.uk |
---|---|
date | Mon Jul 07 09:51:04 2003 +0000 (2003-07-07) |
parents | 0b00a7979a36 |
children | 93c7dcf4a80e |
files | tools/control/src/org/xenoserver/cmdline/ParsePhysicalGrant.java tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java tools/control/src/org/xenoserver/control/Extent.java tools/control/src/org/xenoserver/control/Partition.java |
line diff
1.1 --- a/tools/control/src/org/xenoserver/cmdline/ParsePhysicalGrant.java Mon Jul 07 09:39:22 2003 +0000 1.2 +++ b/tools/control/src/org/xenoserver/cmdline/ParsePhysicalGrant.java Mon Jul 07 09:51:04 2003 +0000 1.3 @@ -43,8 +43,9 @@ public class ParsePhysicalGrant extends 1.4 1.5 // Convert the partition into a physical extent 1.6 Extent e = p.toExtent(); 1.7 + int partition_no = p.getMinor() & 0x1F; 1.8 1.9 - String output = new CommandPhysicalGrant( d, domain_id, e, mode ).execute(); 1.10 + String output = new CommandPhysicalGrant( d, domain_id, e, mode, partition_no ).execute(); 1.11 if ( output != null ) 1.12 System.out.println( output ); 1.13 }
2.1 --- a/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java Mon Jul 07 09:39:22 2003 +0000 2.2 +++ b/tools/control/src/org/xenoserver/control/CommandPhysicalGrant.java Mon Jul 07 09:51:04 2003 +0000 2.3 @@ -5,6 +5,7 @@ public class CommandPhysicalGrant extend 2.4 private int domain_id; 2.5 private Extent extent; 2.6 private Mode mode; 2.7 + private int partition_no; 2.8 2.9 /** 2.10 * Constructor for CommandPhysicalGrant. 2.11 @@ -12,16 +13,19 @@ public class CommandPhysicalGrant extend 2.12 * @param domain_id Domain to grant access for. 2.13 * @param extent Extent to grant access to. 2.14 * @param mode Access mode to grant. 2.15 + * @param partition_no Partition number to use (or zero for none). 2.16 */ 2.17 public CommandPhysicalGrant( 2.18 Defaults d, 2.19 int domain_id, 2.20 Extent extent, 2.21 - Mode mode) { 2.22 + Mode mode, 2.23 + int partition_no) { 2.24 this.d = d; 2.25 this.domain_id = domain_id; 2.26 this.extent = extent; 2.27 this.mode = mode; 2.28 + this.partition_no = partition_no; 2.29 } 2.30 2.31 public String execute() throws CommandFailedException { 2.32 @@ -30,7 +34,7 @@ public class CommandPhysicalGrant extend 2.33 2.34 try { 2.35 Process start_p; 2.36 - String start_cmdarray[] = new String[6]; 2.37 + String start_cmdarray[] = new String[7]; 2.38 int start_rc; 2.39 start_cmdarray[0] = d.XIToolsDir + "xi_phys_grant"; 2.40 if ( mode == Mode.READ_WRITE ) 2.41 @@ -40,9 +44,10 @@ public class CommandPhysicalGrant extend 2.42 else 2.43 throw new CommandFailedException( "Unknown access mode '" + mode + "'" ); 2.44 start_cmdarray[2] = Integer.toString( domain_id ); 2.45 - start_cmdarray[3] = Short.toString( extent.getDisk() ); 2.46 + start_cmdarray[3] = Integer.toString( extent.getDisk() ); 2.47 start_cmdarray[4] = Long.toString( extent.getOffset() ); 2.48 start_cmdarray[5] = Long.toString( extent.getSize() ); 2.49 + start_cmdarray[6] = Integer.toString( partition_no ); 2.50 2.51 if (Settings.TEST) { 2.52 output = reportCommand(start_cmdarray);
3.1 --- a/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java Mon Jul 07 09:39:22 2003 +0000 3.2 +++ b/tools/control/src/org/xenoserver/control/CommandPhysicalRevoke.java Mon Jul 07 09:51:04 2003 +0000 3.3 @@ -30,7 +30,7 @@ public class CommandPhysicalRevoke exten 3.4 int start_rc; 3.5 start_cmdarray[0] = d.XIToolsDir + "xi_phys_revoke"; 3.6 start_cmdarray[1] = Integer.toString( domain_id ); 3.7 - start_cmdarray[2] = Short.toString( extent.getDisk() ); 3.8 + start_cmdarray[2] = Integer.toString( extent.getDisk() ); 3.9 start_cmdarray[3] = Long.toString( extent.getOffset() ); 3.10 start_cmdarray[4] = Long.toString( extent.getSize() ); 3.11
4.1 --- a/tools/control/src/org/xenoserver/control/Extent.java Mon Jul 07 09:39:22 2003 +0000 4.2 +++ b/tools/control/src/org/xenoserver/control/Extent.java Mon Jul 07 09:51:04 2003 +0000 4.3 @@ -8,11 +8,11 @@ package org.xenoserver.control; 4.4 public class 4.5 Extent 4.6 { 4.7 - short disk; 4.8 + int disk; 4.9 long offset; /* offset into disk */ 4.10 long size; /* size of this extent in 512 byte sectors */ 4.11 4.12 - public short 4.13 + public int 4.14 getDisk() 4.15 { 4.16 return disk;
5.1 --- a/tools/control/src/org/xenoserver/control/Partition.java Mon Jul 07 09:39:22 2003 +0000 5.2 +++ b/tools/control/src/org/xenoserver/control/Partition.java Mon Jul 07 09:51:04 2003 +0000 5.3 @@ -161,11 +161,10 @@ Partition 5.4 { 5.5 Extent e = new Extent(); 5.6 // Build 16-bit disk number.. high 8 bits are the major 5.7 - int disknum = major << 8; 5.8 + e.disk = major << 8; 5.9 // Low 8 bits are the minor, but bottom 5 need to be cleared 5.10 // as they are the partition number, not the disk number 5.11 - disknum |= ( minor & 0xE0 ); 5.12 - e.disk = (short) disknum; 5.13 + e.disk |= ( minor & 0xE0 ); 5.14 e.offset = start_sect; 5.15 e.size = nr_sects; 5.16 return e; 5.17 @@ -179,7 +178,7 @@ Partition 5.18 { 5.19 if ( e.getMajor() != major ) 5.20 return false; 5.21 - if ( e.getMinor() != (minor & 0xE0) ) 5.22 + if ( e.getMinor() != minor ) 5.23 return false; 5.24 if ( e.offset != start_sect ) 5.25 return false;