您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

autoboot.c 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. #include <string.h>
  19. #include <vsprintf.h>
  20. #include <gpxe/netdevice.h>
  21. #include <usr/ifmgmt.h>
  22. #include <usr/autoboot.h>
  23. /** @file
  24. *
  25. * Automatic booting
  26. *
  27. */
  28. void test_dhcp ( struct net_device *netdev );
  29. void autoboot ( void ) {
  30. struct net_device *netdev;
  31. int rc;
  32. for_each_netdev ( netdev ) {
  33. if ( ( rc = ifopen ( netdev ) ) != 0 )
  34. continue;
  35. ifstat ( netdev );
  36. test_dhcp ( netdev );
  37. ifclose ( netdev );
  38. }
  39. printf ( "No more network devices\n" );
  40. }