aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2014-09-26 19:20:02 -0400
committerJens Axboe <axboe@fb.com>2014-09-27 11:14:51 -0400
commit8288f496eb1b1905c425e92eaf1abbb29119217b (patch)
tree12559a35cd7ec36bffe28c29a618d0d63b9c1c9f /block
parent1859308853b19c4daf4afaab910d3d52ac1ec2ff (diff)
block: Add prefix to block integrity profile flags
Add a BLK_ prefix to the integrity profile flags. Also rename the flags to be more consistent with the generate/verify terminology in the rest of the integrity code. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/bio-integrity.c4
-rw-r--r--block/blk-integrity.c43
2 files changed, 24 insertions, 23 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index fe4de033b34c..e64733bb29b6 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -173,11 +173,11 @@ bool bio_integrity_enabled(struct bio *bio)
173 return false; 173 return false;
174 174
175 if (bio_data_dir(bio) == READ && bi->verify_fn != NULL && 175 if (bio_data_dir(bio) == READ && bi->verify_fn != NULL &&
176 (bi->flags & INTEGRITY_FLAG_READ)) 176 (bi->flags & BLK_INTEGRITY_VERIFY))
177 return true; 177 return true;
178 178
179 if (bio_data_dir(bio) == WRITE && bi->generate_fn != NULL && 179 if (bio_data_dir(bio) == WRITE && bi->generate_fn != NULL &&
180 (bi->flags & INTEGRITY_FLAG_WRITE)) 180 (bi->flags & BLK_INTEGRITY_GENERATE))
181 return true; 181 return true;
182 182
183 return false; 183 return false;
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 3a83a7d08177..a7436ccc936b 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -269,42 +269,42 @@ static ssize_t integrity_tag_size_show(struct blk_integrity *bi, char *page)
269 return sprintf(page, "0\n"); 269 return sprintf(page, "0\n");
270} 270}
271 271
272static ssize_t integrity_read_store(struct blk_integrity *bi, 272static ssize_t integrity_verify_store(struct blk_integrity *bi,
273 const char *page, size_t count) 273 const char *page, size_t count)
274{ 274{
275 char *p = (char *) page; 275 char *p = (char *) page;
276 unsigned long val = simple_strtoul(p, &p, 10); 276 unsigned long val = simple_strtoul(p, &p, 10);
277 277
278 if (val) 278 if (val)
279 bi->flags |= INTEGRITY_FLAG_READ; 279 bi->flags |= BLK_INTEGRITY_VERIFY;
280 else 280 else
281 bi->flags &= ~INTEGRITY_FLAG_READ; 281 bi->flags &= ~BLK_INTEGRITY_VERIFY;
282 282
283 return count; 283 return count;
284} 284}
285 285
286static ssize_t integrity_read_show(struct blk_integrity *bi, char *page) 286static ssize_t integrity_verify_show(struct blk_integrity *bi, char *page)
287{ 287{
288 return sprintf(page, "%d\n", (bi->flags & INTEGRITY_FLAG_READ) != 0); 288 return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_VERIFY) != 0);
289} 289}
290 290
291static ssize_t integrity_write_store(struct blk_integrity *bi, 291static ssize_t integrity_generate_store(struct blk_integrity *bi,
292 const char *page, size_t count) 292 const char *page, size_t count)
293{ 293{
294 char *p = (char *) page; 294 char *p = (char *) page;
295 unsigned long val = simple_strtoul(p, &p, 10); 295 unsigned long val = simple_strtoul(p, &p, 10);
296 296
297 if (val) 297 if (val)
298 bi->flags |= INTEGRITY_FLAG_WRITE; 298 bi->flags |= BLK_INTEGRITY_GENERATE;
299 else 299 else
300 bi->flags &= ~INTEGRITY_FLAG_WRITE; 300 bi->flags &= ~BLK_INTEGRITY_GENERATE;
301 301
302 return count; 302 return count;
303} 303}
304 304
305static ssize_t integrity_write_show(struct blk_integrity *bi, char *page) 305static ssize_t integrity_generate_show(struct blk_integrity *bi, char *page)
306{ 306{
307 return sprintf(page, "%d\n", (bi->flags & INTEGRITY_FLAG_WRITE) != 0); 307 return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_GENERATE) != 0);
308} 308}
309 309
310static struct integrity_sysfs_entry integrity_format_entry = { 310static struct integrity_sysfs_entry integrity_format_entry = {
@@ -317,23 +317,23 @@ static struct integrity_sysfs_entry integrity_tag_size_entry = {
317 .show = integrity_tag_size_show, 317 .show = integrity_tag_size_show,
318}; 318};
319 319
320static struct integrity_sysfs_entry integrity_read_entry = { 320static struct integrity_sysfs_entry integrity_verify_entry = {
321 .attr = { .name = "read_verify", .mode = S_IRUGO | S_IWUSR }, 321 .attr = { .name = "read_verify", .mode = S_IRUGO | S_IWUSR },
322 .show = integrity_read_show, 322 .show = integrity_verify_show,
323 .store = integrity_read_store, 323 .store = integrity_verify_store,
324}; 324};
325 325
326static struct integrity_sysfs_entry integrity_write_entry = { 326static struct integrity_sysfs_entry integrity_generate_entry = {
327 .attr = { .name = "write_generate", .mode = S_IRUGO | S_IWUSR }, 327 .attr = { .name = "write_generate", .mode = S_IRUGO | S_IWUSR },
328 .show = integrity_write_show, 328 .show = integrity_generate_show,
329 .store = integrity_write_store, 329 .store = integrity_generate_store,
330}; 330};
331 331
332static struct attribute *integrity_attrs[] = { 332static struct attribute *integrity_attrs[] = {
333 &integrity_format_entry.attr, 333 &integrity_format_entry.attr,
334 &integrity_tag_size_entry.attr, 334 &integrity_tag_size_entry.attr,
335 &integrity_read_entry.attr, 335 &integrity_verify_entry.attr,
336 &integrity_write_entry.attr, 336 &integrity_generate_entry.attr,
337 NULL, 337 NULL,
338}; 338};
339 339
@@ -406,7 +406,7 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
406 406
407 kobject_uevent(&bi->kobj, KOBJ_ADD); 407 kobject_uevent(&bi->kobj, KOBJ_ADD);
408 408
409 bi->flags |= INTEGRITY_FLAG_READ | INTEGRITY_FLAG_WRITE; 409 bi->flags |= BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE;
410 bi->interval = queue_logical_block_size(disk->queue); 410 bi->interval = queue_logical_block_size(disk->queue);
411 disk->integrity = bi; 411 disk->integrity = bi;
412 } else 412 } else
@@ -419,6 +419,7 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
419 bi->verify_fn = template->verify_fn; 419 bi->verify_fn = template->verify_fn;
420 bi->tuple_size = template->tuple_size; 420 bi->tuple_size = template->tuple_size;
421 bi->tag_size = template->tag_size; 421 bi->tag_size = template->tag_size;
422 bi->flags |= template->flags;
422 } else 423 } else
423 bi->name = bi_unsupported_name; 424 bi->name = bi_unsupported_name;
424 425