Add very basic sysfs attributes for matrix type and the header file

This commit is contained in:
Sameer Rahmani 2020-03-31 21:29:50 +01:00
parent 9390d36338
commit d9fcf6d8d7
1 changed files with 30 additions and 0 deletions

30
ksudoku.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef _KSUDOKU_H_
#define _KSUDOKU_H_
#include <linux/init.h>
#include <linux/module.h>
#include <linux/sysfs.h>
ssize_t is_valid_show(void);
ssize_t is_valid_store(void);
ssize_t is_solved_show(void);
ssize_t is_solved_store(void);
struct matrix_attribute {
struct attribute attr;
ssize_t (*show)(void);
ssize_t (*store)(void);
bool value;
};
struct matrix {
char matrix[81];
};
#define MATRIX_ATTR_RO(_name) \
struct matrix_attribute matrix_##_name = __ATTR_RO(_name)
#define MATRIX_ATTR_WO(_name) \
struct matrix_attribute matrix_##_name = __ATTR_WO(_name)
#endif