From: Rusty Russell Subject: Re: [PATCH] Convert balloon driver to xenstore Date: Wed, 03 Aug 2005 11:11:53 +1000 Message-ID: <1123031513.7228.6.camel@localhost.localdomain> References: <9cde8bff0508020311157b4463@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Smith Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Tue, 2005-08-02 at 06:51 -0700, Dan Smith wrote: > aq> will we always have to patch xenbus code each time we add a driver > aq> into the kernel? > > I think we need a standardized way to initialize miscellaneous drivers > such as the balloon. It's definitely a temporary solution to a > problem that will require more thought as we get more drivers > converted to xenbus. Generally, you will want to do a module_init() and initialize your driver. If it's in domain 0, it needs to be initialized later (the store isn't up yet): the standard way of doing this is a notifier chain. Something like the following: static struct notifier_block store_notify = { .notifier_call = balloon_setup, }; static int balloon_init() { if (!xen_start_info.store_evtchn) register_xenstore_notifier(&store_notify); else balloon_setup(&store_notify, 0, NULL); return 0; } -- A bad analogy is like a leaky screwdriver -- Richard Braakman