summaryrefslogtreecommitdiff
path: root/usr/src/stand
diff options
context:
space:
mode:
authorgw25295 <none@none>2008-04-11 18:36:28 -0700
committergw25295 <none@none>2008-04-11 18:36:28 -0700
commite7cbe64f7a72dae5cb44f100db60ca88f3313c65 (patch)
tree778467a6522111f338e4644cc2cb895dcecacee4 /usr/src/stand
parentf635d46a9872dc5a02bbbd736f2bf18685c2c221 (diff)
downloadillumos-gate-e7cbe64f7a72dae5cb44f100db60ca88f3313c65.tar.gz
PSARC 2006/370 ZFS Boot Support
5008936 ZFS and/or zvol should support dumps 5070124 dumpadm -d /dev/... does not enforce block device requirement for savecore 6521468 ZFS Boot support Phase 2 6553503 bfu can't find 'rootdev' from /etc/vfstab on a zfs root filesystem 6574993 zfs_mountroot() may need to call clkset() to set the boot_time kstat 6633197 zvol should not permit newfs or createpool while it's in use by swap or dump 6661127 zfs_name_valid() does not support ZFS_TYPE_POOL 6684121 The changes to smf scripts for supporting canmount=noauto will cause a boot failure. --HG-- rename : usr/src/psm/stand/bootblks/zfs/common/debug-zfs.fth => deleted_files/usr/src/psm/stand/bootblks/zfs/common/debug-zfs.fth rename : usr/src/psm/stand/bootblks/zfs/common/big-zfs.fth => usr/src/psm/stand/bootblks/zfs/common/fs-zfs.fth
Diffstat (limited to 'usr/src/stand')
-rw-r--r--usr/src/stand/lib/fs/common/promfs.c114
-rw-r--r--usr/src/stand/lib/sa/Makefile9
2 files changed, 118 insertions, 5 deletions
diff --git a/usr/src/stand/lib/fs/common/promfs.c b/usr/src/stand/lib/fs/common/promfs.c
new file mode 100644
index 0000000000..0ed3aa4e2e
--- /dev/null
+++ b/usr/src/stand/lib/fs/common/promfs.c
@@ -0,0 +1,114 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/param.h>
+#include <sys/sysmacros.h>
+#include <sys/stat.h>
+#include <sys/bootvfs.h>
+#include <sys/bootsyms.h>
+#include <sys/promif.h>
+#include <sys/salib.h>
+
+/*
+ * Function prototypes
+ */
+static int promfs_mountroot(char *str);
+static int promfs_unmountroot(void);
+static int promfs_open(char *filename, int flags);
+static int promfs_close(int fd);
+static ssize_t promfs_read(int fd, caddr_t buf, size_t size);
+static off_t promfs_lseek(int fd, off_t offset, int whence);
+static int promfs_fstat(int fd, struct bootstat *stp);
+static void promfs_closeall(int flag);
+
+struct boot_fs_ops promfs_ops = {
+ "promfs",
+ promfs_mountroot,
+ promfs_unmountroot,
+ promfs_open,
+ promfs_close,
+ promfs_read,
+ promfs_lseek,
+ promfs_fstat,
+ promfs_closeall,
+ NULL
+};
+
+static ihandle_t fsih;
+
+static int
+promfs_mountroot(char *str)
+{
+
+ (void) prom_getprop(prom_chosennode(), str, (caddr_t)&fsih);
+ return (fsih == -1);
+}
+
+static int
+promfs_unmountroot(void)
+{
+ (void) prom_close(fsih);
+ return (0);
+}
+
+/*ARGSUSED*/
+static int
+promfs_open(char *filename, int flags)
+{
+ return (prom_fopen(fsih, filename));
+}
+
+static int
+promfs_close(int fd)
+{
+ prom_fclose(fsih, fd);
+ return (0);
+}
+
+static ssize_t
+promfs_read(int fd, caddr_t buf, size_t size)
+{
+ return (prom_fread(fsih, fd, buf, size));
+}
+
+/*ARGSUSED*/
+static off_t
+promfs_lseek(int fd, off_t offset, int whence)
+{
+ return (prom_fseek(fsih, fd, offset));
+}
+
+static int
+promfs_fstat(int fd, struct bootstat *stp)
+{
+ return (prom_fsize(fsih, fd, (size_t *)&stp->st_size));
+}
+
+/*ARGSUSED*/
+static void
+promfs_closeall(int flag)
+{
+}
diff --git a/usr/src/stand/lib/sa/Makefile b/usr/src/stand/lib/sa/Makefile
index f330cc5b02..f419a548ac 100644
--- a/usr/src/stand/lib/sa/Makefile
+++ b/usr/src/stand/lib/sa/Makefile
@@ -2,9 +2,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -30,7 +29,7 @@ LIBRARY = libsa.a
LOCOBJS = assert.o ctype.o errno.o libintl.o malloc.o memlist.o \
standalloc.o stdio.o stdlib.o strdup.o strings.o \
time.o unistd.o
-CMNOBJS = cache.o diskread.o fsswitch.o
+CMNOBJS = cache.o diskread.o fsswitch.o promfs.o
sparc_CMNUTILOBJS = memchr.o memmove.o
CMNUTILOBJS = $($(MACH)_CMNUTILOBJS) \