From 56b31b8c5ade6986bfbb064e5127d1ac79e597fb Mon Sep 17 00:00:00 2001 From: Sultan Qasim Khan Date: Sun, 6 Sep 2015 17:59:58 -0400 Subject: block: zram: Backport from Linux 4.1 Change-Id: I23f6f75979077992298d848efd79a6efc0d776bd --- include/linux/bio.h | 5 +++++ include/linux/device.h | 6 ++++++ include/linux/sysfs.h | 8 ++++++++ 3 files changed, 19 insertions(+) (limited to 'include') diff --git a/include/linux/bio.h b/include/linux/bio.h index 8245f6cb3..e09261bab 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -284,6 +284,11 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int, extern void bio_set_pages_dirty(struct bio *bio); extern void bio_check_pages_dirty(struct bio *bio); +void generic_start_io_acct(int rw, unsigned long sectors, + struct hd_struct *part); +void generic_end_io_acct(int rw, struct hd_struct *part, + unsigned long start_time); + #ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE # error "You should define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE for your platform" #endif diff --git a/include/linux/device.h b/include/linux/device.h index c0a126125..0f90d5f47 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -504,6 +504,12 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, #define DEVICE_ATTR(_name, _mode, _show, _store) \ struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) +#define DEVICE_ATTR_RW(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_RW(_name) +#define DEVICE_ATTR_RO(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_RO(_name) +#define DEVICE_ATTR_WO(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_WO(_name) #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ struct dev_ext_attribute dev_attr_##_name = \ { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index e2cee22f5..4e1a023c3 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -79,6 +79,14 @@ struct attribute_group { .show = _name##_show, \ } +#define __ATTR_WO(_name) { \ + .attr = { .name = __stringify(_name), .mode = S_IWUSR }, \ + .store = _name##_store, \ +} + +#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \ + _name##_show, _name##_store) + #define __ATTR_NULL { .attr = { .name = NULL } } #ifdef CONFIG_DEBUG_LOCK_ALLOC -- cgit v1.2.3