mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
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:
@@ -0,0 +1,24 @@
|
||||
include ../common.mak
|
||||
|
||||
ALL_CPPFLAGS += -DSYSFS
|
||||
|
||||
all: dasdview
|
||||
|
||||
libs = $(rootdir)/libdasd/libdasd.a \
|
||||
$(rootdir)/libzds/libzds.a \
|
||||
$(rootdir)/libvtoc/libvtoc.a \
|
||||
$(rootdir)/libu2s/libu2s.a \
|
||||
$(rootdir)/libutil/libutil.a
|
||||
|
||||
dasdview: dasdview.o $(libs)
|
||||
|
||||
install: all
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man8
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 dasdview $(DESTDIR)$(BINDIR)
|
||||
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 dasdview.8 \
|
||||
$(DESTDIR)$(MANDIR)/man8
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ dasdview core
|
||||
|
||||
.PHONY: all install clean
|
||||
@@ -0,0 +1,218 @@
|
||||
.\" Copyright 2017 IBM Corp.
|
||||
.\" 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 DASDVIEW 8 "Apr 2006" "s390-tools"
|
||||
.SH NAME
|
||||
dasdview \- Display DASD and VTOC information and dump the content of a DASD
|
||||
to the console.
|
||||
.SH SYNOPSIS
|
||||
\fBdasdview\fR [-h] [-v]
|
||||
.br
|
||||
[-b \fIbegin\fR] [-s \fIsize\fR] [-1|-2]
|
||||
.br
|
||||
[-i] [-x] [-j] [-c]
|
||||
.br
|
||||
[-l] [-t {\fIinfo\fR|\fIf1\fR|\fIf3\fR|\fIf4\fR|\fIf5\fR|\fIf7\fR|\fIf8\fR|\fIf9\fR}]
|
||||
.br
|
||||
\fIdevice\fR
|
||||
.SH DESCRIPTION
|
||||
\fBdasdview\fR prints you some useful information of your disks to the console.
|
||||
You can display a disk dump by specifying start point and offset and you can
|
||||
print the volume label and VTOC entries.
|
||||
The \fIdevice\fR is the node of the device (e.g. '/dev/dasda').
|
||||
Any device node created by udev for kernel 2.6 can be used
|
||||
(e.g. '/dev/dasd/0.0.b100/disc').
|
||||
|
||||
DASD devices in raw_track_access mode are supported and detected
|
||||
automatically. When in raw_track_access mode, the same basic
|
||||
functions are available as in the regular mode, but the output may
|
||||
have a slightly different layout:
|
||||
.IP \(bu 2
|
||||
The disk dump functions (\fB-b\fR and \fB-s\fR) print the count,
|
||||
key and data information for the whole track, and not just the
|
||||
contents of the data areas.
|
||||
.IP \(bu 2
|
||||
The VTOC listing (\fB-t\fR) print all specified DSCBs in the same
|
||||
format as in the regular mode, but in the sequence as they appear in
|
||||
the VTOC. The \fB-t info\fR overview contains more details for each
|
||||
data set than in the regular mode, to support the larger variety of
|
||||
data set layouts.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB-h\fR or \fB--help\fR
|
||||
Print usage and exit.
|
||||
|
||||
.TP
|
||||
\fB-v\fR or \fB--version\fR
|
||||
Print version number and exit.
|
||||
|
||||
.TP
|
||||
\fB-b\fR \fIbegin\fR or \fB--begin=\fR\fIbegin\fR
|
||||
Print a disk dump to the console, starting with \fIbegin\fR. The content of
|
||||
the disk will be displayed in hexadecimal numbers, ASCII text and EBCDIC text.
|
||||
If no size is specified dasdview will take the default size. The variable
|
||||
\fIbegin\fR can be specified in one of the following ways:
|
||||
.br
|
||||
|
||||
begin[k|m|b|t|c]
|
||||
|
||||
.br
|
||||
The default for \fIbegin\fR is \fI0\fR.
|
||||
.br
|
||||
|
||||
\fBNote 1:\fR dasdview will show you the content of your disk using the DASD
|
||||
driver. If this driver decides to hide or add some parts of the disk, you have
|
||||
to live with it. This happens for example with the first two tracks of a
|
||||
cdl-formatted disk. In this case the DASD driver fills up shorter blocks with
|
||||
zeros to have a constant blocksize. And all applications, including dasdview,
|
||||
believe it.
|
||||
.br
|
||||
\fBNote 2:\fR In raw_track_access mode \fIbegin\fR must be aligned to
|
||||
track boundaries. A simple way to do that is to specify a track or
|
||||
cylinder as starting point.
|
||||
.br
|
||||
|
||||
examples:
|
||||
.br
|
||||
-b 32 --> start printing at Byte 32
|
||||
.br
|
||||
-b 32k --> start printing at kByte 32
|
||||
.br
|
||||
-b 32m --> start printing at MByte 32
|
||||
.br
|
||||
-b 32b --> start printing at block 32
|
||||
.br
|
||||
-b 32t --> start printing at track 32
|
||||
.br
|
||||
-b 32c --> start printing at cylinder 32
|
||||
|
||||
.TP
|
||||
\fB-s\fR \fIsize\fR or \fB--size=\fR\fIsize\fR
|
||||
Print a disk dump to the console, starting with \fIbegin\fR, specified with
|
||||
the \fB-b\fR option and size \fIsize\fR. The content of the disk will be
|
||||
displayed in hexadecimal numbers, ASCII text and EBCDIC text. If no start
|
||||
value is specified dasdview will take the default start value. The variable
|
||||
\fIsize\fR can be specified in one of the following ways:
|
||||
.br
|
||||
|
||||
size[k|m|b|t|c]
|
||||
|
||||
.br
|
||||
\fBNote:\fR In raw_track_access mode \fIsize\fR must be a multiple of
|
||||
one track. A simple way to do that is to specify the size in tracks or
|
||||
cylinders.
|
||||
|
||||
.br
|
||||
The default for \fIsize\fR is \fI128\fR in regular mode and \fI1t\fR
|
||||
in raw_track_access mode.
|
||||
.br
|
||||
|
||||
examples:
|
||||
.br
|
||||
-s 16 --> use a 16 Byte size
|
||||
.br
|
||||
-s 16k --> use a 16 kByte size
|
||||
.br
|
||||
-s 16m --> use a 16 MByte size
|
||||
.br
|
||||
-s 16b --> use a 16 block size
|
||||
.br
|
||||
-s 16t --> use a 16 track size
|
||||
.br
|
||||
-s 16c --> use a 16 cylinder size
|
||||
|
||||
.TP
|
||||
\fB-1\fR
|
||||
This option tells dasdview to print the disk dump using format 1. This means
|
||||
you will get 16 Bytes per line in hex, ascii and ebcdic. There is no line
|
||||
number.
|
||||
.br
|
||||
The \fB-1\fR option makes only sense with the \fB-b\fR and/or the \fB-s\fR
|
||||
options.
|
||||
.br
|
||||
This is the default.
|
||||
|
||||
.TP
|
||||
\fB-2\fR
|
||||
This option tells dasdview to print the disk dump using format 2. This means
|
||||
you will get 8 Bytes per line in hex, ascii and ebcdic. And in addition a line
|
||||
number and a decimal and hexadecimal byte count will be printed.
|
||||
.br
|
||||
The \fB-2\fR option makes only sense with the \fB-b\fR and/or the \fB-s\fR
|
||||
options. In raw_track_access mode this format is not supported and the
|
||||
option will be ignored.
|
||||
|
||||
.TP
|
||||
\fB-i\fR or \fB--info\fR
|
||||
Print some useful information (e.g. device node/number/type or geometry data).
|
||||
When running dasdview on a kernel 2.6 based distribution the busid
|
||||
is printed instead of the device number.
|
||||
|
||||
.TP
|
||||
\fB-x\fR or \fB--extended\fR
|
||||
Print some more DASD information (e.g. open count, subchannel identifier).
|
||||
|
||||
.TP
|
||||
\fB-j\fR or \fB--volser\fR
|
||||
Print volume serial number (volume identifier).
|
||||
|
||||
.TP
|
||||
\fB-l\fR or \fB--label\fR
|
||||
Print the volume label.
|
||||
|
||||
.TP
|
||||
\fB-c\fR or \fB--characteristic\fR
|
||||
Print some information about the device e.g. if it is encrypted.
|
||||
|
||||
.TP
|
||||
\fB-t\fR \fIspec\fR or \fB--vtoc=\fR\fIspec\fR
|
||||
Print the VTOC (table of content) or single VTOC entries to the console.
|
||||
\fIspec\fR can be one of the following strings:
|
||||
.br
|
||||
|
||||
\fIinfo\fR:
|
||||
.br
|
||||
Gives you a VTOC overview. You will see what other S/390 or zSeries operating
|
||||
systems would see (e.g. data set names and sizes).
|
||||
.br
|
||||
|
||||
\fIf1\fR:
|
||||
.br
|
||||
Print the content of all format 1 DSCBs.
|
||||
.br
|
||||
|
||||
\fIf3\fR:
|
||||
.br
|
||||
Print the content of all format 3 DSCBs.
|
||||
.br
|
||||
|
||||
\fIf4\fR:
|
||||
.br
|
||||
Print the content of the format 4 DSCB.
|
||||
.br
|
||||
|
||||
\fIf5\fR:
|
||||
.br
|
||||
Print the content of the format 5 DSCB.
|
||||
.br
|
||||
|
||||
\fIf7\fR:
|
||||
.br
|
||||
Print the content of the format 7 DSCB.
|
||||
.br
|
||||
|
||||
\fIf8\fR:
|
||||
.br
|
||||
Print the content of all format 8 DSCBs.
|
||||
.br
|
||||
|
||||
\fIf9\fR:
|
||||
.br
|
||||
Print the content of all format 9 DSCBs.
|
||||
.br
|
||||
|
||||
\fIall\fR:
|
||||
.br
|
||||
Print the content of all DSCBs.
|
||||
+2470
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* dasdview - Display DASD and VTOC information or dump the contents of a DASD
|
||||
*
|
||||
* Copyright IBM Corp. 2002, 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.
|
||||
*/
|
||||
|
||||
#ifndef DASDVIEW_H
|
||||
#define DASDVIEW_H
|
||||
|
||||
#include <limits.h>
|
||||
#include "lib/u2s.h"
|
||||
|
||||
/********************************************************************************
|
||||
* SECTION: Definitions needed for DASD-API (see dasd.h)
|
||||
*******************************************************************************/
|
||||
|
||||
#define DASD_IOCTL_LETTER 'D'
|
||||
|
||||
/*
|
||||
* struct dasd_information_t
|
||||
* represents any data about the device, which is visible to userspace.
|
||||
* including foramt and features.
|
||||
*/
|
||||
typedef struct dasd_information_t {
|
||||
unsigned int devno; /* S/390 devno */
|
||||
unsigned int real_devno; /* for aliases */
|
||||
unsigned int schid; /* S/390 subchannel identifier */
|
||||
unsigned int cu_type : 16; /* from SenseID */
|
||||
unsigned int cu_model : 8; /* from SenseID */
|
||||
unsigned int dev_type : 16; /* from SenseID */
|
||||
unsigned int dev_model : 8; /* from SenseID */
|
||||
unsigned int open_count;
|
||||
unsigned int req_queue_len;
|
||||
unsigned int chanq_len; /* length of chanq */
|
||||
char type[4]; /* from discipline.name, 'none' for unknown */
|
||||
unsigned int status; /* current device level */
|
||||
unsigned int label_block; /* where to find the VOLSER */
|
||||
unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
|
||||
unsigned int characteristics_size;
|
||||
unsigned int confdata_size;
|
||||
char characteristics[64]; /* from read_device_characteristics */
|
||||
char configuration_data[256]; /* from read_configuration_data */
|
||||
} dasd_information_t;
|
||||
|
||||
typedef struct dasd_information2_t {
|
||||
unsigned int devno; /* S/390 devno */
|
||||
unsigned int real_devno; /* for aliases */
|
||||
unsigned int schid; /* S/390 subchannel identifier */
|
||||
unsigned int cu_type : 16; /* from SenseID */
|
||||
unsigned int cu_model : 8; /* from SenseID */
|
||||
unsigned int dev_type : 16; /* from SenseID */
|
||||
unsigned int dev_model : 8; /* from SenseID */
|
||||
unsigned int open_count;
|
||||
unsigned int req_queue_len;
|
||||
unsigned int chanq_len; /* length of chanq */
|
||||
char type[4]; /* from discipline.name, 'none' for unknown */
|
||||
unsigned int status; /* current device level */
|
||||
unsigned int label_block; /* where to find the VOLSER */
|
||||
unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
|
||||
unsigned int characteristics_size;
|
||||
unsigned int confdata_size;
|
||||
unsigned char characteristics[64];/*from read_device_characteristics */
|
||||
unsigned char configuration_data[256];/*from read_configuration_data */
|
||||
unsigned int format; /* format info like formatted/cdl/ldl/... */
|
||||
unsigned int features; /* dasd features like 'ro',... */
|
||||
unsigned int reserved0; /* reserved for further use ,... */
|
||||
unsigned int reserved1; /* reserved for further use ,... */
|
||||
unsigned int reserved2; /* reserved for further use ,... */
|
||||
unsigned int reserved3; /* reserved for further use ,... */
|
||||
unsigned int reserved4; /* reserved for further use ,... */
|
||||
unsigned int reserved5; /* reserved for further use ,... */
|
||||
unsigned int reserved6; /* reserved for further use ,... */
|
||||
unsigned int reserved7; /* reserved for further use ,... */
|
||||
} dasd_information2_t;
|
||||
|
||||
struct dasd_eckd_characteristics {
|
||||
unsigned short cu_type;
|
||||
struct {
|
||||
unsigned char support:2;
|
||||
unsigned char async:1;
|
||||
unsigned char reserved:1;
|
||||
unsigned char cache_info:1;
|
||||
unsigned char model:3;
|
||||
} __attribute__ ((packed)) cu_model;
|
||||
unsigned short dev_type;
|
||||
unsigned char dev_model;
|
||||
struct {
|
||||
unsigned char mult_burst:1;
|
||||
unsigned char RT_in_LR:1;
|
||||
unsigned char reserved1:1;
|
||||
unsigned char RD_IN_LR:1;
|
||||
unsigned char reserved2:4;
|
||||
unsigned char reserved3:8;
|
||||
unsigned char defect_wr:1;
|
||||
unsigned char XRC_supported:1;
|
||||
unsigned char reserved4:1;
|
||||
unsigned char striping:1;
|
||||
unsigned char reserved5:4;
|
||||
unsigned char cfw:1;
|
||||
unsigned char reserved6:2;
|
||||
unsigned char cache:1;
|
||||
unsigned char dual_copy:1;
|
||||
unsigned char dfw:1;
|
||||
unsigned char reset_alleg:1;
|
||||
unsigned char sense_down:1;
|
||||
} __attribute__ ((packed)) facilities;
|
||||
unsigned char dev_class;
|
||||
unsigned char unit_type;
|
||||
unsigned short no_cyl;
|
||||
unsigned short trk_per_cyl;
|
||||
unsigned char sec_per_trk;
|
||||
unsigned char byte_per_track[3];
|
||||
unsigned short home_bytes;
|
||||
unsigned char formula;
|
||||
union {
|
||||
struct {
|
||||
unsigned char f1;
|
||||
unsigned short f2;
|
||||
unsigned short f3;
|
||||
} __attribute__ ((packed)) f_0x01;
|
||||
struct {
|
||||
unsigned char f1;
|
||||
unsigned char f2;
|
||||
unsigned char f3;
|
||||
unsigned char f4;
|
||||
unsigned char f5;
|
||||
} __attribute__ ((packed)) f_0x02;
|
||||
} __attribute__ ((packed)) factors;
|
||||
unsigned short first_alt_trk;
|
||||
unsigned short no_alt_trk;
|
||||
unsigned short first_dia_trk;
|
||||
unsigned short no_dia_trk;
|
||||
unsigned short first_sup_trk;
|
||||
unsigned short no_sup_trk;
|
||||
unsigned char MDR_ID;
|
||||
unsigned char OBR_ID;
|
||||
unsigned char director;
|
||||
unsigned char rd_trk_set;
|
||||
unsigned short max_rec_zero;
|
||||
unsigned char reserved1;
|
||||
unsigned char RWANY_in_LR;
|
||||
unsigned char factor6;
|
||||
unsigned char factor7;
|
||||
unsigned char factor8;
|
||||
unsigned char reserved2[3];
|
||||
unsigned char reserved3[6];
|
||||
unsigned int long_no_cyl;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* values to be used for dasd_information2_t.format
|
||||
* 0x00: NOT formatted
|
||||
* 0x01: Linux disc layout
|
||||
* 0x02: Common disc layout
|
||||
*/
|
||||
#define DASD_FORMAT_NONE 0
|
||||
#define DASD_FORMAT_LDL 1
|
||||
#define DASD_FORMAT_CDL 2
|
||||
|
||||
/*
|
||||
* values to be used for dasd_information2_t.features
|
||||
* 0x00: default features
|
||||
* 0x01: readonly (ro)
|
||||
* 0x02: use diag discipline (diag)
|
||||
*/
|
||||
#define DASD_FEATURE_DEFAULT 0
|
||||
#define DASD_FEATURE_READONLY 1
|
||||
#define DASD_FEATURE_USEDIAG 2
|
||||
|
||||
/* Get information on a dasd device (enhanced) */
|
||||
#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
|
||||
#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
|
||||
|
||||
/********************************************************************************
|
||||
* SECTION: Further IOCTL Definitions (see fs.h and hdreq.h)
|
||||
*******************************************************************************/
|
||||
/* get block device sector size */
|
||||
#define BLKSSZGET _IO(0x12,104)
|
||||
/* return device size in bytes (u64 *arg) */
|
||||
#define BLKGETSIZE64 _IOR(0x12,114,size_t)
|
||||
|
||||
/* get device geometry */
|
||||
#define HDIO_GETGEO 0x0301
|
||||
|
||||
/********************************************************************************
|
||||
* SECTION: DASDVIEW internal types
|
||||
*******************************************************************************/
|
||||
|
||||
#define LINE_LENGTH 80
|
||||
#define DASDVIEW_ERROR "dasdview:"
|
||||
#define DEFAULT_BEGIN 0
|
||||
#define DEFAULT_SIZE 128
|
||||
#define NO_PART_LABELS 8 /* for partition related labels (f1,f8 and f9) */
|
||||
#define SEEK_STEP 4194304LL
|
||||
#define DUMP_STRING_SIZE 1024LL
|
||||
|
||||
#define ERROR_STRING_SIZE 1024
|
||||
static char error_str[ERROR_STRING_SIZE];
|
||||
|
||||
enum dasdview_failure {
|
||||
open_error,
|
||||
seek_error,
|
||||
read_error,
|
||||
ioctl_error,
|
||||
usage_error,
|
||||
disk_layout,
|
||||
vtoc_error
|
||||
};
|
||||
|
||||
typedef struct dasdview_info
|
||||
{
|
||||
char device[PATH_MAX];
|
||||
dasd_information2_t dasd_info;
|
||||
int dasd_info_version;
|
||||
int blksize;
|
||||
struct hd_geometry geo;
|
||||
u_int32_t hw_cylinders;
|
||||
|
||||
unsigned long long begin;
|
||||
unsigned long long size;
|
||||
int format1;
|
||||
int format2;
|
||||
|
||||
int action_specified;
|
||||
int begin_specified;
|
||||
int size_specified;
|
||||
int characteristic_specified;
|
||||
int device_id;
|
||||
int general_info;
|
||||
int extended_info;
|
||||
int volser;
|
||||
int vtoc;
|
||||
int vtoc_info;
|
||||
int vtoc_f1;
|
||||
int vtoc_f3;
|
||||
int vtoc_f4;
|
||||
int vtoc_f5;
|
||||
int vtoc_f7;
|
||||
int vtoc_f8;
|
||||
int vtoc_f9;
|
||||
int vtoc_all;
|
||||
int vlabel_info;
|
||||
|
||||
format1_label_t f1[NO_PART_LABELS];
|
||||
format4_label_t f4;
|
||||
format5_label_t f5;
|
||||
format7_label_t f7;
|
||||
format1_label_t f8[NO_PART_LABELS];
|
||||
format9_label_t f9[NO_PART_LABELS];
|
||||
int f1c;
|
||||
int f4c;
|
||||
int f5c;
|
||||
int f7c;
|
||||
int f8c;
|
||||
int f9c;
|
||||
|
||||
char busid[U2S_BUS_ID_SIZE];
|
||||
int busid_valid;
|
||||
int raw_track_access;
|
||||
struct zdsroot *zdsroot;
|
||||
struct raw_vtoc *rawvtoc;
|
||||
struct dasd *dasd;
|
||||
|
||||
} dasdview_info_t;
|
||||
|
||||
#endif /* DASDVIEW_H */
|
||||
Reference in New Issue
Block a user