[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/6] sutils: allow multiple entries for the device "none"
From: |
Justus Winter |
Subject: |
[PATCH 5/6] sutils: allow multiple entries for the device "none" |
Date: |
Fri, 5 Jul 2013 17:13:31 +0200 |
Previously it was not possible to add two mount entries with the same
device information to an fstab structure. This is easily fixed by
breaking the assumption, that there is only one possible mount entry
for the "none" device as used by many purely virtual file systems.
* utils/fstab.c (fstab_find_device): Return NULL if name is "none".
---
sutils/fstab.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/sutils/fstab.c b/sutils/fstab.c
index e241de6..d3b8b6f 100644
--- a/sutils/fstab.c
+++ b/sutils/fstab.c
@@ -457,11 +457,19 @@ fs_remount (struct fs *fs)
return err;
}
-/* Returns the FS entry in FSTAB with the device field NAME (there can only
- be one such entry). */
+/* Returns the FS entry in FSTAB with the device field NAME.
+
+ In general there can only be one such entry. This holds not true
+ for virtual file systems that use "none" as device name.
+
+ If name is "none", NULL is returned. This also makes it possible to
+ add more than one entry for the device "none". */
inline struct fs *
fstab_find_device (const struct fstab *fstab, const char *name)
{
+ if (strcmp (name, "none") == 0)
+ return NULL;
+
struct fs *fs;
for (fs = fstab->entries; fs; fs = fs->next)
if (strcmp (fs->mntent.mnt_fsname, name) == 0)
--
1.7.10.4
- Re: Updated patches for mount, add umount, (continued)
- Re: Updated patches for mount, add umount, Samuel Thibault, 2013/07/04
- Re: Updated patches for mount, add umount, Justus Winter, 2013/07/04
- Re: Updated patches for mount, add umount, Samuel Thibault, 2013/07/04
- Re: Updated patches for mount, add umount, Justus Winter, 2013/07/04
- Re: Updated patches for mount, add umount, Samuel Thibault, 2013/07/04
- Updated patch series for mount, umount, Justus Winter, 2013/07/05
- [PATCH 3/6] mount: ignore mounted filesystems if --all is given, Justus Winter, 2013/07/05
- [PATCH 1/6] sutils: fix the semantic of -t, --types in fstab.c, Justus Winter, 2013/07/05
- [PATCH 4/6] mount: handle -t auto, Justus Winter, 2013/07/05
- [PATCH 2/6] mount: implement -O, --test-opts, Justus Winter, 2013/07/05
- [PATCH 5/6] sutils: allow multiple entries for the device "none",
Justus Winter <=
- [PATCH 6/6] umount: add a umount utility, Justus Winter, 2013/07/05
- Re: Updated patch series for mount, umount, Samuel Thibault, 2013/07/07