| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | *	Routines to manage notifier chains for passing status changes to any | 
|  | 3 | *	interested routines. We need this instead of hard coded call lists so | 
|  | 4 | *	that modules can poke their nose into the innards. The network devices | 
|  | 5 | *	needed them so here they are for the rest of you. | 
|  | 6 | * | 
|  | 7 | *				Alan Cox <Alan.Cox@linux.org> | 
|  | 8 | */ | 
|  | 9 |  | 
|  | 10 | #ifndef _LINUX_NOTIFIER_H | 
|  | 11 | #define _LINUX_NOTIFIER_H | 
|  | 12 | #include <linux/errno.h> | 
|  | 13 |  | 
|  | 14 | struct notifier_block | 
|  | 15 | { | 
|  | 16 | int (*notifier_call)(struct notifier_block *self, unsigned long, void *); | 
|  | 17 | struct notifier_block *next; | 
|  | 18 | int priority; | 
|  | 19 | }; | 
|  | 20 |  | 
|  | 21 |  | 
|  | 22 | #ifdef __KERNEL__ | 
|  | 23 |  | 
|  | 24 | extern int notifier_chain_register(struct notifier_block **list, struct notifier_block *n); | 
|  | 25 | extern int notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n); | 
|  | 26 | extern int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v); | 
|  | 27 |  | 
|  | 28 | #define NOTIFY_DONE		0x0000		/* Don't care */ | 
|  | 29 | #define NOTIFY_OK		0x0001		/* Suits me */ | 
|  | 30 | #define NOTIFY_STOP_MASK	0x8000		/* Don't call further */ | 
|  | 31 | #define NOTIFY_BAD		(NOTIFY_STOP_MASK|0x0002)	/* Bad/Veto action	*/ | 
|  | 32 | /* | 
|  | 33 | * Clean way to return from the notifier and stop further calls. | 
|  | 34 | */ | 
|  | 35 | #define NOTIFY_STOP		(NOTIFY_OK|NOTIFY_STOP_MASK) | 
|  | 36 |  | 
|  | 37 | /* | 
|  | 38 | *	Declared notifiers so far. I can imagine quite a few more chains | 
|  | 39 | *	over time (eg laptop power reset chains, reboot chain (to clean | 
|  | 40 | *	device units up), device [un]mount chain, module load/unload chain, | 
|  | 41 | *	low memory chain, screenblank chain (for plug in modular screenblankers) | 
|  | 42 | *	VC switch chains (for loadable kernel svgalib VC switch helpers) etc... | 
|  | 43 | */ | 
|  | 44 |  | 
|  | 45 | /* netdevice notifier chain */ | 
|  | 46 | #define NETDEV_UP	0x0001	/* For now you can't veto a device up/down */ | 
|  | 47 | #define NETDEV_DOWN	0x0002 | 
|  | 48 | #define NETDEV_REBOOT	0x0003	/* Tell a protocol stack a network interface | 
|  | 49 | detected a hardware crash and restarted | 
|  | 50 | - we can use this eg to kick tcp sessions | 
|  | 51 | once done */ | 
|  | 52 | #define NETDEV_CHANGE	0x0004	/* Notify device state change */ | 
|  | 53 | #define NETDEV_REGISTER 0x0005 | 
|  | 54 | #define NETDEV_UNREGISTER	0x0006 | 
|  | 55 | #define NETDEV_CHANGEMTU	0x0007 | 
|  | 56 | #define NETDEV_CHANGEADDR	0x0008 | 
|  | 57 | #define NETDEV_GOING_DOWN	0x0009 | 
|  | 58 | #define NETDEV_CHANGENAME	0x000A | 
| Stephen Hemminger | d8a33ac | 2005-05-29 14:13:47 -0700 | [diff] [blame] | 59 | #define NETDEV_FEAT_CHANGE	0x000B | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 |  | 
|  | 61 | #define SYS_DOWN	0x0001	/* Notify of system down */ | 
|  | 62 | #define SYS_RESTART	SYS_DOWN | 
|  | 63 | #define SYS_HALT	0x0002	/* Notify of system halt */ | 
|  | 64 | #define SYS_POWER_OFF	0x0003	/* Notify of system power off */ | 
|  | 65 |  | 
|  | 66 | #define NETLINK_URELEASE	0x0001	/* Unicast netlink socket released */ | 
|  | 67 |  | 
|  | 68 | #define CPU_ONLINE		0x0002 /* CPU (unsigned)v is up */ | 
|  | 69 | #define CPU_UP_PREPARE		0x0003 /* CPU (unsigned)v coming up */ | 
|  | 70 | #define CPU_UP_CANCELED		0x0004 /* CPU (unsigned)v NOT coming up */ | 
|  | 71 | #define CPU_DOWN_PREPARE	0x0005 /* CPU (unsigned)v going down */ | 
|  | 72 | #define CPU_DOWN_FAILED		0x0006 /* CPU (unsigned)v NOT going down */ | 
|  | 73 | #define CPU_DEAD		0x0007 /* CPU (unsigned)v dead */ | 
|  | 74 |  | 
|  | 75 | #endif /* __KERNEL__ */ | 
|  | 76 | #endif /* _LINUX_NOTIFIER_H */ |