Ejemplo n.º 1
0
/* net_initdrivers:
 *  Initialises the given drivers.  Returns the full list of
 *  successfully initialised drivers.
 */
list_t net_initdrivers (list_t which) {
  list_t temp1, temp2, temp3;
  temp1 = net_driverlist_create();
  temp2 = net_driverlist_create();
  temp3 = net_driverlist_create();

  /* Take a copy of our parameter, because the later call to 
   * `net_detectdrivers' could clobber it. */
  net_driverlist_add_list (temp3, which);
  which = temp3;
  
  /* Find undetected drivers */
  net_driverlist_add_list (temp2, which);
  net_driverlist_remove_list (temp2, detected_drivers);

  /* Try to detect them */
  net_detectdrivers (temp2);

  /* Mask out remaining undetected drivers */
  net_driverlist_add_list (temp2, which);
  net_driverlist_remove_list (temp2, detected_drivers);
  net_driverlist_add_list (temp1, which);
  net_driverlist_remove_list (temp1, temp2);
  
  /* Mask out already-initialised drivers */
  net_driverlist_remove_list (temp1, initialised_drivers);
  
  /* Do initialisation */
  net_driverlist_foreach (temp1, initdrivers_helper, NULL);
  
  net_driverlist_destroy (temp1);
  net_driverlist_destroy (temp2);
  net_driverlist_destroy (temp3);
  return initialised_drivers;
}
Ejemplo n.º 2
0
int net_driverlist_remove_list (list_t list1, list_t list2)
  { list_t some_list = list1; return net_driverlist_foreach (list2, remove_helper, some_list); }
Ejemplo n.º 3
0
int net_driverlist_add_list (list_t list1, list_t list2)
  { list_t some_list = list1; return net_driverlist_foreach (list2, add_helper, some_list); }
Ejemplo n.º 4
0
int net_driverlist_count (list_t list)
  { int count = 0; net_driverlist_foreach (list, count_helper, &count); return count; }
Ejemplo n.º 5
0
/* net_detectdrivers:
 *  Attempts to detect each given driver; returns a list showing which
 *  of those specified was detected.
 */
list_t net_detectdrivers (list_t which) {
  net_driverlist_clear (temp_detected_list);
  net_driverlist_foreach (which, detectdrivers_helper, NULL);
  return temp_detected_list;
}
Ejemplo n.º 6
0
/* exit_all_drivers:  (internal)
 *  Shuts down all network drivers.
 */
static void exit_all_drivers (void) {
  net_driverlist_foreach (initialised_drivers, exit_all_drivers_helper, NULL);
  net_driverlist_clear (initialised_drivers);
}