Context |
Check |
Description |
mdraidci/vmtest-md-6_11-PR |
fail
|
PR summary
|
mdraidci/vmtest-md-6_11-VM_Test-0 |
success
|
Logs for Lint
|
mdraidci/vmtest-md-6_11-VM_Test-1 |
success
|
Logs for ShellCheck
|
mdraidci/vmtest-md-6_11-VM_Test-7 |
success
|
Logs for x86_64-gcc / test (test_maps, false, 360) / test_maps on x86_64 with gcc
|
mdraidci/vmtest-md-6_11-VM_Test-8 |
fail
|
Logs for x86_64-gcc / test (test_progs, false, 360) / test_progs on x86_64 with gcc
|
mdraidci/vmtest-md-6_11-VM_Test-9 |
fail
|
Logs for x86_64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with gcc
|
mdraidci/vmtest-md-6_11-VM_Test-10 |
success
|
Logs for x86_64-gcc / test (test_progs_no_alu32_parallel, true, 30) / test_progs_no_alu32_parallel on x86_64 with gcc
|
mdraidci/vmtest-md-6_11-VM_Test-11 |
success
|
Logs for x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
|
mdraidci/vmtest-md-6_11-VM_Test-3 |
success
|
Logs for Validate matrix.py
|
mdraidci/vmtest-md-6_11-VM_Test-2 |
success
|
Logs for Unittests
|
mdraidci/vmtest-md-6_11-VM_Test-4 |
success
|
Logs for set-matrix
|
mdraidci/vmtest-md-6_11-VM_Test-5 |
success
|
Logs for x86_64-gcc / build / build for x86_64 with gcc
|
mdraidci/vmtest-md-6_11-VM_Test-6 |
success
|
Logs for x86_64-gcc / build-release
|
mdraidci/vmtest-md-6_11-VM_Test-12 |
success
|
Logs for x86_64-gcc / test (test_verifier, false, 360) / test_verifier on x86_64 with gcc
|
mdraidci/vmtest-md-6_11-VM_Test-13 |
fail
|
Logs for x86_64-gcc / veristat / veristat on x86_64 with gcc
|
mdraidci/vmtest-md-6_11-VM_Test-14 |
success
|
Logs for x86_64-llvm-17 / build / build for x86_64 with llvm-17
|
mdraidci/vmtest-md-6_11-VM_Test-15 |
success
|
Logs for x86_64-llvm-17 / build-release / build for x86_64 with llvm-17 and -O2 optimization
|
mdraidci/vmtest-md-6_11-VM_Test-16 |
success
|
Logs for x86_64-llvm-17 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-17
|
mdraidci/vmtest-md-6_11-VM_Test-17 |
fail
|
Logs for x86_64-llvm-17 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-17
|
mdraidci/vmtest-md-6_11-VM_Test-18 |
fail
|
Logs for x86_64-llvm-17 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-17
|
mdraidci/vmtest-md-6_11-VM_Test-19 |
success
|
Logs for x86_64-llvm-17 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-17
|
mdraidci/vmtest-md-6_11-VM_Test-20 |
success
|
Logs for x86_64-llvm-17 / veristat
|
mdraidci/vmtest-md-6_11-VM_Test-21 |
success
|
Logs for x86_64-llvm-18 / build / build for x86_64 with llvm-18
|
mdraidci/vmtest-md-6_11-VM_Test-22 |
success
|
Logs for x86_64-llvm-18 / build-release / build for x86_64 with llvm-18 and -O2 optimization
|
mdraidci/vmtest-md-6_11-VM_Test-23 |
success
|
Logs for x86_64-llvm-18 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-18
|
mdraidci/vmtest-md-6_11-VM_Test-24 |
fail
|
Logs for x86_64-llvm-18 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-18
|
mdraidci/vmtest-md-6_11-VM_Test-25 |
fail
|
Logs for x86_64-llvm-18 / test (test_progs_cpuv4, false, 360) / test_progs_cpuv4 on x86_64 with llvm-18
|
mdraidci/vmtest-md-6_11-VM_Test-26 |
fail
|
Logs for x86_64-llvm-18 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-18
|
mdraidci/vmtest-md-6_11-VM_Test-27 |
success
|
Logs for x86_64-llvm-18 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-18
|
mdraidci/vmtest-md-6_11-VM_Test-28 |
success
|
Logs for x86_64-llvm-18 / veristat
|
@@ -241,6 +241,28 @@ const char *blk_integrity_profile_name(struct blk_integrity *bi)
}
EXPORT_SYMBOL_GPL(blk_integrity_profile_name);
+static ssize_t flag_store(struct device *dev, struct device_attribute *attr,
+ const char *page, size_t count, unsigned char flag)
+{
+ struct blk_integrity *bi = dev_to_bi(dev);
+ char *p = (char *) page;
+ unsigned long val = simple_strtoul(p, &p, 10);
+
+ if (val)
+ bi->flags |= flag;
+ else
+ bi->flags &= ~flag;
+ return count;
+}
+
+static ssize_t flag_show(struct device *dev, struct device_attribute *attr,
+ char *page, unsigned char flag)
+{
+ struct blk_integrity *bi = dev_to_bi(dev);
+
+ return sysfs_emit(page, "%d\n", !!(bi->flags & flag));
+}
+
static ssize_t format_show(struct device *dev, struct device_attribute *attr,
char *page)
{
@@ -273,49 +295,26 @@ static ssize_t read_verify_store(struct device *dev,
struct device_attribute *attr,
const char *page, size_t count)
{
- struct blk_integrity *bi = dev_to_bi(dev);
- char *p = (char *) page;
- unsigned long val = simple_strtoul(p, &p, 10);
-
- if (val)
- bi->flags |= BLK_INTEGRITY_VERIFY;
- else
- bi->flags &= ~BLK_INTEGRITY_VERIFY;
-
- return count;
+ return flag_store(dev, attr, page, count, BLK_INTEGRITY_VERIFY);
}
static ssize_t read_verify_show(struct device *dev,
struct device_attribute *attr, char *page)
{
- struct blk_integrity *bi = dev_to_bi(dev);
-
- return sysfs_emit(page, "%d\n", !!(bi->flags & BLK_INTEGRITY_VERIFY));
+ return flag_show(dev, attr, page, BLK_INTEGRITY_VERIFY);
}
static ssize_t write_generate_store(struct device *dev,
struct device_attribute *attr,
const char *page, size_t count)
{
- struct blk_integrity *bi = dev_to_bi(dev);
-
- char *p = (char *) page;
- unsigned long val = simple_strtoul(p, &p, 10);
-
- if (val)
- bi->flags |= BLK_INTEGRITY_GENERATE;
- else
- bi->flags &= ~BLK_INTEGRITY_GENERATE;
-
- return count;
+ return flag_store(dev, attr, page, count, BLK_INTEGRITY_GENERATE);
}
static ssize_t write_generate_show(struct device *dev,
struct device_attribute *attr, char *page)
{
- struct blk_integrity *bi = dev_to_bi(dev);
-
- return sysfs_emit(page, "%d\n", !!(bi->flags & BLK_INTEGRITY_GENERATE));
+ return flag_show(dev, attr, page, BLK_INTEGRITY_GENERATE);
}
static ssize_t device_is_integrity_capable_show(struct device *dev,
Factor the duplicate code for the generate and verify attributes into common helpers. Signed-off-by: Christoph Hellwig <hch@lst.de> --- block/blk-integrity.c | 53 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 27 deletions(-)