nullmedium.c 941 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include "u.h"
  10. #include "../port/lib.h"
  11. #include "mem.h"
  12. #include "dat.h"
  13. #include "fns.h"
  14. #include "../port/error.h"
  15. #include "ip.h"
  16. static void
  17. nullbind(Ipifc *ipifc, int i, char **argv)
  18. {
  19. error("cannot bind null device");
  20. }
  21. static void
  22. nullunbind(Ipifc *ipifc)
  23. {
  24. }
  25. static void
  26. nullbwrite(Ipifc *ipifc, Block *block, int i, uint8_t *c)
  27. {
  28. error("nullbwrite");
  29. }
  30. Medium nullmedium =
  31. {
  32. .name= "null",
  33. .bind= nullbind,
  34. .unbind= nullunbind,
  35. .bwrite= nullbwrite,
  36. };
  37. void
  38. nullmediumlink(void)
  39. {
  40. addipmedium(&nullmedium);
  41. }