Purpose of GLOBAL_EXTERN macro
Subsystems (2)
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"?
Thanks
Suresh
A message that is not in the archive (sent off-list or not yet received): 4E940EF9.7030603-IBi9RG/[email protected]
Quoted 4 lines · On Tue, 11 Oct 2011 15:10:09 +0530 Suresh Jayaraman…
I bumped into the
GLOBAL_EXTERNmacro 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...
In any case, I agree with akpm's thoughts on the matter:
https://lkml.org/lkml/2008/11/14/367
Signature · 1 line
Jeff Layton <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 20111011070821.6c153d53-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org
Quoted 8 lines · Jeff Layton
Quoted 4 lines · On Tue, 11 Oct 2011 15:10:09 +0530 Suresh Jayaraman…
I bumped into the
GLOBAL_EXTERNmacro 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"?
Quoted 6 lines
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.
Signature · 3 lines
Thanks, Steve