dev.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 void ltalk_setup(struct net_device *dev)
  11. {
  12. /* Fill in the fields of the device structure with localtalk-generic values. */
  13. dev->type = ARPHRD_LOCALTLK;
  14. dev->hard_header_len = LTALK_HLEN;
  15. dev->mtu = LTALK_MTU;
  16. dev->addr_len = LTALK_ALEN;
  17. dev->tx_queue_len = 10;
  18. dev->broadcast[0] = 0xFF;
  19. dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
  20. }
  21. /**
  22. * alloc_ltalkdev - Allocates and sets up an localtalk device
  23. * @sizeof_priv: Size of additional driver-private structure to be allocated
  24. * for this localtalk device
  25. *
  26. * Fill in the fields of the device structure with localtalk-generic
  27. * values. Basically does everything except registering the device.
  28. *
  29. * Constructs a new net device, complete with a private data area of
  30. * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for
  31. * this private data area.
  32. */
  33. struct net_device *alloc_ltalkdev(int sizeof_priv)
  34. {
  35. return alloc_netdev(sizeof_priv, "lt%d", NET_NAME_UNKNOWN,
  36. ltalk_setup);
  37. }
  38. EXPORT_SYMBOL(alloc_ltalkdev);