1 | #ifndef LIB_RTEMS_NFS_CLIENT_H |
---|
2 | #define LIB_RTEMS_NFS_CLIENT_H |
---|
3 | /* $Id$ */ |
---|
4 | |
---|
5 | /* public interface to the NFS client library for RTEMS */ |
---|
6 | |
---|
7 | /* Author: Till Straumann <strauman@slac.stanford.edu> 2002-2003 */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Authorship |
---|
11 | * ---------- |
---|
12 | * This software (NFS-2 client implementation for RTEMS) was created by |
---|
13 | * Till Straumann <strauman@slac.stanford.edu>, 2002-2007, |
---|
14 | * Stanford Linear Accelerator Center, Stanford University. |
---|
15 | * |
---|
16 | * Acknowledgement of sponsorship |
---|
17 | * ------------------------------ |
---|
18 | * The NFS-2 client implementation for RTEMS was produced by |
---|
19 | * the Stanford Linear Accelerator Center, Stanford University, |
---|
20 | * under Contract DE-AC03-76SFO0515 with the Department of Energy. |
---|
21 | * |
---|
22 | * Government disclaimer of liability |
---|
23 | * ---------------------------------- |
---|
24 | * Neither the United States nor the United States Department of Energy, |
---|
25 | * nor any of their employees, makes any warranty, express or implied, or |
---|
26 | * assumes any legal liability or responsibility for the accuracy, |
---|
27 | * completeness, or usefulness of any data, apparatus, product, or process |
---|
28 | * disclosed, or represents that its use would not infringe privately owned |
---|
29 | * rights. |
---|
30 | * |
---|
31 | * Stanford disclaimer of liability |
---|
32 | * -------------------------------- |
---|
33 | * Stanford University makes no representations or warranties, express or |
---|
34 | * implied, nor assumes any liability for the use of this software. |
---|
35 | * |
---|
36 | * Stanford disclaimer of copyright |
---|
37 | * -------------------------------- |
---|
38 | * Stanford University, owner of the copyright, hereby disclaims its |
---|
39 | * copyright and all other rights in this software. Hence, anyone may |
---|
40 | * freely use it for any purpose without restriction. |
---|
41 | * |
---|
42 | * Maintenance of notices |
---|
43 | * ---------------------- |
---|
44 | * In the interest of clarity regarding the origin and status of this |
---|
45 | * SLAC software, this and all the preceding Stanford University notices |
---|
46 | * are to remain affixed to any copy or derivative of this software made |
---|
47 | * or distributed by the recipient and are to be affixed to any copy of |
---|
48 | * software made or distributed by the recipient that contains a copy or |
---|
49 | * derivative of this software. |
---|
50 | * |
---|
51 | * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03 |
---|
52 | */ |
---|
53 | |
---|
54 | #ifdef HAVE_CONFIG_H |
---|
55 | #include <config.h> |
---|
56 | #endif |
---|
57 | |
---|
58 | #include <rtems.h> |
---|
59 | #include <rtems/libio.h> |
---|
60 | #include <rtems/libio_.h> |
---|
61 | #include <rtems/seterr.h> |
---|
62 | #include <string.h> |
---|
63 | #include <stdio.h> |
---|
64 | #include <stdlib.h> |
---|
65 | #include <assert.h> |
---|
66 | #include <sys/stat.h> |
---|
67 | #include <dirent.h> |
---|
68 | #include <netdb.h> |
---|
69 | #include <ctype.h> |
---|
70 | #include <netinet/in.h> |
---|
71 | #include <arpa/inet.h> |
---|
72 | |
---|
73 | /* RPCIO driver interface. |
---|
74 | * If you need RPCIO for other purposes than NFS |
---|
75 | * you may want to include <rpcio.h> |
---|
76 | #include "rpcio.h" |
---|
77 | */ |
---|
78 | |
---|
79 | /* Priority of daemon; may be setup prior to calling rpcUdpInit(); |
---|
80 | * otherwise the network task priority from the rtems_bsdnet_config |
---|
81 | * is used... |
---|
82 | */ |
---|
83 | extern rtems_task_priority rpciodPriority; |
---|
84 | |
---|
85 | /* Initialize the driver |
---|
86 | * |
---|
87 | * RETURNS: 0 on success, -1 on failure |
---|
88 | */ |
---|
89 | int |
---|
90 | rpcUdpInit(void); |
---|
91 | |
---|
92 | /* Cleanup/Stop |
---|
93 | * |
---|
94 | * RETURNS: 0 on success, nonzero if still in use |
---|
95 | */ |
---|
96 | int |
---|
97 | rpcUdpCleanup(void); |
---|
98 | |
---|
99 | /* NFS driver interface */ |
---|
100 | |
---|
101 | /* Initialize the NFS driver. |
---|
102 | * |
---|
103 | * NOTE: The RPCIO driver must have been initialized prior to |
---|
104 | * calling this. |
---|
105 | * |
---|
106 | * ARGS: depth of the small and big |
---|
107 | * transaction pools, i.e. how |
---|
108 | * many transactions (buffers) |
---|
109 | * should always be kept around. |
---|
110 | * |
---|
111 | * (If more transactions are needed, |
---|
112 | * they are created and destroyed |
---|
113 | * on the fly). |
---|
114 | * |
---|
115 | * Supply zero values to have the |
---|
116 | * driver chose reasonable defaults. |
---|
117 | */ |
---|
118 | int |
---|
119 | nfsInit(int smallPoolDepth, int bigPoolDepth); |
---|
120 | |
---|
121 | /* Driver cleanup code |
---|
122 | * |
---|
123 | * RETURNS: 0 on success, nonzero if still in use |
---|
124 | */ |
---|
125 | int |
---|
126 | nfsCleanup(void); |
---|
127 | |
---|
128 | /* Dump a list of the currently mounted NFS to a file |
---|
129 | * (stdout is used in case f==NULL) |
---|
130 | */ |
---|
131 | int |
---|
132 | nfsMountsShow(FILE *f); |
---|
133 | |
---|
134 | /* convenience wrapper |
---|
135 | * |
---|
136 | * NOTE: this routine calls NON-REENTRANT |
---|
137 | * gethostbyname() if the host is |
---|
138 | * not in 'dot' notation. |
---|
139 | */ |
---|
140 | int |
---|
141 | nfsMount(char *uidhost, char *path, char *mntpoint); |
---|
142 | |
---|
143 | /* Alternatively, a pointer to the filesystem operations |
---|
144 | * table can be supplied to the native RTEMS (NON-POSIX!) |
---|
145 | * 'mount()' call. |
---|
146 | * Supply a "<host.in.ip.dot.notation>:<path>" string |
---|
147 | * for 'device' argument to 'mount()'. |
---|
148 | */ |
---|
149 | extern struct _rtems_filesystem_operations_table nfs_fs_ops; |
---|
150 | |
---|
151 | /* A utility routine to find the path leading to a |
---|
152 | * rtems_filesystem_location_info_t node. |
---|
153 | * |
---|
154 | * This should really be present in libcsupport... |
---|
155 | * |
---|
156 | * INPUT: 'loc' and a buffer 'buf' (length 'len') to hold the |
---|
157 | * path. |
---|
158 | * OUTPUT: path copied into 'buf' |
---|
159 | * |
---|
160 | * RETURNS: 0 on success, RTEMS error code on error. |
---|
161 | */ |
---|
162 | rtems_status_code |
---|
163 | rtems_filesystem_resolve_location(char *buf, int len, rtems_filesystem_location_info_t *loc); |
---|
164 | |
---|
165 | /* Set the timeout (initial default: 10s) for NFS and mount calls. |
---|
166 | * |
---|
167 | * RETURNS 0 on success, nonzero if the requested timeout is less than |
---|
168 | * a clock tick or if the system clock rate cannot be determined. |
---|
169 | */ |
---|
170 | |
---|
171 | int |
---|
172 | nfsSetTimeout(uint32_t timeout_ms); |
---|
173 | |
---|
174 | /* Read current timeout (in milliseconds) */ |
---|
175 | uint32_t |
---|
176 | nfsGetTimeout(void); |
---|
177 | #endif |
---|