Initial s390-tools-2.0.0 import

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>
This commit is contained in:
Michael Holzheu
2017-08-07 16:13:17 +02:00
commit b627b8d8e1
647 changed files with 168974 additions and 0 deletions

63
hmcdrvfs/Makefile Normal file
View File

@@ -0,0 +1,63 @@
#!/usr/bin/make -f
include ../common.mak
ifeq (${HAVE_FUSE},0)
all:
$(SKIP) HAVE_FUSE=0
install:
$(SKIP) HAVE_FUSE=0
else
check_dep:
$(call check_dep, \
"hmcdrvfs", \
"fuse.h", \
"fuse-devel or libfuse-dev", \
"HAVE_FUSE=0")
ifneq ($(shell sh -c 'command -v pkg-config'),)
FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse)
FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse)
else
FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse
FUSE_LDLIBS = -lfuse
endif
ALL_CFLAGS += -DFUSE_USE_VERSION=26 -D_LARGEFILE_SOURCE $(FUSE_CFLAGS)
LDLIBS += $(FUSE_LDLIBS) -lpthread -lrt -ldl -lm
OBJECTS = hmcdrvfs.o
all: check_dep hmcdrvfs
$(OBJECTS): Makefile
hmcdrvfs: $(OBJECTS)
install: all install-scripts
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 hmcdrvfs \
$(DESTDIR)$(USRBINDIR)
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 hmcdrvfs.1 \
$(DESTDIR)$(MANDIR)/man1
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 lshmc.8 \
$(DESTDIR)$(MANDIR)/man8
install-scripts: lshmc
@for i in $^; do \
cat $$i | \
sed -e 's+%S390_TOOLS_VERSION%+$(S390_TOOLS_RELEASE)+' \
>$(DESTDIR)$(USRSBINDIR)/$$i; \
chown $(OWNER).$(GROUP) $(DESTDIR)$(USRSBINDIR)/$$i; \
chmod 755 $(DESTDIR)$(USRSBINDIR)/$$i; \
done
endif
clean:
rm -f hmcdrvfs *.o
.PHONY: all install install-scripts clean check_dep

417
hmcdrvfs/hmcdrvfs.1 Normal file
View File

