summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMilan Broz <gmazyland@gmail.com>2010-06-01 14:39:10 +0000
committerMilan Broz <gmazyland@gmail.com>2010-06-01 14:39:10 +0000
commit0a68f45bb2d460776357f9699d9911485b895ead (patch)
tree39cd525b2bd5c65260af89e98b223a1a6b689b39 /lib
parentbe60731d0f1144ed2ec1b917de732ab1f3734f82 (diff)
downloadcryptsetup-0a68f45bb2d460776357f9699d9911485b895ead.tar.gz
cryptsetup-0a68f45bb2d460776357f9699d9911485b895ead.tar.bz2
cryptsetup-0a68f45bb2d460776357f9699d9911485b895ead.zip
Fix device alignment ioctl calls parameters.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@251 36d66b0a-2a48-0410-832c-cd162a569da5
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/utils.c b/lib/utils.c
index 589402b..1d1faa9 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -690,8 +690,8 @@ void get_topology_alignment(const char *device,
unsigned long *alignment_offset, /* bytes */
unsigned long default_alignment)
{
- unsigned int dev_alignment_offset = 0;
- unsigned long min_io_size = 0, opt_io_size = 0;
+ int dev_alignment_offset = 0;
+ unsigned int min_io_size = 0, opt_io_size = 0;
int fd;
*required_alignment = default_alignment;
@@ -713,18 +713,18 @@ void get_topology_alignment(const char *device,
opt_io_size = min_io_size;
/* alignment offset, bogus -1 means misaligned/unknown */
- if (ioctl(fd, BLKALIGNOFF, &dev_alignment_offset) == -1 || (int)dev_alignment_offset < 0)
+ if (ioctl(fd, BLKALIGNOFF, &dev_alignment_offset) == -1 || dev_alignment_offset < 0)
dev_alignment_offset = 0;
- if (*required_alignment < min_io_size)
- *required_alignment = min_io_size;
+ if (*required_alignment < (unsigned long)min_io_size)
+ *required_alignment = (unsigned long)min_io_size;
- if (*required_alignment < opt_io_size)
- *required_alignment = opt_io_size;
+ if (*required_alignment < (unsigned long)opt_io_size)
+ *required_alignment = (unsigned long)opt_io_size;
*alignment_offset = (unsigned long)dev_alignment_offset;
- log_dbg("Topology: IO (%lu/%lu), offset = %lu; Required alignment is %lu bytes.",
+ log_dbg("Topology: IO (%u/%u), offset = %lu; Required alignment is %lu bytes.",
min_io_size, opt_io_size, *alignment_offset, *required_alignment);
out:
(void)close(fd);