| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * include/linux/node.h - generic node definition | 
 | 3 |  * | 
 | 4 |  * This is mainly for topological representation. We define the  | 
 | 5 |  * basic 'struct node' here, which can be embedded in per-arch  | 
 | 6 |  * definitions of processors. | 
 | 7 |  * | 
 | 8 |  * Basic handling of the devices is done in drivers/base/node.c | 
 | 9 |  * and system devices are handled in drivers/base/sys.c.  | 
 | 10 |  * | 
 | 11 |  * Nodes are exported via driverfs in the class/node/devices/ | 
 | 12 |  * directory.  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 |  */ | 
 | 14 | #ifndef _LINUX_NODE_H_ | 
 | 15 | #define _LINUX_NODE_H_ | 
 | 16 |  | 
 | 17 | #include <linux/sysdev.h> | 
 | 18 | #include <linux/cpumask.h> | 
| Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 19 | #include <linux/workqueue.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 |  | 
 | 21 | struct node { | 
 | 22 | 	struct sys_device	sysdev; | 
| Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 23 |  | 
 | 24 | #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) | 
 | 25 | 	struct work_struct	node_work; | 
 | 26 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | }; | 
 | 28 |  | 
| Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 29 | struct memory_block; | 
| Yasunori Goto | 0fc4415 | 2006-06-27 02:53:38 -0700 | [diff] [blame] | 30 | extern struct node node_devices[]; | 
| Lee Schermerhorn | 9a30523 | 2009-12-14 17:58:25 -0800 | [diff] [blame] | 31 | typedef  void (*node_registration_func_t)(struct node *); | 
| Yasunori Goto | 0fc4415 | 2006-06-27 02:53:38 -0700 | [diff] [blame] | 32 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | extern int register_node(struct node *, int, struct node *); | 
| Keiichiro Tokunaga | 4b45099 | 2005-05-08 21:28:53 +0900 | [diff] [blame] | 34 | extern void unregister_node(struct node *node); | 
| KAMEZAWA Hiroyuki | 36920e0 | 2006-08-27 01:23:52 -0700 | [diff] [blame] | 35 | #ifdef CONFIG_NUMA | 
| Yasunori Goto | 0fc4415 | 2006-06-27 02:53:38 -0700 | [diff] [blame] | 36 | extern int register_one_node(int nid); | 
 | 37 | extern void unregister_one_node(int nid); | 
| KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 38 | extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); | 
 | 39 | extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); | 
| Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 40 | extern int register_mem_sect_under_node(struct memory_block *mem_blk, | 
 | 41 | 						int nid); | 
 | 42 | extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); | 
| Lee Schermerhorn | 9a30523 | 2009-12-14 17:58:25 -0800 | [diff] [blame] | 43 |  | 
 | 44 | #ifdef CONFIG_HUGETLBFS | 
 | 45 | extern void register_hugetlbfs_with_node(node_registration_func_t doregister, | 
 | 46 | 					 node_registration_func_t unregister); | 
 | 47 | #endif | 
| KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 48 | #else | 
| KAMEZAWA Hiroyuki | 36920e0 | 2006-08-27 01:23:52 -0700 | [diff] [blame] | 49 | static inline int register_one_node(int nid) | 
 | 50 | { | 
 | 51 | 	return 0; | 
 | 52 | } | 
 | 53 | static inline int unregister_one_node(int nid) | 
 | 54 | { | 
 | 55 | 	return 0; | 
 | 56 | } | 
| KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 57 | static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid) | 
 | 58 | { | 
 | 59 | 	return 0; | 
 | 60 | } | 
 | 61 | static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) | 
 | 62 | { | 
 | 63 | 	return 0; | 
 | 64 | } | 
| Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 65 | static inline int register_mem_sect_under_node(struct memory_block *mem_blk, | 
 | 66 | 							int nid) | 
 | 67 | { | 
 | 68 | 	return 0; | 
 | 69 | } | 
 | 70 | static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) | 
 | 71 | { | 
 | 72 | 	return 0; | 
 | 73 | } | 
| Lee Schermerhorn | 9a30523 | 2009-12-14 17:58:25 -0800 | [diff] [blame] | 74 |  | 
 | 75 | static inline void register_hugetlbfs_with_node(node_registration_func_t reg, | 
 | 76 | 						node_registration_func_t unreg) | 
 | 77 | { | 
 | 78 | } | 
| KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 79 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 |  | 
 | 81 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) | 
 | 82 |  | 
 | 83 | #endif /* _LINUX_NODE_H_ */ |