Exemplo n.º 1
0
static void
hf_volume_device_update_mount_properties (HalDevice *device,
					  const struct statfs *mounts,
					  int n_mounts)
{
  const struct statfs *mount = NULL;

  g_return_if_fail(HAL_IS_DEVICE(device));

  if (mounts)
    {
      const char *special;

      special = hal_device_property_get_string(device, "block.device");
      if (special)
	{
	  mount = hf_volume_mounts_find(mounts, n_mounts, special);
          if (mount && strcmp(special, mount->f_mntfromname))
            hal_device_property_set_string(device, "volume.freebsd.real_mounted_device", mount->f_mntfromname);
	  else
	    hal_device_property_remove(device, "volume.freebsd.real_mounted_device");
	}
    }

  hal_device_property_set_bool(device, "volume.is_mounted", mount != NULL);
  hal_device_property_set_bool(device, "volume.is_mounted_read_only", mount && (mount->f_flags & MNT_RDONLY) != 0);
  hal_device_property_set_string(device, "volume.mount_point", mount ? mount->f_mntonname : NULL);
}
Exemplo n.º 2
0
void
devinfo_callouts_preprobing_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
{
        void *end_token = (void *) userdata1;
	DevinfoDevHandler *handler = (DevinfoDevHandler *) userdata2;
	void (*probing_done) (HalDevice *, guint32, gint, char **, gpointer, gpointer);
	const gchar *prober;
	int prober_timeout;

        if (hal_device_property_get_bool (d, "info.ignore")) {
		HAL_INFO (("Preprobing merged info.ignore==TRUE"));

                /* Leave device with info.ignore==TRUE so we won't pick up children */
		hal_device_property_remove (d, "info.category");
		hal_device_property_remove (d, "info.capabilities");

		hal_device_store_remove (hald_get_tdl (), d);
		hal_device_store_add (hald_get_gdl (), d);

		hotplug_event_end (end_token);
		return;
        }

        if (handler != NULL && handler->get_prober != NULL) {
                prober = handler->get_prober (d, &prober_timeout);
        } else {
                prober = NULL;
	}

	if (handler->probing_done != NULL) {
		probing_done = handler->probing_done;
	} else {
		probing_done = devinfo_callouts_probing_done;
	}

        if (prober != NULL) {
                /* probe the device */
		HAL_INFO(("Probing udi=%s", hal_device_get_udi (d)));
                hald_runner_run (d,
				prober, NULL,
				prober_timeout,
				probing_done,
				(gpointer) end_token, (gpointer) handler);
	} else {
		probing_done (d, 0, 0, NULL, userdata1, userdata2);
	}
}