aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota/dquot.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-16 07:05:34 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-09-18 04:01:42 -0400
commit7b9c7321ca6b13d2baeb82b3c9c9f78e9885bcf5 (patch)
treed3fdbe21fa58aaa08d392dcded60f1ef8388a565 /fs/quota/dquot.c
parent4c376dcae892e5b5daf8576c864061d076d4e4dc (diff)
userns: Convert struct dquot_warn
Convert w_dq_id to be a struct kquid and remove the now unncessary w_dq_type. This is a simple conversion and enough other places have already been converted that this actually reduces the code complexity by a little bit, when removing now unnecessary type conversions. Cc: Jan Kara <jack@suse.cz> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r--fs/quota/dquot.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index efaeed35476f..f3db8456dc8a 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1132,8 +1132,7 @@ static void dquot_decr_space(struct dquot *dquot, qsize_t number)
1132 1132
1133struct dquot_warn { 1133struct dquot_warn {
1134 struct super_block *w_sb; 1134 struct super_block *w_sb;
1135 qid_t w_dq_id; 1135 struct kqid w_dq_id;
1136 short w_dq_type;
1137 short w_type; 1136 short w_type;
1138}; 1137};
1139 1138
@@ -1157,11 +1156,11 @@ static int need_print_warning(struct dquot_warn *warn)
1157 if (!flag_print_warnings) 1156 if (!flag_print_warnings)
1158 return 0; 1157 return 0;
1159 1158
1160 switch (warn->w_dq_type) { 1159 switch (warn->w_dq_id.type) {
1161 case USRQUOTA: 1160 case USRQUOTA:
1162 return current_fsuid() == warn->w_dq_id; 1161 return current_fsuid() == warn->w_dq_id.uid;
1163 case GRPQUOTA: 1162 case GRPQUOTA:
1164 return in_group_p(warn->w_dq_id); 1163 return in_group_p(warn->w_dq_id.gid);
1165 } 1164 }
1166 return 0; 1165 return 0;
1167} 1166}
@@ -1187,7 +1186,7 @@ static void print_warning(struct dquot_warn *warn)
1187 tty_write_message(tty, ": warning, "); 1186 tty_write_message(tty, ": warning, ");
1188 else 1187 else
1189 tty_write_message(tty, ": write failed, "); 1188 tty_write_message(tty, ": write failed, ");
1190 tty_write_message(tty, quotatypes[warn->w_dq_type]); 1189 tty_write_message(tty, quotatypes[warn->w_dq_id.type]);
1191 switch (warntype) { 1190 switch (warntype) {
1192 case QUOTA_NL_IHARDWARN: 1191 case QUOTA_NL_IHARDWARN:
1193 msg = " file limit reached.\r\n"; 1192 msg = " file limit reached.\r\n";
@@ -1220,8 +1219,7 @@ static void prepare_warning(struct dquot_warn *warn, struct dquot *dquot,
1220 return; 1219 return;
1221 warn->w_type = warntype; 1220 warn->w_type = warntype;
1222 warn->w_sb = dquot->dq_sb; 1221 warn->w_sb = dquot->dq_sb;
1223 warn->w_dq_id = from_kqid(&init_user_ns, dquot->dq_id); 1222 warn->w_dq_id = dquot->dq_id;
1224 warn->w_dq_type = dquot->dq_id.type;
1225} 1223}
1226 1224
1227/* 1225/*
@@ -1239,7 +1237,7 @@ static void flush_warnings(struct dquot_warn *warn)
1239#ifdef CONFIG_PRINT_QUOTA_WARNING 1237#ifdef CONFIG_PRINT_QUOTA_WARNING
1240 print_warning(&warn[i]); 1238 print_warning(&warn[i]);
1241#endif 1239#endif
1242 quota_send_warning(make_kqid(&init_user_ns, warn[i].w_dq_type, warn[i].w_dq_id), 1240 quota_send_warning(warn[i].w_dq_id,
1243 warn[i].w_sb->s_dev, warn[i].w_type); 1241 warn[i].w_sb->s_dev, warn[i].w_type);
1244 } 1242 }
1245} 1243}