libdasd: Provide definition for bus id size

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>
This commit is contained in:
Jan Höppner
2019-04-03 16:33:39 +02:00
parent 8c06dea4e5
commit ab510cff39
3 changed files with 7 additions and 4 deletions

View File

@@ -11,7 +11,6 @@
#define DASDVIEW_H
#include <limits.h>
#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;

View File

@@ -20,6 +20,9 @@
#include <stdio.h>
#include <sys/ioctl.h>
/* 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 */

View File

@@ -12,6 +12,7 @@
#include <errno.h>
#include <stdlib.h>
#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;