linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/6] udf: fix sparse warnings (shadowing & mismatch between declaration and definition)
@ 2007-12-16  2:17 Marcin Slusarz
  2007-12-17 16:50 ` Jan Kara
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Slusarz @ 2007-12-16  2:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ben Fennema

fix warnings:
fs/udf/super.c:1320:24: warning: symbol 'bh' shadows an earlier one
fs/udf/super.c:1240:21: originally declared here
fs/udf/super.c:1583:4: warning: symbol 'i' shadows an earlier one
fs/udf/super.c:1418:6: originally declared here
fs/udf/super.c:1585:4: warning: symbol 'i' shadows an earlier one
fs/udf/super.c:1418:6: originally declared here
fs/udf/super.c:1658:4: warning: symbol 'i' shadows an earlier one
fs/udf/super.c:1648:6: originally declared here
fs/udf/super.c:1660:4: warning: symbol 'i' shadows an earlier one
fs/udf/super.c:1648:6: originally declared here
fs/udf/super.c:450:6: warning: symbol 'udf_write_super' was not declared. Should it be static?

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
CC: Ben Fennema <bfennema@falcon.csc.calpoly.edu>
---
 fs/udf/super.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/fs/udf/super.c b/fs/udf/super.c
index 4360c7a..9f82b5a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -447,7 +447,7 @@ static int udf_parse_options(char *options, struct udf_options *uopt)
 	return 1;
 }

-void udf_write_super(struct super_block *sb)
+static void udf_write_super(struct super_block *sb)
 {
 	lock_kernel();

@@ -1317,7 +1317,6 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
 				UDF_SB_TYPEVIRT(sb, i).s_num_entries =
 					(UDF_SB_VAT(sb)->i_size - 36) >> 2;
 			} else if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP20) {
-				struct buffer_head *bh = NULL;
 				uint32_t pos;

 				pos = udf_block_map(UDF_SB_VAT(sb), 0);
@@ -1415,7 +1414,7 @@ static void udf_close_lvid(struct super_block *sb)
  */
 static int udf_fill_super(struct super_block *sb, void *options, int silent)
 {
-	int i;
+	int idx;
 	struct inode *inode = NULL;
 	struct udf_options uopt;
 	kernel_lb_addr rootdir, fileset;
@@ -1584,8 +1583,8 @@ error_out:
 		if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP)
 			UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb), s_fspace);
 		if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) {
-			for (i = 0; i < 4; i++)
-				brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]);
+			for (idx = 0; idx < 4; idx++)
+				brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[idx]);
 		}
 	}
 #ifdef CONFIG_UDF_NLS
@@ -1645,7 +1644,7 @@ void udf_warning(struct super_block *sb, const char *function,
  */
 static void udf_put_super(struct super_block *sb)
 {
-	int i;
+	int idx;

 	if (UDF_SB_VAT(sb))
 		iput(UDF_SB_VAT(sb));
@@ -1659,8 +1658,8 @@ static void udf_put_super(struct super_block *sb)
 		if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP)
 			UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb), s_fspace);
 		if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) {
-			for (i = 0; i < 4; i++)
-				brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]);
+			for (idx = 0; idx < 4; idx++)
+				brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[idx]);
 		}
 	}
 #ifdef CONFIG_UDF_NLS
--
1.5.3.4


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

* Re: [PATCH 6/6] udf: fix sparse warnings (shadowing & mismatch between declaration and definition)
  2007-12-16  2:17 [PATCH 6/6] udf: fix sparse warnings (shadowing & mismatch between declaration and definition) Marcin Slusarz
@ 2007-12-17 16:50 ` Jan Kara
  2007-12-19 18:35   ` Marcin Slusarz
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2007-12-17 16:50 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: linux-kernel, Ben Fennema

> fix warnings:
> fs/udf/super.c:1320:24: warning: symbol 'bh' shadows an earlier one
> fs/udf/super.c:1240:21: originally declared here
> fs/udf/super.c:1583:4: warning: symbol 'i' shadows an earlier one
> fs/udf/super.c:1418:6: originally declared here
> fs/udf/super.c:1585:4: warning: symbol 'i' shadows an earlier one
> fs/udf/super.c:1418:6: originally declared here
> fs/udf/super.c:1658:4: warning: symbol 'i' shadows an earlier one
> fs/udf/super.c:1648:6: originally declared here
> fs/udf/super.c:1660:4: warning: symbol 'i' shadows an earlier one
> fs/udf/super.c:1648:6: originally declared here
> fs/udf/super.c:450:6: warning: symbol 'udf_write_super' was not declared. Should it be static?
> 
> Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> CC: Ben Fennema <bfennema@falcon.csc.calpoly.edu>
  Thanks for the patch.  The 'bh' change is fine. The problems with 'i'
should be solved differently I think. Those functions UDF_SB_FREE,
UDF_SB_ALLOC_PARTMAPS should be functions and not macros. Please convert
those to either inline functions if they are small or to regular
functions if they are larger.  It won't be completely trivial because of
the hackery e.g. in UDF_SB_ALLOC_BITMAP. It gets an argument meaning on
which struct member something should be performed. But for example in
the UDF_SB_ALLOC_BITMAP case you can simply make the function return the
pointer to allocated and initialized space and the caller would assign
it to a proper element of the superblock. This would help the overall
code quality of UDF (which is sadly quite poor). Thanks.

								Honza
> ---
>  fs/udf/super.c |   15 +++++++--------
>  1 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index 4360c7a..9f82b5a 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
> @@ -447,7 +447,7 @@ static int udf_parse_options(char *options, struct udf_options *uopt)
>  	return 1;
>  }
> 
> -void udf_write_super(struct super_block *sb)
> +static void udf_write_super(struct super_block *sb)
>  {
>  	lock_kernel();
> 
> @@ -1317,7 +1317,6 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
>  				UDF_SB_TYPEVIRT(sb, i).s_num_entries =
>  					(UDF_SB_VAT(sb)->i_size - 36) >> 2;
>  			} else if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP20) {
> -				struct buffer_head *bh = NULL;
>  				uint32_t pos;
> 
>  				pos = udf_block_map(UDF_SB_VAT(sb), 0);
> @@ -1415,7 +1414,7 @@ static void udf_close_lvid(struct super_block *sb)
>   */
>  static int udf_fill_super(struct super_block *sb, void *options, int silent)
>  {
> -	int i;
> +	int idx;
>  	struct inode *inode = NULL;
>  	struct udf_options uopt;
>  	kernel_lb_addr rootdir, fileset;
> @@ -1584,8 +1583,8 @@ error_out:
>  		if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP)
>  			UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb), s_fspace);
>  		if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) {
> -			for (i = 0; i < 4; i++)
> -				brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]);
> +			for (idx = 0; idx < 4; idx++)
> +				brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[idx]);
>  		}
>  	}
>  #ifdef CONFIG_UDF_NLS
> @@ -1645,7 +1644,7 @@ void udf_warning(struct super_block *sb, const char *function,
>   */
>  static void udf_put_super(struct super_block *sb)
>  {
> -	int i;
> +	int idx;
> 
>  	if (UDF_SB_VAT(sb))
>  		iput(UDF_SB_VAT(sb));
> @@ -1659,8 +1658,8 @@ static void udf_put_super(struct super_block *sb)
>  		if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP)
>  			UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb), s_fspace);
>  		if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) {
> -			for (i = 0; i < 4; i++)
> -				brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]);
> +			for (idx = 0; idx < 4; idx++)
> +				brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[idx]);
>  		}
>  	}
>  #ifdef CONFIG_UDF_NLS
> --
> 1.5.3.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
-- 
Jan Kara <jack@suse.cz>
SuSE CR Labs

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

* Re: [PATCH 6/6] udf: fix sparse warnings (shadowing & mismatch between declaration and definition)
  2007-12-17 16:50 ` Jan Kara
