mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libdasd: Provide function to read ese sysfs attribute
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>
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int dasd_sys_raw_track_access(char *);
|
int dasd_sys_raw_track_access(char *);
|
||||||
|
int dasd_sys_ese(char *);
|
||||||
int dasd_reset_chpid(char *, char *);
|
int dasd_reset_chpid(char *, char *);
|
||||||
int dasd_get_host_access_count(char *device);
|
int dasd_get_host_access_count(char *device);
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,43 @@ int dasd_sys_raw_track_access(char *devnode)
|
|||||||
return (rc == 1) ? 1 : 0;
|
return (rc == 1) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is volume extent space efficient a.k.a. thin-provisioned
|
||||||
|
*
|
||||||
|
* The "devnode" parameter can be any valid relative or absolute path to
|
||||||
|
* a DASD device node, for example:
|
||||||
|
*
|
||||||
|
* - /dev/dasda
|
||||||
|
* - /dev/disk/by-path/ccw-0.0.bf20
|
||||||
|
*
|
||||||
|
* @param[in] devnode Device node of interest
|
||||||
|
*
|
||||||
|
* @retval 1 Volume is extent space efficient
|
||||||
|
* @retval 0 Volume is not extent space efficient or
|
||||||
|
* cannot be determined
|
||||||
|
*/
|
||||||
|
int dasd_sys_ese(char *devnode)
|
||||||
|
{
|
||||||
|
char busid[DASD_BUS_ID_SIZE];
|
||||||
|
char *path;
|
||||||
|
FILE *fp;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (util_sys_get_dev_addr(devnode, busid) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
path = util_path_sysfs("bus/ccw/devices/%s/ese", busid);
|
||||||
|
fp = fopen(path, "r");
|
||||||
|
if (!fp) {
|
||||||
|
free(path);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = fgetc(fp) - '0';
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
return (rc == 1) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
int dasd_get_pm_from_chpid(char *busid, unsigned int chpid, int *mask)
|
int dasd_get_pm_from_chpid(char *busid, unsigned int chpid, int *mask)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user