patch-2.1.20 linux/include/linux/net_alias.h

Next file: linux/include/linux/netdevice.h
Previous file: linux/include/linux/mtio.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.19/linux/include/linux/net_alias.h linux/include/linux/net_alias.h
@@ -17,6 +17,7 @@
 #ifndef _NET_ALIAS_H
 #define _NET_ALIAS_H
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/if.h>
 #include <linux/netdevice.h>
@@ -33,20 +34,20 @@
 
 
 /*
- * main alias structure
- * note that *defines* dev & devname
+ *	Main alias structure
+ *	Note that *defines* dev & devname.
  */
 
 struct net_alias
 {
-  struct device dev;		/* alias device defn*/
-  char name[IFNAMSIZ];		/* device name defn */
-  unsigned hash;		/* my hash value: for quick rehash */
-  unsigned slot;		/* slot number */
-  void *data;			/* private data */
-  struct device *main_dev;	/* pointer to main device */
-  struct net_alias_type *nat;	/* alias type object bound */
-  struct net_alias *next;	/* next alias (hashed linked list) */
+	struct device dev;		/* alias device defn*/
+	char name[IFNAMSIZ];		/* device name defn */
+	unsigned hash;			/* my hash value: for quick rehash */
+	unsigned slot;			/* slot number */
+	void *data;			/* private data */
+	struct device *main_dev;	/* pointer to main device */
+	struct net_alias_type *nat;	/* alias type object bound */
+	struct net_alias *next;		/* next alias (hashed linked list) */
 };
 
 
@@ -57,59 +58,102 @@
 
 struct net_alias_info
 {
-  int n_aliases;		/* num aliases */
-  struct device *taildev;	/* my last (alias) device */
-  struct net_alias *hash_tab[16]; /* hashed alias table */
+	int n_aliases;			/* num aliases */
+	struct device *taildev;		/* my last (alias) device */
+	struct net_alias *hash_tab[16]; /* hashed alias table */
 };
 
 /*
- * net_alias_type class
- * declares a generic (AF_ independent) structure that will
- * manage generic to family-specific behavior.
+ *	net_alias_type class
+ *	Declares a generic (AF_ independent) structure that will
+ *	manage generic to family-specific behavior.
  */
 
 struct net_alias_type
 {
-  int type;			/* aliasing type: address family */
-  int n_attach;	 		/* number of aliases attached */
-  char name[16];		/* af_name */
-  __u32 (*get_addr32)		/* get __u32 addr 'representation'*/
-    (struct net_alias_type *this, struct sockaddr*);	
-  int (*dev_addr_chk)		/* address checking func: */
-    (struct net_alias_type *this, struct device *, struct sockaddr *);
-  struct device * (*dev_select)	/* closest alias selector*/
-    (struct net_alias_type *this, struct device *, struct sockaddr *sa);
-  int (*alias_init_1)		/* called after alias creation: */
-    (struct net_alias_type *this,struct net_alias *alias, struct sockaddr *sa);
-  int (*alias_done_1)		/* called before alias deletion */
-    (struct net_alias_type *this, struct net_alias *alias);
-  int (*alias_print_1)	
-    (struct net_alias_type *this, struct net_alias *alias, char *buf, int len);
-  struct net_alias_type *next;	/* link */
+	int type;			/* aliasing type: address family */
+	int n_attach;	 		/* number of aliases attached */
+	char name[16];			/* af_name */
+	__u32 (*get_addr32)		/* get __u32 addr 'representation'*/
+		(struct net_alias_type *this, struct sockaddr*);	
+	int (*dev_addr_chk)		/* address checking func: */
+		(struct net_alias_type *this, struct device *, struct sockaddr *);
+	struct device * (*dev_select)	/* closest alias selector*/
+		(struct net_alias_type *this, struct device *, struct sockaddr *sa);
+	int (*alias_init_1)		/* called after alias creation: */
+		(struct net_alias_type *this,struct net_alias *alias, struct sockaddr *sa);
+	int (*alias_done_1)		/* called before alias deletion */
+		(struct net_alias_type *this, struct net_alias *alias);
+	int (*alias_print_1)	
+		(struct net_alias_type *this, struct net_alias *alias, char *buf, int len);
+	struct net_alias_type *next;	/* link */
 };
 
 
 /*
- * is dev an alias?
+ *	is dev an alias?
  */
 
-static __inline__ int
-net_alias_is(struct device *dev)
+#ifdef CONFIG_NET_ALIAS
+
+extern __inline__ int net_alias_is(struct device *dev)
+{
+	return (dev->my_alias != NULL);
+}
+
+/*
+ *	Does dev have aliases?
+ */
+
+extern __inline__ int net_alias_has(struct device *dev)
+{
+	return (dev->alias_info != NULL);
+}
+
+/*
+ *	Returns MY 'true' main device
+ *	intended for alias devices
+ */
+
+extern __inline__ struct device *net_alias_main_dev(struct device *dev)
 {
-  return (dev->my_alias != NULL);
+	return (net_alias_is(dev))? dev->my_alias->main_dev : dev;
 }
 
 
 /*
- * does dev have aliases?
+ *	Returns NEXT 'true' device
+ *	intended for true devices
+ */
+
+extern __inline__ struct device *net_alias_nextdev(struct device *dev)
+{
+	return (dev->alias_info)? dev->alias_info->taildev->next : dev->next;
+}
+
+/*
+ *	Sets NEXT 'true' device
+ *	Intended for main devices (treat main device as block: dev+aliases).
  */
 
-static __inline__ int
-net_alias_has(struct device *dev)
+extern __inline__ struct device *net_alias_nextdev_set(struct device *dev, struct device *nextdev)
 {
-  return (dev->alias_info != NULL);
+	struct device *pdev = dev;
+	if (net_alias_has(dev))
+	{
+		pdev = dev->alias_info->taildev; /* point to last dev alias */
+	}
+	pdev->next = nextdev;
+	return nextdev;
 }
 
+#else
+
+#define net_alias_has(dev)	(0)
+#define net_alias_is(dev)	(0)
+#define net_alias_main_dev(dev)	(dev)
+#endif
+
 
 extern void net_alias_init(void);
 
@@ -129,44 +173,5 @@
 extern struct device * net_alias_dev_rcv_sel32(struct device *main_dev, int family, __u32 src, __u32 dst);
 
 
-/*
- * returns MY 'true' main device
- * intended for alias devices
- */
-
-static __inline__ struct device *net_alias_main_dev(struct device *dev)
-{
-  return (net_alias_is(dev))? dev->my_alias->main_dev : dev;
-}
-
-
-/*
- * returns NEXT 'true' device
- * intended for true devices
- */
-
-static __inline__ struct device *
-net_alias_nextdev(struct device *dev)
-{
-  return (dev->alias_info)? dev->alias_info->taildev->next : dev->next;
-}
-
-
-/*
- * sets NEXT 'true' device
- * intended for main devices (treat main device as block: dev+aliases).
- */
-
-static __inline__ struct device *
-net_alias_nextdev_set(struct device *dev, struct device *nextdev)
-{
-  struct device *pdev = dev;
-  if (net_alias_has(dev))
-  {
-    pdev = dev->alias_info->taildev; /* point to last dev alias */
-  }
-  pdev->next = nextdev;
-  return nextdev;
-}
 
 #endif  /* _NET_ALIAS_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov