From ab510cff39ccd8e37e97106f1f708301f557c49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Wed, 3 Apr 2019 16:33:39 +0200 Subject: [PATCH] libdasd: Provide definition for bus id size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- dasdview/dasdview.h | 3 +-- include/lib/dasd_base.h | 3 +++ libdasd/dasd_sys.c | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dasdview/dasdview.h b/dasdview/dasdview.h index 50dd3fe9..35f2c549 100644 --- a/dasdview/dasdview.h +++ b/dasdview/dasdview.h @@ -11,7 +11,6 @@ #define DASDVIEW_H #include -#include "lib/u2s.h" /******************************************************************************** * SECTION: Definitions needed for DASD-API (see dasd.h) @@ -109,7 +108,7 @@ typedef struct dasdview_info int f8c; int f9c; - char busid[U2S_BUS_ID_SIZE]; + char busid[DASD_BUS_ID_SIZE]; int busid_valid; int raw_track_access; struct zdsroot *zdsroot; diff --git a/include/lib/dasd_base.h b/include/lib/dasd_base.h index 3505cdd9..c946ac13 100644 --- a/include/lib/dasd_base.h +++ b/include/lib/dasd_base.h @@ -20,6 +20,9 @@ #include #include +/* A bus id of a DASD is 8 characters long. E.g. 0.0.4711 */ +#define DASD_BUS_ID_SIZE 9 + typedef struct dasd_information2_t { unsigned int devno; /* S/390 devno */ unsigned int real_devno; /* for aliases */ diff --git a/libdasd/dasd_sys.c b/libdasd/dasd_sys.c index c8a6cf91..ac6ea7b6 100644 --- a/libdasd/dasd_sys.c +++ b/libdasd/dasd_sys.c @@ -12,6 +12,7 @@ #include #include +#include "lib/dasd_base.h" #include "lib/dasd_sys.h" #include "lib/util_path.h" @@ -32,7 +33,7 @@ */ int dasd_sys_raw_track_access(char *devnode) { - char busid[9]; + char busid[DASD_BUS_ID_SIZE]; char *path; FILE *fp; int rc; @@ -108,7 +109,7 @@ int dasd_get_pm_from_chpid(char *busid, unsigned int chpid, int *mask) int dasd_reset_chpid(char *devnode, char *chpid_char) { unsigned int chpid; - char busid[9]; + char busid[DASD_BUS_ID_SIZE]; int mask, rc; char *endptr; char *path;