@@ -0,0 +1,417 @@
.\" Copyright IBM Corp. 2015, 2017
.\" s390-tools is free software; you can redistribute it and/or modify
.\" it under the terms of the MIT license. See LICENSE for details.
.\"
.TH HMCDRVFS 1 "Mar 2015" "s390-tools"
.\" disable hyphenation for words below
.hw hmcdrv hmcdrvfs fuse DIAGNOSTICS
.SH NAME
hmcdrvfs \- mount a
.SM FUSE
file system for remote access to a
.SM DVD
in a
.SM HMC DVD
drive
.SH SYNOPSIS
mounting:
.nf
.RS
\fBhmcdrvfs\fP MOUNTPOINT [OPTIONS]
.RE
.fi
.PP
unmounting:
.nf
.RS
\fBfusermount\fP -u MOUNTPOINT
.RE
.fi
.SH DESCRIPTION
Use the \fBhmcdrvfs\fP command for read-only access to files
on a
.SM DVD
in the
.SM DVD
drive of an
.SM HMC\c
\&.
On the
.SM HMC\c
, the
.SM DVD
must be assigned to the
.SM LPAR
within which your Linux instance runs. For
.SM z/VM
guests, the
.SM DVD
must be
assigned to the
.SM LPAR
where the
.SM z/VM
hypervisor runs.
With the
.SM DVD
assigned to your Linux instance, this command creates a
.SM FUSE.HMCDRVFS
file system with the content of the
.SM DVD
at the specified mountpoint.
.SH OPTIONS
.SS "General mount options"
.TP
\fB-o\fP opt[,opt...]
.SM FUSE
or mount command options;
for the
.SM FUSE
options see below, for mount options
see \fBmount(8)\fP
.TP
\fB-h\fP, \fB--help\fP
print usage information, then exit (see also DIAGNOSTICS)
.TP
\fB-v\fP, \fB--version\fP
print version information, then exit
.SS "Specific FUSE.HMCDRVFS options"
.TP
.BI "-o hmclang=" LANG
specify the language setting on the
.SM HMC\c
; for valid values, see \fBlocale(1)\fP;
for more information, see DIAGNOSTICS and EXAMPLES
.TP
.BI "-o hmctz=" TZ
specify the time zone setting on the
.SM HMC\c
; for valid values, see \fBtzset(3)\fP;
for more information, see DIAGNOSTICS and EXAMPLES
.SS "Applicable FUSE options (version 2.6)"
.TP
\fB-d\fP, \fB-o debug\fP
enable debug output (implies \fB-f\fP)
.TP
.B -f
foreground operation
.TP
.B -s
disable multi-threaded operation
.TP
.B -o allow_other
allow access by other users
.TP
.B -o allow_root
allow access by root
.TP
.B -o nonempty
allow mounts over non-empty file/dir
.TP
.B -o default_permissions
enable permission checking by kernel
.TP
.BI "-o fsname=" NAME
set file system name
.TP
.BI "-o subtype=" TYPE
set file system type
.TP
.BI "-o max_read=" N
set maximum size of read requests
.TP
.B -o direct_io
use direct I/O
.TP
.B -o kernel_cache
cache files in kernel
.TP
\fB-o \fP[\fBno\fP]\fBauto_cache\fP
enable caching based on modification times
.TP
.BI "-o umask=" M
set file permissions (octal)
.TP
.BI "-o uid=" N
set file owner
.TP
.BI "-o gid=" N
set file group
.TP
.BI "-o entry_timeout=" T
cache timeout for names (default: 1.0 second)
.TP
.BI "-o attr_timeout=" T
cache timeout for attributes (default: 1.0 second)
.TP
.BI "-o ac_attr_timeout=" T
auto cache timeout for attributes (default: \fBattr_timeout\fP)
.TP
.BI "-o max_readahead=" N
set maximum readahead
.TP
.B -o async_read
perform reads asynchronously (default)
.TP
.B -o sync_read
perform reads synchronously
.TP
.B -o no_remote_lock
disable remote file locking
.TP
.B -o intr
allow requests to be interrupted
.TP
.BI "-o intr_signal=" NUM
signal to send on interrupt
.SH EXAMPLES
To mount the
.SM HMC
drive
.SM DVD
at \fI/mnt/hmc\fP without any special options use:
.PP
.nf
.RS
.B $ hmcdrvfs /mnt/hmc
.RE
.fi
.PP
In case the kernel module \fIhmcdrv\fP was not loaded in advance use:
.PP
.nf
.RS
.B # modprobe hmcdrv
.B # hmcdrvfs /mnt/hmc
.RE
.fi
.PP
To translate the UID and GID of files on the
.SM HMC
drive
.SM DVD
to your system users and groups along with overriding the permissions use for
example:
.PP
.nf
.RS
.B $ hmcdrvfs /mnt/hmc -o uid=500 -o gid=1000 -o umask=0337
.RE
.fi
.PP
To speed up transfer rates to frequently accessed directories use
the cache timeout option:
.PP
.nf
.RS
.B $ hmcdrvfs /mnt/hmc -o entry_timeout=60
.RE
.PP
.fi
If the
.SM HMC
is in a different timezone and is configured for a
different language use, for example:
.PP
.nf
.RS
.B $ hmcdrvfs /mnt/hmc -o hmclang=de_DE -o hmctz=Europe/Berlin
.RE
.fi
.PP
or disregarding any daylight saving time, specifying hours west of
Prime Meridian (UTC):
.PP
.nf
.RS
.B $ hmcdrvfs /mnt/hmc -o hmclang=de_DE -o hmctz="GMT-1"
.RE
.fi
.PP
To unmount the
.SM HMC
drive
.SM DVD
mounted on \fI/mnt/hmc\fP use:
.PP
.nf
.RS
.B $ fusermount -u /mnt/hmc
.RE
.fi
.PP
It is also possible to mount by using \fBfstab(5)\fP. Specify
the mount point and associated mount options in \fI/etc/fstab\fP,
for example:
.PP
.nf
.RS
hmcdrvfs /mnt/hmc fuse ro,noatime,allow_other,uid=500,gid=1000
.RE
.fi
.PP
You can then mount the file system with this command:
.PP
.nf
.RS
.B # mount /mnt/hmc
.RE
.fi
.SH FILES
Some general options about mount policy can be set in the
\fI/etc/\:fuse.conf\fP file. These options are:
.TP
.BI "mount_max=" NNN
Set the maximum number of
.SM FUSE
mounts allowed to non-root users.
The default is 1000.
.TP
.B user_allow_other
Allow non-root users to specify the \fBallow_other\fP or \fBallow_root\fP
mount options.
.SH DIAGNOSTICS
.IP 1. 3
The
.SM FUSE.HMCDRVFS
file system needs access to device node \fI/dev/\:hmcdrv\fP. This node is
created automatically when the \fIhmcdrv\fP kernel module is loaded (see Linux
kernel configuration option
.SM CONFIG_HMC_DRV\c
). The user process that runs the \fBhmcdrvfs\fP command must have
sufficient privileges to read from and write to node \fI/dev/\:hmcdrv\fP.
Use the commands \fBchown(1)\fP, \fBchgrp(1)\fP and/or \fBchmod(1)\fP on
node \fI/dev/\:hmcdrv\fP to ensure this condition.
.IP 2. 3
In addition to the required permissions, there are some environmental
requirements:
.RS
.IP - 2
In a
.SM z/VM
environment, the
.SM z/VM
guest virtual machine must have at least privilege class B.
.IP - 2
For Linux in
.SM LPAR
mode, the
.SM LPAR
activation profile must allow issuing
.SM SCLP
requests.
.IP - 2
On the
.SM HMC\c
, the
.SM DVD
must be assigned to the associated system image (use menu \fIAccess Removable
Media\fP).
.RE
.IP 3. 3
The
.SM FUSE.HMCDRVFS
file system maintains a file attributes cache, with an aging timeout. This
timeout is related to the \fBentry_timeout\fP and \fBattr_timeout\fP
.SM FUSE
options. Its value exceeds the greater of the two, \fBentry_timeout\fP and
\fBattr_timeout\fP, by 30 - 60 seconds. This timeout affects the performance
of the
.SM FUSE.HMCDRVFS
file system.
.RE
.IP 4. 3
Different language and time zone settings on the
.SM HMC
and your Linux instance can result in incorrect file modification information.
.RS
.IP - 2
Use the \fBhmclang\fP specific
.SM FUSE.HMCDRVFS
option if the language settings
of the
.SM HMC
and your Linux instance do not match. Correctly setting this option prevents
incorrect file modification dates in the file details. Omitting the
\fBhmclang\fP option can result in incorrect dates of the form 01-01-YYYY,
with misleading values for the day and month.
.IP - 2
Use the \fBhmctz\fP specific
.SM FUSE.HMCDRVFS
option if the time zone settings
of the
.SM HMC
and your Linux instance do not match. Correctly setting this option prevents
incorrect file modification times in the file details. Omitting \fBhmctz\fP,
an incorrect specification, or a missing time zone description file can result
in modification times that differ up to 25 hours from the correct times.
Specifications that cannot be interpreted result in GMT/UTC being set. If the
.SM HMC
is set to GMT/UTC, specify \fBhmctz=""\fP.
.RE
.IP 5. 3
The following generic mount options from \fBmount(8)\fP are ignored:
.RS 3
.TP
\fB-w\fP, \fB--rw\fP, \fB-o rw\fP
mount the file system read/write
.TP
.B -o atime
update inode access times on this file system
.RE
.IP 6. 3
The following
.SM FUSE
mount options from \fBmount.fuse(8)\fP are
ignored:
.RS 3
.TP
.B -o hard_remove
immediate removal
.TP
.B -o negative_timeout
cache timeout for deleted names
.TP
.BI "-o max_write=" N
set maximum size of write requests
.TP
.B -o atomic_o_trunc
enable atomic open+truncate support
.TP
.B -o big_writes
enable larger than 4kB writes
.TP
.BI "-o subdir=" DIR
prepend this directory to all paths
.TP
.B -o use_ino
let file system set inode numbers
.TP
.B -o readdir_ino
try to fill in d_ino in readdir
.RE
.SH SEE ALSO
.BR tzset(3),
.BR locale(1),
.BR fusermount(1),
.BR fstab(5),
.BR mount(8),
.B mount.fuse(8)
.BR lshmc(8),
and Linux on System z: Device Drivers, Features and Commands

