dev.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Moved here from drivers/net/net_init.c, which is:
  3. * Written 1993,1994,1995 by Donald Becker.
  4. */
  5. #include <linux/errno.h>
  6. #include <linux/module.h>
  7. #include <linux/netdevice.h>
  8. #include <linux/if_arp.h>
  9. #include <linux/if_ltalk.h>
  10. static int ltalk_change_mtu(struct net_device *dev, int mtu)
  11. {
  12. return -EINVAL;
  13. }
  14. static int ltalk_mac_addr(struct net_device *dev, void *addr)
  15. {
  16. return -EINVAL;
  17. }
  18. static void ltalk_setup(struct net_device *dev)
  19. {
  20. /* Fill in the fields of the device structure with localtalk-generic values. */
  21. dev->change_mtu = ltalk_change_mtu;
  22. dev->set_mac_address = ltalk_mac_addr;
  23. dev->type = ARPHRD_LOCALTLK;
  24. dev->hard_header_len = LTALK_HLEN;
  25. dev->mtu = LTALK_MTU;
  26. dev->addr_len = LTALK_ALEN;
  27. dev->tx_queue_len = 10;
  28. dev->broadcast[0] = 0xFF;
  29. dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
  30. }
  31. /**
  32. * alloc_ltalkdev - Allocates and sets up an localtalk device
  33. * @sizeof_priv: Size of additional driver-private structure to be allocated
  34. * for this localtalk device
  35. *
  36. * Fill in the fields of the device structure with localtalk-generic
  37. * values. Basically does everything except registering the device.
  38. *
  39. * Constructs a new net device, complete with a private data area of
  40. * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for
  41. * this private data area.
  42. */
  43. struct net_device *alloc_ltalkdev(int sizeof_priv)
  44. {
  45. return alloc_netdev(sizeof_priv, "lt%d", ltalk_setup);
  46. }
  47. EXPORT_SYMBOL(alloc_ltalkdev);