summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/quota
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-04-06 17:36:44 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-10 18:10:27 +0100
commit4ace5f812c99e516d3b1f0f6bfcc67dc2fd0c5ec (patch)
tree80ba877f7504bdda3248f2d76c753d2bdd0c0e45 /meta/recipes-extended/quota
parent768794e6a8ce2a67990e215616852409b24f65ed (diff)
downloadpoky-4ace5f812c99e516d3b1f0f6bfcc67dc2fd0c5ec.tar.gz
quota: Fix build with musl
add more packageconfigs so we can disable certain features on demand Add patches to make it more portable by making posix compliant and libc agnostic code Change-Id: Ifa1c7f7923322fd22368538310685cd5c440516d (From OE-Core rev: 6da9a5269782923fe5807b07217ffe19b9fb633e) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/quota')
-rw-r--r--meta/recipes-extended/quota/quota/fcntl.patch113
-rw-r--r--meta/recipes-extended/quota/quota/remove_non_posix_types.patch185
-rw-r--r--meta/recipes-extended/quota/quota/replace_getrpcbynumber_r.patch20
-rw-r--r--meta/recipes-extended/quota/quota_4.02.bb17
4 files changed, 333 insertions, 2 deletions
diff --git a/meta/recipes-extended/quota/quota/fcntl.patch b/meta/recipes-extended/quota/quota/fcntl.patch
new file mode 100644
index 0000000000..27e60fd07d
--- /dev/null
+++ b/meta/recipes-extended/quota/quota/fcntl.patch
@@ -0,0 +1,113 @@
1Include fcntl.h to pacify compiler errors on musl
2like
3
4error: unknown type name 'loff_t'
5Cover rpc headers under proper conditional
6Dont use __P its undefined
7
8Upstream-Status: Pending
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12ndex: quota-tools/quota.h
13===================================================================
14Index: quota-tools/quota.h
15===================================================================
16--- quota-tools.orig/quota.h
17+++ quota-tools/quota.h
18@@ -165,6 +165,6 @@ enum {
19 #endif
20 #endif
21
22-long quotactl __P((int, const char *, qid_t, caddr_t));
23+long quotactl (int, const char *, qid_t, caddr_t);
24
25 #endif /* _QUOTA_ */
26Index: quota-tools/quotacheck.c
27===================================================================
28--- quota-tools.orig/quotacheck.c
29+++ quota-tools/quotacheck.c
30@@ -19,6 +19,7 @@
31 #include <unistd.h>
32 #include <stdlib.h>
33 #include <errno.h>
34+#include <fcntl.h>
35
36 #include <sys/stat.h>
37 #include <sys/types.h>
38Index: quota-tools/quotaio.c
39===================================================================
40--- quota-tools.orig/quotaio.c
41+++ quota-tools/quotaio.c
42@@ -12,6 +12,7 @@
43 #include <string.h>
44 #include <unistd.h>
45 #include <stdlib.h>
46+#include <fcntl.h>
47 #include <sys/types.h>
48 #include <sys/stat.h>
49 #include <sys/file.h>
50Index: quota-tools/dqblk_v2.h
51===================================================================
52--- quota-tools.orig/dqblk_v2.h
53+++ quota-tools/dqblk_v2.h
54@@ -7,6 +7,7 @@
55 #ifndef GUARD_DQBLK_V2_H
56 #define GUARD_DQBLK_V2_H
57
58+#include <fcntl.h>
59 #include <sys/types.h>
60 #include "quota_tree.h"
61
62Index: quota-tools/quotaops.c
63===================================================================
64--- quota-tools.orig/quotaops.c
65+++ quota-tools/quotaops.c
66@@ -34,7 +34,9 @@
67
68 #include "config.h"
69
70+#if defined(RPC)
71 #include <rpc/rpc.h>
72+#endif
73 #include <sys/types.h>
74 #include <sys/stat.h>
75 #include <sys/file.h>
76Index: quota-tools/rquota_client.c
77===================================================================
78--- quota-tools.orig/rquota_client.c
79+++ quota-tools/rquota_client.c
80@@ -19,7 +19,9 @@
81
82 #include "config.h"
83
84+#if defined(RPC)
85 #include <rpc/rpc.h>
86+#endif
87 #include <sys/types.h>
88 #include <sys/param.h>
89 #include <sys/stat.h>
90@@ -35,7 +37,9 @@
91 #include <stdint.h>
92
93 #include "mntopt.h"
94+#if defined(RPC)
95 #include "rquota.h"
96+#endif
97 #include "common.h"
98 #include "quotaio.h"
99 #include "quotasys.h"
100Index: quota-tools/setquota.c
101===================================================================
102--- quota-tools.orig/setquota.c
103+++ quota-tools/setquota.c
104@@ -7,7 +7,9 @@
105
106 #include "config.h"
107
108+#if defined(RPC)
109 #include <rpc/rpc.h>
110+#endif
111 #include <sys/types.h>
112 #include <errno.h>
113 #include <stdio.h>
diff --git a/meta/recipes-extended/quota/quota/remove_non_posix_types.patch b/meta/recipes-extended/quota/quota/remove_non_posix_types.patch
new file mode 100644
index 0000000000..5442d9854d
--- /dev/null
+++ b/meta/recipes-extended/quota/quota/remove_non_posix_types.patch
@@ -0,0 +1,185 @@
1Use proper C99 integer types
2
3Upstream-Status: Pending
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7Index: quota-tools/bylabel.c
8===================================================================
9--- quota-tools.orig/bylabel.c
10+++ quota-tools/bylabel.c
11@@ -20,6 +20,7 @@
12 #include <ctype.h>
13 #include <fcntl.h>
14 #include <unistd.h>
15+#include <stdint.h>
16
17 #include "bylabel.h"
18 #include "common.h"
19@@ -37,32 +38,32 @@ static struct uuidCache_s {
20
21 #define EXT2_SUPER_MAGIC 0xEF53
22 struct ext2_super_block {
23- u_char s_dummy1[56];
24- u_char s_magic[2];
25- u_char s_dummy2[46];
26- u_char s_uuid[16];
27- u_char s_volume_name[16];
28+ uint8_t s_dummy1[56];
29+ uint8_t s_magic[2];
30+ uint8_t s_dummy2[46];
31+ uint8_t s_uuid[16];
32+ uint8_t s_volume_name[16];
33 };
34
35-#define ext2magic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8))
36+#define ext2magic(s) ((uint32_t) s.s_magic[0] + (((uint32_t) s.s_magic[1]) << 8))
37
38 #define XFS_SUPER_MAGIC "XFSB"
39 #define XFS_SUPER_MAGIC2 "BSFX"
40 struct xfs_super_block {
41- u_char s_magic[4];
42- u_char s_dummy[28];
43- u_char s_uuid[16];
44- u_char s_dummy2[60];
45- u_char s_fsname[12];
46+ uint8_t s_magic[4];
47+ uint8_t s_dummy[28];
48+ uint8_t s_uuid[16];
49+ uint8_t s_dummy2[60];
50+ uint8_t s_fsname[12];
51 };
52
53 #define REISER_SUPER_MAGIC "ReIsEr2Fs"
54 struct reiserfs_super_block {
55- u_char s_dummy1[52];
56- u_char s_magic[10];
57- u_char s_dummy2[22];
58- u_char s_uuid[16];
59- u_char s_volume_name[16];
60+ uint8_t s_dummy1[52];
61+ uint8_t s_magic[10];
62+ uint8_t s_dummy2[22];
63+ uint8_t s_uuid[16];
64+ uint8_t s_volume_name[16];
65 };
66
67 static inline unsigned short swapped(unsigned short a)
68@@ -222,7 +223,7 @@ static char *get_spec_by_x(int n, const
69 return NULL;
70 }
71
72-static u_char fromhex(char c)
73+static uint8_t fromhex(char c)
74 {
75 if (isdigit(c))
76 return (c - '0');
77@@ -234,7 +235,7 @@ static u_char fromhex(char c)
78
79 static char *get_spec_by_uuid(const char *s)
80 {
81- u_char uuid[16];
82+ uint8_t uuid[16];
83 int i;
84
85 if (strlen(s) != 36 || s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-')
86Index: quota-tools/quot.c
87===================================================================
88--- quota-tools.orig/quot.c
89+++ quota-tools/quot.c
90@@ -47,6 +47,7 @@
91 #include <utmp.h>
92 #include <pwd.h>
93 #include <grp.h>
94+#include <stdint.h>
95
96 #include "pot.h"
97 #include "quot.h"
98@@ -56,8 +57,8 @@
99 #include "quotasys.h"
100
101 #define TSIZE 500
102-static __uint64_t sizes[TSIZE];
103-static __uint64_t overflow;
104+static uint64_t sizes[TSIZE];
105+static uint64_t overflow;
106
107 static int aflag;
108 static int cflag;
109@@ -72,7 +73,7 @@ static time_t now;
110 char *progname;
111
112 static void mounttable(void);
113-static char *idname(__uint32_t, int);
114+static char *idname(uint32_t, int);
115 static void report(const char *, const char *, int);
116 static void creport(const char *, const char *);
117
118@@ -173,7 +174,7 @@ static int qcmp(du_t * p1, du_t * p2)
119 static void creport(const char *file, const char *fsdir)
120 {
121 int i;
122- __uint64_t t = 0;
123+ uint64_t t = 0;
124
125 printf(_("%s (%s):\n"), file, fsdir);
126 for (i = 0; i < TSIZE - 1; i++)
127@@ -219,7 +220,7 @@ static void report(const char *file, con
128 }
129 }
130
131-static idcache_t *getnextent(int type, __uint32_t id, int byid)
132+static idcache_t *getnextent(int type, uint32_t id, int byid)
133 {
134 struct passwd *pw;
135 struct group *gr;
136@@ -240,7 +241,7 @@ static idcache_t *getnextent(int type, _
137 return &idc;
138 }
139
140-static char *idname(__uint32_t id, int type)
141+static char *idname(uint32_t id, int type)
142 {
143 idcache_t *ncp, *idp;
144 static idcache_t nc[2][NID];
145@@ -286,8 +287,8 @@ static void acctXFS(xfs_bstat_t *p)
146 {
147 register du_t *dp;
148 du_t **hp;
149- __uint64_t size;
150- __uint32_t i, id;
151+ uint64_t size;
152+ uint32_t i, id;
153
154 if ((p->bs_mode & S_IFMT) == 0)
155 return;
156Index: quota-tools/quot.h
157===================================================================
158--- quota-tools.orig/quot.h
159+++ quota-tools/quot.h
160@@ -35,18 +35,18 @@
161 #define SEC24HR (60*60*24) /* seconds per day */
162
163 typedef struct {
164- __uint32_t id;
165+ uint32_t id;
166 char name[UT_NAMESIZE + 1];
167 } idcache_t;
168
169 typedef struct du {
170 struct du *next;
171- __uint64_t blocks;
172- __uint64_t blocks30;
173- __uint64_t blocks60;
174- __uint64_t blocks90;
175- __uint64_t nfiles;
176- __uint32_t id;
177+ uint64_t blocks;
178+ uint64_t blocks30;
179+ uint64_t blocks60;
180+ uint64_t blocks90;
181+ uint64_t nfiles;
182+ uint32_t id;
183 } du_t;
184
185 #define NDU 60000
diff --git a/meta/recipes-extended/quota/quota/replace_getrpcbynumber_r.patch b/meta/recipes-extended/quota/quota/replace_getrpcbynumber_r.patch
new file mode 100644
index 0000000000..9ca2ffc0d4
--- /dev/null
+++ b/meta/recipes-extended/quota/quota/replace_getrpcbynumber_r.patch
@@ -0,0 +1,20 @@
1Replace getrpcbynumber_r with getrpcbynumber
2musl and uclibc dont implement it
3
4Upstream-Status: Pending
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Index: quota-tools/svc_socket.c
8===================================================================
9--- quota-tools.orig/svc_socket.c
10+++ quota-tools/svc_socket.c
11@@ -55,7 +55,8 @@ static int svc_socket (u_long number, in
12 addr.sin_family = AF_INET;
13
14 if (!port) {
15- ret = getrpcbynumber_r(number, &rpcbuf, rpcdata, sizeof(rpcdata), &rpcp);
16+ rpcp = getrpcbynumber(number);
17+ ret = 0;
18 if (ret == 0 && rpcp != NULL) {
19 /* First try name */
20 ret = getservbyname_r(rpcp->r_name, proto, &servbuf, servdata,
diff --git a/meta/recipes-extended/quota/quota_4.02.bb b/meta/recipes-extended/quota/quota_4.02.bb
index 020ed3528c..96ff4b597d 100644
--- a/meta/recipes-extended/quota/quota_4.02.bb
+++ b/meta/recipes-extended/quota/quota_4.02.bb
@@ -6,8 +6,14 @@ LICENSE = "BSD & GPLv2+ & LGPLv2.1+"
6LIC_FILES_CHKSUM = "file://quota.c;beginline=1;endline=33;md5=331c7d77744bfe0ad24027f0651028ec \ 6LIC_FILES_CHKSUM = "file://quota.c;beginline=1;endline=33;md5=331c7d77744bfe0ad24027f0651028ec \
7 file://rquota_server.c;beginline=1;endline=20;md5=fe7e0d7e11c6f820f8fa62a5af71230f \ 7 file://rquota_server.c;beginline=1;endline=20;md5=fe7e0d7e11c6f820f8fa62a5af71230f \
8 file://svc_socket.c;beginline=1;endline=17;md5=24d5a8792da45910786eeac750be8ceb" 8 file://svc_socket.c;beginline=1;endline=17;md5=24d5a8792da45910786eeac750be8ceb"
9
9SRC_URI = "${SOURCEFORGE_MIRROR}/project/linuxquota/quota-tools/${PV}/quota-${PV}.tar.gz \ 10SRC_URI = "${SOURCEFORGE_MIRROR}/project/linuxquota/quota-tools/${PV}/quota-${PV}.tar.gz \
10 file://config-tcpwrappers.patch" 11 file://config-tcpwrappers.patch \
12 file://fcntl.patch \
13 file://remove_non_posix_types.patch \
14 "
15SRC_URI_append_libc-musl = " file://replace_getrpcbynumber_r.patch"
16
11SRC_URI[md5sum] = "a8a5df262261e659716ccad2a5d6df0d" 17SRC_URI[md5sum] = "a8a5df262261e659716ccad2a5d6df0d"
12SRC_URI[sha256sum] = "f4c2f48abf94bbdc396df33d276f2e9d19af58c232cb85eef9c174a747c33795" 18SRC_URI[sha256sum] = "f4c2f48abf94bbdc396df33d276f2e9d19af58c232cb85eef9c174a747c33795"
13 19
@@ -17,10 +23,17 @@ DEPENDS = "gettext-native e2fsprogs"
17 23
18inherit autotools-brokensep gettext pkgconfig 24inherit autotools-brokensep gettext pkgconfig
19 25
26CFLAGS += "-I=${includedir}/tirpc"
27LDFLAGS += "-ltirpc"
28ASNEEDED = ""
20EXTRA_OEMAKE += 'STRIP=""' 29EXTRA_OEMAKE += 'STRIP=""'
21 30
22PACKAGECONFIG ??= "tcp-wrappers" 31PACKAGECONFIG ??= "tcp-wrappers rpc bsd"
32PACKAGECONFIG_libc-musl = "tcp-wrappers rpc"
33
23PACKAGECONFIG[tcp-wrappers] = "--with-tcpwrappers,--without-tcpwrappers,tcp-wrappers" 34PACKAGECONFIG[tcp-wrappers] = "--with-tcpwrappers,--without-tcpwrappers,tcp-wrappers"
35PACKAGECONFIG[rpc] = "--enable-rpc=yes,--enable-rpc=no,libtirpc"
36PACKAGECONFIG[bsd] = "--enable-bsd_behaviour=yes,--enable-bsd_behaviour=no,"
24 37
25do_install() { 38do_install() {
26 oe_runmake prefix=${D}${prefix} install 39 oe_runmake prefix=${D}${prefix} install