fc_libfc.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright(c) 2009 Intel Corporation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along with
  14. * this program; if not, write to the Free Software Foundation, Inc.,
  15. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  16. *
  17. * Maintained at www.Open-FCoE.org
  18. */
  19. #include <linux/kernel.h>
  20. #include <linux/types.h>
  21. #include <linux/scatterlist.h>
  22. #include <linux/crc32.h>
  23. #include <scsi/libfc.h>
  24. #include "fc_libfc.h"
  25. MODULE_AUTHOR("Open-FCoE.org");
  26. MODULE_DESCRIPTION("libfc");
  27. MODULE_LICENSE("GPL v2");
  28. unsigned int fc_debug_logging;
  29. module_param_named(debug_logging, fc_debug_logging, int, S_IRUGO|S_IWUSR);
  30. MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels");
  31. /**
  32. * libfc_init() - Initialize libfc.ko
  33. */
  34. static int __init libfc_init(void)
  35. {
  36. int rc = 0;
  37. rc = fc_setup_fcp();
  38. if (rc)
  39. return rc;
  40. rc = fc_setup_exch_mgr();
  41. if (rc)
  42. goto destroy_pkt_cache;
  43. rc = fc_setup_rport();
  44. if (rc)
  45. goto destroy_em;
  46. return rc;
  47. destroy_em:
  48. fc_destroy_exch_mgr();
  49. destroy_pkt_cache:
  50. fc_destroy_fcp();
  51. return rc;
  52. }
  53. module_init(libfc_init);
  54. /**
  55. * libfc_exit() - Tear down libfc.ko
  56. */
  57. static void __exit libfc_exit(void)
  58. {
  59. fc_destroy_fcp();
  60. fc_destroy_exch_mgr();
  61. fc_destroy_rport();
  62. }
  63. module_exit(libfc_exit);