Re: Purpose of GLOBAL_EXTERN macro

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

 



On Tue, Oct 11, 2011 at 6:08 AM, Jeff Layton <jlayton@xxxxxxxxx> wrote:
> On Tue, 11 Oct 2011 15:10:09 +0530
> Suresh Jayaraman <sjayaraman@xxxxxxxx> wrote:
>
>> I bumped into the GLOBAL_EXTERN macro in the cifs code. I'm not sure I
>> understand the purpose of this. Can someone explain why we need this
>> instead of simply using "extern"?
>>
>
> I've never been quite sure what that's all about either. I think the
> idea was to allow you to put global declarations in an include file but
> then have only one .c file actually do them?
>
> Seems like there was a patch to remove it a few years ago, but Steve
> never merged it for some reason...

The idea of having all of the globals in one place was an idea
borrowed from other file systems in the past.  Basically,
having all of the globals in one place made it easier
to identify locking issues and make future locking changes.
We could take all of the global externs and do the equivalent, ie
(put them in cifsfs.c in one big series of defines in the beginning of
the file).
It would make cifsfs.c bigger, and perhaps a little harder to read,
but otherwise would do the same thing.   If it weren't for the spurious sparse
warning, it would be easier.  If others feel strongly about making cifsfs.c
a little longer to avoid the sparse error by removing the macro - I'll take
a patch to remove it, but not sure it matters much the code size would
be the same.

I was fairly certain that a few other file systems in Linux had a global extern
macro or equivalent, but probably  removed it due to sparse throwing warnings.


-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux