cpumask: add show cpu map functions

* Add cpu_sysdev_class functions to display the following maps
    with cpulist_scnprintf().

	cpu_online_map
	cpu_present_map
	cpu_possible_map

  * Small change to include/linux/sysdev.h to allow the attribute
    name and label to be different (to avoid collision with the
    "attr_online" entry for bringing cpus on- and off-line.)

Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Mike Travis 2008-04-08 11:43:04 -07:00 committed by Ingo Molnar
parent 39106dcf85
commit 9d1fe3236a
2 changed files with 59 additions and 6 deletions

View file

@ -45,12 +45,16 @@ struct sysdev_class_attribute {
ssize_t (*store)(struct sysdev_class *, const char *, size_t);
};
#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
struct sysdev_class_attribute attr_##_name = { \
#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
{ \
.attr = {.name = __stringify(_name), .mode = _mode }, \
.show = _show, \
.store = _store, \
};
}
#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
struct sysdev_class_attribute attr_##_name = \
_SYSDEV_CLASS_ATTR(_name,_mode,_show,_store)
extern int sysdev_class_register(struct sysdev_class *);
@ -100,15 +104,16 @@ struct sysdev_attribute {
};
#define _SYSDEV_ATTR(_name,_mode,_show,_store) \
#define _SYSDEV_ATTR(_name, _mode, _show, _store) \
{ \
.attr = { .name = __stringify(_name), .mode = _mode }, \
.show = _show, \
.store = _store, \
}
#define SYSDEV_ATTR(_name,_mode,_show,_store) \
struct sysdev_attribute attr_##_name = _SYSDEV_ATTR(_name,_mode,_show,_store);
#define SYSDEV_ATTR(_name, _mode, _show, _store) \
struct sysdev_attribute attr_##_name = \
_SYSDEV_ATTR(_name, _mode, _show, _store);
extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);