summaryrefslogtreecommitdiff
path: root/usr/src/cmd/zoneadmd
diff options
context:
space:
mode:
authorjohnlev <none@none>2008-05-27 18:25:14 -0700
committerjohnlev <none@none>2008-05-27 18:25:14 -0700
commit93239add0c8984cfe653afea733fc9254f021160 (patch)
tree1505d930707b83cdada21473abe972e5358a917b /usr/src/cmd/zoneadmd
parenteb697d4e197e82b849ffb581a10e573182a3143e (diff)
downloadillumos-joyent-93239add0c8984cfe653afea733fc9254f021160.tar.gz
PSARC/2008/290 lofi mount
6384817 Need persistent lofi based mounts and direct mount(1m) support for lofi
Diffstat (limited to 'usr/src/cmd/zoneadmd')
-rw-r--r--usr/src/cmd/zoneadmd/vplat.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/usr/src/cmd/zoneadmd/vplat.c b/usr/src/cmd/zoneadmd/vplat.c
index 5a118a4eac..0d11899f03 100644
--- a/usr/src/cmd/zoneadmd/vplat.c
+++ b/usr/src/cmd/zoneadmd/vplat.c
@@ -803,6 +803,17 @@ forkexec(zlog_t *zlogp, const char *path, char *const argv[])
}
static int
+isregfile(const char *path)
+{
+ struct stat64 st;
+
+ if (stat64(path, &st) == -1)
+ return (-1);
+
+ return (S_ISREG(st.st_mode));
+}
+
+static int
dofsck(zlog_t *zlogp, const char *fstype, const char *rawdev)
{
char cmdbuf[MAXPATHLEN];
@@ -819,6 +830,13 @@ dofsck(zlog_t *zlogp, const char *fstype, const char *rawdev)
return (-1);
}
+ /*
+ * If it doesn't exist, that's OK: we verified this previously
+ * in zoneadm.
+ */
+ if (isregfile(cmdbuf) == -1)
+ return (0);
+
argv[0] = "fsck";
argv[1] = "-m";
argv[2] = (char *)rawdev;
@@ -1260,8 +1278,12 @@ mount_one(zlog_t *zlogp, struct zone_fstab *fsptr, const char *rootpath)
* Run 'fsck -m' if there's a device to fsck.
*/
if (fsptr->zone_fs_raw[0] != '\0' &&
- dofsck(zlogp, fsptr->zone_fs_type, fsptr->zone_fs_raw) != 0)
+ dofsck(zlogp, fsptr->zone_fs_type, fsptr->zone_fs_raw) != 0) {
+ return (-1);
+ } else if (isregfile(fsptr->zone_fs_special) == 1 &&
+ dofsck(zlogp, fsptr->zone_fs_type, fsptr->zone_fs_special) != 0) {
return (-1);
+ }
/*
* Build up mount option string.