All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] fs: fix code-formatting issues in inotify
@ 2015-01-16 15:15 y
  2015-01-16 15:15 ` [PATCH 2/2] fs: fix checkpatch code warnings for inotify y
  0 siblings, 1 reply; 4+ messages in thread
From: y @ 2015-01-16 15:15 UTC (permalink / raw)
  To: John McCutchan, Robert Love, Eric Paris; +Cc: linux-kernel, Stefan Haun

From: Stefan Haun <tux@netz39.de>

Fix code-formatting warnings from script/checkpatch.pl; multiple instances of

WARNING: line over 80 characters
CHECK: No space is necessary after a cast
CHECK: Alignment should match open parenthesis
WARNING: quoted string split across lines
CHECK: Blank lines aren't necessary before a close brace '}'
CHECK: Please don't use multiple blank lines

Signed-off-by: Stefan Haun <tux@netz39.de>
---
 fs/notify/inotify/inotify_fsnotify.c |   11 +++---
 fs/notify/inotify/inotify_user.c     |   68 ++++++++++++++++++----------------
 2 files changed, 43 insertions(+), 36 deletions(-)

diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 2cd900c..0238615 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -54,7 +54,7 @@ static bool event_compare(struct fsnotify_event *old_fsn,
 }
 
 static int inotify_merge(struct list_head *list,
-			  struct fsnotify_event *event)
+			 struct fsnotify_event *event)
 {
 	struct fsnotify_event *last_event;
 
@@ -120,7 +120,8 @@ int inotify_handle_event(struct fsnotify_group *group,
 	return 0;
 }
 
-static void inotify_freeing_mark(struct fsnotify_mark *fsn_mark, struct fsnotify_group *group)
+static void inotify_freeing_mark(struct fsnotify_mark *fsn_mark,
+				 struct fsnotify_group *group)
 {
 	inotify_ignored_and_remove_idr(fsn_mark, group);
 }
@@ -145,8 +146,8 @@ static int idr_callback(int id, void *p, void *data)
 	fsn_mark = p;
 	i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
 
-	WARN(1, "inotify closing but id=%d for fsn_mark=%p in group=%p still in "
-		"idr.  Probably leaking memory\n", id, p, data);
+	WARN(1, "inotify closing but id=%d for fsn_mark=%p in group=%p still in idr. Probably leaking memory\n",
+	     id, p, data);
 
 	/*
 	 * I'm taking the liberty of assuming that the mark in question is a
@@ -156,7 +157,7 @@ static int idr_callback(int id, void *p, void *data)
 	 */
 	if (fsn_mark)
 		printk(KERN_WARNING "fsn_mark->group=%p inode=%p wd=%d\n",
-			fsn_mark->group, fsn_mark->inode, i_mark->wd);
+		       fsn_mark->group, fsn_mark->inode, i_mark->wd);
 	return 0;
 }
 
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 45064869..3214e2b 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -201,9 +201,9 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
 	buf += event_size;
 
 	/*
-	 * fsnotify only stores the pathname, so here we have to send the pathname
-	 * and then pad that pathname out to a multiple of sizeof(inotify_event)
-	 * with zeros.
+	 * fsnotify only stores the pathname, so here we have to send the
+	 * pathname and then pad that pathname out to a multiple of
+	 * sizeof(inotify_event) with zeros.
 	 */
 	if (pad_name_len) {
 		/* copy the path name */
@@ -278,7 +278,10 @@ static int inotify_release(struct inode *ignored, struct file *file)
 
 	pr_debug("%s: group=%p\n", __func__, group);
 
-	/* free this group, matching get was inotify_init->fsnotify_obtain_group */
+	/*
+	 * free this group, matching get was
+	 * inotify_init->fsnotify_obtain_group
+	 */
 	fsnotify_destroy_group(group);
 
 	return 0;
@@ -294,7 +297,7 @@ static long inotify_ioctl(struct file *file, unsigned int cmd,
 	size_t send_len = 0;
 
 	group = file->private_data;
-	p = (void __user *) arg;
+	p = (void __user *)arg;
 
 	pr_debug("%s: group=%p cmd=%u\n", __func__, group, cmd);
 
@@ -307,7 +310,7 @@ static long inotify_ioctl(struct file *file, unsigned int cmd,
 			send_len += round_event_name_len(fsn_event);
 		}
 		mutex_unlock(&group->notification_mutex);
-		ret = put_user(send_len, (int __user *) p);
+		ret = put_user(send_len, (int __user *)p);
 		break;
 	}
 
@@ -325,11 +328,11 @@ static const struct file_operations inotify_fops = {
 	.llseek		= noop_llseek,
 };
 
-
 /*
  * find_inode - resolve a user-given path to a specific inode
  */
-static int inotify_find_inode(const char __user *dirname, struct path *path, unsigned flags)
+static int inotify_find_inode(const char __user *dirname, struct path *path,
+			      unsigned flags)
 {
 	int error;
 
@@ -363,8 +366,9 @@ static int inotify_add_to_idr(struct idr *idr, spinlock_t *idr_lock,
 	return ret < 0 ? ret : 0;
 }
 
-static struct inotify_inode_mark *inotify_idr_find_locked(struct fsnotify_group *group,
-								int wd)
+static struct inotify_inode_mark *inotify_idr_find_locked(
+					struct fsnotify_group *group,
+					int wd)
 {
 	struct idr *idr = &group->inotify_data.idr;
 	spinlock_t *idr_lock = &group->inotify_data.idr_lock;
@@ -385,7 +389,7 @@ static struct inotify_inode_mark *inotify_idr_find_locked(struct fsnotify_group
 }
 
 static struct inotify_inode_mark *inotify_idr_find(struct fsnotify_group *group,
-							 int wd)
+						   int wd)
 {
 	struct inotify_inode_mark *i_mark;
 	spinlock_t *idr_lock = &group->inotify_data.idr_lock;
@@ -431,18 +435,18 @@ static void inotify_remove_from_idr(struct fsnotify_group *group,
 	 * if it wasn't....
 	 */
 	if (wd == -1) {
-		WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p"
-			" i_mark->inode=%p\n", __func__, i_mark, i_mark->wd,
-			i_mark->fsn_mark.group, i_mark->fsn_mark.inode);
+		WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p i_mark->inode=%p\n",
+			  __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group,
+			  i_mark->fsn_mark.inode);
 		goto out;
 	}
 
 	/* Lets look in the idr to see if we find it */
 	found_i_mark = inotify_idr_find_locked(group, wd);
 	if (unlikely(!found_i_mark)) {
-		WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p"
-			" i_mark->inode=%p\n", __func__, i_mark, i_mark->wd,
-			i_mark->fsn_mark.group, i_mark->fsn_mark.inode);
+		WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p i_mark->inode=%p\n",
+			  __func__, i_mark, i_mark->wd,	i_mark->fsn_mark.group,
+			  i_mark->fsn_mark.inode);
 		goto out;
 	}
 
@@ -452,13 +456,11 @@ static void inotify_remove_from_idr(struct fsnotify_group *group,
 	 * fucked up somewhere.
 	 */
 	if (unlikely(found_i_mark != i_mark)) {
-		WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p "
-			"mark->inode=%p found_i_mark=%p found_i_mark->wd=%d "
-			"found_i_mark->group=%p found_i_mark->inode=%p\n",
-			__func__, i_mark, i_mark->wd, i_mark->fsn_mark.group,
-			i_mark->fsn_mark.inode, found_i_mark, found_i_mark->wd,
-			found_i_mark->fsn_mark.group,
-			found_i_mark->fsn_mark.inode);
+		WARN_ONCE(1, "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p mark->inode=%p found_i_mark=%p found_i_mark->wd=%d found_i_mark->group=%p found_i_mark->inode=%p\n",
+			  __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group,
+			  i_mark->fsn_mark.inode, found_i_mark,
+			  found_i_mark->wd, found_i_mark->fsn_mark.group,
+			  found_i_mark->fsn_mark.inode);
 		goto out;
 	}
 
@@ -536,7 +538,8 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
 
 	old_mask = fsn_mark->mask;
 	if (add)
-		fsnotify_set_mark_mask_locked(fsn_mark, (fsn_mark->mask | mask));
+		fsnotify_set_mark_mask_locked(fsn_mark,
+					      (fsn_mark->mask | mask));
 	else
 		fsnotify_set_mark_mask_locked(fsn_mark, mask);
 	new_mask = fsn_mark->mask;
@@ -552,7 +555,6 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
 		/* update the inode with this new fsn_mark */
 		if (dropped || do_inode)
 			fsnotify_recalc_inode_mask(inode);
-
 	}
 
 	/* return the wd */
@@ -585,7 +587,8 @@ static int inotify_new_watch(struct fsnotify_group *group,
 	tmp_i_mark->wd = -1;
 
 	ret = -ENOSPC;
-	if (atomic_read(&group->inotify_data.user->inotify_watches) >= inotify_max_user_watches)
+	if (atomic_read(&group->inotify_data.user->inotify_watches)
+	    >= inotify_max_user_watches)
 		goto out_err;
 
 	ret = inotify_add_to_idr(idr, idr_lock, tmp_i_mark);
@@ -614,7 +617,8 @@ out_err:
 	return ret;
 }
 
-static int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg)
+static int inotify_update_watch(struct fsnotify_group *group,
+				struct inode *inode, u32 arg)
 {
 	int ret = 0;
 
@@ -664,7 +668,6 @@ static struct fsnotify_group *inotify_new_group(unsigned int max_events)
 	return group;
 }
 
-
 /* inotify syscalls */
 SYSCALL_DEFINE1(inotify_init1, int, flags)
 {
@@ -678,13 +681,16 @@ SYSCALL_DEFINE1(inotify_init1, int, flags)
 	if (flags & ~(IN_CLOEXEC | IN_NONBLOCK))
 		return -EINVAL;
 
-	/* fsnotify_obtain_group took a reference to group, we put this when we kill the file in the end */
+	/*
+	 * fsnotify_obtain_group took a reference to group, we put this when
+	 * we kill the file in the end
+	 */
 	group = inotify_new_group(inotify_max_queued_events);
 	if (IS_ERR(group))
 		return PTR_ERR(group);
 
 	ret = anon_inode_getfd("inotify", &inotify_fops, group,
-				  O_RDONLY | flags);
+			       O_RDONLY | flags);
 	if (ret < 0)
 		fsnotify_destroy_group(group);
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] fs: fix checkpatch code warnings for inotify
  2015-01-16 15:15 [PATCH 1/2] fs: fix code-formatting issues in inotify y
@ 2015-01-16 15:15 ` y
  2015-01-24 21:39   ` Stefan Haun
  0 siblings, 1 reply; 4+ messages in thread
From: y @ 2015-01-16 15:15 UTC (permalink / raw)
  To: John McCutchan, Robert Love, Eric Paris; +Cc: linux-kernel, Stefan Haun

From: Stefan Haun <tux@netz39.de>

./fs/notify/inotify/inotify.h:23:
CHECK: extern prototypes should be avoided in .h files
./fs/notify/inotify/inotify.h:25:
CHECK: extern prototypes should be avoided in .h files

	Removed extrn keywords; the matter, however, seems to be an open
	debate.

./fs/notify/inotify/inotify_fsnotify.c:140:
ERROR: do not initialise statics to 0 or NULL

	Replace the initialization by a comment:
	Compiler takes care of the proper initialization.

./fs/notify/inotify/inotify_fsnotify.c:159:
WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then
dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
./fs/notify/inotify/inotify_user.c:473:
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then
dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
./fs/notify/inotify/inotify_user.c:474:
WARNING: quoted string split across lines

	Use pr_warn instead of printk and fix line break.

./fs/notify/inotify/inotify_user.c:645:
CHECK: Prefer kmalloc(sizeof(*oevent)...) over
kmalloc(sizeof(struct inotify_event_info)...)

	Done that (complies to coding stlye).

Signed-off-by: Stefan Haun <tux@netz39.de>
---
 fs/notify/inotify/inotify.h          |   16 ++++++++--------
 fs/notify/inotify/inotify_fsnotify.c |    6 +++---
 fs/notify/inotify/inotify_user.c     |    8 ++++----
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h
index ed855ef..9d6d4e2 100644
--- a/fs/notify/inotify/inotify.h
+++ b/fs/notify/inotify/inotify.h
@@ -20,13 +20,13 @@ static inline struct inotify_event_info *INOTIFY_E(struct fsnotify_event *fse)
 	return container_of(fse, struct inotify_event_info, fse);
 }
 
-extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
-					   struct fsnotify_group *group);
-extern int inotify_handle_event(struct fsnotify_group *group,
-				struct inode *inode,
-				struct fsnotify_mark *inode_mark,
-				struct fsnotify_mark *vfsmount_mark,
-				u32 mask, void *data, int data_type,
-				const unsigned char *file_name, u32 cookie);
+void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
+				    struct fsnotify_group *group);
+
+int inotify_handle_event(struct fsnotify_group *group, struct inode *inode,
+			 struct fsnotify_mark *inode_mark,
+			 struct fsnotify_mark *vfsmount_mark,
+			 u32 mask, void *data, int data_type,
+			 const unsigned char *file_name, u32 cookie);
 
 extern const struct fsnotify_ops inotify_fsnotify_ops;
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 0238615..16efe98 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -137,7 +137,7 @@ static int idr_callback(int id, void *p, void *data)
 {
 	struct fsnotify_mark *fsn_mark;
 	struct inotify_inode_mark *i_mark;
-	static bool warned = false;
+	static bool warned; /* = false;  default by GCC */
 
 	if (warned)
 		return 0;
@@ -156,8 +156,8 @@ static int idr_callback(int id, void *p, void *data)
 	 * BUG() that was here.
 	 */
 	if (fsn_mark)
-		printk(KERN_WARNING "fsn_mark->group=%p inode=%p wd=%d\n",
-		       fsn_mark->group, fsn_mark->inode, i_mark->wd);
+		pr_warn("fsn_mark->group=%p inode=%p wd=%d\n",
+			fsn_mark->group, fsn_mark->inode, i_mark->wd);
 	return 0;
 }
 
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 3214e2b..d7e3e58 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -470,9 +470,9 @@ static void inotify_remove_from_idr(struct fsnotify_group *group,
 	 * one ref grabbed by inotify_idr_find
 	 */
 	if (unlikely(atomic_read(&i_mark->fsn_mark.refcnt) < 3)) {
-		printk(KERN_ERR "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p"
-			" i_mark->inode=%p\n", __func__, i_mark, i_mark->wd,
-			i_mark->fsn_mark.group, i_mark->fsn_mark.inode);
+		pr_err("%s: i_mark=%p i_mark->wd=%d i_mark->group=%p i_mark->inode=%p\n",
+		       __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group,
+		       i_mark->fsn_mark.inode);
 		/* we can't really recover with bad ref cnting.. */
 		BUG();
 	}
@@ -642,7 +642,7 @@ static struct fsnotify_group *inotify_new_group(unsigned int max_events)
 	if (IS_ERR(group))
 		return group;
 
-	oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL);
+	oevent = kmalloc(sizeof(*oevent), GFP_KERNEL);
 	if (unlikely(!oevent)) {
 		fsnotify_destroy_group(group);
 		return ERR_PTR(-ENOMEM);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] fs: fix checkpatch code warnings for inotify
  2015-01-16 15:15 ` [PATCH 2/2] fs: fix checkpatch code warnings for inotify y
