Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751787Ab2FIF0O (ORCPT ); Sat, 9 Jun 2012 01:26:14 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:36495 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418Ab2FIF0M (ORCPT ); Sat, 9 Jun 2012 01:26:12 -0400 Date: Sat, 9 Jun 2012 06:26:10 +0100 From: Al Viro To: Jan Kara Cc: Eric Van Hensbergen , linux-kernel Subject: Re: seq_file dangerous assumption? Message-ID: <20120609052610.GX30000@ZenIV.linux.org.uk> References: <20120604200720.GI11010@quack.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120604200720.GI11010@quack.suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1220 Lines: 25 On Mon, Jun 04, 2012 at 10:07:20PM +0200, Jan Kara wrote: > Also we don't usually put magics into our data structure just to stop bad > use of interfaces. I agree that in this particular case the interface is > easy to get wrong - but that should be solved by changing the interface to > a more robust one. Actually, I'm not sure if anyone actually passes > ->private_data != NULL since seq_open_private() seems to be a standard way > of associating some additional data with seq_file. So maybe > BUG_ON(file->private_data) would be a good robustification of the interface > :). *cough* /proc/mounts *cough* I've just thrown a cleanup of that shite into #for-next (and posted it upthread). The bottom line: * seq_open() is fine with ->private_data pointing to struct seq_file embedded into something. * that's a supported use; just use container_of() to get to the entire object by ->private_data (or similar container_of() by seq_file * argument in seq_file methods). -- 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/