Skip to content

Commit d79bd9f

Browse files
committed
libs: move to upstream nfs4j
Acked-by: Target: master Require-book: no Require-notes: no
1 parent dcf77e3 commit d79bd9f

File tree

13 files changed

+220
-119
lines changed

13 files changed

+220
-119
lines changed

modules/dcache/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@
277277
</dependency>
278278

279279
<dependency>
280-
<groupId>org.dcache.chimera</groupId>
281-
<artifactId>jpnfs</artifactId>
280+
<groupId>org.dcache</groupId>
281+
<artifactId>nfs4j-core</artifactId>
282282
</dependency>
283283

284284
</dependencies>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2009 - 2014 Deutsches Elektronen-Synchroton,
3+
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
4+
*
5+
* This library is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU Library General Public License as
7+
* published by the Free Software Foundation; either version 2 of the
8+
* License, or (at your option) any later version.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Library General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Library General Public
16+
* License along with this program (see the file COPYING.LIB for more
17+
* details); if not, write to the Free Software Foundation, Inc.,
18+
* 675 Mass Ave, Cambridge, MA 02139, USA.
19+
*/
20+
package org.dcache.chimera.nfs.v4.xdr;
21+
import java.util.Arrays;
22+
23+
import java.io.Serializable;
24+
import org.dcache.utils.Bytes;
25+
26+
public class stateid4 implements Serializable {
27+
28+
static final long serialVersionUID = -6677150504723505919L;
29+
30+
public uint32_t seqid;
31+
public byte [] other;
32+
33+
public stateid4(byte[] other, int seq) {
34+
this.other = other;
35+
seqid = new uint32_t(seq);
36+
}
37+
38+
public stateid4(org.dcache.nfs.v4.xdr.stateid4 stateid) {
39+
this(stateid.other, stateid.seqid.value);
40+
}
41+
42+
@Override
43+
public boolean equals(Object obj) {
44+
45+
if( obj == this) return true;
46+
if( !(obj instanceof stateid4) ) return false;
47+
48+
final stateid4 other_id = (stateid4) obj;
49+
50+
return Arrays.equals(this.other, other_id.other);
51+
}
52+
53+
@Override
54+
public int hashCode() {
55+
return Arrays.hashCode(other);
56+
}
57+
58+
@Override
59+
public String toString() {
60+
StringBuilder sb = new StringBuilder();
61+
62+
sb.append("[");
63+
sb.append(Bytes.toHexString(other));
64+
sb.append(", seq: ").append(seqid.value).append("]");
65+
return sb.toString();
66+
}
67+
68+
}
69+
// End of stateid4.java
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2009 - 2014 Deutsches Elektronen-Synchroton,
3+
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
4+
*
5+
* This library is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU Library General Public License as
7+
* published by the Free Software Foundation; either version 2 of the
8+
* License, or (at your option) any later version.
9+
*
10+
* This library is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Library General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Library General Public
16+
* License along with this program (see the file COPYING.LIB for more
17+
* details); if not, write to the Free Software Foundation, Inc.,
18+
* 675 Mass Ave, Cambridge, MA 02139, USA.
19+
*/
20+
package org.dcache.chimera.nfs.v4.xdr;
21+
22+
import java.io.Serializable;
23+
24+
public class uint32_t implements Serializable {
25+
26+
static final long serialVersionUID = -6603937444681096490L;
27+
28+
public int value;
29+
30+
public uint32_t(int value) {
31+
this.value = value;
32+
}
33+
34+
}
35+
// End of uint32_t.java

modules/dcache/src/main/java/org/dcache/chimera/nfsv41/door/NFSv3.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55

66
import java.io.IOException;
77

8-
import org.dcache.chimera.FileSystemProvider;
9-
import org.dcache.chimera.nfs.ExportFile;
10-
import org.dcache.chimera.nfs.v3.MountServer;
11-
import org.dcache.chimera.nfs.v3.NfsServerV3;
12-
import org.dcache.chimera.nfs.v3.xdr.mount_prot;
13-
import org.dcache.chimera.nfs.v3.xdr.nfs3_prot;
14-
import org.dcache.chimera.nfs.vfs.VirtualFileSystem;
8+
import org.dcache.nfs.ExportFile;
9+
import org.dcache.nfs.v3.MountServer;
10+
import org.dcache.nfs.v3.NfsServerV3;
11+
import org.dcache.nfs.v3.xdr.mount_prot;
12+
import org.dcache.nfs.v3.xdr.nfs3_prot;
13+
import org.dcache.nfs.vfs.VirtualFileSystem;
1514
import org.dcache.xdr.OncRpcProgram;
1615
import org.dcache.xdr.OncRpcSvc;
1716

