Skip to content

Commit db14099

Browse files
committed
core: FileTracker: Use stateid4.getType instead of byteAt
With the introduction of stateid4.getType, let's not make any further assumptions about how the type is stored in the Opaque. Add a static getType variant in stateid4 and call that instead of Opaque.byteAt. Signed-off-by: Christian Kohlschütter <[email protected]>
1 parent 5db35a0 commit db14099

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/src/main/java/org/dcache/nfs/v4/FileTracker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ public int getShareAccess(NFS4Client client, Inode inode, Opaque stateid)
475475
lock.lock();
476476
try {
477477

478-
switch (stateid.byteAt(11)) {
478+
switch (stateid4.getType(stateid)) {
479479
case Stateids.LOCK_STATE_ID:
480480
NFS4State lockState = client.state(stateid);
481481
stateid = lockState.getOpenState().stateid().getOpaque();

core/src/main/java/org/dcache/nfs/v4/xdr/stateid4.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ public int getType() {
7878
return opaque.byteAt(11);
7979
}
8080

81+
public static int getType(Opaque stateIdOther) {
82+
return stateIdOther.byteAt(11);
83+
}
84+
8185
@Override
8286
public stateid4 clone() {
8387
return new stateid4(seqid, opaque);

0 commit comments

Comments
 (0)