From 70e9e58ff3136e1498f15055aed38ac41048681c Mon Sep 17 00:00:00 2001 From: Brandon Li Date: Tue, 2 Jul 2013 18:03:59 +0000 Subject: [PATCH] Add the missed file in commit r1499029 git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1499041 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/hadoop/mount/MountdBase.java | 8 +++++--- .../org/apache/hadoop/nfs/nfs3/Nfs3Base.java | 10 ++++++---- .../hadoop/nfs/nfs3/Nfs3FileAttributes.java | 16 ++++++++++++++++ .../nfs/nfs3/response/READDIR3Response.java | 1 + .../nfs/nfs3/response/READDIRPLUS3Response.java | 1 + hadoop-project/pom.xml | 5 +++++ 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java index 534342f33c..8ef39c4766 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/mount/MountdBase.java @@ -50,7 +50,6 @@ public MountdBase(List exports, RpcProgram program) throws IOException { /* Start UDP server */ private void startUDPServer() { - rpcProgram.register(PortmapMapping.TRANSPORT_UDP); SimpleUdpServer udpServer = new SimpleUdpServer(rpcProgram.getPort(), rpcProgram, 1); udpServer.run(); @@ -58,14 +57,17 @@ private void startUDPServer() { /* Start TCP server */ private void startTCPServer() { - rpcProgram.register(PortmapMapping.TRANSPORT_TCP); SimpleTcpServer tcpServer = new SimpleTcpServer(rpcProgram.getPort(), rpcProgram, 1); tcpServer.run(); } - public void start() { + public void start(boolean register) { startUDPServer(); startTCPServer(); + if (register) { + rpcProgram.register(PortmapMapping.TRANSPORT_UDP); + rpcProgram.register(PortmapMapping.TRANSPORT_TCP); + } } } diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Base.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Base.java index 933115cf88..ec96e61758 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Base.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3Base.java @@ -52,10 +52,12 @@ protected Nfs3Base(MountdBase mountd, RpcProgram program) { this.rpcProgram = program; } - public void start() { - mountd.start(); // Start mountd - rpcProgram.register(PortmapMapping.TRANSPORT_TCP); - startTCPServer(); // Start TCP server + public void start(boolean register) { + mountd.start(register); // Start mountd + startTCPServer(); // Start TCP server + if (register) { + rpcProgram.register(PortmapMapping.TRANSPORT_TCP); + } } private void startTCPServer() { diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3FileAttributes.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3FileAttributes.java index d805aad022..1ba727b447 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3FileAttributes.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/Nfs3FileAttributes.java @@ -96,6 +96,22 @@ public Nfs3FileAttributes(boolean isDir, int nlink, short mode, int uid, this.ctime = this.mtime; } + public Nfs3FileAttributes(Nfs3FileAttributes other) { + this.type = other.getType(); + this.mode = other.getMode(); + this.nlink = other.getNlink(); + this.uid = other.getUid(); + this.gid = other.getGid(); + this.size = other.getSize(); + this.used = other.getUsed(); + this.rdev = new Specdata3(); + this.fsid = other.getFsid(); + this.fileid = other.getFileid(); + this.mtime = new NfsTime(other.getMtime()); + this.atime = new NfsTime(other.getAtime()); + this.ctime = new NfsTime(other.getCtime()); + } + public void serialize(XDR xdr) { xdr.writeInt(type); xdr.writeInt(mode); diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/READDIR3Response.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/READDIR3Response.java index 6adcd0cc23..fa54c5459f 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/READDIR3Response.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/READDIR3Response.java @@ -61,6 +61,7 @@ public static class DirList3 { public DirList3(Entry3[] entries, boolean eof) { this.entries = ObjectArrays.newArray(entries, entries.length); + System.arraycopy(this.entries, 0, entries, 0, entries.length); this.eof = eof; } } diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/READDIRPLUS3Response.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/READDIRPLUS3Response.java index 1102c30d71..77794cf48a 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/READDIRPLUS3Response.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/response/READDIRPLUS3Response.java @@ -65,6 +65,7 @@ public static class DirListPlus3 { public DirListPlus3(EntryPlus3[] entries, boolean eof) { this.entries = ObjectArrays.newArray(entries, entries.length); + System.arraycopy(this.entries, 0, entries, 0, entries.length); this.eof = eof; } diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 4b914cb1cd..ae321cd174 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -92,6 +92,11 @@ hadoop-auth ${project.version} + + org.apache.hadoop + hadoop-nfs + ${project.version} + org.apache.hadoop hadoop-hdfs