]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/mountd/mount_dispatch.c
cee19810476d1270918934c4e2c826887a89aab6
[nfs-utils.git] / utils / mountd / mount_dispatch.c
1 /*
2  * mount_dispatch       This file contains the function dispatch table.
3  *
4  * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
5  */
6
7 #include "config.h"
8
9 #include "mountd.h"
10 #include "rpcmisc.h"
11
12 /*
13  * Procedures for MNTv1
14  */
15 static struct rpc_dentry mnt_1_dtable[] = {
16         dtable_ent(mount_null,1,void,void),             /* NULL */
17         dtable_ent(mount_mnt,1,dirpath,fhstatus),       /* MNT */
18         dtable_ent(mount_dump,1,void,mountlist),        /* DUMP */
19         dtable_ent(mount_umnt,1,dirpath,void),          /* UMNT */
20         dtable_ent(mount_umntall,1,void,void),          /* UMNTALL */
21         dtable_ent(mount_export,1,void,exports),        /* EXPORT */
22         dtable_ent(mount_exportall,1,void,exports),     /* EXPORTALL */
23 };
24
25 /*
26  * Procedures for MNTv2
27  */
28 static struct rpc_dentry mnt_2_dtable[] = {
29         dtable_ent(mount_null,1,void,void),             /* NULL */
30         dtable_ent(mount_mnt,1,dirpath,fhstatus),       /* MNT */
31         dtable_ent(mount_dump,1,void,mountlist),        /* DUMP */
32         dtable_ent(mount_umnt,1,dirpath,void),          /* UMNT */
33         dtable_ent(mount_umntall,1,void,void),          /* UMNTALL */
34         dtable_ent(mount_export,1,void,exports),        /* EXPORT */
35         dtable_ent(mount_exportall,1,void,exports),     /* EXPORTALL */
36         dtable_ent(mount_pathconf,2,dirpath,ppathcnf),  /* PATHCONF */
37 };
38
39 /*
40  * Procedures for MNTv3
41  */
42 static struct rpc_dentry mnt_3_dtable[] = {
43         dtable_ent(mount_null,1,void,void),             /* NULL */
44         dtable_ent(mount_mnt,3,dirpath,mountres3),      /* MNT */
45         dtable_ent(mount_dump,1,void,mountlist),        /* DUMP */
46         dtable_ent(mount_umnt,1,dirpath,void),          /* UMNT */
47         dtable_ent(mount_umntall,1,void,void),          /* UMNTALL */
48         dtable_ent(mount_export,1,void,exports),        /* EXPORT */
49 };
50
51 #define number_of(x)    (sizeof(x)/sizeof(x[0]))
52
53 static struct rpc_dtable        dtable[] = {
54         { mnt_1_dtable,         number_of(mnt_1_dtable) },
55         { mnt_2_dtable,         number_of(mnt_2_dtable) },
56         { mnt_3_dtable,         number_of(mnt_3_dtable) },
57 };
58
59 /*
60  * The main dispatch routine.
61  */
62 void
63 mount_dispatch(struct svc_req *rqstp, SVCXPRT *transp)
64 {
65         union mountd_arguments  argument;
66         union mountd_results    result;
67
68         rpc_dispatch(rqstp, transp, dtable, number_of(dtable),
69                         &argument, &result);
70 }