From 8a81eab8463d1320585e9e1c606636701ddf57db Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sat, 11 Feb 2012 14:29:19 +0100 Subject: 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 --- commands/mount.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'commands') 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; } -- cgit v1.2.3