summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2007-12-05 14:11:26 +0000
committerAlasdair Kergon <agk@redhat.com>2007-12-05 14:11:26 +0000
commit82bb0e8dda9058f244fef7105d4b722084dcfa07 (patch)
tree2a29fa1e7a1f7b8bb67494ccf9408f613bbce4d9
parent8c01179075d103cbe36182bf81b0535625acce29 (diff)
downloadlvm2-82bb0e8dda9058f244fef7105d4b722084dcfa07.tar.gz
fix ioctls to use long not int
update dm-ioctl.h after compat tidy-up
-rw-r--r--WHATS_NEW_DM1
-rw-r--r--libdm/libdm-common.c13
2 files changed, 9 insertions, 5 deletions
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;
}