4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
25 #pragma ident "%Z%%M% %I% %E% SMI"
27 #include <sys/param.h>
28 #include <sys/sysmacros.h>
30 #include <sys/bootvfs.h>
31 #include <sys/bootsyms.h>
32 #include <sys/promif.h>
33 #include <sys/salib.h>
38 static int promfs_mountroot(char *str
);
39 static int promfs_unmountroot(void);
40 static int promfs_open(char *filename
, int flags
);
41 static int promfs_close(int fd
);
42 static ssize_t
promfs_read(int fd
, caddr_t buf
, size_t size
);
43 static off_t
promfs_lseek(int fd
, off_t offset
, int whence
);
44 static int promfs_fstat(int fd
, struct bootstat
*stp
);
45 static void promfs_closeall(int flag
);
47 struct boot_fs_ops promfs_ops
= {
60 static ihandle_t fsih
;
63 promfs_mountroot(char *str
)
66 (void) prom_getprop(prom_chosennode(), str
, (caddr_t
)&fsih
);
71 promfs_unmountroot(void)
73 (void) prom_close(fsih
);
79 promfs_open(char *filename
, int flags
)
81 return (prom_fopen(fsih
, filename
));
87 prom_fclose(fsih
, fd
);
92 promfs_read(int fd
, caddr_t buf
, size_t size
)
94 return (prom_fread(fsih
, fd
, buf
, size
));
99 promfs_lseek(int fd
, off_t offset
, int whence
)
101 return (prom_fseek(fsih
, fd
, offset
));
105 promfs_fstat(int fd
, struct bootstat
*stp
)
107 return (prom_fsize(fsih
, fd
, (size_t *)&stp
->st_size
));
112 promfs_closeall(int flag
)