-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiskResult.java
executable file
·64 lines (59 loc) · 1.58 KB
/
DiskResult.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* DiskResult.java
*
* Contains the result of a disk read.
*
* You must follow the coding standards distributed
* on the class web page.
*
* (C) 2007,2010 Mike Dahlin
*
*/
public class DiskResult{
public static final int INPROGRESS = 34234;
public static final int OK = 9083;
public static final int FAKE_ERROR = 23955; // We "killed" disk
public static final int REAL_ERROR = 33245; // Real IO eror
public static final int RESERVED_TAG = -1;
private int tag; // Request identifier provided by caller
private int status;
private byte buf[];
private int secNum;
private int operation;
//-------------------------------------------------------
// DiskResult
//-------------------------------------------------------
public DiskResult(int operation, int tag, int sectorNum, byte b[])
{
this.operation = operation;
this.tag = tag;
this.secNum = sectorNum;
this.buf = b;
this.status = INPROGRESS;
}
//-------------------------------------------------------
// get/set fields
//-------------------------------------------------------
public int getOperation(){
return operation;
}
public int getSectorNum(){
return secNum;
}
public byte[] getBuf(){
return buf;
}
public void setStatus(int status){
assert(status == INPROGRESS
|| status == OK
|| status == FAKE_ERROR
|| status == REAL_ERROR);
this.status = status;
}
public int getStatus(){
return status;
}
public int getTag(){
return tag;
}
}