#ifndef _KSUDOKU_H_ #define _KSUDOKU_H_ #include #include #include #include struct ksudoku; #define to_ksudoku(obj) container_of(obj, struct ksudoku, kobj) #define to_ksudoku_attr(_attr) container_of(_attr, struct kobj_attribute, attr) struct sudoku_attribute { struct attribute attr; ssize_t (*show)(struct kobject *kobj, struct attribute *attr, char *buf); ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count); bool value; }; /* * The type of sudoku, "struct sudoku" is embedded in. A class * or bus can only contain one sudoku type. * This identifies the sudoku type and carries type-specific * information, equivalent to the kobj_type of a kobject. * Since we have only one type it always will be the same button * we're designing a subsystem so we have to make sysfs happy. * If "name" is specified, the uevent will contain it in * the DEVTYPE variable. */ /* struct sudoku_type { */ /* const char *name; */ /* const struct attribute_group **groups; */ /* int (*uevent)(struct sudoku *s, struct kobj_uevent_env *env); */ /* void (*release)(struct kobject *kobj); */ /* const struct sysfs_ops *sysfs_ops; */ /* }; */ struct ksudoku { struct kobject *kobj; const struct attribute_group *attr_group; char matrix[81]; atomic_t status; } ; #define SUDOKU_ATTR_RO(_name) \ struct kobj_attribute sudoku_##_name = __ATTR_RO(_name) #define SUDOKU_ATTR_WO(_name) \ struct kobj_attribute sudoku_##_name = __ATTR_WO(_name) #endif