@ 2015-01-24 21:39   ` Stefan Haun
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Haun @ 2015-01-24 21:39 UTC (permalink / raw)
  To: y; +Cc: John McCutchan, Robert Love, Eric Paris, linux-kernel

[-- Attachment #1: Type: Text/Plain, Size: 5655 bytes --]

I just noticed that I failed in setting the right From: header. Sorry for 
this, I will re-post the patches with correct meta-data set.


Am Freitag, 16. Januar 2015, 16:15:11 schrieb y@mail.netz39.de:
> From: Stefan Haun <tux@netz39.de>
> 
> ./fs/notify/inotify/inotify.h:23:
> CHECK: extern prototypes should be avoided in .h files
> ./fs/notify/inotify/inotify.h:25:
> CHECK: extern prototypes should be avoided in .h files
> 
> 	Removed extrn keywords; the matter, however, seems to be an open
> 	debate.
> 
> ./fs/notify/inotify/inotify_fsnotify.c:140:
> ERROR: do not initialise statics to 0 or NULL
> 
> 	Replace the initialization by a comment:
> 	Compiler takes care of the proper initialization.
> 
> ./fs/notify/inotify/inotify_fsnotify.c:159:
> WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then
> dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
> ./fs/notify/inotify/inotify_user.c:473:
> WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then
> dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
> ./fs/notify/inotify/inotify_user.c:474:
> WARNING: quoted string split across lines
> 
> 	Use pr_warn instead of printk and fix line break.
> 
> ./fs/notify/inotify/inotify_user.c:645:
> CHECK: Prefer kmalloc(sizeof(*oevent)...) over
> kmalloc(sizeof(struct inotify_event_info)...)
> 
> 	Done that (complies to coding stlye).
> 
> Signed-off-by: Stefan Haun <tux@netz39.de>
> ---
>  fs/notify/inotify/inotify.h          |   16 ++++++++--------
>  fs/notify/inotify/inotify_fsnotify.c |    6 +++---
>  fs/notify/inotify/inotify_user.c     |    8 ++++----
>  3 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h
> index ed855ef..9d6d4e2 100644
> --- a/fs/notify/inotify/inotify.h
> +++ b/fs/notify/inotify/inotify.h
> @@ -20,13 +20,13 @@ static inline struct inotify_event_info
> *INOTIFY_E(struct fsnotify_event *fse) return container_of(fse, struct
> inotify_event_info, fse);
>  }
> 
> -extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
> -					   struct fsnotify_group *group);
> -extern int inotify_handle_event(struct fsnotify_group *group,
> -				struct inode *inode,
> -				struct fsnotify_mark *inode_mark,
> -				struct fsnotify_mark *vfsmount_mark,
> -				u32 mask, void *data, int data_type,
> -				const unsigned char *file_name, u32 cookie);
> +void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
> +				    struct fsnotify_group *group);
> +
> +int inotify_handle_event(struct fsnotify_group *group, struct inode
> *inode, +			 struct fsnotify_mark *inode_mark,
> +			 struct fsnotify_mark *vfsmount_mark,
> +			 u32 mask, void *data, int data_type,
> +			 const unsigned char *file_name, u32 cookie);
> 
>  extern const struct fsnotify_ops inotify_fsnotify_ops;
> diff --git a/fs/notify/inotify/inotify_fsnotify.c
> b/fs/notify/inotify/inotify_fsnotify.c index 0238615..16efe98 100644
> --- a/fs/notify/inotify/inotify_fsnotify.c
> +++ b/fs/notify/inotify/inotify_fsnotify.c
> @@ -137,7 +137,7 @@ static int idr_callback(int id, void *p, void *data)
>  {
>  	struct fsnotify_mark *fsn_mark;
>  	struct inotify_inode_mark *i_mark;
> -	static bool warned = false;
> +	static bool warned; /* = false;  default by GCC */
> 
>  	if (warned)
>  		return 0;
> @@ -156,8 +156,8 @@ static int idr_callback(int id, void *p, void *data)
>  	 * BUG() that was here.
>  	 */
>  	if (fsn_mark)
> -		printk(KERN_WARNING "fsn_mark->group=%p inode=%p wd=%d\n",
> -		       fsn_mark->group, fsn_mark->inode, i_mark->wd);
> +		pr_warn("fsn_mark->group=%p inode=%p wd=%d\n",
> +			fsn_mark->group, fsn_mark->inode, i_mark->wd);
>  	return 0;
>  }
> 
> diff --git a/fs/notify/inotify/inotify_user.c
> b/fs/notify/inotify/inotify_user.c index 3214e2b..d7e3e58 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -470,9 +470,9 @@ static void inotify_remove_from_idr(struct
> fsnotify_group *group, * one ref grabbed by inotify_idr_find
>  	 */
>  	if (unlikely(atomic_read(&i_mark->fsn_mark.refcnt) < 3)) {
> -		printk(KERN_ERR "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p"
> -			" i_mark->inode=%p\n", __func__, i_mark, i_mark->wd,
> -			i_mark->fsn_mark.group, i_mark->fsn_mark.inode);
> +		pr_err("%s: i_mark=%p i_mark->wd=%d i_mark->group=%p
> i_mark->inode=%p\n", +		       __func__, i_mark, i_mark->wd,
> i_mark->fsn_mark.group,
> +		       i_mark->fsn_mark.inode);
>  		/* we can't really recover with bad ref cnting.. */
>  		BUG();
>  	}
> @@ -642,7 +642,7 @@ static struct fsnotify_group
> *inotify_new_group(unsigned int max_events) if (IS_ERR(group))
>  		return group;
> 
> -	oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL);
> +	oevent = kmalloc(sizeof(*oevent), GFP_KERNEL);
>  	if (unlikely(!oevent)) {
>  		fsnotify_destroy_group(group);
>  		return ERR_PTR(-ENOMEM);


-- 
Netz39 e.V. - Real World Virtuality                http://www.netz39.de
Stefan Haun                                               tux@netz39.de


E-Mail: kontakt@netz39.de

Vertretungsberechtigter Vorstand: René Meye, Sebastian Mai
Inhaltlich verantwortlich gemäß §55 (2) RStV: René Meye

Registergericht: Amtsgericht Stendal
Registernummer:  VR 3169


Disclaimer:   Diese E-Mail ist in keiner Form böse oder beleidigend ge-
meint. Sollte sie an Stellen doch so sein, dann sage mir das bitte. Ich 
werde Dein Feedback annehmen und nur beantworten, falls Du es ausdrück-
lich wünschst.

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] fs: fix checkpatch code warnings for inotify
  2015-01-24 21:40 [PATCH 1/2] fs: fix code-formatting issues in inotify Stefan Haun
@ 2015-01-24 21:40 ` Stefan Haun
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Haun @ 2015-01-24 21:40 UTC (permalink / raw)
  To: John McCutchan, Robert Love, Eric Paris; +Cc: linux-kernel, Stefan Haun

