From owner-freebsd-arch@FreeBSD.ORG Fri Aug 6 23:16:37 2010 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0DB1106567B for ; Fri, 6 Aug 2010 23:16:37 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 5E2728FC12 for ; Fri, 6 Aug 2010 23:16:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o76NEdge056679; Fri, 6 Aug 2010 17:14:39 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 06 Aug 2010 17:15:10 -0600 (MDT) Message-Id: <20100806.171510.506212773199813899.imp@bsdimp.com> To: jroberson@jroberson.net From: "M. Warner Losh" In-Reply-To: References: X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: arch@freebsd.org Subject: Re: Change to sysctl to support linux kobj X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 23:16:37 -0000 In message: Jeff Roberson writes: : Hi folks, : : I really need two pointer arguments to a sysctl function to support : linux sysfs via sysctl. To facilitate this I propose changing the int : arg2 to a uinptr_t. This keeps it as an integer type but makes it : wide enough to accept a pointer. A small number of places in the : kernel have to be fixed for the new type or because they don't use : SYSCTL_HANDLER_ARGS. This will introduce an api/abi incompatibility : although it is relatively minor. : : Comments? Alternatives? : : Thanks, : Jeff : : Index: sysctl.h : =================================================================== : --- sysctl.h (revision 207767) : +++ sysctl.h (working copy) : @@ -114,8 +114,8 @@ : #define CTL_AUTO_START 0x100 : : #ifdef _KERNEL : -#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int : -#arg2, \ : - struct sysctl_req *req : +#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \ : + uintptr_t arg2, struct sysctl_req *req : : /* definitions for sysctl_req 'lock' member */ : #define REQ_UNLOCKED 0 /* not locked and not wired */ : @@ -158,7 +158,7 @@ : int oid_number; : u_int oid_kind; : void *oid_arg1; : - int oid_arg2; : + uintptr_t oid_arg2; : const char *oid_name; : int (*oid_handler)(SYSCTL_HANDLER_ARGS); : const char *oid_fmt; We've been making a lot of changes to the MIPS tree that involve using intptr_t when dealing with addresses to get the proper sign extension to happen. I'm unsure if this would be a good thing or not more generally, but at least two architectures use this convention (MIPS and the now-defunct alpha). Warner