.. | .. |
---|
30 | 30 | * fnic directory and statistics directory for trace buffer and |
---|
31 | 31 | * stats logging |
---|
32 | 32 | */ |
---|
33 | | - |
---|
34 | | -int |
---|
35 | | -snic_debugfs_init(void) |
---|
| 33 | +void snic_debugfs_init(void) |
---|
36 | 34 | { |
---|
37 | | - int rc = -1; |
---|
38 | | - struct dentry *de = NULL; |
---|
| 35 | + snic_glob->trc_root = debugfs_create_dir("snic", NULL); |
---|
39 | 36 | |
---|
40 | | - de = debugfs_create_dir("snic", NULL); |
---|
41 | | - if (!de) { |
---|
42 | | - SNIC_DBG("Cannot create debugfs root\n"); |
---|
43 | | - |
---|
44 | | - return rc; |
---|
45 | | - } |
---|
46 | | - snic_glob->trc_root = de; |
---|
47 | | - |
---|
48 | | - de = debugfs_create_dir("statistics", snic_glob->trc_root); |
---|
49 | | - if (!de) { |
---|
50 | | - SNIC_DBG("Cannot create Statistics directory\n"); |
---|
51 | | - |
---|
52 | | - return rc; |
---|
53 | | - } |
---|
54 | | - snic_glob->stats_root = de; |
---|
55 | | - |
---|
56 | | - rc = 0; |
---|
57 | | - |
---|
58 | | - return rc; |
---|
59 | | -} /* end of snic_debugfs_init */ |
---|
| 37 | + snic_glob->stats_root = debugfs_create_dir("statistics", |
---|
| 38 | + snic_glob->trc_root); |
---|
| 39 | +} |
---|
60 | 40 | |
---|
61 | 41 | /* |
---|
62 | 42 | * snic_debugfs_term - Tear down debugfs intrastructure |
---|
.. | .. |
---|
391 | 371 | * It will create file stats and reset_stats under statistics/host# directory |
---|
392 | 372 | * to log per snic stats |
---|
393 | 373 | */ |
---|
394 | | -int |
---|
395 | | -snic_stats_debugfs_init(struct snic *snic) |
---|
| 374 | +void snic_stats_debugfs_init(struct snic *snic) |
---|
396 | 375 | { |
---|
397 | | - int rc = -1; |
---|
398 | 376 | char name[16]; |
---|
399 | | - struct dentry *de = NULL; |
---|
400 | 377 | |
---|
401 | 378 | snprintf(name, sizeof(name), "host%d", snic->shost->host_no); |
---|
402 | | - if (!snic_glob->stats_root) { |
---|
403 | | - SNIC_DBG("snic_stats root doesn't exist\n"); |
---|
404 | 379 | |
---|
405 | | - return rc; |
---|
406 | | - } |
---|
| 380 | + snic->stats_host = debugfs_create_dir(name, snic_glob->stats_root); |
---|
407 | 381 | |
---|
408 | | - de = debugfs_create_dir(name, snic_glob->stats_root); |
---|
409 | | - if (!de) { |
---|
410 | | - SNIC_DBG("Cannot create host directory\n"); |
---|
| 382 | + snic->stats_file = debugfs_create_file("stats", S_IFREG|S_IRUGO, |
---|
| 383 | + snic->stats_host, snic, |
---|
| 384 | + &snic_stats_fops); |
---|
411 | 385 | |
---|
412 | | - return rc; |
---|
413 | | - } |
---|
414 | | - snic->stats_host = de; |
---|
415 | | - |
---|
416 | | - de = debugfs_create_file("stats", |
---|
417 | | - S_IFREG|S_IRUGO, |
---|
418 | | - snic->stats_host, |
---|
419 | | - snic, |
---|
420 | | - &snic_stats_fops); |
---|
421 | | - if (!de) { |
---|
422 | | - SNIC_DBG("Cannot create host's stats file\n"); |
---|
423 | | - |
---|
424 | | - return rc; |
---|
425 | | - } |
---|
426 | | - snic->stats_file = de; |
---|
427 | | - |
---|
428 | | - de = debugfs_create_file("reset_stats", |
---|
429 | | - S_IFREG|S_IRUGO|S_IWUSR, |
---|
430 | | - snic->stats_host, |
---|
431 | | - snic, |
---|
432 | | - &snic_reset_stats_fops); |
---|
433 | | - |
---|
434 | | - if (!de) { |
---|
435 | | - SNIC_DBG("Cannot create host's reset_stats file\n"); |
---|
436 | | - |
---|
437 | | - return rc; |
---|
438 | | - } |
---|
439 | | - snic->reset_stats_file = de; |
---|
440 | | - rc = 0; |
---|
441 | | - |
---|
442 | | - return rc; |
---|
443 | | -} /* end of snic_stats_debugfs_init */ |
---|
| 386 | + snic->reset_stats_file = debugfs_create_file("reset_stats", |
---|
| 387 | + S_IFREG|S_IRUGO|S_IWUSR, |
---|
| 388 | + snic->stats_host, snic, |
---|
| 389 | + &snic_reset_stats_fops); |
---|
| 390 | +} |
---|
444 | 391 | |
---|
445 | 392 | /* |
---|
446 | 393 | * snic_stats_debugfs_remove - Tear down debugfs infrastructure of stats |
---|
.. | .. |
---|
492 | 439 | return 0; |
---|
493 | 440 | } |
---|
494 | 441 | |
---|
495 | | -static const struct seq_operations snic_trc_seq_ops = { |
---|
| 442 | +static const struct seq_operations snic_trc_sops = { |
---|
496 | 443 | .start = snic_trc_seq_start, |
---|
497 | 444 | .next = snic_trc_seq_next, |
---|
498 | 445 | .stop = snic_trc_seq_stop, |
---|
499 | 446 | .show = snic_trc_seq_show, |
---|
500 | 447 | }; |
---|
501 | 448 | |
---|
502 | | -static int |
---|
503 | | -snic_trc_open(struct inode *inode, struct file *filp) |
---|
504 | | -{ |
---|
505 | | - return seq_open(filp, &snic_trc_seq_ops); |
---|
506 | | -} |
---|
507 | | - |
---|
508 | | -static const struct file_operations snic_trc_fops = { |
---|
509 | | - .owner = THIS_MODULE, |
---|
510 | | - .open = snic_trc_open, |
---|
511 | | - .read = seq_read, |
---|
512 | | - .llseek = seq_lseek, |
---|
513 | | - .release = seq_release, |
---|
514 | | -}; |
---|
| 449 | +DEFINE_SEQ_ATTRIBUTE(snic_trc); |
---|
515 | 450 | |
---|
516 | 451 | /* |
---|
517 | 452 | * snic_trc_debugfs_init : creates trace/tracing_enable files for trace |
---|
518 | 453 | * under debugfs |
---|
519 | 454 | */ |
---|
520 | | -int |
---|
521 | | -snic_trc_debugfs_init(void) |
---|
| 455 | +void snic_trc_debugfs_init(void) |
---|
522 | 456 | { |
---|
523 | | - struct dentry *de = NULL; |
---|
524 | | - int ret = -1; |
---|
| 457 | + snic_glob->trc.trc_enable = debugfs_create_bool("tracing_enable", |
---|
| 458 | + S_IFREG | S_IRUGO | S_IWUSR, |
---|
| 459 | + snic_glob->trc_root, |
---|
| 460 | + &snic_glob->trc.enable); |
---|
525 | 461 | |
---|
526 | | - if (!snic_glob->trc_root) { |
---|
527 | | - SNIC_ERR("Debugfs root directory for snic doesn't exist.\n"); |
---|
528 | | - |
---|
529 | | - return ret; |
---|
530 | | - } |
---|
531 | | - |
---|
532 | | - de = debugfs_create_bool("tracing_enable", |
---|
533 | | - S_IFREG | S_IRUGO | S_IWUSR, |
---|
534 | | - snic_glob->trc_root, |
---|
535 | | - &snic_glob->trc.enable); |
---|
536 | | - |
---|
537 | | - if (!de) { |
---|
538 | | - SNIC_ERR("Can't create trace_enable file.\n"); |
---|
539 | | - |
---|
540 | | - return ret; |
---|
541 | | - } |
---|
542 | | - snic_glob->trc.trc_enable = de; |
---|
543 | | - |
---|
544 | | - de = debugfs_create_file("trace", |
---|
545 | | - S_IFREG | S_IRUGO | S_IWUSR, |
---|
546 | | - snic_glob->trc_root, |
---|
547 | | - NULL, |
---|
548 | | - &snic_trc_fops); |
---|
549 | | - |
---|
550 | | - if (!de) { |
---|
551 | | - SNIC_ERR("Cannot create trace file.\n"); |
---|
552 | | - |
---|
553 | | - return ret; |
---|
554 | | - } |
---|
555 | | - snic_glob->trc.trc_file = de; |
---|
556 | | - ret = 0; |
---|
557 | | - |
---|
558 | | - return ret; |
---|
559 | | -} /* end of snic_trc_debugfs_init */ |
---|
| 462 | + snic_glob->trc.trc_file = debugfs_create_file("trace", |
---|
| 463 | + S_IFREG | S_IRUGO | S_IWUSR, |
---|
| 464 | + snic_glob->trc_root, NULL, |
---|
| 465 | + &snic_trc_fops); |
---|
| 466 | +} |
---|
560 | 467 | |
---|
561 | 468 | /* |
---|
562 | 469 | * snic_trc_debugfs_term : cleans up the files created for trace under debugfs |
---|