diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 8541bde94..eec49cdde 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.23 - ================================== + Update dm-ioctl.h after removal of compat code. Add --readahead to dmsetup. Add external read_ahead library functions and DM_READ_AHEAD_* definitions. Fix double free in a libdevmapper-event error path. diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 72631e2c6..dae804cfb 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -380,17 +380,19 @@ int get_dev_node_read_ahead(const char *dev_name, uint32_t *read_ahead) { int r = 1; int fd; + long read_ahead_long; if ((fd = _open_dev_node(dev_name)) < 0) return_0; - *read_ahead = 0; - - if (ioctl(fd, BLKRAGET, read_ahead)) { + if (ioctl(fd, BLKRAGET, &read_ahead_long)) { log_sys_error("BLKRAGET", dev_name); + *read_ahead = 0; r = 0; - } else + } else { + *read_ahead = (uint32_t) read_ahead_long; log_debug("%s: read ahead is %" PRIu32, dev_name, *read_ahead); + } if (close(fd)) stack; @@ -402,13 +404,14 @@ static int _set_read_ahead(const char *dev_name, uint32_t read_ahead) { int r = 1; int fd; + long read_ahead_long = (long) read_ahead; if ((fd = _open_dev_node(dev_name)) < 0) return_0; log_debug("%s: Setting read ahead to %" PRIu32, dev_name, read_ahead); - if (ioctl(fd, BLKRASET, read_ahead)) { + if (ioctl(fd, BLKRASET, read_ahead_long)) { log_sys_error("BLKRASET", dev_name); r = 0; }