Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
Make include/linux/ conform to ZFS style standard
Browse files Browse the repository at this point in the history
No semantic changes.

Fix the following types of style issues:
	blank after preprocessor #
	#define followed by space instead of tab
	improper first line of block comment
	indent by spaces instead of tabs
	last line in file is blank
	missing blank after open comment
	missing space before left brace
	non-continuation indented 4 spaces
	spaces instead of tabs
	unparenthesized return expression

Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
  • Loading branch information
ofaaland authored and behlendorf committed Oct 9, 2017
1 parent 4b393c5 commit ce319db
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 53 deletions.
3 changes: 1 addition & 2 deletions include/linux/bitops_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
*/

#ifndef _SPL_BITOPS_COMPAT_H
#define _SPL_BITOPS_COMPAT_H
#define _SPL_BITOPS_COMPAT_H

#include <linux/bitops.h>

#endif /* _SPL_BITOPS_COMPAT_H */

4 changes: 2 additions & 2 deletions include/linux/compiler_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

#ifndef _SPL_COMPILER_COMPAT_H
#define _SPL_COMPILER_COMPAT_H
#define _SPL_COMPILER_COMPAT_H

#include <linux/compiler.h>

Expand All @@ -41,7 +41,7 @@
* handlers, all running on the same CPU.
*/
/* Taken from 2.6.33.2 */
# define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
#endif

#endif /* _SPL_COMPILER_COMPAT_H */
2 changes: 1 addition & 1 deletion include/linux/delay_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

#ifndef _SPL_DELAY_COMPAT_H
#define _SPL_DELAY_COMPAT_H
#define _SPL_DELAY_COMPAT_H

#include <linux/delay.h>
#include <linux/time.h>
Expand Down
31 changes: 15 additions & 16 deletions include/linux/file_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

#ifndef _SPL_FILE_COMPAT_H
#define _SPL_FILE_COMPAT_H
#define _SPL_FILE_COMPAT_H

#include <linux/fs.h>
#ifdef HAVE_FDTABLE_HEADER
Expand All @@ -33,22 +33,22 @@
static inline struct file *
spl_filp_open(const char *name, int flags, int mode, int *err)
{
struct file *filp = NULL;
int rc;
struct file *filp = NULL;
int rc;

filp = filp_open(name, flags, mode);
if (IS_ERR(filp)) {
rc = PTR_ERR(filp);
if (err)
*err = rc;
filp = NULL;
}
return filp;
filp = filp_open(name, flags, mode);
if (IS_ERR(filp)) {
rc = PTR_ERR(filp);
if (err)
*err = rc;
filp = NULL;
}
return (filp);
}

#define spl_filp_close(f) filp_close(f, NULL)
#define spl_filp_poff(f) (&(f)->f_pos)
#define spl_filp_write(fp, b, s, p) (fp)->f_op->write((fp), (b), (s), p)
#define spl_filp_close(f) filp_close(f, NULL)
#define spl_filp_poff(f) (&(f)->f_pos)
#define spl_filp_write(fp, b, s, p) (fp)->f_op->write((fp), (b), (s), p)

static inline int
spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len)
Expand All @@ -65,7 +65,7 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len)
error = fp->f_dentry->d_inode->i_op->fallocate(
fp->f_dentry->d_inode, mode, offset, len);
#endif /* HAVE_INODE_FALLOCATE */
#endif /*HAVE_FILE_FALLOCATE */
#endif /* HAVE_FILE_FALLOCATE */

return (error);
}
Expand Down Expand Up @@ -97,4 +97,3 @@ spl_filp_fallocate(struct file *fp, int mode, loff_t offset, loff_t len)
#endif

#endif /* SPL_FILE_COMPAT_H */

23 changes: 11 additions & 12 deletions include/linux/list_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,28 @@
*/

#ifndef _SPL_LIST_COMPAT_H
#define _SPL_LIST_COMPAT_H
#define _SPL_LIST_COMPAT_H

#include <linux/list.h>

#ifndef list_for_each_entry_safe_reverse

/**
/*
* list_for_each_entry_safe_reverse
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate backwards over list of given type, safe against removal
* of list entry.
*/
#define list_for_each_entry_safe_reverse(pos, n, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member), \
n = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.prev, typeof(*n), member))
#define list_for_each_entry_safe_reverse(pos, n, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member), \
n = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.prev, typeof(*n), member))

#endif /* list_for_each_entry_safe_reverse */

#endif /* SPL_LIST_COMPAT_H */

4 changes: 2 additions & 2 deletions include/linux/math64_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
*/

#ifndef _SPL_MATH64_COMPAT_H
#define _SPL_MATH64_COMPAT_H
#define _SPL_MATH64_COMPAT_H

