public void xdrDecode(XdrDecodingStream xdr) throws OncRpcException, IOException { no_newoffset = xdr.xdrDecodeBoolean(); if ( no_newoffset ) { no_offset = new offset4(xdr); } }
@Test public void shouldSucceedIfSumNotOverflow() throws Exception { offset4 offset = new offset4(5); length4 length = new length4(Long.MAX_VALUE - 10); offset.checkOverflow(length, null); }
public void xdrEncode(XdrEncodingStream xdr) throws OncRpcException, IOException { offset.xdrEncode(xdr); count.xdrEncode(xdr); }
/** * Checks whatever extending a file from this offset with to a given length * will overflow NFS4_UINT64_MAX. * * @see #checkOverflow(long, java.lang.String) * @param length to verify * @param msg included into exception * @throws InvalException if offset + length will overflow */ public void checkOverflow(length4 length, String msg) throws InvalException { checkOverflow(length.value, msg); }
/** * Checks whatever extending a file from this offset with to a given length * will overflow NFS4_UINT64_MAX. * * @see #checkOverflow(long, java.lang.String) * @param length to verify * @param msg included into exception * @throws InvalException if offset + length will overflow */ public void checkOverflow(int length, String msg) throws InvalException { checkOverflow((long)length, msg); }
public void xdrDecode(XdrDecodingStream xdr) throws OncRpcException, IOException { offset = new offset4(xdr); count = new count4(xdr); }
@Test public void shouldSuccessSignedLongOverflow() throws Exception { offset4 offset = new offset4(Long.MAX_VALUE); length4 length = new length4(5); offset.checkOverflow(length, null); } }
@Override public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNFSException, IOException { final COMMIT4res res = result.opcommit; Inode inode = context.currentInode(); _args.opcommit.offset.checkOverflow(_args.opcommit.count.value, "offset + length overflow"); context.getFs().commit(inode, _args.opcommit.offset.value, _args.opcommit.count.value); res.resok4 = new COMMIT4resok(); res.resok4.writeverf = context.getRebootVerifier(); result.opcommit.status = nfsstat.NFS_OK; } }
public void xdrEncode(XdrEncodingStream xdr) throws OncRpcException, IOException { xdr.xdrEncodeBoolean(no_newoffset); if ( no_newoffset ) { no_offset.xdrEncode(xdr); } }
public CompoundBuilder withWrite(long offset, ByteBuffer data, stateid4 stateid) { WRITE4args args = new WRITE4args(); args.stable = stable_how4.FILE_SYNC4; args.offset = new offset4(offset); args.stateid = stateid; args.data = data; nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_WRITE; op.opwrite = args; ops.add(op); return this; }
@Test(expected = InvalException.class) public void shouldfailIfSumOverflow() throws Exception { offset4 offset = new offset4(UnsignedLong.MAX_VALUE.longValue()); length4 length = new length4(5); offset.checkOverflow(length, null); }
_args.opwrite.offset.checkOverflow(_args.opwrite.data.remaining(), "offset + length overflow");
public void xdrEncode(XdrEncodingStream xdr) throws OncRpcException, IOException { stateid.xdrEncode(xdr); offset.xdrEncode(xdr); count.xdrEncode(xdr); }
public void xdrDecode(XdrDecodingStream xdr) throws OncRpcException, IOException { stateid = new stateid4(xdr); offset = new offset4(xdr); count = new count4(xdr); }
_args.oplock.offset.checkOverflow(_args.oplock.length, "offset + len overflow"); NlmLock conflictingLock = e.getConflictingLock(); result.oplock.denied = new LOCK4denied(); result.oplock.denied.offset = new offset4(conflictingLock.getOffset()); result.oplock.denied.length = new length4(conflictingLock.getLength()); result.oplock.denied.locktype = conflictingLock.getLockType();
_args.opwrite.offset.checkOverflow(_args.opwrite.data.remaining(), "offset + length overflow");
public void xdrEncode(XdrEncodingStream xdr) throws OncRpcException, IOException { lrf_offset.xdrEncode(xdr); lrf_length.xdrEncode(xdr); lrf_stateid.xdrEncode(xdr); xdr.xdrEncodeDynamicOpaque(lrf_body); }
public CompoundBuilder withRead(int count, long offset, stateid4 stateid) { READ4args args = new READ4args(); args.count = new count4(count); args.offset = new offset4(offset); args.stateid = stateid; nfs_argop4 op = new nfs_argop4(); op.argop = nfs_opnum4.OP_READ; op.opread = args; ops.add(op); return this; }
@Override public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNFSException, IOException, OncRpcException { // FIXME: sync the data _args.opcommit.offset.checkOverflow(_args.opcommit.count.value, "offset + length overflow"); final COMMIT4res res = result.opcommit; if (context.getFs() != null) { Inode inode = context.currentInode(); Stat stat = context.getFs().getattr(inode); if (stat.type() == Stat.Type.DIRECTORY) { throw new IsDirException("Invalid can't commit a directory"); } if (stat.type() != Stat.Type.REGULAR) { throw new InvalException("Invalid object type"); } FileChannel out = _fsCache.get(inode); Stat newStat = new Stat(); newStat.setSize(out.size()); context.getFs().setattr(context.currentInode(), newStat); } res.status = nfsstat.NFS_OK; res.resok4 = new COMMIT4resok(); res.resok4.writeverf = context.getRebootVerifier(); } }
public void xdrEncode(XdrEncodingStream xdr) throws OncRpcException, IOException { stateid.xdrEncode(xdr); offset.xdrEncode(xdr); xdr.xdrEncodeInt(stable); xdr.xdrEncodeByteBuffer(data); }