diff mbox

fix qcow.c compiler warnings

Message ID 20170513153244.26918-1-dab21774@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Butterfield May 13, 2017, 3:32 p.m. UTC
Change bdev->blocksize to signed, used in comparison <= 0 in qcow_open().
Change iovec_segment() and iovec_memset() to be static functions.
define _GNU_SOURCE 1 to match -D_GNU_SOURCE
---
 qcow.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Mike Christie May 16, 2017, 5:50 p.m. UTC | #1
On 05/13/2017 10:32 AM, David Butterfield wrote:
> Change bdev->blocksize to signed, used in comparison <= 0 in qcow_open().
> Change iovec_segment() and iovec_memset() to be static functions.
> define _GNU_SOURCE 1 to match -D_GNU_SOURCE
> ---
>  qcow.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/qcow.c b/qcow.c
> index 9f108ae..d6b2bd2 100644
> --- a/qcow.c
> +++ b/qcow.c
> @@ -44,7 +44,7 @@
>   * THE SOFTWARE.
>   */
>  
> -#define _GNU_SOURCE
> +#define _GNU_SOURCE 1

I might have misunderstood the rbd.c GNU_SOURCE plan. Were we going to
fix all the code at the same time?


>  #include <stddef.h>
>  #include <stdint.h>
>  #include <stdbool.h>
> @@ -89,7 +89,7 @@ struct bdev {
>  	/* from TCMU configfs configuration */
>  	int64_t size;
>  	uint64_t num_lbas;
> -	uint32_t block_size;
> +	int32_t block_size;

I have a fix for this already here:

https://github.com/open-iscsi/tcmu-runner/pull/147


>  
>  	int fd;		/* image file descriptor */
>  };
> @@ -1167,7 +1167,7 @@ out:
>  }
>  
>  /* returns number of iovs initialized in seg */
> -size_t iovec_segment(struct iovec *iov, struct iovec *seg, size_t off, size_t len)
> +static size_t iovec_segment(struct iovec *iov, struct iovec *seg, size_t off, size_t len)
>  {
>  	struct iovec *seg_start = seg;
>  
> @@ -1195,7 +1195,7 @@ size_t iovec_segment(struct iovec *iov, struct iovec *seg, size_t off, size_t le
>  	return seg - seg_start;
>  }
>  
> -void iovec_memset(struct iovec *iov, int iovcnt, int c, size_t len)
> +static void iovec_memset(struct iovec *iov, int iovcnt, int c, size_t len)
>  {
>  	while (len && iovcnt) {
>  		size_t n = min(iov->iov_len, len);
> 

I merged the rest of this patch. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/qcow.c b/qcow.c
index 9f108ae..d6b2bd2 100644
--- a/qcow.c
+++ b/qcow.c
@@ -44,7 +44,7 @@ 
  * THE SOFTWARE.
  */
 
-#define _GNU_SOURCE
+#define _GNU_SOURCE 1
 #include <stddef.h>
 #include <stdint.h>
 #include <stdbool.h>
@@ -89,7 +89,7 @@  struct bdev {
 	/* from TCMU configfs configuration */
 	int64_t size;
 	uint64_t num_lbas;
-	uint32_t block_size;
+	int32_t block_size;
 
 	int fd;		/* image file descriptor */
 };
@@ -1167,7 +1167,7 @@  out:
 }
 
 /* returns number of iovs initialized in seg */
-size_t iovec_segment(struct iovec *iov, struct iovec *seg, size_t off, size_t len)
+static size_t iovec_segment(struct iovec *iov, struct iovec *seg, size_t off, size_t len)
 {
 	struct iovec *seg_start = seg;
 
@@ -1195,7 +1195,7 @@  size_t iovec_segment(struct iovec *iov, struct iovec *seg, size_t off, size_t le
 	return seg - seg_start;
 }
 
-void iovec_memset(struct iovec *iov, int iovcnt, int c, size_t len)
+static void iovec_memset(struct iovec *iov, int iovcnt, int c, size_t len)
 {
 	while (len && iovcnt) {
 		size_t n = min(iov->iov_len, len);