Skip to content

Commit

Permalink
nfs4-client: CompoundBuilder#withGetdeviceinfo should accept layout type
Browse files Browse the repository at this point in the history
if client supports multiple layout types, then we need a way to specify which
one is needed.

Acked-by: Paul Millar
Target: master
  • Loading branch information
kofemann committed Feb 22, 2021
1 parent d2ed5a5 commit 11b19a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions basic-client/src/main/java/org/dcache/nfs/v4/client/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ private void get_deviceinfo(deviceid4 deviceId) throws OncRpcException,
IOException {

COMPOUND4args args = new CompoundBuilder()
.withGetdeviceinfo(deviceId)
.withGetdeviceinfo(deviceId, clientLayoutType)
.withTag("get_deviceinfo")
.build();
COMPOUND4res compound4res = sendCompoundInSession(args);
Expand Down Expand Up @@ -1191,7 +1191,7 @@ private void get_devicelist() throws OncRpcException, IOException {

COMPOUND4args args = new CompoundBuilder()
.withPutfh(_rootFh)
.withGetdevicelist()
.withGetdevicelist(clientLayoutType)
.withTag("get_devicelist")
.build();

Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/org/dcache/nfs/v4/CompoundBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009 - 2020 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2021 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -369,7 +369,7 @@ public CompoundBuilder withRead(int count, long offset, stateid4 stateid) {
return this;
}

public CompoundBuilder withGetdevicelist() {
public CompoundBuilder withGetdevicelist(layouttype4 layoutType) {
nfs_argop4 op = new nfs_argop4();
op.argop = nfs_opnum4.OP_GETDEVICELIST;
op.opgetdevicelist = new GETDEVICELIST4args();
Expand All @@ -379,19 +379,19 @@ public CompoundBuilder withGetdevicelist() {
op.opgetdevicelist.gdla_cookieverf = new verifier4();
op.opgetdevicelist.gdla_cookieverf.value = new byte[nfs4_prot.NFS4_VERIFIER_SIZE];

op.opgetdevicelist.gdla_layout_type = layouttype4.LAYOUT4_NFSV4_1_FILES.getValue();
op.opgetdevicelist.gdla_layout_type = layoutType.getValue();
op.opgetdevicelist.gdla_maxdevices = new count4(256);
ops.add(op);
return this;
}

public CompoundBuilder withGetdeviceinfo(deviceid4 devId) {
public CompoundBuilder withGetdeviceinfo(deviceid4 devId, layouttype4 layoutType) {
nfs_argop4 op = new nfs_argop4();
op.argop = nfs_opnum4.OP_GETDEVICEINFO;
op.opgetdeviceinfo = new GETDEVICEINFO4args();

op.opgetdeviceinfo.gdia_device_id = devId;
op.opgetdeviceinfo.gdia_layout_type = layouttype4.LAYOUT4_NFSV4_1_FILES.getValue();
op.opgetdeviceinfo.gdia_layout_type = layoutType.getValue();

op.opgetdeviceinfo.gdia_maxcount = new count4(1024);
op.opgetdeviceinfo.gdia_notify_types = new bitmap4();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testNotificationBitmapSize() throws IOException, URISyntaxException
.build();

COMPOUND4args gdiArgs = new CompoundBuilder()
.withGetdeviceinfo(new deviceid4(new byte[] {0x7}))
.withGetdeviceinfo(new deviceid4(new byte[] {0x7}), layouttype4.LAYOUT4_NFSV4_1_FILES)
.build();

COMPOUND4res res = execute(context, gdiArgs);
Expand Down

0 comments on commit 11b19a6

Please sign in to comment.