Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261693AbVBAHk5 (ORCPT ); Tue, 1 Feb 2005 02:40:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261769AbVBAHk5 (ORCPT ); Tue, 1 Feb 2005 02:40:57 -0500 Received: from mail.kroah.org ([69.55.234.183]:43164 "EHLO perch.kroah.org") by vger.kernel.org with ESMTP id S261693AbVBAHkv (ORCPT ); Tue, 1 Feb 2005 02:40:51 -0500 Date: Mon, 31 Jan 2005 22:30:24 -0800 From: Greg KH To: Mitch Williams Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] buffer writes to sysfs Message-ID: <20050201063024.GA15179@kroah.com> References: <20050122080930.GB6999@kroah.com> <20050124213906.GE18933@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2038 Lines: 57 On Tue, Jan 25, 2005 at 03:39:00PM -0800, Mitch Williams wrote: > > > On Mon, 24 Jan 2005, Greg KH wrote: > > > > Who is trying to send > 1K to a sysfs file? Remember, sysfs files are > > for 1 value only. If you consider > 1K a "single value" please point me > > to that part of the kernel that does that. > > > > > To the typical user, there's really no difference in behavior, unless > > you > > > are writing a ton of data into the file. Of course, there's the > > obvious > > > question of why you'd want to do so... > > > > Exactly, you should not be doing that anyway. So, because of that, I > > really don't want/like this patch. > > > OK, I've had a day to think about this, and I think I have a good answer > now. > > Leaving aside the issue of how big a 'single object' is, we still have to > consider the possibility that a user _will_ indeed someday try to write 4K > (or more) to a sysfs file. It's just going to happen. And right now, the > kernel's behavior in that event is unpredictable, because we don't know > how the c library is going to buffer this write. That's your C library, probably not mine :) Anyway, sure, I can see that we want to handle this in a sane manner. > diff -urpN -X dontdiff linux-2.6.11-clean/fs/sysfs/file.c linux-2.6.11/fs/sysfs/file.c > --- linux-2.6.11-clean/fs/sysfs/file.c 2004-12-24 13:33:50.000000000 -0800 > +++ linux-2.6.11/fs/sysfs/file.c 2005-01-25 10:47:15.000000000 -0800 > @@ -232,6 +232,8 @@ sysfs_write_file(struct file *file, cons > { > struct sysfs_buffer * buffer = file->private_data; > > + if (*ppos > 0) > + return -EIO; > down(&buffer->sem); > count = fill_write_buffer(buffer,buf,count); > if (count > 0) You are using spaces instead of tabs :( Care to redo it? thanks, greg k-h - 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/