From owner-freebsd-arch@FreeBSD.ORG Wed Sep 1 18:43:19 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 752A116A4CE for ; Wed, 1 Sep 2004 18:43:19 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id C7EE443D2F for ; Wed, 1 Sep 2004 18:43:16 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.0.201] ([192.168.0.201]) (authenticated bits=0) by pooker.samsco.org (8.12.11/8.12.10) with ESMTP id i81Ih0E1077939; Wed, 1 Sep 2004 12:43:01 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <413617A4.1030202@samsco.org> Date: Wed, 01 Sep 2004 12:40:36 -0600 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20040831 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Sam References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.0 required=3.8 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on pooker.samsco.org cc: freebsd-arch@freebsd.org Subject: Re: disk_create and cdevsw_add X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2004 18:43:19 -0000 Sam wrote: > 'lo again, > > kern/subr_disk.c:/^disk_create/ takes > two cdevsw types, and I only vaguely > understand why. Can someone explain it to me? I'm not really clear on this myself, other than the first cdevsw contains your actual table, and the second one is a dummy that you allocate but don't actually touch. > > I'm generally confused about resolving > entry points into the driver. Does a > block device only get an open() after > registering it with disk_create? Yes. disk_create() is just a modified form of cdevsw_add(), and your cdevsw entry points are not accessable until that is called. > Supposing I want to set some ioctls for > an aoecontrol utility (show all devices > known, eg), what would aoecontrol open > to ioctl? You can either implement the ioctl handler in the same device as the AoE device, or you can create a separate control device with it's own major and minor that represents all of the AoE devices, or you can do both. You can also create a control device per AoE device, but that isn't terribly common these days and has implications when porting to 5.x and beyond. What kind of things will aoecontrol do? If it will be creating and destroying AoE device instances, then you definetly want a separate control device. You might want to look at my old 4.x RAIDFrame patches that do this. They can be found at http://people.freebsd.org/~scottl/rf Scott