Fix more cstyle warnings
This patch contains no functional changes. It is solely intended to resolve cstyle warnings in order to facilitate moving the spl source code in to the zfs repository. Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Reviewed by: George Melikov <mail@gmelikov.ru> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #687
This commit is contained in:
parent
378c6ed549
commit
3673d03285
@ -34,9 +34,11 @@
|
|||||||
* analysis and other such goodies.
|
* analysis and other such goodies.
|
||||||
* But we would still default to the current default of not to do that.
|
* But we would still default to the current default of not to do that.
|
||||||
*/
|
*/
|
||||||
|
/* BEGIN CSTYLED */
|
||||||
unsigned int spl_panic_halt;
|
unsigned int spl_panic_halt;
|
||||||
module_param(spl_panic_halt, uint, 0644);
|
module_param(spl_panic_halt, uint, 0644);
|
||||||
MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures");
|
MODULE_PARM_DESC(spl_panic_halt, "Cause kernel panic on assertion failures");
|
||||||
|
/* END CSTYLED */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Limit the number of stack traces dumped to not more than 5 every
|
* Limit the number of stack traces dumped to not more than 5 every
|
||||||
@ -55,7 +57,8 @@ spl_dumpstack(void)
|
|||||||
EXPORT_SYMBOL(spl_dumpstack);
|
EXPORT_SYMBOL(spl_dumpstack);
|
||||||
|
|
||||||
int
|
int
|
||||||
spl_panic(const char *file, const char *func, int line, const char *fmt, ...) {
|
spl_panic(const char *file, const char *func, int line, const char *fmt, ...)
|
||||||
|
{
|
||||||
const char *newfile;
|
const char *newfile;
|
||||||
char msg[MAXMSGLEN];
|
char msg[MAXMSGLEN];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -50,10 +50,12 @@
|
|||||||
char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE;
|
char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE;
|
||||||
EXPORT_SYMBOL(spl_version);
|
EXPORT_SYMBOL(spl_version);
|
||||||
|
|
||||||
|
/* BEGIN CSTYLED */
|
||||||
unsigned long spl_hostid = 0;
|
unsigned long spl_hostid = 0;
|
||||||
EXPORT_SYMBOL(spl_hostid);
|
EXPORT_SYMBOL(spl_hostid);
|
||||||
module_param(spl_hostid, ulong, 0644);
|
module_param(spl_hostid, ulong, 0644);
|
||||||
MODULE_PARM_DESC(spl_hostid, "The system hostid.");
|
MODULE_PARM_DESC(spl_hostid, "The system hostid.");
|
||||||
|
/* END CSTYLED */
|
||||||
|
|
||||||
proc_t p0;
|
proc_t p0;
|
||||||
EXPORT_SYMBOL(p0);
|
EXPORT_SYMBOL(p0);
|
||||||
@ -98,7 +100,8 @@ static DEFINE_PER_CPU(uint64_t[2], spl_pseudo_entropy);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static inline uint64_t
|
static inline uint64_t
|
||||||
spl_rand_next(uint64_t *s) {
|
spl_rand_next(uint64_t *s)
|
||||||
|
{
|
||||||
uint64_t s1 = s[0];
|
uint64_t s1 = s[0];
|
||||||
const uint64_t s0 = s[1];
|
const uint64_t s0 = s[1];
|
||||||
s[0] = s0;
|
s[0] = s0;
|
||||||
@ -108,7 +111,8 @@ spl_rand_next(uint64_t *s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
spl_rand_jump(uint64_t *s) {
|
spl_rand_jump(uint64_t *s)
|
||||||
|
{
|
||||||
static const uint64_t JUMP[] =
|
static const uint64_t JUMP[] =
|
||||||
{ 0x8a5cd789635d2dff, 0x121fd2155c472f96 };
|
{ 0x8a5cd789635d2dff, 0x121fd2155c472f96 };
|
||||||
|
|
||||||
@ -184,7 +188,8 @@ EXPORT_SYMBOL(random_get_pseudo_bytes);
|
|||||||
* Calculate number of leading of zeros for a 64-bit value.
|
* Calculate number of leading of zeros for a 64-bit value.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
nlz64(uint64_t x) {
|
nlz64(uint64_t x)
|
||||||
|
{
|
||||||
register int n = 0;
|
register int n = 0;
|
||||||
|
|
||||||
if (x == 0)
|
if (x == 0)
|
||||||
|
@ -66,6 +66,7 @@
|
|||||||
* because it has been shown to improve responsiveness on low memory systems.
|
* because it has been shown to improve responsiveness on low memory systems.
|
||||||
* This policy may be changed by setting KMC_EXPIRE_AGE or KMC_EXPIRE_MEM.
|
* This policy may be changed by setting KMC_EXPIRE_AGE or KMC_EXPIRE_MEM.
|
||||||
*/
|
*/
|
||||||
|
/* BEGIN CSTYLED */
|
||||||
unsigned int spl_kmem_cache_expire = KMC_EXPIRE_MEM;
|
unsigned int spl_kmem_cache_expire = KMC_EXPIRE_MEM;
|
||||||
EXPORT_SYMBOL(spl_kmem_cache_expire);
|
EXPORT_SYMBOL(spl_kmem_cache_expire);
|
||||||
module_param(spl_kmem_cache_expire, uint, 0644);
|
module_param(spl_kmem_cache_expire, uint, 0644);
|
||||||
@ -148,6 +149,7 @@ unsigned int spl_kmem_cache_kmem_threads = 4;
|
|||||||
module_param(spl_kmem_cache_kmem_threads, uint, 0444);
|
module_param(spl_kmem_cache_kmem_threads, uint, 0444);
|
||||||
MODULE_PARM_DESC(spl_kmem_cache_kmem_threads,
|
MODULE_PARM_DESC(spl_kmem_cache_kmem_threads,
|
||||||
"Number of spl_kmem_cache threads");
|
"Number of spl_kmem_cache threads");
|
||||||
|
/* END CSTYLED */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Slab allocation interfaces
|
* Slab allocation interfaces
|
||||||
@ -356,8 +358,9 @@ out:
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
if (skc->skc_flags & KMC_OFFSLAB)
|
if (skc->skc_flags & KMC_OFFSLAB)
|
||||||
list_for_each_entry_safe(sko,
|
list_for_each_entry_safe(sko,
|
||||||
n, &sks->sks_free_list, sko_list)
|
n, &sks->sks_free_list, sko_list) {
|
||||||
kv_free(skc, sko->sko_addr, offslab_size);
|
kv_free(skc, sko->sko_addr, offslab_size);
|
||||||
|
}
|
||||||
|
|
||||||
kv_free(skc, base, skc->skc_slab_size);
|
kv_free(skc, base, skc->skc_slab_size);
|
||||||
sks = NULL;
|
sks = NULL;
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
* allocations are quickly caught. These warnings may be disabled by setting
|
* allocations are quickly caught. These warnings may be disabled by setting
|
||||||
* the threshold to zero.
|
* the threshold to zero.
|
||||||
*/
|
*/
|
||||||
|
/* BEGIN CSTYLED */
|
||||||
unsigned int spl_kmem_alloc_warn = MIN(16 * PAGE_SIZE, 64 * 1024);
|
unsigned int spl_kmem_alloc_warn = MIN(16 * PAGE_SIZE, 64 * 1024);
|
||||||
module_param(spl_kmem_alloc_warn, uint, 0644);
|
module_param(spl_kmem_alloc_warn, uint, 0644);
|
||||||
MODULE_PARM_DESC(spl_kmem_alloc_warn,
|
MODULE_PARM_DESC(spl_kmem_alloc_warn,
|
||||||
@ -64,6 +65,7 @@ module_param(spl_kmem_alloc_max, uint, 0644);
|
|||||||
MODULE_PARM_DESC(spl_kmem_alloc_max,
|
MODULE_PARM_DESC(spl_kmem_alloc_max,
|
||||||
"Maximum size in bytes for a kmem_alloc()");
|
"Maximum size in bytes for a kmem_alloc()");
|
||||||
EXPORT_SYMBOL(spl_kmem_alloc_max);
|
EXPORT_SYMBOL(spl_kmem_alloc_max);
|
||||||
|
/* END CSTYLED */
|
||||||
|
|
||||||
int
|
int
|
||||||
kmem_debugging(void)
|
kmem_debugging(void)
|
||||||
@ -520,10 +522,11 @@ spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock)
|
|||||||
printk(KERN_WARNING "%-16s %-5s %-16s %s:%s\n", "address",
|
printk(KERN_WARNING "%-16s %-5s %-16s %s:%s\n", "address",
|
||||||
"size", "data", "func", "line");
|
"size", "data", "func", "line");
|
||||||
|
|
||||||
list_for_each_entry(kd, list, kd_list)
|
list_for_each_entry(kd, list, kd_list) {
|
||||||
printk(KERN_WARNING "%p %-5d %-16s %s:%d\n", kd->kd_addr,
|
printk(KERN_WARNING "%p %-5d %-16s %s:%d\n", kd->kd_addr,
|
||||||
(int)kd->kd_size, spl_sprintf_addr(kd, str, 17, 8),
|
(int)kd->kd_size, spl_sprintf_addr(kd, str, 17, 8),
|
||||||
kd->kd_func, kd->kd_line);
|
kd->kd_func, kd->kd_line);
|
||||||
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(lock, flags);
|
spin_unlock_irqrestore(lock, flags);
|
||||||
}
|
}
|
||||||
|
@ -434,9 +434,10 @@ kstat_find_module(char *name)
|
|||||||
{
|
{
|
||||||
kstat_module_t *module;
|
kstat_module_t *module;
|
||||||
|
|
||||||
list_for_each_entry(module, &kstat_module_list, ksm_module_list)
|
list_for_each_entry(module, &kstat_module_list, ksm_module_list) {
|
||||||
if (strncmp(name, module->ksm_name, KSTAT_STRLEN) == 0)
|
if (strncmp(name, module->ksm_name, KSTAT_STRLEN) == 0)
|
||||||
return (module);
|
return (module);
|
||||||
|
}
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -628,12 +629,13 @@ kstat_detect_collision(kstat_t *ksp)
|
|||||||
|
|
||||||
cp[0] = '\0';
|
cp[0] = '\0';
|
||||||
if ((module = kstat_find_module(parent)) != NULL) {
|
if ((module = kstat_find_module(parent)) != NULL) {
|
||||||
list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
|
list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list) {
|
||||||
if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) {
|
if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) {
|
||||||
strfree(parent);
|
strfree(parent);
|
||||||
return (EEXIST);
|
return (EEXIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
strfree(parent);
|
strfree(parent);
|
||||||
return (0);
|
return (0);
|
||||||
@ -665,9 +667,10 @@ __kstat_install(kstat_t *ksp)
|
|||||||
* Only one entry by this name per-module, on failure the module
|
* Only one entry by this name per-module, on failure the module
|
||||||
* shouldn't be deleted because we know it has at least one entry.
|
* shouldn't be deleted because we know it has at least one entry.
|
||||||
*/
|
*/
|
||||||
list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list)
|
list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list) {
|
||||||
if (strncmp(tmp->ks_name, ksp->ks_name, KSTAT_STRLEN) == 0)
|
if (strncmp(tmp->ks_name, ksp->ks_name, KSTAT_STRLEN) == 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
list_add_tail(&ksp->ks_list, &module->ksm_kstat_list);
|
list_add_tail(&ksp->ks_list, &module->ksm_kstat_list);
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ proc_copyin_string(char *kbuffer, int kbuffer_size, const char *ubuffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
proc_copyout_string(char *ubuffer, int ubuffer_size,
|
proc_copyout_string(char *ubuffer, int ubuffer_size, const char *kbuffer,
|
||||||
const char *kbuffer, char *append)
|
char *append)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* NB if 'append' != NULL, it's a single character to append to the
|
* NB if 'append' != NULL, it's a single character to append to the
|
||||||
@ -239,9 +239,11 @@ taskq_seq_show_headers(struct seq_file *f)
|
|||||||
#define LHEAD_ACTIVE 4
|
#define LHEAD_ACTIVE 4
|
||||||
#define LHEAD_SIZE 5
|
#define LHEAD_SIZE 5
|
||||||
|
|
||||||
|
/* BEGIN CSTYLED */
|
||||||
static unsigned int spl_max_show_tasks = 512;
|
static unsigned int spl_max_show_tasks = 512;
|
||||||
module_param(spl_max_show_tasks, uint, 0644);
|
module_param(spl_max_show_tasks, uint, 0644);
|
||||||
MODULE_PARM_DESC(spl_max_show_tasks, "Max number of tasks shown in taskq proc");
|
MODULE_PARM_DESC(spl_max_show_tasks, "Max number of tasks shown in taskq proc");
|
||||||
|
/* END CSTYLED */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag)
|
taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag)
|
||||||
@ -719,15 +721,15 @@ spl_proc_init(void)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_spl_taskq_all = proc_create_data("taskq-all", 0444,
|
proc_spl_taskq_all = proc_create_data("taskq-all", 0444, proc_spl,
|
||||||
proc_spl, &proc_taskq_all_operations, NULL);
|
&proc_taskq_all_operations, NULL);
|
||||||
if (proc_spl_taskq_all == NULL) {
|
if (proc_spl_taskq_all == NULL) {
|
||||||
rc = -EUNATCH;
|
rc = -EUNATCH;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_spl_taskq = proc_create_data("taskq", 0444,
|
proc_spl_taskq = proc_create_data("taskq", 0444, proc_spl,
|
||||||
proc_spl, &proc_taskq_operations, NULL);
|
&proc_taskq_operations, NULL);
|
||||||
if (proc_spl_taskq == NULL) {
|
if (proc_spl_taskq == NULL) {
|
||||||
rc = -EUNATCH;
|
rc = -EUNATCH;
|
||||||
goto out;
|
goto out;
|
||||||
@ -739,8 +741,8 @@ spl_proc_init(void)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_spl_kmem_slab = proc_create_data("slab", 0444,
|
proc_spl_kmem_slab = proc_create_data("slab", 0444, proc_spl_kmem,
|
||||||
proc_spl_kmem, &proc_slab_operations, NULL);
|
&proc_slab_operations, NULL);
|
||||||
if (proc_spl_kmem_slab == NULL) {
|
if (proc_spl_kmem_slab == NULL) {
|
||||||
rc = -EUNATCH;
|
rc = -EUNATCH;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -79,8 +79,7 @@ EXPORT_SYMBOL(__thread_exit);
|
|||||||
*/
|
*/
|
||||||
kthread_t *
|
kthread_t *
|
||||||
__thread_create(caddr_t stk, size_t stksize, thread_func_t func,
|
__thread_create(caddr_t stk, size_t stksize, thread_func_t func,
|
||||||
const char *name, void *args, size_t len, proc_t *pp,
|
const char *name, void *args, size_t len, proc_t *pp, int state, pri_t pri)
|
||||||
int state, pri_t pri)
|
|
||||||
{
|
{
|
||||||
thread_priv_t *tp;
|
thread_priv_t *tp;
|
||||||
struct task_struct *tsk;
|
struct task_struct *tsk;
|
||||||
|
@ -118,8 +118,8 @@ vn_free(vnode_t *vp)
|
|||||||
EXPORT_SYMBOL(vn_free);
|
EXPORT_SYMBOL(vn_free);
|
||||||
|
|
||||||
int
|
int
|
||||||
vn_open(const char *path, uio_seg_t seg, int flags, int mode,
|
vn_open(const char *path, uio_seg_t seg, int flags, int mode, vnode_t **vpp,
|
||||||
vnode_t **vpp, int x1, void *x2)
|
int x1, void *x2)
|
||||||
{
|
{
|
||||||
struct file *fp;
|
struct file *fp;
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
@ -401,9 +401,8 @@ int vn_space(vnode_t *vp, int cmd, struct flock *bfp, int flag,
|
|||||||
--end;
|
--end;
|
||||||
|
|
||||||
vp->v_file->f_dentry->d_inode->i_op->truncate_range(
|
vp->v_file->f_dentry->d_inode->i_op->truncate_range(
|
||||||
vp->v_file->f_dentry->d_inode,
|
vp->v_file->f_dentry->d_inode, bfp->l_start, end);
|
||||||
bfp->l_start, end
|
|
||||||
);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user