summaryrefslogtreecommitdiff
path: root/pcap_sg.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-07-14 16:26:16 +0200
committerTobias Klauser <tklauser@distanz.ch>2013-07-14 16:26:16 +0200
commit36a782b897c013ba9b8cd4c3abddbe07758f7a65 (patch)
treea1e80a1c37eafb968e6d4a40d395d833a10d5581 /pcap_sg.c
parentcabf2bedace69096dc6b134e0add5792671a13c6 (diff)
pcap_sg: Fix various compiler warnings
Fix the following compiler warnings that occur when building with "-W -Wall": pcap_sg.c: In function ‘__pcap_sg_inter_iov_hdr_read’: pcap_sg.c:46:89: warning: unused parameter ‘type’ [-Wunused-parameter] pcap_sg.c:47:19: warning: unused parameter ‘packet’ [-Wunused-parameter] pcap_sg.c:47:34: warning: unused parameter ‘len’ [-Wunused-parameter] pcap_sg.c: In function ‘__pcap_sg_inter_iov_data_read’: pcap_sg.c:77:78: warning: unused parameter ‘len’ [-Wunused-parameter] pcap_sg.c: In function ‘pcap_sg_prepare_access’: pcap_sg.c:163:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] pcap_sg.c: In function ‘pcap_sg_prepare_close’: pcap_sg.c:184:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] pcap_sg.c:180:39: warning: unused parameter ‘fd’ [-Wunused-parameter] pcap_sg.c:180:58: warning: unused parameter ‘mode’ [-Wunused-parameter] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'pcap_sg.c')
-rw-r--r--pcap_sg.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/pcap_sg.c b/pcap_sg.c
index 19bec40..7a2bfb0 100644
--- a/pcap_sg.c
+++ b/pcap_sg.c
@@ -43,8 +43,8 @@ static ssize_t pcap_sg_write(int fd, pcap_pkthdr_t *phdr, enum pcap_type type,
return ret;
}
-static ssize_t __pcap_sg_inter_iov_hdr_read(int fd, pcap_pkthdr_t *phdr, enum pcap_type type,
- uint8_t *packet, size_t len, size_t hdrsize)
+static ssize_t __pcap_sg_inter_iov_hdr_read(int fd, pcap_pkthdr_t *phdr,
+ size_t hdrsize)
{
int ret;
size_t offset = 0;
@@ -74,7 +74,7 @@ static ssize_t __pcap_sg_inter_iov_hdr_read(int fd, pcap_pkthdr_t *phdr, enum pc
return hdrsize;
}
-static ssize_t __pcap_sg_inter_iov_data_read(int fd, uint8_t *packet, size_t len, size_t hdrlen)
+static ssize_t __pcap_sg_inter_iov_data_read(int fd, uint8_t *packet, size_t hdrlen)
{
int ret;
size_t offset = 0;
@@ -114,8 +114,7 @@ static ssize_t pcap_sg_read(int fd, pcap_pkthdr_t *phdr, enum pcap_type type,
fmemcpy(&phdr->raw, iov[iov_slot].iov_base + iov_off_rd, hdrsize);
iov_off_rd += hdrsize;
} else {
- ret = __pcap_sg_inter_iov_hdr_read(fd, phdr, type, packet,
- len, hdrsize);
+ ret = __pcap_sg_inter_iov_hdr_read(fd, phdr, hdrsize);
if (unlikely(ret < 0))
return ret;
}
@@ -128,7 +127,7 @@ static ssize_t pcap_sg_read(int fd, pcap_pkthdr_t *phdr, enum pcap_type type,
fmemcpy(packet, iov[iov_slot].iov_base + iov_off_rd, hdrlen);
iov_off_rd += hdrlen;
} else {
- ret = __pcap_sg_inter_iov_data_read(fd, packet, len, hdrlen);
+ ret = __pcap_sg_inter_iov_data_read(fd, packet, hdrlen);
if (unlikely(ret < 0))
return ret;
}
@@ -153,8 +152,8 @@ static void pcap_sg_init_once(void)
static int pcap_sg_prepare_access(int fd, enum pcap_mode mode, bool jumbo)
{
- int i, ret;
- size_t len = 0;
+ int ret;
+ size_t i, len = 0;
iov_slot = 0;
len = jumbo ? (PAGE_SIZE * 16) /* 64k max */ :
@@ -177,9 +176,10 @@ static int pcap_sg_prepare_access(int fd, enum pcap_mode mode, bool jumbo)
return 0;
}
-static void pcap_sg_prepare_close(int fd, enum pcap_mode mode)
+static void pcap_sg_prepare_close(int fd __maybe_unused,
+ enum pcap_mode mode __maybe_unused)
{
- int i;
+ size_t i;
for (i = 0; i < array_size(iov); ++i)
xfree(iov[i].iov_base);