diff options
Diffstat (limited to 'fs/xfs/xfs_dmops.c')
-rw-r--r-- | fs/xfs/xfs_dmops.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/fs/xfs/xfs_dmops.c b/fs/xfs/xfs_dmops.c index 1e4a35ddf7f9..6cd5704258a2 100644 --- a/fs/xfs/xfs_dmops.c +++ b/fs/xfs/xfs_dmops.c | |||
@@ -19,18 +19,51 @@ | |||
19 | #include "xfs_fs.h" | 19 | #include "xfs_fs.h" |
20 | #include "xfs_types.h" | 20 | #include "xfs_types.h" |
21 | #include "xfs_log.h" | 21 | #include "xfs_log.h" |
22 | #include "xfs_inum.h" | ||
23 | #include "xfs_trans.h" | 22 | #include "xfs_trans.h" |
24 | #include "xfs_sb.h" | 23 | #include "xfs_sb.h" |
25 | #include "xfs_ag.h" | ||
26 | #include "xfs_dir2.h" | ||
27 | #include "xfs_dmapi.h" | 24 | #include "xfs_dmapi.h" |
25 | #include "xfs_inum.h" | ||
26 | #include "xfs_ag.h" | ||
28 | #include "xfs_mount.h" | 27 | #include "xfs_mount.h" |
28 | #include "xfs_clnt.h" | ||
29 | |||
29 | 30 | ||
30 | xfs_dmops_t xfs_dmcore_stub = { | 31 | static struct xfs_dmops xfs_dmcore_stub = { |
31 | .xfs_send_data = (xfs_send_data_t)fs_nosys, | 32 | .xfs_send_data = (xfs_send_data_t)fs_nosys, |
32 | .xfs_send_mmap = (xfs_send_mmap_t)fs_noerr, | 33 | .xfs_send_mmap = (xfs_send_mmap_t)fs_noerr, |
33 | .xfs_send_destroy = (xfs_send_destroy_t)fs_nosys, | 34 | .xfs_send_destroy = (xfs_send_destroy_t)fs_nosys, |
34 | .xfs_send_namesp = (xfs_send_namesp_t)fs_nosys, | 35 | .xfs_send_namesp = (xfs_send_namesp_t)fs_nosys, |
35 | .xfs_send_unmount = (xfs_send_unmount_t)fs_noval, | 36 | .xfs_send_mount = (xfs_send_mount_t)fs_nosys, |
37 | .xfs_send_unmount = (xfs_send_unmount_t)fs_noerr, | ||
36 | }; | 38 | }; |
39 | |||
40 | int | ||
41 | xfs_dmops_get(struct xfs_mount *mp, struct xfs_mount_args *args) | ||
42 | { | ||
43 | if (args->flags & XFSMNT_DMAPI) { | ||
44 | struct xfs_dmops *ops; | ||
45 | |||
46 | ops = symbol_get(xfs_dmcore_xfs); | ||
47 | if (!ops) { | ||
48 | request_module("xfs_dmapi"); | ||
49 | ops = symbol_get(xfs_dmcore_xfs); | ||
50 | } | ||
51 | |||
52 | if (!ops) { | ||
53 | cmn_err(CE_WARN, "XFS: no dmapi support available."); | ||
54 | return EINVAL; | ||
55 | } | ||
56 | mp->m_dm_ops = ops; | ||
57 | } else { | ||
58 | mp->m_dm_ops = &xfs_dmcore_stub; | ||
59 | } | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | void | ||
65 | xfs_dmops_put(struct xfs_mount *mp) | ||
66 | { | ||
67 | if (mp->m_dm_ops != &xfs_dmcore_stub) | ||
68 | symbol_put(xfs_dmcore_xfs); | ||
69 | } | ||