Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

interface.c 1.9KB

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