]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
7b718769 NS |
2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
1da177e4 | 4 | * |
7b718769 NS |
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 | |
1da177e4 LT |
7 | * published by the Free Software Foundation. |
8 | * | |
7b718769 NS |
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. | |
1da177e4 | 13 | * |
7b718769 NS |
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 | |
1da177e4 LT |
17 | */ |
18 | #include "xfs.h" | |
a844f451 | 19 | #include "xfs_fs.h" |
1da177e4 | 20 | #include "xfs_types.h" |
1da177e4 LT |
21 | #include "xfs_log.h" |
22 | #include "xfs_trans.h" | |
23 | #include "xfs_sb.h" | |
1da177e4 | 24 | #include "xfs_dmapi.h" |
293688ec CH |
25 | #include "xfs_inum.h" |
26 | #include "xfs_ag.h" | |
1da177e4 | 27 | #include "xfs_mount.h" |
293688ec CH |
28 | #include "xfs_clnt.h" |
29 | ||
1da177e4 | 30 | |
293688ec | 31 | static struct xfs_dmops xfs_dmcore_stub = { |
1da177e4 LT |
32 | .xfs_send_data = (xfs_send_data_t)fs_nosys, |
33 | .xfs_send_mmap = (xfs_send_mmap_t)fs_noerr, | |
34 | .xfs_send_destroy = (xfs_send_destroy_t)fs_nosys, | |
35 | .xfs_send_namesp = (xfs_send_namesp_t)fs_nosys, | |
293688ec CH |
36 | .xfs_send_mount = (xfs_send_mount_t)fs_nosys, |
37 | .xfs_send_unmount = (xfs_send_unmount_t)fs_noerr, | |
1da177e4 | 38 | }; |
293688ec CH |
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 | } |