lkml.org 
[lkml]   [2002]   [Aug]   [20]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
From kuebelr@email ...
DateTue, 20 Aug 2002 07:59:42 -0400
SubjectRe: [RFC] [PATCH] cdrom per drive sysctl's
On Tue, Aug 20, 2002 at 09:35:39AM +0200, Kristian Peters wrote:
...
> > +	/* copy the default settings for the new drive */
> > +	memcpy(cst, &cdrom_table, sizeof(struct cdrom_sysctl_table));
> 
> Hm. I don't understand this. Why are you applying the default settings to a new entry hence they're overwritten later ?
> 
> > +	cst->options_table[0].data = &cst->options.autoclose;
> > +	cst->options_table[1].data = &cst->options.autoeject;
> > +	cst->options_table[2].data = &cst->options.debug;
> > +	cst->options_table[3].data = &cst->options.lock;
> > +	cst->options_table[4].data = &cst->options.check_media;
> > +	cst->options_table[5].procname = "info";
> > +	cst->options_table[5].extra1 = cdi;
> > +	cst->drive_table[0].child = cst->options_table;
> > +	cst->drive_table[0].procname = cdi->name;
> > +	cst->drive_table[0].ctl_name = kdev_t_to_nr(cdi->dev);
> > +	cst->cdrom_table[0].child = cst->drive_table;
> > +	cst->dev_table[0].child = cst->cdrom_table;
> > +
...

the values of the default settings are copied w/ memcpy(), but the new
structure has to point to its own settings (so changing sr0/debug
changes sr0's data not the default settings). that is why i manipulate
the pointers later.

rob.
-
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/

\
 
 \ /
  Last update: 2005-03-22 12:22    [from the cache]
©2003-2008