Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 2007 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 <gpxe/interface.h>
  19. /** @file
  20. *
  21. * Object communication interfaces
  22. *
  23. */
  24. /**
  25. * Plug an interface into a new destination interface
  26. *
  27. * @v intf Interface
  28. * @v dest New destination interface
  29. *
  30. * The reference to the existing destination interface is dropped, a
  31. * reference to the new destination interface is obtained, and the
  32. * interface is updated to point to the new destination interface.
  33. *
  34. * Note that there is no "unplug" call; instead you must plug the
  35. * interface into a null interface.
  36. */
  37. void plug ( struct interface *intf, struct interface *dest ) {
  38. DBGC ( intf, "INTF %p moving from INTF %p to INTF %p\n",
  39. intf, intf->dest, dest );
  40. intf_put ( intf->dest );
  41. intf->dest = intf_get ( dest );
  42. }
  43. /**
  44. * Plug two interfaces together
  45. *
  46. * @v a Interface A
  47. * @v b Interface B
  48. *
  49. * Plugs interface A into interface B, and interface B into interface
  50. * A. (The basic plug() function is unidirectional; this function is
  51. * merely a shorthand for two calls to plug(), hence the name.)
  52. */
  53. void plug_plug ( struct interface *a, struct interface *b ) {
  54. plug ( a, b );
  55. plug ( b, a );
  56. }