node.h 2.18 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * include/linux/node.h - generic node definition
 *
 * This is mainly for topological representation. We define the 
 * basic 'struct node' here, which can be embedded in per-arch 
 * definitions of processors.
 *
 * Basic handling of the devices is done in drivers/base/node.c
 * and system devices are handled in drivers/base/sys.c. 
 *
 * Nodes are exported via driverfs in the class/node/devices/
 * directory. 
 */
#ifndef _LINUX_NODE_H_
#define _LINUX_NODE_H_

17
#include <linux/device.h>
Linus Torvalds's avatar
Linus Torvalds committed
18
#include <linux/cpumask.h>
19
#include <linux/workqueue.h>
Linus Torvalds's avatar
Linus Torvalds committed
20 21

struct node {
22
	struct device	dev;
23 24 25 26

#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
	struct work_struct	node_work;
#endif
Linus Torvalds's avatar
Linus Torvalds committed
27 28
};

29
struct memory_block;
30
extern struct node *node_devices[];
31
typedef  void (*node_registration_func_t)(struct node *);
32

33
extern void unregister_node(struct node *node);
34
#ifdef CONFIG_NUMA
35 36
extern int register_one_node(int nid);
extern void unregister_one_node(int nid);
37 38
extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
39 40
extern int register_mem_sect_under_node(struct memory_block *mem_blk,
						int nid);
41 42
extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
					   unsigned long phys_index);
43 44 45 46 47

#ifdef CONFIG_HUGETLBFS
extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
					 node_registration_func_t unregister);
#endif
48
#else
49 50 51 52 53 54 55 56
static inline int register_one_node(int nid)
{
	return 0;
}
static inline int unregister_one_node(int nid)
{
	return 0;
}
57 58 59 60 61 62 63 64
static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid)
{
	return 0;
}
static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
{
	return 0;
}
65 66 67 68 69
static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
							int nid)
{
	return 0;
}
70 71
static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
						  unsigned long phys_index)
72 73 74
{
	return 0;
}
75 76 77 78 79

static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
						node_registration_func_t unreg)
{
}
80
#endif
Linus Torvalds's avatar
Linus Torvalds committed
81

82
#define to_node(device) container_of(device, struct node, dev)
Linus Torvalds's avatar
Linus Torvalds committed
83 84

#endif /* _LINUX_NODE_H_ */