Print this page
PSARC 2008/290 lofi mount
6384817 Need persistent lofi based mounts and direct mount(1m) support for lofi
*** 22,32 ****
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
! #pragma ident "@(#)vplat.c 1.60 08/04/08 SMI"
/*
* This module contains functions used to bring up and tear down the
* Virtual Platform: [un]mounting file-systems, [un]plumbing network
* interfaces, [un]configuring devices, establishing resource controls,
--- 22,32 ----
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
! #pragma ident "@(#)vplat.c 1.61 08/05/07 SMI"
/*
* This module contains functions used to bring up and tear down the
* Virtual Platform: [un]mounting file-systems, [un]plumbing network
* interfaces, [un]configuring devices, establishing resource controls,
*** 802,811 ****
--- 802,822 ----
}
return (WEXITSTATUS(child_status));
}
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];
char *argv[4];
int status;
*** 818,827 ****
--- 829,844 ----
>= sizeof (cmdbuf)) {
zerror(zlogp, B_FALSE, "file-system type %s too long", fstype);
return (-1);
}
+ /*
+ * If it doesn't exist, that's OK: we verified this previously.
+ */
+ if (isregfile(cmdbuf) == -1)
+ return (0);
+
argv[0] = "fsck";
argv[1] = "-m";
argv[2] = (char *)rawdev;
argv[3] = NULL;
*** 1259,1270 ****
/*
* 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)
return (-1);
/*
* Build up mount option string.
*/
optstr[0] = '\0';
--- 1276,1291 ----
/*
* 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) {
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.
*/
optstr[0] = '\0';