summaryrefslogtreecommitdiff
path: root/apps/nshlib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/nshlib')
-rw-r--r--apps/nshlib/nsh.h9
-rw-r--r--apps/nshlib/nsh_mntcmds.c8
-rw-r--r--apps/nshlib/nsh_parse.c4
3 files changed, 20 insertions, 1 deletions
diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h
index 23209dba5..3afbce8f9 100644
--- a/apps/nshlib/nsh.h
+++ b/apps/nshlib/nsh.h
@@ -403,6 +403,15 @@
# define IOBUFFERSIZE (PATH_MAX + 1)
#endif
+/* Certain commands are not availalbe in a kernel build because they depend
+ * on interfaces that are not exported by the kernel.
+ */
+
+#ifdef CONFIG_NUTTX_KERNEL
+# undef CONFIG_NSH_DISABLE_DF
+# define CONFIG_NSH_DISABLE_DF 1
+#endif
+
/****************************************************************************
* Public Types
****************************************************************************/
diff --git a/apps/nshlib/nsh_mntcmds.c b/apps/nshlib/nsh_mntcmds.c
index f8e3a142a..8e62229fa 100644
--- a/apps/nshlib/nsh_mntcmds.c
+++ b/apps/nshlib/nsh_mntcmds.c
@@ -1,7 +1,7 @@
/****************************************************************************
* apps/nshlib/nsh_mntcmds.c
*
- * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -107,6 +107,7 @@ static int df_handler(FAR const char *mountpoint,
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT)
+#ifndef CONFIG_NUTTX_KERNEL
static int mount_handler(FAR const char *mountpoint,
FAR struct statfs *statbuf, FAR void *arg)
{
@@ -158,6 +159,7 @@ static int mount_handler(FAR const char *mountpoint,
return OK;
}
#endif
+#endif
/****************************************************************************
* Name: mount_show
@@ -165,11 +167,13 @@ static int mount_handler(FAR const char *mountpoint,
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT)
+#ifndef CONFIG_NUTTX_KERNEL
static inline int mount_show(FAR struct nsh_vtbl_s *vtbl, FAR const char *progname)
{
return foreach_mountpoint(mount_handler, (FAR void *)vtbl);
}
#endif
+#endif
/****************************************************************************
* Public Functions
@@ -209,10 +213,12 @@ int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* The mount command behaves differently if no parameters are provided */
+#ifndef CONFIG_NUTTX_KERNEL
if (argc < 2)
{
return mount_show(vtbl, argv[0]);
}
+#endif
/* Get the mount options. NOTE: getopt() is not thread safe nor re-entrant.
* To keep its state proper for the next usage, it is necessary to parse to
diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c
index 4ee86b4cc..d5ffd81ee 100644
--- a/apps/nshlib/nsh_parse.c
+++ b/apps/nshlib/nsh_parse.c
@@ -302,7 +302,11 @@ static const struct cmdmap_s g_cmdmap[] =
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
# ifndef CONFIG_NSH_DISABLE_MOUNT
+# ifdef CONFIG_NUTTX_KERNEL
+ { "mount", cmd_mount, 5, 5, "-t <fstype> [<block-device>] <mount-point>" },
+# else
{ "mount", cmd_mount, 1, 5, "[-t <fstype> [<block-device>] <mount-point>]" },
+# endif
# endif
#endif