Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
nfs4j
Commits
283c82ed
Commit
283c82ed
authored
Dec 29, 2011
by
Tigran Mkrtchyan
☕
Browse files
nfsv41 client: squash dsRead/Write with nfsRead/Write
parent
47051118
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/org/dcache/chimera/nfs/v4/client/Main.java
View file @
283c82ed
...
...
@@ -771,7 +771,7 @@ public class Main {
0
,
4096
,
stripe
.
getFirstStripeIndex
());
Main
dsClient
=
_servers
.
get
(
deviceAddr
);
dsClient
.
d
sRead
(
dsClient
,
stripe
.
getFh
(),
or
.
stateid
());
dsClient
.
nf
sRead
(
stripe
.
getFh
(),
or
.
stateid
());
layoutreturn
(
or
.
fh
(),
0
,
-
1
,
new
byte
[
0
],
or
.
stateid
());
...
...
@@ -848,7 +848,7 @@ public class Main {
offset
,
data
.
length
,
stripe
.
getFirstStripeIndex
());
Main
dsClient
=
_servers
.
get
(
deviceAddr
);
dsClient
.
d
sWrite
(
dsClient
,
stripe
.
getFh
(),
data
,
offset
,
or
.
stateid
());
dsClient
.
nf
sWrite
(
stripe
.
getFh
(),
data
,
offset
,
or
.
stateid
());
offset
+=
n
;
}
...
...
@@ -863,7 +863,7 @@ public class Main {
}
else
{
// not a pNFS server
nfsWrite
(
or
.
fh
(),
or
.
stateid
());
nfsWrite
(
or
.
fh
(),
"hello world"
.
getBytes
(),
0
,
or
.
stateid
());
}
close
(
or
.
fh
(),
or
.
stateid
());
}
...
...
@@ -1106,7 +1106,7 @@ public class Main {
}
private
void
d
sRead
(
Main
client
,
nfs_fh4
fh
,
stateid4
stateid
)
private
void
nf
sRead
(
nfs_fh4
fh
,
stateid4
stateid
)
throws
OncRpcException
,
IOException
{
COMPOUND4args
args
=
new
CompoundBuilder
()
...
...
@@ -1129,29 +1129,7 @@ public class Main {
}
private
void
nfsRead
(
nfs_fh4
fh
,
stateid4
stateid
)
throws
OncRpcException
,
IOException
{
COMPOUND4args
args
=
new
CompoundBuilder
()
.
withSequence
(
false
,
_sessionid
,
_sequenceID
.
value
.
value
,
12
,
0
)
.
withPutfh
(
fh
)
.
withRead
(
4096
,
0
,
stateid
)
.
withTag
(
"nfs read"
)
.
build
();
COMPOUND4res
compound4res
=
sendCompound
(
args
);
if
(
compound4res
.
status
==
nfsstat
.
NFS_OK
)
{
byte
[]
data
=
new
byte
[
compound4res
.
resarray
.
get
(
2
).
opread
.
resok4
.
data
.
remaining
()];
compound4res
.
resarray
.
get
(
2
).
opread
.
resok4
.
data
.
get
(
data
);
System
.
out
.
println
(
"["
+
new
String
(
data
)
+
"]"
);
}
else
{
System
.
out
.
println
(
"read failed. Error = "
+
nfsstat
.
toString
(
compound4res
.
status
));
}
}
private
void
dsWrite
(
Main
client
,
nfs_fh4
fh
,
byte
[]
data
,
long
offset
,
stateid4
stateid
)
private
void
nfsWrite
(
nfs_fh4
fh
,
byte
[]
data
,
long
offset
,
stateid4
stateid
)
throws
OncRpcException
,
IOException
{
COMPOUND4args
args
=
new
CompoundBuilder
()
...
...
@@ -1171,27 +1149,6 @@ public class Main {
// OK
}
private
void
nfsWrite
(
nfs_fh4
fh
,
stateid4
stateid
)
throws
OncRpcException
,
IOException
{
COMPOUND4args
args
=
new
CompoundBuilder
()
.
withSequence
(
false
,
_sessionid
,
_sequenceID
.
value
.
value
,
12
,
0
)
.
withPutfh
(
fh
)
.
withWrite
(
0
,
"hello world"
.
getBytes
(),
stateid
)
.
withTag
(
"nfs write"
)
.
build
();
COMPOUND4res
compound4res
=
sendCompound
(
args
);
if
(
compound4res
.
status
!=
nfsstat
.
NFS_OK
)
{
System
.
out
.
println
(
"write failed. Error = "
+
nfsstat
.
toString
(
compound4res
.
status
));
}
else
{
System
.
out
.
println
(
compound4res
.
resarray
.
get
(
2
).
opwrite
.
resok4
.
count
.
value
.
value
+
" bytes written."
);
}
}
private
void
sequence
()
throws
OncRpcException
,
IOException
{
COMPOUND4args
args
=
new
CompoundBuilder
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment