* create_proc_entry and !CONFIG_PROC_FS
@ 2003-08-31 15:06 Adrian Bunk
2003-08-31 21:40 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Adrian Bunk @ 2003-08-31 15:06 UTC (permalink / raw)
To: linux-kernel
Hi,
I've observed a possible problem with create_proc_entry and
!CONFIG_PROC_FS.
If !CONFIG_PROC_FS include/linux/proc_fs.h includes a dummy
create_proc_entry that simply returns NULL.
Unfortunately, many callers of this function do things like e.g.
static int __init br2684_init(void)
{
struct proc_dir_entry *p;
if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
return -ENOMEM;
p->proc_fops = &br2684_proc_operations;
br2684_ioctl_set(br2684_ioctl);
return 0;
}
IOW, the dummy create_proc_entry fixes the compilation but the init
function always returns -ENOMEM if !CONFIG_PROC_FS.
Is there any better solution than removing the dummy create_proc_entry
and #ifdef'ing all places where it's used?
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: create_proc_entry and !CONFIG_PROC_FS
2003-08-31 15:06 create_proc_entry and !CONFIG_PROC_FS Adrian Bunk
@ 2003-08-31 21:40 ` Andrew Morton
2003-08-31 21:45 ` Adrian Bunk
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2003-08-31 21:40 UTC (permalink / raw)
To: Adrian Bunk; +Cc: linux-kernel
Adrian Bunk <bunk@fs.tum.de> wrote:
>
> Hi,
>
> I've observed a possible problem with create_proc_entry and
> !CONFIG_PROC_FS.
>
> If !CONFIG_PROC_FS include/linux/proc_fs.h includes a dummy
> create_proc_entry that simply returns NULL.
>
> Unfortunately, many callers of this function do things like e.g.
>
> static int __init br2684_init(void)
> {
> struct proc_dir_entry *p;
> if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
> return -ENOMEM;
> p->proc_fops = &br2684_proc_operations;
> br2684_ioctl_set(br2684_ioctl);
> return 0;
> }
>
>
> IOW, the dummy create_proc_entry fixes the compilation but the init
> function always returns -ENOMEM if !CONFIG_PROC_FS.
>
> Is there any better solution than removing the dummy create_proc_entry
> and #ifdef'ing all places where it's used?
The normal fix would be to sprinkle ifdefs throughout the driver itself.
You need to lok at the driver and ask yourself "is anyone ever going to want
to use this in a no-procfs system". Probably, the answer is always "no".
In which case appropriate fixes would be to ignore the problem, or disable
the driver in config if !CONFIG_PROC_FS.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: create_proc_entry and !CONFIG_PROC_FS
2003-08-31 21:40 ` Andrew Morton
@ 2003-08-31 21:45 ` Adrian Bunk
0 siblings, 0 replies; 3+ messages in thread
From: Adrian Bunk @ 2003-08-31 21:45 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
On Sun, Aug 31, 2003 at 02:40:33PM -0700, Andrew Morton wrote:
> Adrian Bunk <bunk@fs.tum.de> wrote:
> >
> > Hi,
> >
> > I've observed a possible problem with create_proc_entry and
> > !CONFIG_PROC_FS.
> >
> > If !CONFIG_PROC_FS include/linux/proc_fs.h includes a dummy
> > create_proc_entry that simply returns NULL.
> >
> > Unfortunately, many callers of this function do things like e.g.
> >
> > static int __init br2684_init(void)
> > {
> > struct proc_dir_entry *p;
> > if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
> > return -ENOMEM;
> > p->proc_fops = &br2684_proc_operations;
> > br2684_ioctl_set(br2684_ioctl);
> > return 0;
> > }
> >
> >
> > IOW, the dummy create_proc_entry fixes the compilation but the init
> > function always returns -ENOMEM if !CONFIG_PROC_FS.
> >
> > Is there any better solution than removing the dummy create_proc_entry
> > and #ifdef'ing all places where it's used?
>
> The normal fix would be to sprinkle ifdefs throughout the driver itself.
That's what I was thinking of when I wrote "#ifdef'ing all places where
it's used"...
> You need to lok at the driver and ask yourself "is anyone ever going to want
> to use this in a no-procfs system". Probably, the answer is always "no".
> In which case appropriate fixes would be to ignore the problem, or disable
> the driver in config if !CONFIG_PROC_FS.
The latter is IMHO the better solution, a driver that compiles but
doesn't work (#if !CONFIG_PROC_FS) is simply useless.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-08-31 21:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-31 15:06 create_proc_entry and !CONFIG_PROC_FS Adrian Bunk
2003-08-31 21:40 ` Andrew Morton
2003-08-31 21:45 ` Adrian Bunk
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).