Add an option to tunedasd to trigger a copy pair swap using the appropriate
ioctl for DASD devices.
-s, --copy-pair-swap COPY_PAIR
This command requires a comma separated pair of primary,secondary to be
specified. In case of success the old secondary will become the new primary
device and the old primary will become a secondary device.
Example:
tunedasd /dev/dasda -s 0.0.9700,0.0.9740
This will set the old secondary device 0.0.9740 as the new primary.
The old primary device 0.0.9700 will automatically become a secondary
device.
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
In case of an error the ioctl macro only returns errno to the calling
function.
This misses positive returncodes from ioctls.
Change the macro to also return positive return codes.
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Fix Sparse findings like:
warning: symbol 'hash_table_find' was not declared. Should it be static?
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
util_path_sysfs() allocates memory for the created path which must be
freed by the user.
Fixes: 8023a72b11 ("libdasd: Provide function to read ese sysfs attribute")
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Since commit 75e3afb6a0 ("libdasd: Move get_host_access_count() to
libdasd") dasd_get_host_access_count() reports always 0 as the check for
unsuccessful execution of util_sys_get_dev_addr() is incorrect.
Fix the behaviour by turning the check around.
Fixes: 75e3afb6a0 ("libdasd: Move get_host_access_count() to libdasd")
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
dasd_is_ro() uses the O_RDWR flag when opening the file descriptor.
However, an attempt to open the file descriptor of a device that is in
read-only state will fail and the BLKROGET ioctl that is used to
actually determine the read-only state can't be issued.
Change the flag to O_RDONLY to fix this.
Fixes: a5c1923d32 ("libdasd: Add common DASD ioctl's to the lib")
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
The BIODASDRAS (Release Allocated Space) ioctl allows to release
track-wise or full space of an Extent Space Efficient DASD volume.
Provide a library function to utilise this functionality.
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Provide a function to determine whether a DASD is an Extent Space
Efficient (ESE) volume.
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Reading DASD specific sysfs attributes should be collected in one
library. Move get_host_access_count() to libdasd/dasd_sys.
Remove the old implementation and update any user accordingly.
Also, fix the build order for zdsfs.
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Use the newer and more robust libutil provided function
util_sys_get_dev_addr() to identify a device address for any former user
of u2s_getbusid().
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
dasdview and libdasd deal with DASD bus ids and should use a definition
for the size. libu2s already provides a definition, which is used by
dasdview. However, the size of 32 is a bit much and the definition
should be part of libdasd.
Including the terminating null byte ('\0') and considering a DASD bus id
length of 8 characters (e.g. 0.0.4711), this leads to a size of 9.
Provide such a definition via libdasd and update any user.
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Don't rely on rather arbitrary values for the string buffer size of
different sysfs paths. Instead use util_path_sysfs(), which allocates
the exact amount of memory necessary for a certain path string.
As these path strings are dynamically constructed, potential buffer
overflows can hereby be avoided and make the library functions more
robust.
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Enable zdsfs to access datasets that were created after zdsfs was
mounted without the need to remount zdsfs.
This is done by re-reading the VTOC with every readdir system call.
To ensure a consistent VTOC state the DASD device is reserved for
every VTOC read and released afterwards.
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is based on the s390-tools-1.39.0 version.
Changes on top of s390-tools-1.39.0:
- Add MIT license to all source files
- Add LICENSE file
- Transform REAMDE to README.md (markdown)
- Add AUTHORS.md file
- Add CONTRIBUTING.md file
- Move changelog from README to CHANGELOG.md file
Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>