Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753084AbXF3Bz2 (ORCPT ); Fri, 29 Jun 2007 21:55:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751810AbXF3BzU (ORCPT ); Fri, 29 Jun 2007 21:55:20 -0400 Received: from wx-out-0506.google.com ([66.249.82.239]:2386 "EHLO wx-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbXF3BzT (ORCPT ); Fri, 29 Jun 2007 21:55:19 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=NDzSU4jHzBDy5SCIH8dUW9dAijlKO51G6IF0BPPkJ4I/a+e7XC9ro9fvhceRkuD3l7aHO+zAb3iIZpdWLAvBHmoemIfCrAYjVTyTvrp1hz+nHeX4I2omb9fSPXdGpLfZ0iWgv4q7rL1xJPCTH66BrNVsgHxm2yGGpFs2IdoBr0Q= Message-ID: Date: Fri, 29 Jun 2007 18:55:18 -0700 From: "Ulrich Drepper" To: "Davide Libenzi" Subject: Re: [patch 3/6] sys_indirect RFC - sys_indirect core Cc: "Linux Kernel Mailing List" , "Andrew Morton" , "Linus Torvalds" , "Ingo Molnar" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1637 Lines: 38 On 6/29/07, Davide Libenzi wrote: > +int indirect_set_context(struct fsa_context *ator, > + const struct indirect_ctx __user * __user *ctxs, > + unsigned int nctxs, struct indirect_op **first) > +{ > + unsigned int i; > + int error; > + u32 ctx; > + const struct indirect_ctx __user *pctx; > + struct indirect_op *new; > + > + *first = NULL; > + for (i = 0; i < nctxs; i++) { > + if (get_user(pctx, &ctxs[i]) || get_user(ctx, &pctx->ctx)) > + return -EFAULT; > + if (unlikely(ctx >= ARRAY_SIZE(inprocs) || !inprocs[ctx].set)) > + return -EINVAL; > + error = (*inprocs[ctx].set)(ator, pctx, &new); > + if (unlikely(error)) > + return error; > + new->next = *first; > + *first = new; > + } If you use one single struct as explained in my last mail all this shouldn't be necessary. The sys_indirect syscall would simply points current->ind_ctx to a kernel-copy of the struct. Then call the syscall and on return clear current->ind_ctx. In the affected syscalls we can then test whether current->ind_ctx is NULL and if not, enable the extra functionality. These callbacks etc seem to be far too expensive and complicated. - 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/