source: rtems/cpukit/libmisc/shell/main_mount_nfs.c @ f97536d

5
Last change on this file since f97536d was f97536d, checked in by Sebastian Huber <sebastian.huber@…>, on 10/16/15 at 06:21:48

basdefs.h: Add and use RTEMS_UNUSED

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *   Shell Command Implmentation
3 *
4 *  Author: Fernando RUIZ CASAS
5 *  Work: fernando.ruiz@ctv.es
6 *  Home: correo@fernando-ruiz.com
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.org/license/LICENSE.
11 */
12
13#ifdef HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <stdio.h>
18#include <unistd.h>
19#include <string.h>
20#include <errno.h>
21
22#include <rtems.h>
23#include <rtems/shell.h>
24#include "internal.h"
25
26#include <librtemsNfs.h>
27
28static int
29rtems_shell_nfs_mounter (
30  const char*                device,
31  const char*                mntpoint,
32  rtems_shell_filesystems_t* fs RTEMS_UNUSED,
33  rtems_filesystem_options_t options RTEMS_UNUSED)
34{
35  char* uidhost;
36  char* path;
37  int   ret;
38
39  if (strchr (device, ':') == NULL) {
40    fprintf (stderr, "error: nfs mount device is [uid.gid@]host:path\n");
41    return -1;
42  }
43
44  if (rpcUdpInit () < 0) {
45    fprintf (stderr, "error: initialising RPC\n");
46    return -1;
47  }
48
49  nfsInit (0, 0);
50
51  uidhost = strdup (device);
52  path = strchr (uidhost, ':');
53  *path = '\0';
54  path++;
55
56  ret = nfsMount(uidhost, path, (char*) mntpoint);
57
58  free (uidhost);
59
60  return ret;
61}
62
63rtems_shell_filesystems_t rtems_shell_Mount_NFS = {
64  name:          "nfs",
65  driver_needed: 1,
66  fs_ops:        NULL,
67  mounter:       rtems_shell_nfs_mounter
68};
Note: See TracBrowser for help on using the repository browser.