]> git.proxmox.com Git - zfsonlinux.git/blame - spl-patches/0011-Fix-more-cstyle-warnings.patch
update SPL to 0.7.7
[zfsonlinux.git] / spl-patches / 0011-Fix-more-cstyle-warnings.patch
CommitLineData
edf5051c
FG
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Brian Behlendorf <behlendorf1@llnl.gov>
3Date: Sat, 24 Feb 2018 10:05:37 -0800
4Subject: [PATCH] Fix more cstyle warnings
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9This patch contains no functional changes. It is solely intended
10to resolve cstyle warnings in order to facilitate moving the spl
11source code in to the zfs repository.
12
13Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
14Reviewed by: George Melikov <mail@gmelikov.ru>
15Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
16Closes #687
17(cherry picked from commit 37a93c61226f3fd76f6f1e67291128a5d2d6d7c1)
18Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
19---
20 module/spl/spl-err.c | 5 ++++-
21 module/spl/spl-generic.c | 11 ++++++++---
22 module/spl/spl-kmem-cache.c | 5 ++++-
23 module/spl/spl-kmem.c | 5 ++++-
24 module/spl/spl-kstat.c | 17 ++++++++++-------
25 module/spl/spl-proc.c | 18 ++++++++++--------
26 module/spl/spl-thread.c | 3 +--
27 module/spl/spl-vnode.c | 11 +++++------
28 module/spl/spl-xdr.c | 10 +++++-----
29 9 files changed, 51 insertions(+), 34 deletions(-)
30
31diff --git a/module/spl/spl-err.c b/module/spl/spl-err.c
32index e089de2..adfa555 100644
33--- a/module/spl/spl-err.c
34+++ b/module/spl/spl-err.c
35@@ -34,9 +34,11 @@
36 * analysis and other such goodies.
37 * But we would still default to the current default of not to do that.
38 */
39+/* BEGIN CSTYLED */
40 unsigned int spl_panic_halt;
41 module_param(spl_panic_halt, uint, 0644);
42 MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures");
43+/* END CSTYLED */
44
45 /*
46 * Limit the number of stack traces dumped to not more than 5 every
47@@ -55,7 +57,8 @@ spl_dumpstack(void)
48 EXPORT_SYMBOL(spl_dumpstack);
49
50 int
51-spl_panic(const char *file, const char *func, int line, const char *fmt, ...) {
52+spl_panic(const char *file, const char *func, int line, const char *fmt, ...)
53+{
54 const char *newfile;
55 char msg[MAXMSGLEN];
56 va_list ap;
57diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c
58index 80fc54c..1098d9a 100644
59--- a/module/spl/spl-generic.c
60+++ b/module/spl/spl-generic.c
61@@ -50,10 +50,12 @@
62 char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE;
63 EXPORT_SYMBOL(spl_version);
64
65+/* BEGIN CSTYLED */
66 unsigned long spl_hostid = 0;
67 EXPORT_SYMBOL(spl_hostid);
68 module_param(spl_hostid, ulong, 0644);
69 MODULE_PARM_DESC(spl_hostid, "The system hostid.");
70+/* END CSTYLED */
71
72 proc_t p0;
73 EXPORT_SYMBOL(p0);
74@@ -98,7 +100,8 @@ static DEFINE_PER_CPU(uint64_t[2], spl_pseudo_entropy);
75 */
76
77 static inline uint64_t
78-spl_rand_next(uint64_t *s) {
79+spl_rand_next(uint64_t *s)
80+{
81 uint64_t s1 = s[0];
82 const uint64_t s0 = s[1];
83 s[0] = s0;
84@@ -108,7 +111,8 @@ spl_rand_next(uint64_t *s) {
85 }
86
87 static inline void
88-spl_rand_jump(uint64_t *s) {
89+spl_rand_jump(uint64_t *s)
90+{
91 static const uint64_t JUMP[] =
92 { 0x8a5cd789635d2dff, 0x121fd2155c472f96 };
93
94@@ -184,7 +188,8 @@ EXPORT_SYMBOL(random_get_pseudo_bytes);
95 * Calculate number of leading of zeros for a 64-bit value.
96 */
97 static int
98-nlz64(uint64_t x) {
99+nlz64(uint64_t x)
100+{
101 register int n = 0;
102
103 if (x == 0)
104diff --git a/module/spl/spl-kmem-cache.c b/module/spl/spl-kmem-cache.c
105index e4bcdd8..c73a2fd 100644
106--- a/module/spl/spl-kmem-cache.c
107+++ b/module/spl/spl-kmem-cache.c
108@@ -66,6 +66,7 @@
109 * because it has been shown to improve responsiveness on low memory systems.
110 * This policy may be changed by setting KMC_EXPIRE_AGE or KMC_EXPIRE_MEM.
111 */
112+/* BEGIN CSTYLED */
113 unsigned int spl_kmem_cache_expire = KMC_EXPIRE_MEM;
114 EXPORT_SYMBOL(spl_kmem_cache_expire);
115 module_param(spl_kmem_cache_expire, uint, 0644);
116@@ -148,6 +149,7 @@ unsigned int spl_kmem_cache_kmem_threads = 4;
117 module_param(spl_kmem_cache_kmem_threads, uint, 0444);
118 MODULE_PARM_DESC(spl_kmem_cache_kmem_threads,
119 "Number of spl_kmem_cache threads");
120+/* END CSTYLED */
121
122 /*
123 * Slab allocation interfaces
124@@ -356,8 +358,9 @@ out:
125 if (rc) {
126 if (skc->skc_flags & KMC_OFFSLAB)
127 list_for_each_entry_safe(sko,
128- n, &sks->sks_free_list, sko_list)
129+ n, &sks->sks_free_list, sko_list) {
130 kv_free(skc, sko->sko_addr, offslab_size);
131+ }
132
133 kv_free(skc, base, skc->skc_slab_size);
134 sks = NULL;
135diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
136index bf9c6b1..e0d5510 100755
137--- a/module/spl/spl-kmem.c
138+++ b/module/spl/spl-kmem.c
139@@ -44,6 +44,7 @@
140 * allocations are quickly caught. These warnings may be disabled by setting
141 * the threshold to zero.
142 */
143+/* BEGIN CSTYLED */
144 unsigned int spl_kmem_alloc_warn = MIN(16 * PAGE_SIZE, 64 * 1024);
145 module_param(spl_kmem_alloc_warn, uint, 0644);
146 MODULE_PARM_DESC(spl_kmem_alloc_warn,
147@@ -64,6 +65,7 @@ module_param(spl_kmem_alloc_max, uint, 0644);
148 MODULE_PARM_DESC(spl_kmem_alloc_max,
149 "Maximum size in bytes for a kmem_alloc()");
150 EXPORT_SYMBOL(spl_kmem_alloc_max);
151+/* END CSTYLED */
152
153 int
154 kmem_debugging(void)
155@@ -520,10 +522,11 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock)
156 printk(KERN_WARNING "%-16s %-5s %-16s %s:%s\n", "address",
157 "size", "data", "func", "line");
158
159- list_for_each_entry(kd, list, kd_list)
160+ list_for_each_entry(kd, list, kd_list) {
161 printk(KERN_WARNING "%p %-5d %-16s %s:%d\n", kd->kd_addr,
162 (int)kd->kd_size, spl_sprintf_addr(kd, str, 17, 8),
163 kd->kd_func, kd->kd_line);
164+ }
165
166 spin_unlock_irqrestore(lock, flags);
167 }
168diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c
169index e769510..6970fcc 100644
170--- a/module/spl/spl-kstat.c
171+++ b/module/spl/spl-kstat.c
172@@ -305,7 +305,7 @@ restart:
173 } else {
174 ASSERT(ksp->ks_ndata == 1);
175 rc = kstat_seq_show_raw(f, ksp->ks_data,
176- ksp->ks_data_size);
177+ ksp->ks_data_size);
178 }
179 break;
180 case KSTAT_TYPE_NAMED:
181@@ -434,9 +434,10 @@ kstat_find_module(char *name)
182 {
183 kstat_module_t *module;
184
185- list_for_each_entry(module, &kstat_module_list, ksm_module_list)
186+ list_for_each_entry(module, &kstat_module_list, ksm_module_list) {
187 if (strncmp(name, module->ksm_name, KSTAT_STRLEN) == 0)
188 return (module);
189+ }
190
191 return (NULL);
192 }
193@@ -517,9 +518,9 @@ static struct file_operations proc_kstat_operations = {
194
195 void
196 __kstat_set_raw_ops(kstat_t *ksp,
197- int (*headers)(char *buf, size_t size),
198- int (*data)(char *buf, size_t size, void *data),
199- void *(*addr)(kstat_t *ksp, loff_t index))
200+ int (*headers)(char *buf, size_t size),
201+ int (*data)(char *buf, size_t size, void *data),
202+ void *(*addr)(kstat_t *ksp, loff_t index))
203 {
204 ksp->ks_raw_ops.headers = headers;
205 ksp->ks_raw_ops.data = data;
206@@ -628,11 +629,12 @@ kstat_detect_collision(kstat_t *ksp)
207
208 cp[0] = '\0';
209 if ((module = kstat_find_module(parent)) != NULL) {
210- list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
211+ list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list) {
212 if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) {
213 strfree(parent);
214 return (EEXIST);
215 }
216+ }
217 }
218
219 strfree(parent);
220@@ -665,9 +667,10 @@ __kstat_install(kstat_t *ksp)
221 * Only one entry by this name per-module, on failure the module
222 * shouldn't be deleted because we know it has at least one entry.
223 */
224- list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
225+ list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list) {
226 if (strncmp(tmp->ks_name, ksp->ks_name, KSTAT_STRLEN) == 0)
227 goto out;
228+ }
229
230 list_add_tail(&ksp->ks_list, &module->ksm_kstat_list);
231
232diff --git a/module/spl/spl-proc.c b/module/spl/spl-proc.c
233index 60d6bbb..8ce5bbe 100644
234--- a/module/spl/spl-proc.c
235+++ b/module/spl/spl-proc.c
236@@ -85,8 +85,8 @@ proc_copyin_string(char *kbuffer, int kbuffer_size, const char *ubuffer,
237 }
238
239 static int
240-proc_copyout_string(char *ubuffer, int ubuffer_size,
241- const char *kbuffer, char *append)
242+proc_copyout_string(char *ubuffer, int ubuffer_size, const char *kbuffer,
243+ char *append)
244 {
245 /*
246 * NB if 'append' != NULL, it's a single character to append to the
247@@ -239,9 +239,11 @@ taskq_seq_show_headers(struct seq_file *f)
248 #define LHEAD_ACTIVE 4
249 #define LHEAD_SIZE 5
250
251+/* BEGIN CSTYLED */
252 static unsigned int spl_max_show_tasks = 512;
253 module_param(spl_max_show_tasks, uint, 0644);
254 MODULE_PARM_DESC(spl_max_show_tasks, "Max number of tasks shown in taskq proc");
255+/* END CSTYLED */
256
257 static int
258 taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag)
259@@ -719,15 +721,15 @@ spl_proc_init(void)
260 goto out;
261 }
262
263- proc_spl_taskq_all = proc_create_data("taskq-all", 0444,
264- proc_spl, &proc_taskq_all_operations, NULL);
265+ proc_spl_taskq_all = proc_create_data("taskq-all", 0444, proc_spl,
266+ &proc_taskq_all_operations, NULL);
267 if (proc_spl_taskq_all == NULL) {
268 rc = -EUNATCH;
269 goto out;
270 }
271
272- proc_spl_taskq = proc_create_data("taskq", 0444,
273- proc_spl, &proc_taskq_operations, NULL);
274+ proc_spl_taskq = proc_create_data("taskq", 0444, proc_spl,
275+ &proc_taskq_operations, NULL);
276 if (proc_spl_taskq == NULL) {
277 rc = -EUNATCH;
278 goto out;
279@@ -739,8 +741,8 @@ spl_proc_init(void)
280 goto out;
281 }
282
283- proc_spl_kmem_slab = proc_create_data("slab", 0444,
284- proc_spl_kmem, &proc_slab_operations, NULL);
285+ proc_spl_kmem_slab = proc_create_data("slab", 0444, proc_spl_kmem,
286+ &proc_slab_operations, NULL);
287 if (proc_spl_kmem_slab == NULL) {
288 rc = -EUNATCH;
289 goto out;
290diff --git a/module/spl/spl-thread.c b/module/spl/spl-thread.c
291index 357d0ca..6f640fd 100644
292--- a/module/spl/spl-thread.c
293+++ b/module/spl/spl-thread.c
294@@ -79,8 +79,7 @@ EXPORT_SYMBOL(__thread_exit);
295 */
296 kthread_t *
297 __thread_create(caddr_t stk, size_t stksize, thread_func_t func,
298- const char *name, void *args, size_t len, proc_t *pp,
299- int state, pri_t pri)
300+ const char *name, void *args, size_t len, proc_t *pp, int state, pri_t pri)
301 {
302 thread_priv_t *tp;
303 struct task_struct *tsk;
304diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
305index 23008af..74ae8fe 100644
306--- a/module/spl/spl-vnode.c
307+++ b/module/spl/spl-vnode.c
308@@ -118,8 +118,8 @@ vn_free(vnode_t *vp)
309 EXPORT_SYMBOL(vn_free);
310
311 int
312-vn_open(const char *path, uio_seg_t seg, int flags, int mode,
313- vnode_t **vpp, int x1, void *x2)
314+vn_open(const char *path, uio_seg_t seg, int flags, int mode, vnode_t **vpp,
315+ int x1, void *x2)
316 {
317 struct file *fp;
318 struct kstat stat;
319@@ -210,7 +210,7 @@ EXPORT_SYMBOL(vn_openat);
320
321 int
322 vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, offset_t off,
323- uio_seg_t seg, int ioflag, rlim64_t x2, void *x3, ssize_t *residp)
324+ uio_seg_t seg, int ioflag, rlim64_t x2, void *x3, ssize_t *residp)
325 {
326 struct file *fp = vp->v_file;
327 loff_t offset = off;
328@@ -401,9 +401,8 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
329 --end;
330
331 vp->v_file->f_dentry->d_inode->i_op->truncate_range(
332- vp->v_file->f_dentry->d_inode,
333- bfp->l_start, end
334- );
335+ vp->v_file->f_dentry->d_inode, bfp->l_start, end);
336+
337 return (0);
338 }
339 #endif
340diff --git a/module/spl/spl-xdr.c b/module/spl/spl-xdr.c
341index 7c166e9..456887e 100644
342--- a/module/spl/spl-xdr.c
343+++ b/module/spl/spl-xdr.c
344@@ -160,7 +160,7 @@ EXPORT_SYMBOL(xdrmem_create);
345 static bool_t
346 xdrmem_control(XDR *xdrs, int req, void *info)
347 {
348- struct xdr_bytesrec *rec = (struct xdr_bytesrec *) info;
349+ struct xdr_bytesrec *rec = (struct xdr_bytesrec *)info;
350
351 if (req != XDR_GET_BYTES_AVAIL)
352 return (FALSE);
353@@ -236,7 +236,7 @@ xdrmem_enc_uint32(XDR *xdrs, uint32_t val)
354 if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end)
355 return (FALSE);
356
357- *((uint32_t *) xdrs->x_addr) = cpu_to_be32(val);
358+ *((uint32_t *)xdrs->x_addr) = cpu_to_be32(val);
359
360 xdrs->x_addr += sizeof (uint32_t);
361
362@@ -249,7 +249,7 @@ xdrmem_dec_uint32(XDR *xdrs, uint32_t *val)
363 if (xdrs->x_addr + sizeof (uint32_t) > xdrs->x_addr_end)
364 return (FALSE);
365
366- *val = be32_to_cpu(*((uint32_t *) xdrs->x_addr));
367+ *val = be32_to_cpu(*((uint32_t *)xdrs->x_addr));
368
369 xdrs->x_addr += sizeof (uint32_t);
370
371@@ -333,7 +333,7 @@ xdrmem_dec_uint(XDR *xdrs, unsigned *up)
372 {
373 BUILD_BUG_ON(sizeof (unsigned) != 4);
374
375- return (xdrmem_dec_uint32(xdrs, (uint32_t *) up));
376+ return (xdrmem_dec_uint32(xdrs, (uint32_t *)up));
377 }
378
379 static bool_t
380@@ -359,7 +359,7 @@ xdrmem_dec_ulonglong(XDR *xdrs, u_longlong_t *ullp)
381 if (!xdrmem_dec_uint32(xdrs, &low))
382 return (FALSE);
383
384- *ullp = ((u_longlong_t) high << 32) | low;
385+ *ullp = ((u_longlong_t)high << 32) | low;
386
387 return (TRUE);
388 }
389--
3902.14.2
391