summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-02-11 14:29:19 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-02-17 10:27:15 +0100
commit8a81eab8463d1320585e9e1c606636701ddf57db (patch)
tree73f1e08bc1903e337404389309d8a8190a26b290 /commands
parent80b767748b0dca9939315d95326dd76f93ffff88 (diff)
downloadbarebox-8a81eab8463d1320585e9e1c606636701ddf57db.tar.gz
barebox-8a81eab8463d1320585e9e1c606636701ddf57db.tar.xz
fs: Store mtab entries in list
To make the code a bit easier to read. Also, do not allow to umount / when something else is mounted. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/mount.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/commands/mount.c b/commands/mount.c
index 7cefdbea24..926cd3fbf9 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -33,18 +33,15 @@
static int do_mount(struct command *cmdtp, int argc, char *argv[])
{
int ret = 0;
- struct mtab_entry *entry = NULL;
+ struct mtab_entry *entry;
if (argc == 1) {
- do {
- entry = mtab_next_entry(entry);
- if (entry) {
- printf("%s on %s type %s\n",
- entry->parent_device ? dev_name(entry->parent_device) : "none",
- entry->path,
- entry->dev->name);
- }
- } while (entry);
+ for_each_mtab_entry(entry) {
+ printf("%s on %s type %s\n",
+ entry->parent_device ? dev_name(entry->parent_device) : "none",
+ entry->path,
+ entry->dev->name);
+ }
return 0;
}