blob: 9ad4a5b99eaa5d4350b25a51a47bf902ae9b23ac [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From fecbb7056d621a30f7106e67f5fe209763571b70 Mon Sep 17 00:00:00 2001
2From: Andrea Adami <andrea.adami@gmail.com>
3Date: Sun, 29 Jun 2014 00:40:15 +0200
4Subject: [PATCH 3/9] libubi.c: add klibc specific fixes for ioctl
5
6First issue is that ioctl() in klibc doesn't expect a constant as arg3.
7Second issue is that arg3 in klibc ioctl() implementation is not optional.
8
9Fixes:
10
11| ubi-utils/libubi.c: In function 'do_attach':
12| ubi-utils/libubi.c:698:8: warning: passing argument 3 of 'ioctl' discards
13| 'const' qualifier from pointer target type
14| ret = ioctl(fd, UBI_IOCATT, r);
15| ^
16| In file included from ubi-utils/libubi.c:32:0:
17| .../lib/klibc/include/sys/ioctl.h:15:14: note: expected 'void *' but argument
18| is of type 'const struct ubi_attach_req *'
19| __extern int ioctl(int, int, void *);
20| ^
21
22| ubi-utils/libubi.c: In function 'ubi_vol_block_create':
23| ubi-utils/libubi.c:1118:9: error: too few arguments to function 'ioctl'
24| return ioctl(fd, UBI_IOCVOLCRBLK);
25| ^
26| In file included from ubi-utils/libubi.c:32:0:
27| .../lib/klibc/include/sys/ioctl.h:15:14: note: declared here
28| __extern int ioctl(int, int, void *);
29| ^
30| ubi-utils/libubi.c: In function 'ubi_vol_block_remove':
31| ubi-utils/libubi.c:1123:9: error: too few arguments to function 'ioctl'
32| return ioctl(fd, UBI_IOCVOLRMBLK);
33| ^
34| In file included from ubi-utils/libubi.c:32:0:
35| .../usr/lib/klibc/include/sys/ioctl.h:15:14: note: declared here
36| __extern int ioctl(int, int, void *);
37| ^
38
39Upstream-Status: Accepted
40
41Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
42---
43 ubi-utils/libubi.c | 6 +++---
44 1 file changed, 3 insertions(+), 3 deletions(-)
45
46diff --git a/ubi-utils/libubi.c b/ubi-utils/libubi.c
47index 97c0434..2b49833 100644
48--- a/ubi-utils/libubi.c
49+++ b/ubi-utils/libubi.c
50@@ -687,7 +687,7 @@ void libubi_close(libubi_t desc)
51 * success and %-1 in case of failure. @r->ubi_num contains newly created UBI
52 * device number.
53 */
54-static int do_attach(const char *node, const struct ubi_attach_req *r)
55+static int do_attach(const char *node, struct ubi_attach_req *r)
56 {
57 int fd, ret;
58
59@@ -1115,12 +1115,12 @@ int ubi_rsvol(libubi_t desc, const char *node, int vol_id, long long bytes)
60
61 int ubi_vol_block_create(int fd)
62 {
63- return ioctl(fd, UBI_IOCVOLCRBLK);
64+ return ioctl(fd, UBI_IOCVOLCRBLK, NULL);
65 }
66
67 int ubi_vol_block_remove(int fd)
68 {
69- return ioctl(fd, UBI_IOCVOLRMBLK);
70+ return ioctl(fd, UBI_IOCVOLRMBLK, NULL);
71 }
72
73 int ubi_update_start(libubi_t desc, int fd, long long bytes)
74--
752.7.4
76