xfs_dmops.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "xfs.h"
  19. #include "xfs_fs.h"
  20. #include "xfs_types.h"
  21. #include "xfs_log.h"
  22. #include "xfs_trans.h"
  23. #include "xfs_sb.h"
  24. #include "xfs_dmapi.h"
  25. #include "xfs_inum.h"
  26. #include "xfs_ag.h"
  27. #include "xfs_mount.h"
  28. #include "xfs_clnt.h"
  29. static struct xfs_dmops xfs_dmcore_stub = {
  30. .xfs_send_data = (xfs_send_data_t)fs_nosys,
  31. .xfs_send_mmap = (xfs_send_mmap_t)fs_noerr,
  32. .xfs_send_destroy = (xfs_send_destroy_t)fs_nosys,
  33. .xfs_send_namesp = (xfs_send_namesp_t)fs_nosys,
  34. .xfs_send_mount = (xfs_send_mount_t)fs_nosys,
  35. .xfs_send_unmount = (xfs_send_unmount_t)fs_noerr,
  36. };
  37. int
  38. xfs_dmops_get(struct xfs_mount *mp, struct xfs_mount_args *args)
  39. {
  40. if (args->flags & XFSMNT_DMAPI) {
  41. struct xfs_dmops *ops;
  42. ops = symbol_get(xfs_dmcore_xfs);
  43. if (!ops) {
  44. request_module("xfs_dmapi");
  45. ops = symbol_get(xfs_dmcore_xfs);
  46. }
  47. if (!ops) {
  48. cmn_err(CE_WARN, "XFS: no dmapi support available.");
  49. return EINVAL;
  50. }
  51. mp->m_dm_ops = ops;
  52. } else {
  53. mp->m_dm_ops = &xfs_dmcore_stub;
  54. }
  55. return 0;
  56. }
  57. void
  58. xfs_dmops_put(struct xfs_mount *mp)
  59. {
  60. if (mp->m_dm_ops != &xfs_dmcore_stub)
  61. symbol_put(xfs_dmcore_xfs);
  62. }