diff options
author | Joe Perches <joe@perches.com> | 2014-09-29 19:08:23 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-11-05 14:12:38 -0500 |
commit | d6d906b234afc984e93044c19e7b6598824412aa (patch) | |
tree | 7e14ddf4041430182d844302214f3acdf9b7449d /fs | |
parent | e71456ae9871f53868befd08b1d192ca93ce0753 (diff) |
dlm: Remove seq_printf() return checks and use seq_has_overflowed()
The seq_printf() return is going away soon and users of it should
check seq_has_overflowed() to see if the buffer is full and will
not accept any more data.
Convert functions returning int to void where seq_printf() is used.
Link: http://lkml.kernel.org/p/43590057bcb83846acbbcc1fe641f792b2fb7773.1412031505.git.joe@perches.com
Link: http://lkml.kernel.org/r/20141029220107.939492048@goodmis.org
Acked-by: David Teigland <teigland@redhat.com>
Cc: Christine Caulfield <ccaulfie@redhat.com>
Cc: cluster-devel@redhat.com
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dlm/debug_fs.c | 251 |
1 files changed, 117 insertions, 134 deletions
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c index 1323c568e362..3bf460894088 100644 --- a/fs/dlm/debug_fs.c +++ b/fs/dlm/debug_fs.c | |||
@@ -48,8 +48,8 @@ static char *print_lockmode(int mode) | |||
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | static int print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb, | 51 | static void print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb, |
52 | struct dlm_rsb *res) | 52 | struct dlm_rsb *res) |
53 | { | 53 | { |
54 | seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode)); | 54 | seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode)); |
55 | 55 | ||
@@ -68,21 +68,17 @@ static int print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb, | |||
68 | if (lkb->lkb_wait_type) | 68 | if (lkb->lkb_wait_type) |
69 | seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); | 69 | seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); |
70 | 70 | ||
71 | return seq_puts(s, "\n"); | 71 | seq_puts(s, "\n"); |
72 | } | 72 | } |
73 | 73 | ||
74 | static int print_format1(struct dlm_rsb *res, struct seq_file *s) | 74 | static void print_format1(struct dlm_rsb *res, struct seq_file *s) |
75 | { | 75 | { |
76 | struct dlm_lkb *lkb; | 76 | struct dlm_lkb *lkb; |
77 | int i, lvblen = res->res_ls->ls_lvblen, recover_list, root_list; | 77 | int i, lvblen = res->res_ls->ls_lvblen, recover_list, root_list; |
78 | int rv; | ||
79 | 78 | ||
80 | lock_rsb(res); | 79 | lock_rsb(res); |
81 | 80 | ||
82 | rv = seq_printf(s, "\nResource %p Name (len=%d) \"", | 81 | seq_printf(s, "\nResource %p Name (len=%d) \"", res, res->res_length); |
83 | res, res->res_length); | ||
84 | if (rv) | ||
85 | goto out; | ||
86 | 82 | ||
87 | for (i = 0; i < res->res_length; i++) { | 83 | for (i = 0; i < res->res_length; i++) { |
88 | if (isprint(res->res_name[i])) | 84 | if (isprint(res->res_name[i])) |
@@ -92,17 +88,16 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s) | |||
92 | } | 88 | } |
93 | 89 | ||
94 | if (res->res_nodeid > 0) | 90 | if (res->res_nodeid > 0) |
95 | rv = seq_printf(s, "\"\nLocal Copy, Master is node %d\n", | 91 | seq_printf(s, "\"\nLocal Copy, Master is node %d\n", |
96 | res->res_nodeid); | 92 | res->res_nodeid); |
97 | else if (res->res_nodeid == 0) | 93 | else if (res->res_nodeid == 0) |
98 | rv = seq_puts(s, "\"\nMaster Copy\n"); | 94 | seq_puts(s, "\"\nMaster Copy\n"); |
99 | else if (res->res_nodeid == -1) | 95 | else if (res->res_nodeid == -1) |
100 | rv = seq_printf(s, "\"\nLooking up master (lkid %x)\n", | 96 | seq_printf(s, "\"\nLooking up master (lkid %x)\n", |
101 | res->res_first_lkid); | 97 | res->res_first_lkid); |
102 | else | 98 | else |
103 | rv = seq_printf(s, "\"\nInvalid master %d\n", | 99 | seq_printf(s, "\"\nInvalid master %d\n", res->res_nodeid); |
104 | res->res_nodeid); | 100 | if (seq_has_overflowed(s)) |
105 | if (rv) | ||
106 | goto out; | 101 | goto out; |
107 | 102 | ||
108 | /* Print the LVB: */ | 103 | /* Print the LVB: */ |
@@ -116,8 +111,8 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s) | |||
116 | } | 111 | } |
117 | if (rsb_flag(res, RSB_VALNOTVALID)) | 112 | if (rsb_flag(res, RSB_VALNOTVALID)) |
118 | seq_puts(s, " (INVALID)"); | 113 | seq_puts(s, " (INVALID)"); |
119 | rv = seq_puts(s, "\n"); | 114 | seq_puts(s, "\n"); |
120 | if (rv) | 115 | if (seq_has_overflowed(s)) |
121 | goto out; | 116 | goto out; |
122 | } | 117 | } |
123 | 118 | ||
@@ -125,32 +120,30 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s) | |||
125 | recover_list = !list_empty(&res->res_recover_list); | 120 | recover_list = !list_empty(&res->res_recover_list); |
126 | 121 | ||
127 | if (root_list || recover_list) { | 122 | if (root_list || recover_list) { |
128 | rv = seq_printf(s, "Recovery: root %d recover %d flags %lx " | 123 | seq_printf(s, "Recovery: root %d recover %d flags %lx count %d\n", |
129 | "count %d\n", root_list, recover_list, | 124 | root_list, recover_list, |
130 | res->res_flags, res->res_recover_locks_count); | 125 | res->res_flags, res->res_recover_locks_count); |
131 | if (rv) | ||
132 | goto out; | ||
133 | } | 126 | } |
134 | 127 | ||
135 | /* Print the locks attached to this resource */ | 128 | /* Print the locks attached to this resource */ |
136 | seq_puts(s, "Granted Queue\n"); | 129 | seq_puts(s, "Granted Queue\n"); |
137 | list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) { | 130 | list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) { |
138 | rv = print_format1_lock(s, lkb, res); | 131 | print_format1_lock(s, lkb, res); |
139 | if (rv) | 132 | if (seq_has_overflowed(s)) |
140 | goto out; | 133 | goto out; |
141 | } | 134 | } |
142 | 135 | ||
143 | seq_puts(s, "Conversion Queue\n"); | 136 | seq_puts(s, "Conversion Queue\n"); |
144 | list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) { | 137 | list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) { |
145 | rv = print_format1_lock(s, lkb, res); | 138 | print_format1_lock(s, lkb, res); |
146 | if (rv) | 139 | if (seq_has_overflowed(s)) |
147 | goto out; | 140 | goto out; |
148 | } | 141 | } |
149 | 142 | ||
150 | seq_puts(s, "Waiting Queue\n"); | 143 | seq_puts(s, "Waiting Queue\n"); |
151 | list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) { | 144 | list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) { |
152 | rv = print_format1_lock(s, lkb, res); | 145 | print_format1_lock(s, lkb, res); |
153 | if (rv) | 146 | if (seq_has_overflowed(s)) |
154 | goto out; | 147 | goto out; |
155 | } | 148 | } |
156 | 149 | ||
@@ -159,23 +152,23 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s) | |||
159 | 152 | ||
160 | seq_puts(s, "Lookup Queue\n"); | 153 | seq_puts(s, "Lookup Queue\n"); |
161 | list_for_each_entry(lkb, &res->res_lookup, lkb_rsb_lookup) { | 154 | list_for_each_entry(lkb, &res->res_lookup, lkb_rsb_lookup) { |
162 | rv = seq_printf(s, "%08x %s", lkb->lkb_id, | 155 | seq_printf(s, "%08x %s", |
163 | print_lockmode(lkb->lkb_rqmode)); | 156 | lkb->lkb_id, print_lockmode(lkb->lkb_rqmode)); |
164 | if (lkb->lkb_wait_type) | 157 | if (lkb->lkb_wait_type) |
165 | seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); | 158 | seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); |
166 | rv = seq_puts(s, "\n"); | 159 | seq_puts(s, "\n"); |
160 | if (seq_has_overflowed(s)) | ||
161 | goto out; | ||
167 | } | 162 | } |
168 | out: | 163 | out: |
169 | unlock_rsb(res); | 164 | unlock_rsb(res); |
170 | return rv; | ||
171 | } | 165 | } |
172 | 166 | ||
173 | static int print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb, | 167 | static void print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb, |
174 | struct dlm_rsb *r) | 168 | struct dlm_rsb *r) |
175 | { | 169 | { |
176 | u64 xid = 0; | 170 | u64 xid = 0; |
177 | u64 us; | 171 | u64 us; |
178 | int rv; | ||
179 | 172 | ||
180 | if (lkb->lkb_flags & DLM_IFL_USER) { | 173 | if (lkb->lkb_flags & DLM_IFL_USER) { |
181 | if (lkb->lkb_ua) | 174 | if (lkb->lkb_ua) |
@@ -188,103 +181,97 @@ static int print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb, | |||
188 | /* id nodeid remid pid xid exflags flags sts grmode rqmode time_us | 181 | /* id nodeid remid pid xid exflags flags sts grmode rqmode time_us |
189 | r_nodeid r_len r_name */ | 182 | r_nodeid r_len r_name */ |
190 | 183 | ||
191 | rv = seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %llu %u %d \"%s\"\n", | 184 | seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %llu %u %d \"%s\"\n", |
192 | lkb->lkb_id, | 185 | lkb->lkb_id, |
193 | lkb->lkb_nodeid, | 186 | lkb->lkb_nodeid, |
194 | lkb->lkb_remid, | 187 | lkb->lkb_remid, |
195 | lkb->lkb_ownpid, | 188 | lkb->lkb_ownpid, |
196 | (unsigned long long)xid, | 189 | (unsigned long long)xid, |
197 | lkb->lkb_exflags, | 190 | lkb->lkb_exflags, |
198 | lkb->lkb_flags, | 191 | lkb->lkb_flags, |
199 | lkb->lkb_status, | 192 | lkb->lkb_status, |
200 | lkb->lkb_grmode, | 193 | lkb->lkb_grmode, |
201 | lkb->lkb_rqmode, | 194 | lkb->lkb_rqmode, |
202 | (unsigned long long)us, | 195 | (unsigned long long)us, |
203 | r->res_nodeid, | 196 | r->res_nodeid, |
204 | r->res_length, | 197 | r->res_length, |
205 | r->res_name); | 198 | r->res_name); |
206 | return rv; | ||
207 | } | 199 | } |
208 | 200 | ||
209 | static int print_format2(struct dlm_rsb *r, struct seq_file *s) | 201 | static void print_format2(struct dlm_rsb *r, struct seq_file *s) |
210 | { | 202 | { |
211 | struct dlm_lkb *lkb; | 203 | struct dlm_lkb *lkb; |
212 | int rv = 0; | ||
213 | 204 | ||
214 | lock_rsb(r); | 205 | lock_rsb(r); |
215 | 206 | ||
216 | list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { | 207 | list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { |
217 | rv = print_format2_lock(s, lkb, r); | 208 | print_format2_lock(s, lkb, r); |
218 | if (rv) | 209 | if (seq_has_overflowed(s)) |
219 | goto out; | 210 | goto out; |
220 | } | 211 | } |
221 | 212 | ||
222 | list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { | 213 | list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { |
223 | rv = print_format2_lock(s, lkb, r); | 214 | print_format2_lock(s, lkb, r); |
224 | if (rv) | 215 | if (seq_has_overflowed(s)) |
225 | goto out; | 216 | goto out; |
226 | } | 217 | } |
227 | 218 | ||
228 | list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) { | 219 | list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) { |
229 | rv = print_format2_lock(s, lkb, r); | 220 | print_format2_lock(s, lkb, r); |
230 | if (rv) | 221 | if (seq_has_overflowed(s)) |
231 | goto out; | 222 | goto out; |
232 | } | 223 | } |
233 | out: | 224 | out: |
234 | unlock_rsb(r); | 225 | unlock_rsb(r); |
235 | return rv; | ||
236 | } | 226 | } |
237 | 227 | ||
238 | static int print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb, | 228 | static void print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb, |
239 | int rsb_lookup) | 229 | int rsb_lookup) |
240 | { | 230 | { |
241 | u64 xid = 0; | 231 | u64 xid = 0; |
242 | int rv; | ||
243 | 232 | ||
244 | if (lkb->lkb_flags & DLM_IFL_USER) { | 233 | if (lkb->lkb_flags & DLM_IFL_USER) { |
245 | if (lkb->lkb_ua) | 234 | if (lkb->lkb_ua) |
246 | xid = lkb->lkb_ua->xid; | 235 | xid = lkb->lkb_ua->xid; |
247 | } | 236 | } |
248 | 237 | ||
249 | rv = seq_printf(s, "lkb %x %d %x %u %llu %x %x %d %d %d %d %d %d %u %llu %llu\n", | 238 | seq_printf(s, "lkb %x %d %x %u %llu %x %x %d %d %d %d %d %d %u %llu %llu\n", |
250 | lkb->lkb_id, | 239 | lkb->lkb_id, |
251 | lkb->lkb_nodeid, | 240 | lkb->lkb_nodeid, |
252 | lkb->lkb_remid, | 241 | lkb->lkb_remid, |
253 | lkb->lkb_ownpid, | 242 | lkb->lkb_ownpid, |
254 | (unsigned long long)xid, | 243 | (unsigned long long)xid, |
255 | lkb->lkb_exflags, | 244 | lkb->lkb_exflags, |
256 | lkb->lkb_flags, | 245 | lkb->lkb_flags, |
257 | lkb->lkb_status, | 246 | lkb->lkb_status, |
258 | lkb->lkb_grmode, | 247 | lkb->lkb_grmode, |
259 | lkb->lkb_rqmode, | 248 | lkb->lkb_rqmode, |
260 | lkb->lkb_last_bast.mode, | 249 | lkb->lkb_last_bast.mode, |
261 | rsb_lookup, | 250 | rsb_lookup, |
262 | lkb->lkb_wait_type, | 251 | lkb->lkb_wait_type, |
263 | lkb->lkb_lvbseq, | 252 | lkb->lkb_lvbseq, |
264 | (unsigned long long)ktime_to_ns(lkb->lkb_timestamp), | 253 | (unsigned long long)ktime_to_ns(lkb->lkb_timestamp), |
265 | (unsigned long long)ktime_to_ns(lkb->lkb_last_bast_time)); | 254 | (unsigned long long)ktime_to_ns(lkb->lkb_last_bast_time)); |
266 | return rv; | ||
267 | } | 255 | } |
268 | 256 | ||
269 | static int print_format3(struct dlm_rsb *r, struct seq_file *s) | 257 | static void print_format3(struct dlm_rsb *r, struct seq_file *s) |
270 | { | 258 | { |
271 | struct dlm_lkb *lkb; | 259 | struct dlm_lkb *lkb; |
272 | int i, lvblen = r->res_ls->ls_lvblen; | 260 | int i, lvblen = r->res_ls->ls_lvblen; |
273 | int print_name = 1; | 261 | int print_name = 1; |
274 | int rv; | ||
275 | 262 | ||
276 | lock_rsb(r); | 263 | lock_rsb(r); |
277 | 264 | ||
278 | rv = seq_printf(s, "rsb %p %d %x %lx %d %d %u %d ", | 265 | seq_printf(s, "rsb %p %d %x %lx %d %d %u %d ", |
279 | r, | 266 | r, |
280 | r->res_nodeid, | 267 | r->res_nodeid, |
281 | r->res_first_lkid, | 268 | r->res_first_lkid, |
282 | r->res_flags, | 269 | r->res_flags, |
283 | !list_empty(&r->res_root_list), | 270 | !list_empty(&r->res_root_list), |
284 | !list_empty(&r->res_recover_list), | 271 | !list_empty(&r->res_recover_list), |
285 | r->res_recover_locks_count, | 272 | r->res_recover_locks_count, |
286 | r->res_length); | 273 | r->res_length); |
287 | if (rv) | 274 | if (seq_has_overflowed(s)) |
288 | goto out; | 275 | goto out; |
289 | 276 | ||
290 | for (i = 0; i < r->res_length; i++) { | 277 | for (i = 0; i < r->res_length; i++) { |
@@ -300,8 +287,8 @@ static int print_format3(struct dlm_rsb *r, struct seq_file *s) | |||
300 | else | 287 | else |
301 | seq_printf(s, " %02x", (unsigned char)r->res_name[i]); | 288 | seq_printf(s, " %02x", (unsigned char)r->res_name[i]); |
302 | } | 289 | } |
303 | rv = seq_puts(s, "\n"); | 290 | seq_puts(s, "\n"); |
304 | if (rv) | 291 | if (seq_has_overflowed(s)) |
305 | goto out; | 292 | goto out; |
306 | 293 | ||
307 | if (!r->res_lvbptr) | 294 | if (!r->res_lvbptr) |
@@ -311,58 +298,55 @@ static int print_format3(struct dlm_rsb *r, struct seq_file *s) | |||
311 | 298 | ||
312 | for (i = 0; i < lvblen; i++) | 299 | for (i = 0; i < lvblen; i++) |
313 | seq_printf(s, " %02x", (unsigned char)r->res_lvbptr[i]); | 300 | seq_printf(s, " %02x", (unsigned char)r->res_lvbptr[i]); |
314 | rv = seq_puts(s, "\n"); | 301 | seq_puts(s, "\n"); |
315 | if (rv) | 302 | if (seq_has_overflowed(s)) |
316 | goto out; | 303 | goto out; |
317 | 304 | ||
318 | do_locks: | 305 | do_locks: |
319 | list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { | 306 | list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { |
320 | rv = print_format3_lock(s, lkb, 0); | 307 | print_format3_lock(s, lkb, 0); |
321 | if (rv) | 308 | if (seq_has_overflowed(s)) |
322 | goto out; | 309 | goto out; |
323 | } | 310 | } |
324 | 311 | ||
325 | list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { | 312 | list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { |
326 | rv = print_format3_lock(s, lkb, 0); | 313 | print_format3_lock(s, lkb, 0); |
327 | if (rv) | 314 | if (seq_has_overflowed(s)) |
328 | goto out; | 315 | goto out; |
329 | } | 316 | } |
330 | 317 | ||
331 | list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) { | 318 | list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) { |
332 | rv = print_format3_lock(s, lkb, 0); | 319 | print_format3_lock(s, lkb, 0); |
333 | if (rv) | 320 | if (seq_has_overflowed(s)) |
334 | goto out; | 321 | goto out; |
335 | } | 322 | } |
336 | 323 | ||
337 | list_for_each_entry(lkb, &r->res_lookup, lkb_rsb_lookup) { | 324 | list_for_each_entry(lkb, &r->res_lookup, lkb_rsb_lookup) { |
338 | rv = print_format3_lock(s, lkb, 1); | 325 | print_format3_lock(s, lkb, 1); |
339 | if (rv) | 326 | if (seq_has_overflowed(s)) |
340 | goto out; | 327 | goto out; |
341 | } | 328 | } |
342 | out: | 329 | out: |
343 | unlock_rsb(r); | 330 | unlock_rsb(r); |
344 | return rv; | ||
345 | } | 331 | } |
346 | 332 | ||
347 | static int print_format4(struct dlm_rsb *r, struct seq_file *s) | 333 | static void print_format4(struct dlm_rsb *r, struct seq_file *s) |
348 | { | 334 | { |
349 | int our_nodeid = dlm_our_nodeid(); | 335 | int our_nodeid = dlm_our_nodeid(); |
350 | int print_name = 1; | 336 | int print_name = 1; |
351 | int i, rv; | 337 | int i; |
352 | 338 | ||
353 | lock_rsb(r); | 339 | lock_rsb(r); |
354 | 340 | ||
355 | rv = seq_printf(s, "rsb %p %d %d %d %d %lu %lx %d ", | 341 | seq_printf(s, "rsb %p %d %d %d %d %lu %lx %d ", |
356 | r, | 342 | r, |
357 | r->res_nodeid, | 343 | r->res_nodeid, |
358 | r->res_master_nodeid, | 344 | r->res_master_nodeid, |
359 | r->res_dir_nodeid, | 345 | r->res_dir_nodeid, |
360 | our_nodeid, | 346 | our_nodeid, |
361 | r->res_toss_time, | 347 | r->res_toss_time, |
362 | r->res_flags, | 348 | r->res_flags, |
363 | r->res_length); | 349 | r->res_length); |
364 | if (rv) | ||
365 | goto out; | ||
366 | 350 | ||
367 | for (i = 0; i < r->res_length; i++) { | 351 | for (i = 0; i < r->res_length; i++) { |
368 | if (!isascii(r->res_name[i]) || !isprint(r->res_name[i])) | 352 | if (!isascii(r->res_name[i]) || !isprint(r->res_name[i])) |
@@ -377,10 +361,9 @@ static int print_format4(struct dlm_rsb *r, struct seq_file *s) | |||
377 | else | 361 | else |
378 | seq_printf(s, " %02x", (unsigned char)r->res_name[i]); | 362 | seq_printf(s, " %02x", (unsigned char)r->res_name[i]); |
379 | } | 363 | } |
380 | rv = seq_puts(s, "\n"); | 364 | seq_puts(s, "\n"); |
381 | out: | 365 | |
382 | unlock_rsb(r); | 366 | unlock_rsb(r); |
383 | return rv; | ||
384 | } | 367 | } |
385 | 368 | ||
386 | struct rsbtbl_iter { | 369 | struct rsbtbl_iter { |
@@ -390,20 +373,20 @@ struct rsbtbl_iter { | |||
390 | int header; | 373 | int header; |
391 | }; | 374 | }; |
392 | 375 | ||
393 | /* seq_printf returns -1 if the buffer is full, and 0 otherwise. | 376 | /* |
394 | If the buffer is full, seq_printf can be called again, but it | 377 | * If the buffer is full, seq_printf can be called again, but it |
395 | does nothing and just returns -1. So, the these printing routines | 378 | * does nothing. So, the these printing routines periodically check |
396 | periodically check the return value to avoid wasting too much time | 379 | * seq_has_overflowed to avoid wasting too much time trying to print to |
397 | trying to print to a full buffer. */ | 380 | * a full buffer. |
381 | */ | ||
398 | 382 | ||
399 | static int table_seq_show(struct seq_file *seq, void *iter_ptr) | 383 | static int table_seq_show(struct seq_file *seq, void *iter_ptr) |
400 | { | 384 | { |
401 | struct rsbtbl_iter *ri = iter_ptr; | 385 | struct rsbtbl_iter *ri = iter_ptr; |
402 | int rv = 0; | ||
403 | 386 | ||
404 | switch (ri->format) { | 387 | switch (ri->format) { |
405 | case 1: | 388 | case 1: |
406 | rv = print_format1(ri->rsb, seq); | 389 | print_format1(ri->rsb, seq); |
407 | break; | 390 | break; |
408 | case 2: | 391 | case 2: |
409 | if (ri->header) { | 392 | if (ri->header) { |
@@ -412,25 +395,25 @@ static int table_seq_show(struct seq_file *seq, void *iter_ptr) | |||
412 | "r_nodeid r_len r_name\n"); | 395 | "r_nodeid r_len r_name\n"); |
413 | ri->header = 0; | 396 | ri->header = 0; |
414 | } | 397 | } |
415 | rv = print_format2(ri->rsb, seq); | 398 | print_format2(ri->rsb, seq); |
416 | break; | 399 | break; |
417 | case 3: | 400 | case 3: |
418 | if (ri->header) { | 401 | if (ri->header) { |
419 | seq_printf(seq, "version rsb 1.1 lvb 1.1 lkb 1.1\n"); | 402 | seq_printf(seq, "version rsb 1.1 lvb 1.1 lkb 1.1\n"); |
420 | ri->header = 0; | 403 | ri->header = 0; |
421 | } | 404 | } |
422 | rv = print_format3(ri->rsb, seq); | 405 | print_format3(ri->rsb, seq); |
423 | break; | 406 | break; |
424 | case 4: | 407 | case 4: |
425 | if (ri->header) { | 408 | if (ri->header) { |
426 | seq_printf(seq, "version 4 rsb 2\n"); | 409 | seq_printf(seq, "version 4 rsb 2\n"); |
427 | ri->header = 0; | 410 | ri->header = 0; |
428 | } | 411 | } |
429 | rv = print_format4(ri->rsb, seq); | 412 | print_format4(ri->rsb, seq); |
430 | break; | 413 | break; |
431 | } | 414 | } |
432 | 415 | ||
433 | return rv; | 416 | return 0; |
434 | } | 417 | } |
435 | 418 | ||
436 | static const struct seq_operations format1_seq_ops; | 419 | static const struct seq_operations format1_seq_ops; |