HDFS-5107. Merging change r1515166 from trunk
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1515218 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
77c5db3940
commit
1c58240ffc
|
@ -17,12 +17,14 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.nfs.nfs3.response;
|
package org.apache.hadoop.nfs.nfs3.response;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.hadoop.nfs.nfs3.Nfs3FileAttributes;
|
import org.apache.hadoop.nfs.nfs3.Nfs3FileAttributes;
|
||||||
import org.apache.hadoop.nfs.nfs3.Nfs3Status;
|
import org.apache.hadoop.nfs.nfs3.Nfs3Status;
|
||||||
import org.apache.hadoop.oncrpc.XDR;
|
import org.apache.hadoop.oncrpc.XDR;
|
||||||
|
|
||||||
import com.google.common.collect.ObjectArrays;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* READDIR3 Response
|
* READDIR3 Response
|
||||||
*/
|
*/
|
||||||
|
@ -56,12 +58,11 @@ public class READDIR3Response extends NFS3Response {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DirList3 {
|
public static class DirList3 {
|
||||||
final Entry3 entries[];
|
final List<Entry3> entries;
|
||||||
final boolean eof;
|
final boolean eof;
|
||||||
|
|
||||||
public DirList3(Entry3[] entries, boolean eof) {
|
public DirList3(Entry3[] entries, boolean eof) {
|
||||||
this.entries = ObjectArrays.newArray(entries, entries.length);
|
this.entries = Collections.unmodifiableList(Arrays.asList(entries));
|
||||||
System.arraycopy(this.entries, 0, entries, 0, entries.length);
|
|
||||||
this.eof = eof;
|
this.eof = eof;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,12 +103,11 @@ public class READDIR3Response extends NFS3Response {
|
||||||
|
|
||||||
if (getStatus() == Nfs3Status.NFS3_OK) {
|
if (getStatus() == Nfs3Status.NFS3_OK) {
|
||||||
xdr.writeLongAsHyper(cookieVerf);
|
xdr.writeLongAsHyper(cookieVerf);
|
||||||
Entry3[] f = dirList.entries;
|
for (Entry3 e : dirList.entries) {
|
||||||
for (int i = 0; i < f.length; i++) {
|
|
||||||
xdr.writeBoolean(true); // Value follows
|
xdr.writeBoolean(true); // Value follows
|
||||||
xdr.writeLongAsHyper(f[i].getFileId());
|
xdr.writeLongAsHyper(e.getFileId());
|
||||||
xdr.writeString(f[i].getName());
|
xdr.writeString(e.getName());
|
||||||
xdr.writeLongAsHyper(f[i].getCookie());
|
xdr.writeLongAsHyper(e.getCookie());
|
||||||
}
|
}
|
||||||
|
|
||||||
xdr.writeBoolean(false);
|
xdr.writeBoolean(false);
|
||||||
|
|
|
@ -17,13 +17,15 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.nfs.nfs3.response;
|
package org.apache.hadoop.nfs.nfs3.response;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.hadoop.nfs.nfs3.FileHandle;
|
import org.apache.hadoop.nfs.nfs3.FileHandle;
|
||||||
import org.apache.hadoop.nfs.nfs3.Nfs3FileAttributes;
|
import org.apache.hadoop.nfs.nfs3.Nfs3FileAttributes;
|
||||||
import org.apache.hadoop.nfs.nfs3.Nfs3Status;
|
import org.apache.hadoop.nfs.nfs3.Nfs3Status;
|
||||||
import org.apache.hadoop.oncrpc.XDR;
|
import org.apache.hadoop.oncrpc.XDR;
|
||||||
|
|
||||||
import com.google.common.collect.ObjectArrays;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* READDIRPLUS3 Response
|
* READDIRPLUS3 Response
|
||||||
*/
|
*/
|
||||||
|
@ -60,16 +62,15 @@ public class READDIRPLUS3Response extends NFS3Response {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DirListPlus3 {
|
public static class DirListPlus3 {
|
||||||
EntryPlus3 entries[];
|
List<EntryPlus3> entries;
|
||||||
boolean eof;
|
boolean eof;
|
||||||
|
|
||||||
public DirListPlus3(EntryPlus3[] entries, boolean eof) {
|
public DirListPlus3(EntryPlus3[] entries, boolean eof) {
|
||||||
this.entries = ObjectArrays.newArray(entries, entries.length);
|
this.entries = Collections.unmodifiableList(Arrays.asList(entries));
|
||||||
System.arraycopy(this.entries, 0, entries, 0, entries.length);
|
|
||||||
this.eof = eof;
|
this.eof = eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryPlus3[] getEntries() {
|
List<EntryPlus3> getEntries() {
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,10 +102,9 @@ public class READDIRPLUS3Response extends NFS3Response {
|
||||||
|
|
||||||
if (getStatus() == Nfs3Status.NFS3_OK) {
|
if (getStatus() == Nfs3Status.NFS3_OK) {
|
||||||
out.writeLongAsHyper(cookieVerf);
|
out.writeLongAsHyper(cookieVerf);
|
||||||
EntryPlus3[] f = dirListPlus.getEntries();
|
for (EntryPlus3 f : dirListPlus.getEntries()) {
|
||||||
for (int i = 0; i < f.length; i++) {
|
|
||||||
out.writeBoolean(true); // next
|
out.writeBoolean(true); // next
|
||||||
f[i].seralize(out);
|
f.seralize(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.writeBoolean(false);
|
out.writeBoolean(false);
|
||||||
|
|
|
@ -67,6 +67,9 @@ Release 2.1.1-beta - UNRELEASED
|
||||||
|
|
||||||
HDFS-5104 Support dotdot name in NFS LOOKUP operation (brandonli)
|
HDFS-5104 Support dotdot name in NFS LOOKUP operation (brandonli)
|
||||||
|
|
||||||
|
HDFS-5107 Fix array copy error in Readdir and Readdirplus responses
|
||||||
|
(brandonli)
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
|
||||||
HDFS-4513. Clarify in the WebHDFS REST API that all JSON respsonses may
|
HDFS-4513. Clarify in the WebHDFS REST API that all JSON respsonses may
|
||||||
|
|
Loading…
Reference in New Issue