1573
hmcdrvfs/hmcdrvfs.c Normal file

File diff suppressed because it is too large Load Diff

91
hmcdrvfs/lshmc Normal file
View File

@@ -0,0 +1,91 @@
#!/bin/bash
#
# lshmc - Print files from a HMC drive DVD
#
# Copyright IBM Corp. 2015, 2017
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
#
TOOL=$(basename $0)
FTPDEV="/dev/hmcdrv"
FTPCMD="dir"
#------------------------------------------------------------------------------
# Print usage
#------------------------------------------------------------------------------
function PrintUsage() {
cat <<-EOD
Usage: $(basename $0) [OPTIONS] [FILE]
List information about the FILE(s) residing on a HMC drive DVD.
Use OPTIONS described below or present simple wildcards on
behalf of FILE.
-h, --help Print this help, then exit.
-v, --version Print version information, then exit.
-s, --short Print only files, in a short listing format.
EOD
}
#------------------------------------------------------------------------------
# Print version
#------------------------------------------------------------------------------
function PrintVersion()
{
cat <<-EOD
$TOOL: version %S390_TOOLS_VERSION%
Copyright IBM Corp. 2015, 2017
EOD
}
FILES=""
while [ $# -gt 0 ]; do
case $1 in
--help|-h)
PrintUsage
exit 0
;;
--version|-v)
PrintVersion
exit 0
;;
--short|-s)
FTPCMD="nls"
;;
-*)
echo "$TOOL: Invalid option $1"
echo "Try '$TOOL --help' for more information."
exit 1
;;
*)
FILES="$FILES $1"
;;
esac
shift
done
if [ ! -c "$FTPDEV" ]; then
echo "$TOOL: Device \"$FTPDEV\" does not exist (modprobe hmcdrv ?)"
exit 1
fi
if [ ${#FILES} -eq 0 ]; then
FILES="/"
fi
# open device $FTPDEV and assign the file descriptor to variable fd
exec {fd}<>${FTPDEV}
# echo the FTP command into device file
echo "$FTPCMD $FILES" >&${fd}
# and output the response
cat <&${fd}
STATUS="$?"
# close file descriptor $fd
exec {fd}>&-
exit $STATUS

106
hmcdrvfs/lshmc.8 Normal file
View File

@@ -0,0 +1,106 @@
.\" Copyright IBM Corp. 2015, 2017
.\" s390-tools is free software; you can redistribute it and/or modify
.\" it under the terms of the MIT license. See LICENSE for details.
.\"
.TH LSHMC 8 "Mar 2015" "s390-tools"
.\" disable hyphenation for words below
.hw hmcdrv lshmc
.\" save horizontal spacing to registers
.nr default-word-spacing \n[.ss]
.nr default-sentence-spacing \n[.sss]
.\" define a macro for default horizontal spacing
.de ssd
.ss \n[default-word-spacing] \n[default-sentence-spacing]
..
.SH NAME
lshmc \- list
.SM HMC
drive
.SM DVD
contents
.SH SYNOPSIS
.TP
\fBlshmc\fP [OPTIONS] [FILE]
.SH DESCRIPTION
List files on a
.SM DVD
in the
.SM DVD
drive of the Hardware Management Console
.ss 0
(
.SM HMC
)
.ssd
\&.
By default, the command lists all files in the root directory of the
.SM DVD\c
\&.
Use FILE to list a different set of files. FILE can specify the path, relative
to the
.SM DVD
root directory, for a directory and file and can contain the * and ? wildcard
characters.
.SH OPTIONS
.TP
.B "-h, --help"
Print help text, then exit.
.TP
.B "-v, --version"
Print version information, then exit.
.TP
.B "-s, --short"
Print only regular files (no directories, symbolic links and special files),
in a short listing format.
.SH EXAMPLES
To list the files in a
.SM HMC
drive
.SM DVD
root directory use:
.PP
.nf
.RS
.B # lshmc
.RE
.fi
.PP
In case the kernel module \fIhmcdrv\fP was not loaded in advance use:
.PP
.nf
.RS
.B # modprobe hmcdrv
.B # lshmc
.RE
.fi
.PP
To list all HTML files in subdirectory \fIwww\fP use:
.PP
.nf
.RS
.B # lshmc /www/*.html
.RE
.fi
.PP
.SH DIAGNOSTICS
The \fBlshmc\fP command needs access to device node \fI/dev/\:hmcdrv\fP. This
node is created automatically when the \fIhmcdrv\fP kernel module is loaded
(see Linux kernel configuration option
.SM CONFIG_HMC_DRV\c
). The user process that runs the \fBlshmc\fP command must have sufficient
privileges to read from and write to node \fI/dev/\:hmcdrv\fP. Use the commands
\fBchown(1)\fP, \fBchgrp(1)\fP and/or \fBchmod(1)\fP on node
\fI/dev/\:hmcdrv\fP to ensure this condition.
.SH SEE ALSO
.B ls(1), chown(1), chgrp(1), chmod(1)
and Linux on System z: Device Drivers, Features and Commands