modules/dcache/src/main/java/org/dcache/chimera/nfsv41/door/NFSv41Door.java

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -50,37 +50,37 @@
5050
import org.dcache.chimera.FsInode;
5151
import org.dcache.chimera.FsInodeType;
5252
import org.dcache.chimera.JdbcFs;
53-
import org.dcache.chimera.nfs.ChimeraNFSException;
54-
import org.dcache.chimera.nfs.ExportFile;
55-
import org.dcache.chimera.nfs.nfsstat;
56-
import org.dcache.chimera.nfs.v3.MountServer;
57-
import org.dcache.chimera.nfs.v3.NfsServerV3;
58-
import org.dcache.chimera.nfs.v3.xdr.mount_prot;
59-
import org.dcache.chimera.nfs.v3.xdr.nfs3_prot;
60-
import org.dcache.chimera.nfs.v4.CompoundContext;
61-
import org.dcache.chimera.nfs.v4.Layout;
62-
import org.dcache.chimera.nfs.v4.MDSOperationFactory;
63-
import org.dcache.chimera.nfs.v4.NFS4Client;
64-
import org.dcache.chimera.nfs.v4.NFSServerV41;
65-
import org.dcache.chimera.nfs.v4.NFSv41DeviceManager;
66-
import org.dcache.chimera.nfs.v4.NFSv41Session;
67-
import org.dcache.chimera.nfs.v4.NfsIdMapping;
68-
import org.dcache.chimera.nfs.v4.RoundRobinStripingPattern;
69-
import org.dcache.chimera.nfs.v4.StripingPattern;
70-
import org.dcache.chimera.nfs.v4.xdr.device_addr4;
71-
import org.dcache.chimera.nfs.v4.xdr.deviceid4;
72-
import org.dcache.chimera.nfs.v4.xdr.layout4;
73-
import org.dcache.chimera.nfs.v4.xdr.layoutiomode4;
74-
import org.dcache.chimera.nfs.v4.xdr.layouttype4;
75-
import org.dcache.chimera.nfs.v4.xdr.multipath_list4;
76-
import org.dcache.chimera.nfs.v4.xdr.netaddr4;
77-
import org.dcache.chimera.nfs.v4.xdr.nfs4_prot;
78-
import org.dcache.chimera.nfs.v4.xdr.nfs_fh4;
79-
import org.dcache.chimera.nfs.v4.xdr.nfsv4_1_file_layout_ds_addr4;
80-
import org.dcache.chimera.nfs.v4.xdr.stateid4;
81-
import org.dcache.chimera.nfs.vfs.ChimeraVfs;
82-
import org.dcache.chimera.nfs.vfs.Inode;
83-
import org.dcache.chimera.nfs.vfs.VirtualFileSystem;
53+
import org.dcache.nfs.ChimeraNFSException;
54+
import org.dcache.nfs.ExportFile;
55+
import org.dcache.nfs.nfsstat;
56+
import org.dcache.nfs.v3.MountServer;
57+
import org.dcache.nfs.v3.NfsServerV3;
58+
import org.dcache.nfs.v3.xdr.mount_prot;
59+
import org.dcache.nfs.v3.xdr.nfs3_prot;
60+
import org.dcache.nfs.v4.CompoundContext;
61+
import org.dcache.nfs.v4.Layout;
62+
import org.dcache.nfs.v4.MDSOperationFactory;
63+
import org.dcache.nfs.v4.NFS4Client;
64+
import org.dcache.nfs.v4.NFSServerV41;
65+
import org.dcache.nfs.v4.NFSv41DeviceManager;
66+
import org.dcache.nfs.v4.NFSv41Session;
67+
import org.dcache.nfs.v4.NfsIdMapping;
68+
import org.dcache.nfs.v4.RoundRobinStripingPattern;
69+
import org.dcache.nfs.v4.StripingPattern;
70+
import org.dcache.nfs.v4.xdr.device_addr4;
71+
import org.dcache.nfs.v4.xdr.deviceid4;
72+
import org.dcache.nfs.v4.xdr.layout4;
73+
import org.dcache.nfs.v4.xdr.layoutiomode4;
74+
import org.dcache.nfs.v4.xdr.layouttype4;
75+
import org.dcache.nfs.v4.xdr.multipath_list4;
76+
import org.dcache.nfs.v4.xdr.netaddr4;
77+
import org.dcache.nfs.v4.xdr.nfs4_prot;
78+
import org.dcache.nfs.v4.xdr.nfs_fh4;
79+
import org.dcache.nfs.v4.xdr.nfsv4_1_file_layout_ds_addr4;
80+
import org.dcache.nfs.v4.xdr.stateid4;
81+
import org.dcache.nfs.vfs.ChimeraVfs;
82+
import org.dcache.nfs.vfs.Inode;
83+
import org.dcache.nfs.vfs.VirtualFileSystem;
8484
import org.dcache.chimera.nfsv41.mover.NFS4ProtocolInfo;
8585
import org.dcache.commons.util.NDC;
8686
import org.dcache.util.RedirectedTransfer;
@@ -246,7 +246,7 @@ public void destroy() throws IOException {
246246
* and NFSv4.1 device id. Finally, notify waiting request that we have got
247247
* the reply for LAYOUTGET
248248
*/
249-
public void messageArrived(PoolPassiveIoFileMessage<stateid4> message) {
249+
public void messageArrived(PoolPassiveIoFileMessage<org.dcache.chimera.nfs.v4.xdr.stateid4> message) {
250250

251251
String poolName = message.getPoolName();
252252

@@ -278,17 +278,17 @@ public void messageArrived(PoolPassiveIoFileMessage<stateid4> message) {
278278
_log.debug("new mapping: {}", device);
279279
}
280280

281-
stateid4 stateid = message.challange();
282-
283-
NfsTransfer transfer = _ioMessages.get(stateid);
281+
org.dcache.chimera.nfs.v4.xdr.stateid4 legacyStateid = message.challange();
282+
NfsTransfer transfer = _ioMessages.get(new stateid4(legacyStateid.other, legacyStateid.seqid.value));
284283
transfer.redirect(device);
285284
}
286285

287286
public void messageArrived(DoorTransferFinishedMessage transferFinishedMessage) {
288287

289288
NFS4ProtocolInfo protocolInfo = (NFS4ProtocolInfo)transferFinishedMessage.getProtocolInfo();
290289
_log.debug("Mover {} done.", protocolInfo.stateId());
291-
Transfer transfer = _ioMessages.remove(protocolInfo.stateId());
290+
org.dcache.chimera.nfs.v4.xdr.stateid4 legacyStateid = protocolInfo.stateId();
291+
Transfer transfer = _ioMessages.remove(new stateid4(legacyStateid.other, legacyStateid.seqid.value));
292292
if(transfer != null) {
293293
transfer.finished(transferFinishedMessage);
294294
transfer.notifyBilling(transferFinishedMessage.getReturnCode(), "");
@@ -373,7 +373,7 @@ public Layout layoutGet(CompoundContext context, Inode nfsInode, int ioMode, sta
373373
transfer.setClientAddress(remote);
374374
transfer.readNameSpaceEntry();
375375

376-
_ioMessages.put(protocolInfo.stateId(), transfer);
376+
_ioMessages.put(stateid, transfer);
377377

378378
PoolDS ds = getPool(transfer, protocolInfo, ioMode);
379379
deviceid = ds.getDeviceId();
@@ -577,7 +577,7 @@ private static class NfsTransfer extends RedirectedTransfer<PoolDS> {
577577
stateid4 stateid) {
578578
super(pnfs, subject, path);
579579
_stateid = stateid;
580-
_protocolInfo = new NFS4ProtocolInfo(client, _stateid);
580+
_protocolInfo = new NFS4ProtocolInfo(client, new org.dcache.chimera.nfs.v4.xdr.stateid4(_stateid));
581581
}
582582

583583
@Override

modules/dcache/src/main/java/org/dcache/chimera/nfsv41/door/StrategyIdMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.dcache.auth.Subjects;
1818
import org.dcache.auth.UidPrincipal;
1919
import org.dcache.auth.UserNamePrincipal;
20-
import org.dcache.chimera.nfs.v4.NfsIdMapping;
20+
import org.dcache.nfs.v4.NfsIdMapping;
2121
import org.dcache.xdr.RpcLoginService;
2222

2323
public class StrategyIdMapper implements NfsIdMapping, RpcLoginService {

modules/dcache/src/main/java/org/dcache/chimera/nfsv41/mover/EDSOperationREAD.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
import java.nio.ByteBuffer;
88
import java.util.Map;
99

10-
import org.dcache.chimera.nfs.ChimeraNFSException;
11-
import org.dcache.chimera.nfs.nfsstat;
12-
import org.dcache.chimera.nfs.v4.AbstractNFSv4Operation;
13-
import org.dcache.chimera.nfs.v4.CompoundContext;
14-
import org.dcache.chimera.nfs.v4.xdr.READ4res;
15-
import org.dcache.chimera.nfs.v4.xdr.READ4resok;
16-
import org.dcache.chimera.nfs.v4.xdr.nfs_argop4;
17-
import org.dcache.chimera.nfs.v4.xdr.nfs_opnum4;
18-
import org.dcache.chimera.nfs.v4.xdr.nfs_resop4;
19-
import org.dcache.chimera.nfs.v4.xdr.stateid4;
10+
import org.dcache.nfs.ChimeraNFSException;
11+
import org.dcache.nfs.nfsstat;
12+
import org.dcache.nfs.v4.AbstractNFSv4Operation;
13+
import org.dcache.nfs.v4.CompoundContext;
14+
import org.dcache.nfs.v4.xdr.READ4res;
15+
import org.dcache.nfs.v4.xdr.READ4resok;
16+
import org.dcache.nfs.v4.xdr.nfs_argop4;
17+
import org.dcache.nfs.v4.xdr.nfs_opnum4;
18+
import org.dcache.nfs.v4.xdr.nfs_resop4;
19+
import org.dcache.nfs.v4.xdr.stateid4;
2020
import org.dcache.pool.repository.RepositoryChannel;
2121

2222
public class EDSOperationREAD extends AbstractNFSv4Operation {

modules/dcache/src/main/java/org/dcache/chimera/nfsv41/mover/EDSOperationWRITE.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
import java.io.IOException;
77
import java.util.Map;
88

9-
import org.dcache.chimera.nfs.ChimeraNFSException;
10-
import org.dcache.chimera.nfs.nfsstat;
11-
import org.dcache.chimera.nfs.v4.AbstractNFSv4Operation;
12-
import org.dcache.chimera.nfs.v4.CompoundContext;
13-
import org.dcache.chimera.nfs.v4.xdr.WRITE4res;
14-
import org.dcache.chimera.nfs.v4.xdr.WRITE4resok;
15-
import org.dcache.chimera.nfs.v4.xdr.count4;
16-
import org.dcache.chimera.nfs.v4.xdr.nfs4_prot;
17-
import org.dcache.chimera.nfs.v4.xdr.nfs_argop4;
18-
import org.dcache.chimera.nfs.v4.xdr.nfs_opnum4;
19-
import org.dcache.chimera.nfs.v4.xdr.nfs_resop4;
20-
import org.dcache.chimera.nfs.v4.xdr.stable_how4;
21-
import org.dcache.chimera.nfs.v4.xdr.stateid4;
22-
import org.dcache.chimera.nfs.v4.xdr.uint32_t;
23-
import org.dcache.chimera.nfs.v4.xdr.verifier4;
9+
import org.dcache.nfs.ChimeraNFSException;
10+
import org.dcache.nfs.nfsstat;
11+
import org.dcache.nfs.v4.AbstractNFSv4Operation;
12+
import org.dcache.nfs.v4.CompoundContext;
13+
import org.dcache.nfs.v4.xdr.WRITE4res;
14+
import org.dcache.nfs.v4.xdr.WRITE4resok;
15+
import org.dcache.nfs.v4.xdr.count4;
16+
import org.dcache.nfs.v4.xdr.nfs4_prot;
17+
import org.dcache.nfs.v4.xdr.nfs_argop4;
18+
import org.dcache.nfs.v4.xdr.nfs_opnum4;
19+
import org.dcache.nfs.v4.xdr.nfs_resop4;
20+
import org.dcache.nfs.v4.xdr.stable_how4;
21+
import org.dcache.nfs.v4.xdr.stateid4;
22+
import org.dcache.nfs.v4.xdr.uint32_t;
23+
import org.dcache.nfs.v4.xdr.verifier4;
2424
import org.dcache.pool.movers.IoMode;
2525
import org.dcache.pool.repository.RepositoryChannel;
2626

modules/dcache/src/main/java/org/dcache/chimera/nfsv41/mover/MoverBridge.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import diskCacheV111.util.PnfsId;
44

5-
import org.dcache.chimera.nfs.v4.xdr.stateid4;
5+
import org.dcache.nfs.v4.xdr.stateid4;
66
import org.dcache.pool.movers.IoMode;
77
import org.dcache.pool.movers.ManualMover;
88
import org.dcache.pool.repository.Allocator;

0 commit comments

Comments
 (0)