File indexing completed on 2025-05-11 08:24:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifdef HAVE_CONFIG_H
0016 #include "config.h"
0017 #endif
0018
0019 #include <stdio.h>
0020 #include <unistd.h>
0021 #include <string.h>
0022 #include <errno.h>
0023
0024 #include <rtems.h>
0025 #include <rtems/shell.h>
0026 #include "internal.h"
0027
0028 #include <librtemsNfs.h>
0029
0030 static int
0031 rtems_shell_nfs_mounter (
0032 const char* device,
0033 const char* mntpoint,
0034 rtems_shell_filesystems_t* fs RTEMS_UNUSED,
0035 rtems_filesystem_options_t options RTEMS_UNUSED)
0036 {
0037 char* uidhost;
0038 char* path;
0039 int ret;
0040
0041 if (strchr (device, ':') == NULL) {
0042 fprintf (stderr, "error: nfs mount device is [uid.gid@]host:path\n");
0043 return -1;
0044 }
0045
0046 if (rpcUdpInit () < 0) {
0047 fprintf (stderr, "error: initialising RPC\n");
0048 return -1;
0049 }
0050
0051 nfsInit (0, 0);
0052
0053 uidhost = strdup (device);
0054 path = strchr (uidhost, ':');
0055 *path = '\0';
0056 path++;
0057
0058 ret = nfsMount(uidhost, path, (char*) mntpoint);
0059
0060 free (uidhost);
0061
0062 return ret;
0063 }
0064
0065 rtems_shell_filesystems_t rtems_shell_Mount_NFS = {
0066 name: "nfs",
0067 driver_needed: 1,
0068 fs_ops: NULL,
0069 mounter: rtems_shell_nfs_mounter
0070 };