@ 2007-12-19 18:35   ` Marcin Slusarz
  2007-12-20 12:51     ` Jan Kara
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Slusarz @ 2007-12-19 18:35 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-kernel, Ben Fennema

On Mon, Dec 17, 2007 at 05:50:17PM +0100, Jan Kara wrote:
> > fix warnings:
> > fs/udf/super.c:1320:24: warning: symbol 'bh' shadows an earlier one
> > fs/udf/super.c:1240:21: originally declared here
> > fs/udf/super.c:1583:4: warning: symbol 'i' shadows an earlier one
> > fs/udf/super.c:1418:6: originally declared here
> > fs/udf/super.c:1585:4: warning: symbol 'i' shadows an earlier one
> > fs/udf/super.c:1418:6: originally declared here
> > fs/udf/super.c:1658:4: warning: symbol 'i' shadows an earlier one
> > fs/udf/super.c:1648:6: originally declared here
> > fs/udf/super.c:1660:4: warning: symbol 'i' shadows an earlier one
> > fs/udf/super.c:1648:6: originally declared here
> > fs/udf/super.c:450:6: warning: symbol 'udf_write_super' was not declared. Should it be static?
> >
> > Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> > CC: Ben Fennema <bfennema@falcon.csc.calpoly.edu>
>   Thanks for the patch.  The 'bh' change is fine. The problems with 'i'
> should be solved differently I think. Those functions UDF_SB_FREE,
> UDF_SB_ALLOC_PARTMAPS should be functions and not macros. Please convert
> those to either inline functions if they are small or to regular
> functions if they are larger.  It won't be completely trivial because of
> the hackery e.g. in UDF_SB_ALLOC_BITMAP. It gets an argument meaning on
> which struct member something should be performed. But for example in
> the UDF_SB_ALLOC_BITMAP case you can simply make the function return the
> pointer to allocated and initialized space and the caller would assign
> it to a proper element of the superblock.
Ok, I'll try to do it.

> This would help the overall
> code quality of UDF (which is sadly quite poor).
If you have other suggestions how to clean up this code, let me know.
I'll see what I can do with them ;)

Marcin

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

