linux/arch/um/include/net_kern.h
Jeff Dike b10aeeef55 [PATCH] uml: mechanical tidying after random MACs change
Mechanical, hopefully non-functional changes stemming from
setup_etheraddr always succeeding now that it always assigns a MAC,
either from the command line or generated randomly:
   the test of the return of setup_etheraddr is removed, and code
dependent on it succeeding is now unconditional
   setup_etheraddr can now be made void
   struct uml_net.have_mac is now always 1, so tests of it can be
similarly removed, and uses of it can be replaced with 1
   struct uml_net.have_mac is no longer used, so it can be removed
   struct uml_net_private.have_mac is copied from struct uml_net, so
it is always 1
   tests of uml_net_private.have_mac can be removed
   uml_net_private.have_mac can now be removed
   the only call to dev_ip_addr was removed, so it can be deleted

It also turns out that setup_etheraddr is called only once, from the same
file, so it can be static and its declaration removed from net_kern.h.

Similarly, set_ether_mac is defined and called only from one file.

Finally, setup_etheraddr and set_ether_mac were moved to avoid needing forward
declarations.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00

70 lines
1.9 KiB
C

/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __UM_NET_KERN_H
#define __UM_NET_KERN_H
#include <linux/netdevice.h>
#include <linux/platform_device.h>
#include <linux/skbuff.h>
#include <linux/socket.h>
#include <linux/list.h>
struct uml_net {
struct list_head list;
struct net_device *dev;
struct platform_device pdev;
int index;
unsigned char mac[ETH_ALEN];
};
struct uml_net_private {
struct list_head list;
spinlock_t lock;
struct net_device *dev;
struct timer_list tl;
struct net_device_stats stats;
int fd;
unsigned char mac[ETH_ALEN];
unsigned short (*protocol)(struct sk_buff *);
int (*open)(void *);
void (*close)(int, void *);
void (*remove)(void *);
int (*read)(int, struct sk_buff **skb, struct uml_net_private *);
int (*write)(int, struct sk_buff **skb, struct uml_net_private *);
void (*add_address)(unsigned char *, unsigned char *, void *);
void (*delete_address)(unsigned char *, unsigned char *, void *);
int (*set_mtu)(int mtu, void *);
int user[1];
};
struct net_kern_info {
void (*init)(struct net_device *, void *);
unsigned short (*protocol)(struct sk_buff *);
int (*read)(int, struct sk_buff **skb, struct uml_net_private *);
int (*write)(int, struct sk_buff **skb, struct uml_net_private *);
};
struct transport {
struct list_head list;
char *name;
int (*setup)(char *, char **, void *);
const struct net_user_info *user;
const struct net_kern_info *kern;
int private_size;
int setup_size;
};
extern struct net_device *ether_init(int);
extern unsigned short ether_protocol(struct sk_buff *);
extern struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra);
extern int tap_setup_common(char *str, char *type, char **dev_name,
char **mac_out, char **gate_addr);
extern void register_transport(struct transport *new);
extern unsigned short eth_protocol(struct sk_buff *skb);
#endif