Uses size_t for open_memstream size parameter.

open_memstream expects a size_t pointer instead of an int pointer. In
64-bit platforms, size_t is 64-bit. Using the int pointer will make
other bytes be overriden when the stream is closed and on big-endian
platforms, the size will be updated to 0, which will make tgtadm create
invalid requests for tgtd.

iqn.2010-10.org.example:volume-123
tgtadm: invalid request

The size_t pointer cast hid this problem, which would produce a warning
otherwise.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Add README.rbd to installed docs

Ensure that the README for Ceph RBD integration is included
when installing docs.

Signed-off-by: James Page <james.page@ubuntu.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Add conf.d support to default configuration

Add /etc/tgt/conf.d/*.conf to standard configuration to support
insertion of configuration without changing the default configuration
file.

Signed-off-by: James Page <james.page@ubuntu.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
DOC: Document the blocksize argument to tgtadm

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
iscsi: Add NOP-OUT probe support

Add support for setting NOP-OUT probes to detect dead initiators.
We can set the interval(how frequently to send the probes)
and the count(after how many failures will we tear down the connection)
globally from the tgtd command line.

Optionally, using tgtadm, it is possible to configure the interval/count
for individual targets.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Add support for SoftwareWriteProtect and fix bugs in modeselect

Fix a bug in sbc_mode_page_update. We only have a subpagecode in byte 1
IFF the SPF bit in byte 0 is set.

Add support for using modeselect for the CONTROLS page and set the
mask to allow SWP to be changed.

Add a SWP flag to the device attributes and update this as the CONTROLS/SWP
flag is set by the initiator.

Update SBC so that we treat writeprotect as either the current ->readonly flag
that is used to se the hard property for the lun,   or the ->swp flag
that is set in software by the initiators.
Thus like on a real disk, SWP can be used to turn a read-write LUN to become
temporarily readonly, but SWP can NOT be used to turn a physically readonly
medium to become read-write.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
bs_rbd.c: don't shutdown a nonexistent RADOS cluster

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgtadm: clarify tid==0 error message

The problem with supporting tid 0 is unclear, but this at least
clarifies the message with "you can't use 0" as opposed to "you have
to supply the tid option", since in the case of 0, the user *has*
supplied the option, but with an unacceptable value.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
use oom_score_adj instead of oom_adj for avoiding OOM killer

Using /proc/self/oom_adj for avoiding OOM killer of linux is
deprecated because it will be removed in the future. This patch lets
tgtd use /proc/self/oom_score_adj if it is available.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgt 1.0.38

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Allow recursive includes in /etc/tgt/conf.d

Enable IncludeDirectories so that config files within conf.d can
include arbitrary config files (IncludeGlob is only supported for
a single level in perl's Config-general currently).

We ran into this because instead of adding the globbed include directive
to targets.conf, we added a higher-level .conf that then included
targets.conf as well as conf.d/*.conf.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Add the possibility for building a debian package

Added support files needed for building the package.
Updated the rpm build script to build also deb package.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>