./fs/notify/inotify/inotify.h:23:
CHECK: extern prototypes should be avoided in .h files
./fs/notify/inotify/inotify.h:25:
CHECK: extern prototypes should be avoided in .h files

	Removed extrn keywords; the matter, however, seems to be an open
	debate.

./fs/notify/inotify/inotify_fsnotify.c:140:
ERROR: do not initialise statics to 0 or NULL

	Replace the initialization by a comment:
	Compiler takes care of the proper initialization.

./fs/notify/inotify/inotify_fsnotify.c:159:
WARNING: Prefer [subsystem eg: netdev]_warn([subsystem]dev, ... then
dev_warn(dev, ... then pr_warn(...  to printk(KERN_WARNING ...
./fs/notify/inotify/inotify_user.c:473:
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then
dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
./fs/notify/inotify/inotify_user.c:474:
WARNING: quoted string split across lines

	Use pr_warn instead of printk and fix line break.

./fs/notify/inotify/inotify_user.c:645:
CHECK: Prefer kmalloc(sizeof(*oevent)...) over
kmalloc(sizeof(struct inotify_event_info)...)

	Done that (complies to coding stlye).

Signed-off-by: Stefan Haun <tux@netz39.de>
---
 fs/notify/inotify/inotify.h          |   16 ++++++++--------
 fs/notify/inotify/inotify_fsnotify.c |    6 +++---
 fs/notify/inotify/inotify_user.c     |    8 ++++----
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h
index ed855ef..9d6d4e2 100644
--- a/fs/notify/inotify/inotify.h
+++ b/fs/notify/inotify/inotify.h
@@ -20,13 +20,13 @@ static inline struct inotify_event_info *INOTIFY_E(struct fsnotify_event *fse)
 	return container_of(fse, struct inotify_event_info, fse);
 }
 
-extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
-					   struct fsnotify_group *group);
-extern int inotify_handle_event(struct fsnotify_group *group,
-				struct inode *inode,
-				struct fsnotify_mark *inode_mark,
-				struct fsnotify_mark *vfsmount_mark,
-				u32 mask, void *data, int data_type,
-				const unsigned char *file_name, u32 cookie);
+void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
+				    struct fsnotify_group *group);
+
+int inotify_handle_event(struct fsnotify_group *group, struct inode *inode,
+			 struct fsnotify_mark *inode_mark,
+			 struct fsnotify_mark *vfsmount_mark,
+			 u32 mask, void *data, int data_type,
+			 const unsigned char *file_name, u32 cookie);
 
 extern const struct fsnotify_ops inotify_fsnotify_ops;
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 0238615..16efe98 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -137,7 +137,7 @@ static int idr_callback(int id, void *p, void *data)
 {
 	struct fsnotify_mark *fsn_mark;
 	struct inotify_inode_mark *i_mark;
-	static bool warned = false;
+	static bool warned; /* = false;  default by GCC */
 
 	if (warned)
 		return 0;
@@ -156,8 +156,8 @@ static int idr_callback(int id, void *p, void *data)
 	 * BUG() that was here.
 	 */
 	if (fsn_mark)
-		printk(KERN_WARNING "fsn_mark->group=%p inode=%p wd=%d\n",
-		       fsn_mark->group, fsn_mark->inode, i_mark->wd);
+		pr_warn("fsn_mark->group=%p inode=%p wd=%d\n",
+			fsn_mark->group, fsn_mark->inode, i_mark->wd);
 	return 0;
 }
 
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 3214e2b..d7e3e58 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -470,9 +470,9 @@ static void inotify_remove_from_idr(struct fsnotify_group *group,
 	 * one ref grabbed by inotify_idr_find
 	 */
 	if (unlikely(atomic_read(&i_mark->fsn_mark.refcnt) < 3)) {
-		printk(KERN_ERR "%s: i_mark=%p i_mark->wd=%d i_mark->group=%p"
-			" i_mark->inode=%p\n", __func__, i_mark, i_mark->wd,
-			i_mark->fsn_mark.group, i_mark->fsn_mark.inode);
+		pr_err("%s: i_mark=%p i_mark->wd=%d i_mark->group=%p i_mark->inode=%p\n",
+		       __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group,
+		       i_mark->fsn_mark.inode);
 		/* we can't really recover with bad ref cnting.. */
 		BUG();
 	}
@@ -642,7 +642,7 @@ static struct fsnotify_group *inotify_new_group(unsigned int max_events)
 	if (IS_ERR(group))
 		return group;
 
-	oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL);
+	oevent = kmalloc(sizeof(*oevent), GFP_KERNEL);
 	if (unlikely(!oevent)) {
 		fsnotify_destroy_group(group);
 		return ERR_PTR(-ENOMEM);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-24 21:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-16 15:15 [PATCH 1/2] fs: fix code-formatting issues in inotify y
2015-01-16 15:15 ` [PATCH 2/2] fs: fix checkpatch code warnings for inotify y
2015-01-24 21:39   ` Stefan Haun
2015-01-24 21:40 [PATCH 1/2] fs: fix code-formatting issues in inotify Stefan Haun
2015-01-24 21:40 ` [PATCH 2/2] fs: fix checkpatch code warnings for inotify Stefan Haun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.