* Re: [PATCH 6/6] udf: fix sparse warnings (shadowing & mismatch between declaration and definition)
  2007-12-19 18:35   ` Marcin Slusarz
@ 2007-12-20 12:51     ` Jan Kara
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2007-12-20 12:51 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: linux-kernel, Ben Fennema

On Wed 19-12-07 19:35:14, Marcin Slusarz wrote:
> On Mon, Dec 17, 2007 at 05:50:17PM +0100, Jan Kara wrote:
> > > fix warnings:
> > > fs/udf/super.c:1320:24: warning: symbol 'bh' shadows an earlier one
> > > fs/udf/super.c:1240:21: originally declared here
> > > fs/udf/super.c:1583:4: warning: symbol 'i' shadows an earlier one
> > > fs/udf/super.c:1418:6: originally declared here
> > > fs/udf/super.c:1585:4: warning: symbol 'i' shadows an earlier one
> > > fs/udf/super.c:1418:6: originally declared here
> > > fs/udf/super.c:1658:4: warning: symbol 'i' shadows an earlier one
> > > fs/udf/super.c:1648:6: originally declared here
> > > fs/udf/super.c:1660:4: warning: symbol 'i' shadows an earlier one
> > > fs/udf/super.c:1648:6: originally declared here
> > > fs/udf/super.c:450:6: warning: symbol 'udf_write_super' was not declared. Should it be static?
> > >
> > > Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> > > CC: Ben Fennema <bfennema@falcon.csc.calpoly.edu>
> >   Thanks for the patch.  The 'bh' change is fine. The problems with 'i'
> > should be solved differently I think. Those functions UDF_SB_FREE,
> > UDF_SB_ALLOC_PARTMAPS should be functions and not macros. Please convert
> > those to either inline functions if they are small or to regular
> > functions if they are larger.  It won't be completely trivial because of
> > the hackery e.g. in UDF_SB_ALLOC_BITMAP. It gets an argument meaning on
> > which struct member something should be performed. But for example in
> > the UDF_SB_ALLOC_BITMAP case you can simply make the function return the
> > pointer to allocated and initialized space and the caller would assign
> > it to a proper element of the superblock.
> Ok, I'll try to do it.
  Thanks.

> > This would help the overall
> > code quality of UDF (which is sadly quite poor).
> If you have other suggestions how to clean up this code, let me know.
> I'll see what I can do with them ;)
  Hmm, it's hard to formulate precisely. It's nothing particular but all in
all the code is simply hard to read - all those strange names of variables,
unusual sideeffects of functions, ... But one specific problem I'm aware of
is the lack of error handling so in case of IO error or filesystem
corruption results are quite spectacular (kernel crash, etc.).

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

* [PATCH 6/6] udf: fix sparse warnings (shadowing & mismatch between declaration and definition)
  2007-12-24  0:10 [PATCH 0/6] udf: improve code related to super_block, was: udf: convert super_block macros to functions marcin.slusarz
@ 2007-12-24  0:10 ` marcin.slusarz
  0 siblings, 0 replies; 5+ messages in thread
From: marcin.slusarz @ 2007-12-24  0:10 UTC (permalink / raw)
  To: LKML; +Cc: Ben Fennema, Jan Kara, Christoph Hellwig, Marcin Slusarz

fix sparse warnings:
fs/udf/super.c:1431:24: warning: symbol 'bh' shadows an earlier one
fs/udf/super.c:1347:21: originally declared here
fs/udf/super.c:472:6: warning: symbol 'udf_write_super' was not declared. Should it be static?

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
CC: Ben Fennema <bfennema@falcon.csc.calpoly.edu>
CC: Jan Kara <jack@suse.cz>
CC: Christoph Hellwig <hch@infradead.org>
---
 fs/udf/super.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/udf/super.c b/fs/udf/super.c
index dc09c2d..c190317 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -469,7 +469,7 @@ static int udf_parse_options(char *options, struct udf_options *uopt)
 	return 1;
 }
 
-void udf_write_super(struct super_block *sb)
+static void udf_write_super(struct super_block *sb)
 {
 	lock_kernel();
 
@@ -1428,7 +1428,6 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
 				map->s_type_specific.s_virtual.s_num_entries =
 					(sbi->s_vat_inode->i_size - 36) >> 2;
 			} else if (map->s_partition_type == UDF_VIRTUAL_MAP20) {
-				struct buffer_head *bh = NULL;
 				uint32_t pos;
 
 				pos = udf_block_map(sbi->s_vat_inode, 0);
-- 
1.5.3.4


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

end of thread, other threads:[~2007-12-24  0:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-16  2:17 [PATCH 6/6] udf: fix sparse warnings (shadowing & mismatch between declaration and definition) Marcin Slusarz
2007-12-17 16:50 ` Jan Kara
2007-12-19 18:35   ` Marcin Slusarz
2007-12-20 12:51     ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2007-12-24  0:10 [PATCH 0/6] udf: improve code related to super_block, was: udf: convert super_block macros to functions marcin.slusarz
2007-12-24  0:10 ` [PATCH 6/6] udf: fix sparse warnings (shadowing & mismatch between declaration and definition) marcin.slusarz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).