#ifndef abs64
#define abs64(x) ({ uint64_t t = (x) >> 63; ((x) ^ t) - t; })
#define abs64(x) ({ uint64_t t = (x) >> 63; ((x) ^ t) - t; })
#endif

#endif /* _SPL_MATH64_COMPAT_H */
2 changes: 1 addition & 1 deletion include/linux/mm_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

#ifndef _SPL_MM_COMPAT_H
#define _SPL_MM_COMPAT_H
#define _SPL_MM_COMPAT_H

#include <linux/mm.h>
#include <linux/fs.h>
Expand Down
2 changes: 1 addition & 1 deletion include/linux/proc_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

#ifndef _SPL_PROC_COMPAT_H
#define _SPL_PROC_COMPAT_H
#define _SPL_PROC_COMPAT_H

#include <linux/proc_fs.h>

Expand Down
17 changes: 9 additions & 8 deletions include/linux/rwsem_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

#ifndef _SPL_RWSEM_COMPAT_H
#define _SPL_RWSEM_COMPAT_H
#define _SPL_RWSEM_COMPAT_H

#include <linux/rwsem.h>

Expand Down Expand Up @@ -53,15 +53,16 @@
int rwsem_tryupgrade(struct rw_semaphore *rwsem);

#if defined(RWSEM_SPINLOCK_IS_RAW)
#define spl_rwsem_lock_irqsave(lk, fl) raw_spin_lock_irqsave(lk, fl)
#define spl_rwsem_unlock_irqrestore(lk, fl) raw_spin_unlock_irqrestore(lk, fl)
#define spl_rwsem_trylock_irqsave(lk, fl) raw_spin_trylock_irqsave(lk, fl)
#define spl_rwsem_lock_irqsave(lk, fl) raw_spin_lock_irqsave(lk, fl)
#define spl_rwsem_unlock_irqrestore(lk, fl) \
raw_spin_unlock_irqrestore(lk, fl)
#define spl_rwsem_trylock_irqsave(lk, fl) raw_spin_trylock_irqsave(lk, fl)
#else
#define spl_rwsem_lock_irqsave(lk, fl) spin_lock_irqsave(lk, fl)
#define spl_rwsem_unlock_irqrestore(lk, fl) spin_unlock_irqrestore(lk, fl)
#define spl_rwsem_trylock_irqsave(lk, fl) spin_trylock_irqsave(lk, fl)
#define spl_rwsem_lock_irqsave(lk, fl) spin_lock_irqsave(lk, fl)
#define spl_rwsem_unlock_irqrestore(lk, fl) spin_unlock_irqrestore(lk, fl)
#define spl_rwsem_trylock_irqsave(lk, fl) spin_trylock_irqsave(lk, fl)
#endif /* RWSEM_SPINLOCK_IS_RAW */

#define spl_rwsem_is_locked(rwsem) rwsem_is_locked(rwsem)
#define spl_rwsem_is_locked(rwsem) rwsem_is_locked(rwsem)

#endif /* _SPL_RWSEM_COMPAT_H */
10 changes: 5 additions & 5 deletions include/linux/wait_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
*/

#ifndef _SPL_WAIT_COMPAT_H
#define _SPL_WAIT_COMPAT_H
#define _SPL_WAIT_COMPAT_H

#include <linux/sched.h>
#include <linux/wait.h>

#ifndef HAVE_WAIT_ON_BIT_ACTION
# define spl_wait_on_bit(word, bit, mode) wait_on_bit(word, bit, mode)
#define spl_wait_on_bit(word, bit, mode) wait_on_bit(word, bit, mode)
#else

static inline int
spl_bit_wait(void *word)
{
schedule();
return 0;
schedule();
return (0);
}

#define spl_wait_on_bit(word, bit, mode) \
#define spl_wait_on_bit(word, bit, mode) \
wait_on_bit(word, bit, spl_bit_wait, mode)

#endif /* HAVE_WAIT_ON_BIT_ACTION */
Expand Down
6 changes: 3 additions & 3 deletions include/linux/zlib_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
*/

#ifndef _SPL_ZLIB_COMPAT_H
#define _SPL_ZLIB_COMPAT_H
#define _SPL_ZLIB_COMPAT_H

#include <linux/zlib.h>

#ifdef HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
#define spl_zlib_deflate_workspacesize(wb, ml) \
#define spl_zlib_deflate_workspacesize(wb, ml) \
zlib_deflate_workspacesize(wb, ml)
#else
#define spl_zlib_deflate_workspacesize(wb, ml) \
#define spl_zlib_deflate_workspacesize(wb, ml) \
zlib_deflate_workspacesize()
#endif /* HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE */

Expand Down

0 comments on commit ce319db

Please sign in to comment.