Re: [PATCH] - Sunrpc: fix sparse warnings by adding static's to variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2012-08-31 at 14:40 -0700, Jason Kelley wrote:
> 
> Good Afternoon,
> 
> I am a High School Intern learning about open source development
> including the Linux kernel. As part of my internship I am working on
> writing a patch for the linux-3.5 kernel. I plan to use this
> experience, writing a patch, beyond my internship here at IBM, so that
> I may continue to contribute
> to the open-source community.
> 
> --
> 
> From: Jason Kelley <jasonkelley94@xxxxxxxxx>
> 
> Make rpc_debug, nfs_debug, nfsd_debug, and nlm_debug static to remove
> the following sparse warnings:
> * net/sunrpc/sysctl.c warning: symbol 'rpc_debug' was not declared.
> Should it be static?
> * net/sunrpc/sysctl.c warning: symbol 'nfs_debug' was not declared.
> Should it be static?
> * net/sunrpc/sysctl.c warning: symbol 'nfsd_debug' was not declared.
> Should it be static?
> * net/sunrpc/sysctl.c warning: symbol 'nlm_debug' was not declared.
> Should it be static?
> 
> Tested by building and booting the patched kernel with CONFIG_SUNRPC
> enabled.

Hi Jason,

If CONFIG_SUNRPC is defined, then include/linux/sunrpc/debug.h will
declare all these variables as 'extern', which conflicts with your
static declaration. The reason why they need to be 'extern' should be
obvious if you look at how they are used in the various 'ifdebug' macro
definitions: those macros mean that the variables can be accessed from
all over the nfs/nfsd/sunrpc/... code as part of a 'dprintk()' call.

The right thing to do here is therefore rather to move the declarations
in net/sunrpc/sysctl.c into the '#ifdef RPC_DEBUG' section, so that the
way that they are declared matches the declarations in
include/linux/sunrpc/debug.h

Cheers
  Trond


-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux