mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 11:05:53 -04:00
Merge tag 'configfs-for-linus' of git://git.infradead.org/users/hch/configfs
Pull configfs updates from Christoph Hellwig: "I'm assisting Joel as co-maintainer and patch monkey now, and you will see pull reuquests from me for a while. Besides the MAINTAINERS update there is just a single change, which adds support for binary attributes to configfs, which are very similar to the sysfs binary attributes. Thanks to Pantelis Antoniou! You will see another actually bigger set of configfs changes in the SCSI target pull from Nic - those were merged before this new tree even existed" * tag 'configfs-for-linus' of git://git.infradead.org/users/hch/configfs: configfs: add myself as co-maintainer, updated git tree configfs: implement binary attributes
This commit is contained in:
@@ -51,6 +51,7 @@ struct module;
|
||||
struct configfs_item_operations;
|
||||
struct configfs_group_operations;
|
||||
struct configfs_attribute;
|
||||
struct configfs_bin_attribute;
|
||||
struct configfs_subsystem;
|
||||
|
||||
struct config_item {
|
||||
@@ -84,6 +85,7 @@ struct config_item_type {
|
||||
struct configfs_item_operations *ct_item_ops;
|
||||
struct configfs_group_operations *ct_group_ops;
|
||||
struct configfs_attribute **ct_attrs;
|
||||
struct configfs_bin_attribute **ct_bin_attrs;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -154,6 +156,54 @@ static struct configfs_attribute _pfx##attr_##_name = { \
|
||||
.store = _pfx##_name##_store, \
|
||||
}
|
||||
|
||||
struct file;
|
||||
struct vm_area_struct;
|
||||
|
||||
struct configfs_bin_attribute {
|
||||
struct configfs_attribute cb_attr; /* std. attribute */
|
||||
void *cb_private; /* for user */
|
||||
size_t cb_max_size; /* max core size */
|
||||
ssize_t (*read)(struct config_item *, void *, size_t);
|
||||
ssize_t (*write)(struct config_item *, const void *, size_t);
|
||||
};
|
||||
|
||||
#define CONFIGFS_BIN_ATTR(_pfx, _name, _priv, _maxsz) \
|
||||
static struct configfs_bin_attribute _pfx##attr_##_name = { \
|
||||
.cb_attr = { \
|
||||
.ca_name = __stringify(_name), \
|
||||
.ca_mode = S_IRUGO | S_IWUSR, \
|
||||
.ca_owner = THIS_MODULE, \
|
||||
}, \
|
||||
.cb_private = _priv, \
|
||||
.cb_max_size = _maxsz, \
|
||||
.read = _pfx##_name##_read, \
|
||||
.write = _pfx##_name##_write, \
|
||||
}
|
||||
|
||||
#define CONFIGFS_BIN_ATTR_RO(_pfx, _name, _priv, _maxsz) \
|
||||
static struct configfs_attribute _pfx##attr_##_name = { \
|
||||
.cb_attr = { \
|
||||
.ca_name = __stringify(_name), \
|
||||
.ca_mode = S_IRUGO, \
|
||||
.ca_owner = THIS_MODULE, \
|
||||
}, \
|
||||
.cb_private = _priv, \
|
||||
.cb_max_size = _maxsz, \
|
||||
.read = _pfx##_name##_read, \
|
||||
}
|
||||
|
||||
#define CONFIGFS_BIN_ATTR_WO(_pfx, _name, _priv, _maxsz) \
|
||||
static struct configfs_attribute _pfx##attr_##_name = { \
|
||||
.cb_attr = { \
|
||||
.ca_name = __stringify(_name), \
|
||||
.ca_mode = S_IWUSR, \
|
||||
.ca_owner = THIS_MODULE, \
|
||||
}, \
|
||||
.cb_private = _priv, \
|
||||
.cb_max_size = _maxsz, \
|
||||
.write = _pfx##_name##_write, \
|
||||
}
|
||||
|
||||
/*
|
||||
* If allow_link() exists, the item can symlink(2) out to other
|
||||
* items. If the item is a group, it may support mkdir(2).
|
||||
|
||||
Reference in New Issue
Block a user