Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves compatible with PB size storage file and Linux CentOS 7 commands including iscsiadm, parted, fdisk, mkfs.* #43

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#jSCSI - A Java iSCSI Framework
# jSCSI - A Java iSCSI Framework

jSCSI is a feature-complete iSCSI implementation in Java only.
Platform-independent and fast, jSCSI represents a premium example how low-level protocols can be pushed to higher levels.
jSCSI contains a server (target), a client (initiator) and common classes to work with the protocol.

[![Build Status](https://secure.travis-ci.org/sebastiangraf/jSCSI.png)](http://travis-ci.org/sebastiangraf/jSCSI)

##Using jSCSI
## Using jSCSI

* Get the latest jar over Github or Maven

Expand Down Expand Up @@ -34,29 +34,39 @@ The schema and an example config are accessible as download as well and included

For further documentation and as an example, please refer to the examples in the initiator- and target-module.

##Content
## Content

* README: this readme file
* LICENSE: license file
* bundles: bundles containing the projects
* pom.xml: Simple pom (yes we use Maven)

##License
## Build
* jar only:
```bash
mvn -Dmaven.test.skip=true -Dmaven.source.skip=true -Dmaven.javadoc.skip=true clean package
```
* jar, javadoc and sources:
```bash
mvn -Dmaven.test.skip=true -Pdoclint-java8-disable clean package
```

## License

This work is released in the public domain under the BSD 3-clause license

##Further information
## Further information

The project is currently under refactoring, the documentation is accessible under http://jscsi.org (pointing to http://disy.github.com/jscsi/) and a mailinglist has been set up:
https://mailman.uni-konstanz.de/mailman/listinfo/jscsi

##Publications
## Publications

* A TechReport describes the second iteration of the framework: [PDF](http://nbn-resolving.de/urn:nbn:de:bsz:352-opus-84511)
* The framework was presented at the Jazoon '07 as work in progress: [PDF](http://nbn-resolving.de/urn:nbn:de:bsz:352-opus-84424)
* jSCSI acted as backend for a block visualization presented at the InfoVis 2006: [PDF](http://nbn-resolving.de/urn:nbn:de:bsz:352-opus-69096)

##Concluded Thesis
## Concluded Thesis

* Target 1.0 (english): TO FOLLOW
* Initiator 2.0 (german only): [PDF](http://nbn-resolving.de/urn:nbn:de:bsz:352-opus-130096)
Expand All @@ -65,7 +75,7 @@ https://mailman.uni-konstanz.de/mailman/listinfo/jscsi

Any questions, just contact sebastian.graf AT uni-konstanz.de

##Involved People
## Involved People

jSCSI is maintained by:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Copyright (c) 2012, University of Konstanz, Distributed Systems Group All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or other materials provided with the
* distribution. * Neither the name of the University of Konstanz nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
Expand All @@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.Iterator;

import com.google.common.io.BaseEncoding;
import org.jscsi.exception.InternetSCSIException;
import org.jscsi.parser.datasegment.AbstractDataSegment;
import org.jscsi.parser.datasegment.IDataSegmentIterator.IDataSegmentChunk;
Expand All @@ -39,7 +40,7 @@
* <h1>ProtocolDataUnit</h1>
* <p>
* This class encapsulates a Protocol Data Unit (PDU), which is defined in the iSCSI Standard (RFC 3720).
*
*
* @author Volker Wildi
*/
public final class ProtocolDataUnit {
Expand Down Expand Up @@ -95,7 +96,7 @@ public final class ProtocolDataUnit {

/**
* Default constructor, creates a new, empty ProtcolDataUnit object.
*
*
* @param initHeaderDigest The instance of the digest to use for the Basic Header Segment protection.
* @param initDataDigest The instance of the digest to use for the Data Segment protection.
*/
Expand All @@ -115,7 +116,7 @@ public ProtocolDataUnit (final IDigest initHeaderDigest, final IDigest initDataD

/**
* Serialize all informations of this PDU object to its byte representation.
*
*
* @return The byte representation of this PDU.
* @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
* @throws IOException if an I/O error occurs.
Expand All @@ -134,7 +135,7 @@ public final ByteBuffer serialize () throws InternetSCSIException , IOException
}

offset += serializeAdditionalHeaderSegments(pdu, offset);

// write header digest
// TODO: Move CRC calculation in BasicHeaderSegment.serialize?
if (basicHeaderSegment.getParser().canHaveDigests()) {
Expand All @@ -150,12 +151,12 @@ public final ByteBuffer serialize () throws InternetSCSIException , IOException
offset += serializeDigest(pdu, dataDigest);
}

return (ByteBuffer) pdu.rewind();
return pdu.rewind();
}

/**
* Deserializes (parses) a given byte representation of a PDU to an PDU object.
*
*
* @param pdu The byte representation of an PDU to parse.
* @return The number of bytes, which are serialized.
* @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
Expand All @@ -178,7 +179,7 @@ public final int deserialize (final ByteBuffer pdu) throws InternetSCSIException
/**
* Deserializes a given array starting from offset <code>0</code> and store the informations in the
* BasicHeaderSegment object..
*
*
* @param bhs The array to read from.
* @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
* @throws DigestException There is a mismatch of the digest.
Expand All @@ -202,7 +203,7 @@ private final int deserializeBasicHeaderSegment (final ByteBuffer bhs) throws In
/**
* Deserializes a array (starting from offset <code>0</code>) and store the informations to the
* <code>AdditionalHeaderSegment</code> object.
*
*
* @param pdu The array to read from.
* @return The length of the read bytes.
* @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
Expand All @@ -215,7 +216,7 @@ private final int deserializeAdditionalHeaderSegments (final ByteBuffer pdu) thr
/**
* Deserializes a array (starting from the given offset) and store the informations to the
* <code>AdditionalHeaderSegment</code> object.
*
*
* @param pdu The <code>ByteBuffer</code> to read from.
* @param offset The offset to start from.
* @return The length of the written bytes.
Expand All @@ -241,7 +242,7 @@ private final int deserializeAdditionalHeaderSegments (final ByteBuffer pdu, fin

/**
* Serialize all the contained additional header segments to the destination array starting from the given offset.
*
*
* @param dst The destination array to write in.
* @param offset The offset to start to write in <code>dst</code>.
* @return The written length.
Expand All @@ -259,7 +260,7 @@ private final int serializeAdditionalHeaderSegments (final ByteBuffer dst, final

/**
* Serializes the data segment (binary or key-value pairs) to a destination array, staring from offset to write.
*
*
* @param dst The array to write in.
* @param offset The start offset to start from in <code>dst</code>.
* @return The written length.
Expand All @@ -276,7 +277,7 @@ public final int serializeDataSegment (final ByteBuffer dst, final int offset) t

/**
* Deserializes a array (starting from the given offset) and store the informations to the Data Segment.
*
*
* @param pdu The array to read from.
* @param offset The offset to start from.
* @return The length of the written bytes.
Expand Down Expand Up @@ -312,7 +313,7 @@ private final int deserializeDataSegment (final ByteBuffer pdu, final int offset

/**
* Writes this <code>ProtocolDataUnit</code> object to the given <code>SocketChannel</code>.
*
*
* @param sChannel <code>SocketChannel</code> to write to.
* @return The number of bytes written, possibly zero.
* @throws InternetSCSIException if any violation of the iSCSI-Standard emerge.
Expand All @@ -337,7 +338,7 @@ public final int write (final SocketChannel sChannel) throws InternetSCSIExcepti

/**
* Reads from the given <code>SocketChannel</code> all the neccassary bytes to fill this PDU.
*
*
* @param sChannel <code>SocketChannel</code> to read from.
* @return The number of bytes, possibly zero,or <code>-1</code> if the channel has reached end-of-stream
* @throws IOException if an I/O error occurs.
Expand Down Expand Up @@ -420,7 +421,7 @@ public final void clear () {

/**
* Returns an iterator to all contained Additional Header Segment in this PDU.
*
*
* @return The iterator to the contained Additional Header Segment.
* @see AdditionalHeaderSegment
*/
Expand All @@ -431,7 +432,7 @@ public final Iterator<AdditionalHeaderSegment> getAdditionalHeaderSegments () {

/**
* Returns the Basic Header Segment contained in this PDU.
*
*
* @return The Basic Header Segment.
* @see BasicHeaderSegment
*/
Expand All @@ -442,7 +443,7 @@ public final BasicHeaderSegment getBasicHeaderSegment () {

/**
* Gets the data segment in this PDU.
*
*
* @return The data segment of this <code>ProtocolDataUnit</code> object.
*/
public final ByteBuffer getDataSegment () {
Expand All @@ -458,7 +459,7 @@ public final void setDataSegment (final ByteBuffer dataSegment) {

/**
* Sets a new data segment in this PDU.
*
*
* @param chunk The new data segment of this <code>ProtocolDataUnit</code> object.
*/
public final void setDataSegment (final IDataSegmentChunk chunk) {
Expand All @@ -472,7 +473,7 @@ public final void setDataSegment (final IDataSegmentChunk chunk) {

/**
* Returns the instance of the used digest algorithm for the header.
*
*
* @return The instance of the header digest.
*/
public final IDigest getHeaderDigest () {
Expand All @@ -482,7 +483,7 @@ public final IDigest getHeaderDigest () {

/**
* Sets the digest of the header to use for data integrity.
*
*
* @param newHeaderDigest An instance of the new header digest.
*/
public final void setHeaderDigest (final IDigest newHeaderDigest) {
Expand All @@ -492,7 +493,7 @@ public final void setHeaderDigest (final IDigest newHeaderDigest) {

/**
* Returns the instance of the used digest algorithm for the data segment.
*
*
* @return The instance of the data digest.
*/
public final IDigest getDataDigest () {
Expand All @@ -502,7 +503,7 @@ public final IDigest getDataDigest () {

/**
* Sets the digest of the data segment to use for data integrity.
*
*
* @param newDataDigest An instance of the new data segment digest.
*/
public final void setDataDigest (final IDigest newDataDigest) {
Expand All @@ -516,15 +517,23 @@ public final void setDataDigest (final IDigest newDataDigest) {
/** {@inheritDoc} */
@Override
public final String toString () {

final StringBuilder sb = new StringBuilder(Constants.LOG_INITIAL_SIZE);

sb.append(basicHeaderSegment.toString());

for (AdditionalHeaderSegment ahs : additionalHeaderSegments) {
sb.append(ahs.toString());
}

if (dataSegment.limit () > 0) {
sb.append (" DataSegment (first 16 bytes): 0x");
byte[] preview = new byte [Math.min (dataSegment.limit (), 16)];
// NOT to use mark and reset because
// "If the mark is defined and larger than the new position then it is discarded."
int pos = dataSegment.position ();
dataSegment.position (0).get (preview).position (pos);
sb.append (BaseEncoding.base16 ().withSeparator (" ", 2).encode (preview));
}

return sb.toString();
}

Expand Down Expand Up @@ -567,7 +576,7 @@ public int hashCode() {

/**
* Calculates the needed size (in bytes) of serializing this object.
*
*
* @return The needed size to store this object.
*/
private final int calcSize () {
Expand Down
Loading