On Llu, 2004-11-01 at 17:18, Linux Kernel Mailing List wrote:
> ChangeSet 1.2424.1.2, 2004/11/01 18:18:35+01:00, bzolnier@trik.(none)
>
> [ide] obsolete /proc/ide/hd?/settings
>
> Majority of these settings is also available through ioctls.
> We will deal with the rest during deprecation period.
Unfortunately while these changes are definitely a good thing.
>
> + printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
> + "obsolete, and will be removed soon!\n");
> +
The above should be rate limited or on the write case moved to after
the capable() check. A program polling these settings now makes a nasty
noise and wipes the logs. A user can also do it intentionally.
On Thu, Nov 11 2004, Alan Cox wrote:
> > + printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
> > + "obsolete, and will be removed soon!\n");
> > +
>
> The above should be rate limited or on the write case moved to after
> the capable() check. A program polling these settings now makes a nasty
> noise and wipes the logs. A user can also do it intentionally.
Or just print it once...
--
Jens Axboe
On Thu, 11 Nov 2004 17:10:21 +0100, Jens Axboe <[email protected]> wrote:
> On Thu, Nov 11 2004, Alan Cox wrote:
> > > + printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
> > > + "obsolete, and will be removed soon!\n");
> > > +
> >
> > The above should be rate limited or on the write case moved to after
> > the capable() check. A program polling these settings now makes a nasty
> > noise and wipes the logs. A user can also do it intentionally.
>
> Or just print it once...
I'm about to add this to ide-2.6...
[ide] fix /proc/ide/hd?/settings to not spam logs
On Thu, 11 Nov 2004 17:10:21 +0100, Jens Axboe <[email protected]> wrote:
> On Thu, Nov 11 2004, Alan Cox wrote:
> > > + printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
> > > + "obsolete, and will be removed soon!\n");
> > > +
> >
> > The above should be rate limited or on the write case moved to after
> > the capable() check. A program polling these settings now makes a nasty
> > noise and wipes the logs. A user can also do it intentionally.
>
> Or just print it once...
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
--- a/drivers/ide/ide-proc.c 2004-11-17 23:56:13 +01:00
+++ b/drivers/ide/ide-proc.c 2004-11-17 23:56:13 +01:00
@@ -124,6 +124,18 @@
PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
}
+static void proc_ide_settings_warn(void)
+{
+ static int warned = 0;
+
+ if (warned)
+ return;
+
+ printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
+ "obsolete, and will be removed soon!\n");
+ warned = 1;
+}
+
static int proc_ide_read_settings
(char *page, char **start, off_t off, int count, int *eof, void *data)
{
@@ -132,8 +144,7 @@
char *out = page;
int len, rc, mul_factor, div_factor;
- printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
- "obsolete, and will be removed soon!\n");
+ proc_ide_settings_warn();
down(&ide_setting_sem);
out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
@@ -171,11 +182,10 @@
ide_settings_t *setting;
char *buf, *s;
- printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
- "obsolete, and will be removed soon!\n");
-
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
+
+ proc_ide_settings_warn();
if (count >= PAGE_SIZE)
return -EINVAL;