Skip to contentSkip to conversation

user_ns: compile bug fix in quota.h

PATCH In review Zhao Hongjiang 2 participants 2 messages Sep 6, 2012 – Sep 7, 2012 1 message not in the archive Diskquota

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 user_ns: compile bug fix in quota.h

From: Zhao Hongjiang <[email protected]>

Failed to build userns-always-map-user-v53 from Eric's latest user_ns branch with GCC 4.4.4 compiler due to violation of C89 standard.

---
 include/linux/quota.h |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
include/linux/quota.h +9 -6
index 781ffc4..90f12d7 100644
@@ -280,9 +280,10 @@ static inline struct kqid make_kqid_invalid(enum quota_type type)
 static inline struct kqid make_kqid_uid(kuid_t uid)
 {
 	struct kqid kqid = {
-		.type = USRQUOTA,
-		.uid  = uid,
+		.type = USRQUOTA
 	};
+	kqid.uid = uid;
+
 	return kqid;
 }
 
@@ -293,9 +294,10 @@ static inline struct kqid make_kqid_uid(kuid_t uid)
 static inline struct kqid make_kqid_gid(kgid_t gid)
 {
 	struct kqid kqid = {
-		.type = GRPQUOTA,
-		.gid  = gid,
+		.type = GRPQUOTA
 	};
+	kqid.gid  = gid;
+
 	return kqid;
 }
 
@@ -306,9 +308,10 @@ static inline struct kqid make_kqid_gid(kgid_t gid)
 static inline struct kqid make_kqid_projid(kprojid_t projid)
 {
 	struct kqid kqid = {
-		.type = PRJQUOTA,
-		.projid = projid,
+		.type = PRJQUOTA
 	};
+	kqid.projid = projid;
+
 	return kqid;
 }
 

-- 1.7.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 5 lines · Zhao Hongjiang

From: Zhao Hongjiang <[email protected]>

Failed to build userns-always-map-user-v53 from Eric's latest user_ns branch with GCC 4.4.4 compiler due to violation of C89 standard.

Thanks.

Given that they are C99 style initializers in general I don't see how taking one member out of the initializer and leaving the other solves the C89 violation. But I do remember that gcc has historically had some interesting problems with C99 initializers, so in this case I have just opted to not use an initializer for either field, which should make older gcc versions.

Eric