static int backend_probe_and_watch(struct notifier_block *notifier,
				   unsigned long event,
				   void *data)
{
	/* Enumerate devices in xenstore and watch for changes. */
	xenbus_probe_devices(&xenbus_backend);
	register_xenbus_watch(&be_watch);

	return NOTIFY_DONE;
}
Exemple #2
0
void xenbus_probe(void *unused)
{
	int i;

	BUG_ON((xenstored_ready <= 0));

	/* Enumerate devices in xenstore. */
	xenbus_probe_devices(&xenbus_frontend);
#ifdef CONFIG_XEN
	xenbus_probe_devices(&xenbus_backend);
#endif
	/* Watch for changes. */
	register_xenbus_watch(&fe_watch);
#ifdef CONFIG_XEN
	register_xenbus_watch(&be_watch);
#endif

	/* Notify others that xenstore is up */
	notifier_call_chain(&xenstore_chain, 0, NULL);

	/* On a 10 second timeout, waiting for all devices currently
	   configured.  We need to do this to guarantee that the filesystems
	   and / or network devices needed for boot are available, before we
	   can allow the boot to proceed.

	   A possible improvement here would be to have the tools add a
	   per-device flag to the store entry, indicating whether it is needed
	   at boot time.  This would allow people who knew what they were
	   doing to accelerate their boot slightly, but of course needs tools
	   or manual intervention to set up those flags correctly.
	 */
	for (i = 0; i < 10 * HZ; i++) {
		if (all_devices_ready())
			return;

		set_current_state(TASK_INTERRUPTIBLE);
		schedule_timeout(1);
	}

	printk(KERN_WARNING
	       "XENBUS: Timeout connecting to devices!\n");
}
void xenbus_probe(struct work_struct *unused)
{
	BUG_ON((xenstored_ready <= 0));

	/* Enumerate devices in xenstore and watch for changes. */
	xenbus_probe_devices(&xenbus_frontend);
	register_xenbus_watch(&fe_watch);
	xenbus_backend_probe_and_watch();

	/* Notify others that xenstore is up */
	blocking_notifier_call_chain(&xenstore_chain, 0, NULL);
}
void xenbus_backend_probe_and_watch(void)
{
	xenbus_probe_devices(&xenbus_backend);
	register_xenbus_watch_uvp(&be_watch);
}