10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
51544Seschrock * Common Development and Distribution License (the "License").
61544Seschrock * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
210Sstevel@tonic-gate /*
22*3446Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
230Sstevel@tonic-gate * Use is subject to license terms.
240Sstevel@tonic-gate */
250Sstevel@tonic-gate
260Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
270Sstevel@tonic-gate
280Sstevel@tonic-gate /*
290Sstevel@tonic-gate * Basic file system reading code for standalone I/O system.
300Sstevel@tonic-gate * Simulates a primitive UNIX I/O system (read(), write(), open(), etc).
310Sstevel@tonic-gate * Does not support writes.
320Sstevel@tonic-gate */
330Sstevel@tonic-gate
340Sstevel@tonic-gate #include <sys/param.h>
350Sstevel@tonic-gate #include <sys/sysmacros.h>
360Sstevel@tonic-gate #include <sys/vnode.h>
370Sstevel@tonic-gate #include <sys/fs/ufs_fsdir.h>
380Sstevel@tonic-gate #include <sys/fs/ufs_fs.h>
390Sstevel@tonic-gate #include <sys/fs/ufs_inode.h>
400Sstevel@tonic-gate
410Sstevel@tonic-gate #include <sys/fs/hsfs_spec.h>
420Sstevel@tonic-gate #include <sys/fs/hsfs_isospec.h>
430Sstevel@tonic-gate #include <sys/fs/hsfs_node.h>
440Sstevel@tonic-gate #include <sys/fs/hsfs_susp.h>
450Sstevel@tonic-gate #include <sys/fs/hsfs_rrip.h>
460Sstevel@tonic-gate #include <sys/bootvfs.h>
470Sstevel@tonic-gate #include <sys/filep.h>
480Sstevel@tonic-gate
490Sstevel@tonic-gate #ifdef _BOOT
500Sstevel@tonic-gate #include "../common/util.h"
510Sstevel@tonic-gate #else
520Sstevel@tonic-gate #include <sys/sunddi.h>
530Sstevel@tonic-gate #endif
540Sstevel@tonic-gate
550Sstevel@tonic-gate #define hdbtodb(n) ((ISO_SECTOR_SIZE / DEV_BSIZE) * (n))
560Sstevel@tonic-gate
570Sstevel@tonic-gate #define HSFS_NUM_SIG 14
580Sstevel@tonic-gate
590Sstevel@tonic-gate #define SUSP_SP_IX 0
600Sstevel@tonic-gate #define SUSP_CE_IX 1
610Sstevel@tonic-gate #define SUSP_PD_IX 2
620Sstevel@tonic-gate #define SUSP_ST_IX 3
630Sstevel@tonic-gate #define SUSP_ER_IX 4
640Sstevel@tonic-gate #define RRIP_PX_IX 5
650Sstevel@tonic-gate #define RRIP_PN_IX 6
660Sstevel@tonic-gate #define RRIP_SL_IX 7
670Sstevel@tonic-gate #define RRIP_CL_IX 8
680Sstevel@tonic-gate #define RRIP_PL_IX 9
690Sstevel@tonic-gate #define RRIP_RE_IX 10
700Sstevel@tonic-gate #define RRIP_RF_IX 11
710Sstevel@tonic-gate #define RRIP_RR_IX 12
720Sstevel@tonic-gate #define RRIP_NM_IX 13
730Sstevel@tonic-gate
740Sstevel@tonic-gate #ifdef _BOOT
750Sstevel@tonic-gate #define dprintf if (bootrd_debug) printf
760Sstevel@tonic-gate #else
770Sstevel@tonic-gate #define printf kobj_printf
780Sstevel@tonic-gate #define dprintf if (bootrd_debug) kobj_printf
790Sstevel@tonic-gate
800Sstevel@tonic-gate /* PRINTFLIKE1 */
810Sstevel@tonic-gate extern void kobj_printf(char *, ...);
820Sstevel@tonic-gate #endif
830Sstevel@tonic-gate
840Sstevel@tonic-gate extern int bootrd_debug;
850Sstevel@tonic-gate extern void *bkmem_alloc(size_t);
860Sstevel@tonic-gate extern void bkmem_free(void *, size_t);
87*3446Smrj extern int cf_check_compressed(fileid_t *);
88*3446Smrj extern void cf_close(fileid_t *);
89*3446Smrj extern void cf_seek(fileid_t *, off_t, int);
90*3446Smrj extern int cf_read(fileid_t *, caddr_t, size_t);
910Sstevel@tonic-gate
920Sstevel@tonic-gate struct dirstuff {
930Sstevel@tonic-gate int loc;
940Sstevel@tonic-gate fileid_t *filep;
950Sstevel@tonic-gate };
960Sstevel@tonic-gate
970Sstevel@tonic-gate struct hs_direct {
980Sstevel@tonic-gate struct direct hs_ufs_dir;
990Sstevel@tonic-gate struct hs_direntry hs_dir;
1000Sstevel@tonic-gate };
1010Sstevel@tonic-gate
1020Sstevel@tonic-gate static uint_t root_ino = 0;
1030Sstevel@tonic-gate static struct hs_volume *hsfsp;
1040Sstevel@tonic-gate static fileid_t *head;
1050Sstevel@tonic-gate
1060Sstevel@tonic-gate static char *hsfs_sig_tab[] = {
1070Sstevel@tonic-gate SUSP_SP,
1080Sstevel@tonic-gate SUSP_CE,
1090Sstevel@tonic-gate SUSP_PD,
1100Sstevel@tonic-gate SUSP_ST,
1110Sstevel@tonic-gate SUSP_ER,
1120Sstevel@tonic-gate RRIP_PX,
1130Sstevel@tonic-gate RRIP_PN,
1140Sstevel@tonic-gate RRIP_SL,
1150Sstevel@tonic-gate RRIP_CL,
1160Sstevel@tonic-gate RRIP_PL,
1170Sstevel@tonic-gate RRIP_RE,
1180Sstevel@tonic-gate RRIP_TF,
1190Sstevel@tonic-gate RRIP_RR,
1200Sstevel@tonic-gate RRIP_NM
1210Sstevel@tonic-gate };
1220Sstevel@tonic-gate
1230Sstevel@tonic-gate static int hsfs_num_sig = sizeof (hsfs_sig_tab) / sizeof (hsfs_sig_tab[0]);
1240Sstevel@tonic-gate
1250Sstevel@tonic-gate /*
1260Sstevel@tonic-gate * Local prototypes
1270Sstevel@tonic-gate */
1280Sstevel@tonic-gate static struct hs_direct *readdir(struct dirstuff *);
1290Sstevel@tonic-gate static uint_t parse_dir(fileid_t *, int, struct hs_direct *);
1300Sstevel@tonic-gate static uint_t parse_susp(char *, uint_t *, struct hs_direct *);
1310Sstevel@tonic-gate static ino_t dlook(char *, fileid_t *);
1320Sstevel@tonic-gate static int opendir(ino_t, fileid_t *);
1330Sstevel@tonic-gate static ino_t find(char *, fileid_t *);
1340Sstevel@tonic-gate
1350Sstevel@tonic-gate static int bhsfs_mountroot(char *str);
1360Sstevel@tonic-gate static int bhsfs_unmountroot(void);
1370Sstevel@tonic-gate static int bhsfs_open(char *str, int flags);
1380Sstevel@tonic-gate static int bhsfs_close(int fd);
1390Sstevel@tonic-gate static void bhsfs_closeall(void);
1400Sstevel@tonic-gate static ssize_t bhsfs_read(int fdesc, char *buf, size_t count);
1410Sstevel@tonic-gate static off_t bhsfs_lseek(int fdesc, off_t addr, int whence);
1421544Seschrock static int bhsfs_fstat(int fdesc, struct bootstat *stp);
1430Sstevel@tonic-gate
1440Sstevel@tonic-gate static fileid_t *
find_fp(int fd)1450Sstevel@tonic-gate find_fp(int fd)
1460Sstevel@tonic-gate {
1470Sstevel@tonic-gate fileid_t *filep = head;
1480Sstevel@tonic-gate
1490Sstevel@tonic-gate if (fd >= 0) {
1500Sstevel@tonic-gate while ((filep = filep->fi_forw) != head)
1510Sstevel@tonic-gate if (fd == filep->fi_filedes)
1520Sstevel@tonic-gate return (filep->fi_taken ? filep : 0);
1530Sstevel@tonic-gate }
1540Sstevel@tonic-gate
1550Sstevel@tonic-gate return (0);
1560Sstevel@tonic-gate }
1570Sstevel@tonic-gate
1580Sstevel@tonic-gate static int
opendir(ino_t inode,fileid_t * filep)1590Sstevel@tonic-gate opendir(ino_t inode, fileid_t *filep)
1600Sstevel@tonic-gate {
1610Sstevel@tonic-gate struct hs_direct hsdep;
1620Sstevel@tonic-gate
1630Sstevel@tonic-gate dprintf("opendir: inode = %ld\n", inode);
1640Sstevel@tonic-gate /* Set up the IO request */
1650Sstevel@tonic-gate filep->fi_offset = 0;
1660Sstevel@tonic-gate filep->fi_blocknum = hdbtodb(inode);
1670Sstevel@tonic-gate filep->fi_count = ISO_SECTOR_SIZE;
1680Sstevel@tonic-gate filep->fi_memp = 0;
1690Sstevel@tonic-gate
1700Sstevel@tonic-gate if (diskread(filep))
1710Sstevel@tonic-gate return (0);
1720Sstevel@tonic-gate
1730Sstevel@tonic-gate filep->fi_offset = 0;
1740Sstevel@tonic-gate filep->fi_blocknum = hdbtodb(inode);
1750Sstevel@tonic-gate
1760Sstevel@tonic-gate if (inode != root_ino)
1770Sstevel@tonic-gate return (0);
1780Sstevel@tonic-gate
1790Sstevel@tonic-gate if (parse_dir(filep, 0, &hsdep) > 0) {
1800Sstevel@tonic-gate struct inode *ip;
1810Sstevel@tonic-gate
1820Sstevel@tonic-gate ip = filep->fi_inode;
1830Sstevel@tonic-gate if (ip == NULL)
1840Sstevel@tonic-gate ip = filep->fi_inode = bkmem_alloc(sizeof (*ip));
1850Sstevel@tonic-gate
1860Sstevel@tonic-gate ip->i_size = hsdep.hs_dir.ext_size;
1870Sstevel@tonic-gate ip->i_smode = hsdep.hs_dir.mode;
1880Sstevel@tonic-gate ip->i_number = inode;
1890Sstevel@tonic-gate return (0);
1900Sstevel@tonic-gate }
1910Sstevel@tonic-gate return (1);
1920Sstevel@tonic-gate }
1930Sstevel@tonic-gate
1940Sstevel@tonic-gate static ino_t
find(char * path,fileid_t * filep)1950Sstevel@tonic-gate find(char *path, fileid_t *filep)
1960Sstevel@tonic-gate {
1970Sstevel@tonic-gate char *q;
1980Sstevel@tonic-gate char c;
1990Sstevel@tonic-gate ino_t n;
2000Sstevel@tonic-gate
2010Sstevel@tonic-gate dprintf("find: %s\n", path);
2020Sstevel@tonic-gate if (path == NULL || *path == '\0')
2030Sstevel@tonic-gate return (0);
2040Sstevel@tonic-gate
2050Sstevel@tonic-gate if (opendir(root_ino, filep))
2060Sstevel@tonic-gate return (0);
2070Sstevel@tonic-gate
2080Sstevel@tonic-gate while (*path) {
2090Sstevel@tonic-gate while (*path == '/')
2100Sstevel@tonic-gate path++;
2110Sstevel@tonic-gate q = path;
2120Sstevel@tonic-gate while (*q != '/' && *q != '\0')
2130Sstevel@tonic-gate q++;
2140Sstevel@tonic-gate c = *q;
2150Sstevel@tonic-gate *q = '\0';
216397Sszhou n = dlook(path, filep);
217397Sszhou *q = c;
218397Sszhou path = q;
2190Sstevel@tonic-gate
220397Sszhou if (n != 0) {
2210Sstevel@tonic-gate if (c == '\0')
2220Sstevel@tonic-gate break;
2230Sstevel@tonic-gate if (opendir(n, filep))
2240Sstevel@tonic-gate return (0);
2250Sstevel@tonic-gate continue;
2260Sstevel@tonic-gate } else {
2270Sstevel@tonic-gate return (0);
2280Sstevel@tonic-gate }
2290Sstevel@tonic-gate }
2300Sstevel@tonic-gate return ((ino_t)n);
2310Sstevel@tonic-gate }
2320Sstevel@tonic-gate
2330Sstevel@tonic-gate static ino_t
dlook(char * s,fileid_t * filep)2340Sstevel@tonic-gate dlook(char *s, fileid_t *filep)
2350Sstevel@tonic-gate {
2360Sstevel@tonic-gate struct hs_direct *hsdep;
2370Sstevel@tonic-gate struct direct *udp;
2380Sstevel@tonic-gate struct inode *ip;
2390Sstevel@tonic-gate struct dirstuff dirp;
2400Sstevel@tonic-gate int len;
2410Sstevel@tonic-gate
2420Sstevel@tonic-gate dprintf("dlook: %s\n", s);
2430Sstevel@tonic-gate ip = filep->fi_inode;
2440Sstevel@tonic-gate if (s == NULL || *s == '\0')
2450Sstevel@tonic-gate return (0);
2460Sstevel@tonic-gate if ((ip->i_smode & IFMT) != IFDIR) {
2470Sstevel@tonic-gate return (0);
2480Sstevel@tonic-gate }
2490Sstevel@tonic-gate if (ip->i_size == 0) {
2500Sstevel@tonic-gate return (0);
2510Sstevel@tonic-gate }
2520Sstevel@tonic-gate len = strlen(s);
2530Sstevel@tonic-gate dirp.loc = 0;
2540Sstevel@tonic-gate dirp.filep = filep;
2550Sstevel@tonic-gate for (hsdep = readdir(&dirp); hsdep != NULL; hsdep = readdir(&dirp)) {
2560Sstevel@tonic-gate udp = &hsdep->hs_ufs_dir;
2570Sstevel@tonic-gate if (udp->d_namlen == 1 &&
2580Sstevel@tonic-gate udp->d_name[0] == '.' &&
2590Sstevel@tonic-gate udp->d_name[1] == '\0')
2600Sstevel@tonic-gate continue;
2610Sstevel@tonic-gate if (udp->d_namlen == 2 &&
2620Sstevel@tonic-gate udp->d_name[0] == '.' &&
2630Sstevel@tonic-gate udp->d_name[1] == '.' &&
2640Sstevel@tonic-gate udp->d_name[2] == '\0')
2650Sstevel@tonic-gate continue;
2660Sstevel@tonic-gate if (udp->d_namlen == len && (strcmp(s, udp->d_name)) == 0) {
2670Sstevel@tonic-gate struct inode *ip = filep->fi_inode;
2680Sstevel@tonic-gate
2690Sstevel@tonic-gate filep->fi_offset = 0;
2700Sstevel@tonic-gate filep->fi_blocknum = hdbtodb(udp->d_ino);
2710Sstevel@tonic-gate
2720Sstevel@tonic-gate bzero(filep->fi_inode, sizeof (struct inode));
2730Sstevel@tonic-gate ip->i_size = hsdep->hs_dir.ext_size;
2740Sstevel@tonic-gate ip->i_smode = hsdep->hs_dir.mode;
2750Sstevel@tonic-gate ip->i_number = udp->d_ino;
2760Sstevel@tonic-gate return (udp->d_ino);
2770Sstevel@tonic-gate }
2780Sstevel@tonic-gate }
2790Sstevel@tonic-gate return (0);
2800Sstevel@tonic-gate }
2810Sstevel@tonic-gate
2820Sstevel@tonic-gate /*
2830Sstevel@tonic-gate * get next entry in a directory.
2840Sstevel@tonic-gate */
2850Sstevel@tonic-gate static struct hs_direct *
readdir(struct dirstuff * dirp)2860Sstevel@tonic-gate readdir(struct dirstuff *dirp)
2870Sstevel@tonic-gate {
2880Sstevel@tonic-gate static struct hs_direct hsdep;
2890Sstevel@tonic-gate struct direct *udp = &hsdep.hs_ufs_dir;
2900Sstevel@tonic-gate struct inode *ip;
2910Sstevel@tonic-gate fileid_t *filep;
2920Sstevel@tonic-gate daddr_t lbn;
2930Sstevel@tonic-gate int off;
2940Sstevel@tonic-gate
2950Sstevel@tonic-gate dprintf("readdir: start\n");
2960Sstevel@tonic-gate filep = dirp->filep;
2970Sstevel@tonic-gate ip = filep->fi_inode;
2980Sstevel@tonic-gate for (;;) {
2990Sstevel@tonic-gate if (dirp->loc >= ip->i_size) {
3000Sstevel@tonic-gate return (NULL);
3010Sstevel@tonic-gate }
3020Sstevel@tonic-gate off = dirp->loc & ((1 << ISO_SECTOR_SHIFT) - 1);
3030Sstevel@tonic-gate if (off == 0) {
3040Sstevel@tonic-gate lbn = hdbtodb(dirp->loc >> ISO_SECTOR_SHIFT);
3050Sstevel@tonic-gate filep->fi_blocknum = lbn + hdbtodb(ip->i_number);
3060Sstevel@tonic-gate filep->fi_count = ISO_SECTOR_SIZE;
3070Sstevel@tonic-gate filep->fi_memp = 0;
3080Sstevel@tonic-gate if (diskread(filep)) {
3090Sstevel@tonic-gate dprintf("readdir: diskread failed\n");
3100Sstevel@tonic-gate return (NULL);
3110Sstevel@tonic-gate }
3120Sstevel@tonic-gate }
3130Sstevel@tonic-gate dirp->loc += parse_dir(filep, off, &hsdep);
3140Sstevel@tonic-gate if (udp->d_reclen == 0 && dirp->loc <= ip->i_size) {
3150Sstevel@tonic-gate dirp->loc = roundup(dirp->loc, ISO_SECTOR_SIZE);
3160Sstevel@tonic-gate continue;
3170Sstevel@tonic-gate }
3180Sstevel@tonic-gate return (&hsdep);
3190Sstevel@tonic-gate }
3200Sstevel@tonic-gate }
3210Sstevel@tonic-gate
3220Sstevel@tonic-gate static int
getblock(fileid_t * filep)3230Sstevel@tonic-gate getblock(fileid_t *filep)
3240Sstevel@tonic-gate {
3250Sstevel@tonic-gate struct inode *ip = filep->fi_inode;
3260Sstevel@tonic-gate int off, size, diff;
3270Sstevel@tonic-gate daddr_t lbn;
3280Sstevel@tonic-gate
3290Sstevel@tonic-gate dprintf("getblock: start\n");
3300Sstevel@tonic-gate diff = ip->i_size - filep->fi_offset;
3310Sstevel@tonic-gate if (diff <= 0)
3320Sstevel@tonic-gate return (-1);
3330Sstevel@tonic-gate
3340Sstevel@tonic-gate /* which block (or frag) in the file do we read? */
3350Sstevel@tonic-gate lbn = hdbtodb(filep->fi_offset >> ISO_SECTOR_SHIFT);
3360Sstevel@tonic-gate filep->fi_blocknum = lbn + hdbtodb(ip->i_number);
3370Sstevel@tonic-gate
3380Sstevel@tonic-gate off = filep->fi_offset & ((1 << ISO_SECTOR_SHIFT) - 1);
3390Sstevel@tonic-gate size = filep->fi_count = ISO_SECTOR_SIZE;
3400Sstevel@tonic-gate filep->fi_memp = 0;
3410Sstevel@tonic-gate if (diskread(filep)) /* Trap errors */
3420Sstevel@tonic-gate return (-1);
3430Sstevel@tonic-gate
3440Sstevel@tonic-gate if (filep->fi_offset - off + size >= ip->i_size)
3450Sstevel@tonic-gate filep->fi_count = diff + off;
3460Sstevel@tonic-gate filep->fi_count -= off;
3470Sstevel@tonic-gate filep->fi_memp += off;
3480Sstevel@tonic-gate dprintf("getblock: end\n");
3490Sstevel@tonic-gate return (0);
3500Sstevel@tonic-gate }
3510Sstevel@tonic-gate
3520Sstevel@tonic-gate static ssize_t
bhsfs_read(int fd,caddr_t buf,size_t count)3530Sstevel@tonic-gate bhsfs_read(int fd, caddr_t buf, size_t count)
3540Sstevel@tonic-gate {
3550Sstevel@tonic-gate int i, j;
3560Sstevel@tonic-gate fileid_t *filep;
3570Sstevel@tonic-gate struct inode *ip;
3580Sstevel@tonic-gate caddr_t n;
3590Sstevel@tonic-gate
360*3446Smrj dprintf("bhsfs_read %d, ", fd);
361*3446Smrj dprintf("count 0x%lx\n", count);
3620Sstevel@tonic-gate filep = find_fp(fd);
3630Sstevel@tonic-gate if (filep == NULL)
3640Sstevel@tonic-gate return (-1);
3650Sstevel@tonic-gate
3660Sstevel@tonic-gate ip = filep->fi_inode;
3670Sstevel@tonic-gate n = buf;
368*3446Smrj if ((filep->fi_flags & FI_COMPRESSED) == 0 &&
369*3446Smrj filep->fi_offset + count > ip->i_size)
3700Sstevel@tonic-gate count = ip->i_size - filep->fi_offset;
3710Sstevel@tonic-gate
3720Sstevel@tonic-gate if ((i = count) <= 0)
3730Sstevel@tonic-gate return (0);
3740Sstevel@tonic-gate
3750Sstevel@tonic-gate while (i > 0) {
376*3446Smrj if (filep->fi_flags & FI_COMPRESSED) {
377*3446Smrj if ((j = cf_read(filep, buf, count)) < 0)
378*3446Smrj return (0); /* encountered an error */
379*3446Smrj if (j < i)
380*3446Smrj i = j; /* short read, must have hit EOF */
381*3446Smrj } else {
382*3446Smrj if (filep->fi_count == 0) {
383*3446Smrj if (getblock(filep) == -1)
384*3446Smrj return (0);
385*3446Smrj }
386*3446Smrj j = MIN(i, filep->fi_count);
387*3446Smrj bcopy(filep->fi_memp, buf, (uint_t)j);
3880Sstevel@tonic-gate }
3890Sstevel@tonic-gate filep->fi_memp += j;
3900Sstevel@tonic-gate filep->fi_offset += j;
3910Sstevel@tonic-gate filep->fi_count -= j;
392*3446Smrj buf += j;
3930Sstevel@tonic-gate i -= j;
3940Sstevel@tonic-gate }
3950Sstevel@tonic-gate
3960Sstevel@tonic-gate dprintf("bhsfs_read: read 0x%x\n", (int)(buf - n));
3970Sstevel@tonic-gate return (buf - n);
3980Sstevel@tonic-gate }
3990Sstevel@tonic-gate
4000Sstevel@tonic-gate /*ARGSUSED*/
4010Sstevel@tonic-gate static int
bhsfs_mountroot(char * str)4020Sstevel@tonic-gate bhsfs_mountroot(char *str)
4030Sstevel@tonic-gate {
4040Sstevel@tonic-gate char *bufp;
4050Sstevel@tonic-gate
4060Sstevel@tonic-gate if (hsfsp != NULL)
4070Sstevel@tonic-gate return (0); /* already mounted */
4080Sstevel@tonic-gate
4090Sstevel@tonic-gate dprintf("mounting ramdisk as hsfs\n");
4100Sstevel@tonic-gate
4110Sstevel@tonic-gate hsfsp = bkmem_alloc(sizeof (*hsfsp));
4120Sstevel@tonic-gate bzero(hsfsp, sizeof (*hsfsp));
4130Sstevel@tonic-gate head = bkmem_alloc(sizeof (*head));
4140Sstevel@tonic-gate bzero(head, sizeof (*head));
4150Sstevel@tonic-gate head->fi_back = head->fi_forw = head;
4160Sstevel@tonic-gate
4170Sstevel@tonic-gate /* now read the superblock. */
4180Sstevel@tonic-gate head->fi_blocknum = hdbtodb(ISO_VOLDESC_SEC);
4190Sstevel@tonic-gate head->fi_offset = 0;
4200Sstevel@tonic-gate head->fi_count = ISO_SECTOR_SIZE;
4210Sstevel@tonic-gate head->fi_memp = head->fi_buf;
4220Sstevel@tonic-gate if (diskread(head)) {
4230Sstevel@tonic-gate printf("failed to read superblock\n");
4240Sstevel@tonic-gate bhsfs_closeall();
4250Sstevel@tonic-gate return (-1);
4260Sstevel@tonic-gate }
4270Sstevel@tonic-gate
4280Sstevel@tonic-gate /* Since RRIP is based on ISO9660, that's where we start */
4290Sstevel@tonic-gate bufp = head->fi_buf;
4300Sstevel@tonic-gate if ((ISO_DESC_TYPE(bufp) != ISO_VD_PVD) ||
4310Sstevel@tonic-gate (strncmp((const char *)ISO_std_id(bufp), ISO_ID_STRING,
4320Sstevel@tonic-gate ISO_ID_STRLEN) != 0) || (ISO_STD_VER(bufp) != ISO_ID_VER)) {
4330Sstevel@tonic-gate dprintf("volume type does not match\n");
4340Sstevel@tonic-gate bhsfs_closeall();
4350Sstevel@tonic-gate return (-1);
4360Sstevel@tonic-gate }
4370Sstevel@tonic-gate
4380Sstevel@tonic-gate /* Now we fill in the volume descriptor */
4390Sstevel@tonic-gate hsfsp->vol_size = ISO_VOL_SIZE(bufp);
4400Sstevel@tonic-gate hsfsp->lbn_size = ISO_BLK_SIZE(bufp);
4410Sstevel@tonic-gate hsfsp->lbn_shift = ISO_SECTOR_SHIFT;
4420Sstevel@tonic-gate hsfsp->lbn_secshift = ISO_SECTOR_SHIFT;
4430Sstevel@tonic-gate hsfsp->vol_set_size = (ushort_t)ISO_SET_SIZE(bufp);
4440Sstevel@tonic-gate hsfsp->vol_set_seq = (ushort_t)ISO_SET_SEQ(bufp);
4450Sstevel@tonic-gate
4460Sstevel@tonic-gate /* Make sure we have a valid logical block size */
4470Sstevel@tonic-gate if (hsfsp->lbn_size & ~(1 << hsfsp->lbn_shift)) {
4480Sstevel@tonic-gate printf("%d invalid logical block size\n", hsfsp->lbn_size);
4490Sstevel@tonic-gate bhsfs_closeall();
4500Sstevel@tonic-gate return (-1);
4510Sstevel@tonic-gate }
4520Sstevel@tonic-gate
4530Sstevel@tonic-gate /* Since an HSFS root could be located anywhere on the media! */
4540Sstevel@tonic-gate root_ino = IDE_EXT_LBN(ISO_root_dir(bufp));
4550Sstevel@tonic-gate return (0);
4560Sstevel@tonic-gate }
4570Sstevel@tonic-gate
4580Sstevel@tonic-gate static int
bhsfs_unmountroot(void)4590Sstevel@tonic-gate bhsfs_unmountroot(void)
4600Sstevel@tonic-gate {
4610Sstevel@tonic-gate if (hsfsp == NULL)
4620Sstevel@tonic-gate return (-1);
4630Sstevel@tonic-gate
4640Sstevel@tonic-gate bhsfs_closeall();
4650Sstevel@tonic-gate
4660Sstevel@tonic-gate return (0);
4670Sstevel@tonic-gate }
4680Sstevel@tonic-gate
4690Sstevel@tonic-gate /*
4700Sstevel@tonic-gate * Open a file.
4710Sstevel@tonic-gate */
4720Sstevel@tonic-gate /*ARGSUSED*/
4730Sstevel@tonic-gate int
bhsfs_open(char * str,int flags)4740Sstevel@tonic-gate bhsfs_open(char *str, int flags)
4750Sstevel@tonic-gate {
4760Sstevel@tonic-gate static int filedes = 1;
4770Sstevel@tonic-gate
4780Sstevel@tonic-gate fileid_t *filep;
4790Sstevel@tonic-gate ino_t ino;
4800Sstevel@tonic-gate
4810Sstevel@tonic-gate dprintf("open %s\n", str);
4820Sstevel@tonic-gate filep = (fileid_t *)bkmem_alloc(sizeof (fileid_t));
4830Sstevel@tonic-gate filep->fi_back = head->fi_back;
4840Sstevel@tonic-gate filep->fi_forw = head;
4850Sstevel@tonic-gate head->fi_back->fi_forw = filep;
4860Sstevel@tonic-gate head->fi_back = filep;
4870Sstevel@tonic-gate filep->fi_filedes = filedes++;
4880Sstevel@tonic-gate filep->fi_taken = 1;
4890Sstevel@tonic-gate filep->fi_path = (char *)bkmem_alloc(strlen(str) + 1);
4900Sstevel@tonic-gate (void) strcpy(filep->fi_path, str);
4910Sstevel@tonic-gate filep->fi_inode = NULL;
4920Sstevel@tonic-gate bzero(filep->fi_buf, MAXBSIZE);
493*3446Smrj filep->fi_getblock = getblock;
494*3446Smrj filep->fi_flags = 0;
4950Sstevel@tonic-gate
4960Sstevel@tonic-gate ino = find(str, filep);
4970Sstevel@tonic-gate if (ino == 0) {
4980Sstevel@tonic-gate (void) bhsfs_close(filep->fi_filedes);
4990Sstevel@tonic-gate return (-1);
5000Sstevel@tonic-gate }
5010Sstevel@tonic-gate
5020Sstevel@tonic-gate filep->fi_blocknum = hdbtodb(ino);
5030Sstevel@tonic-gate filep->fi_offset = 0;
5040Sstevel@tonic-gate filep->fi_count = 0;
5050Sstevel@tonic-gate filep->fi_memp = 0;
5060Sstevel@tonic-gate
507*3446Smrj if (cf_check_compressed(filep) != 0)
508*3446Smrj return (-1);
5090Sstevel@tonic-gate dprintf("open done\n");
5100Sstevel@tonic-gate return (filep->fi_filedes);
5110Sstevel@tonic-gate }
5120Sstevel@tonic-gate
5130Sstevel@tonic-gate int
bhsfs_close(int fd)5140Sstevel@tonic-gate bhsfs_close(int fd)
5150Sstevel@tonic-gate {
5160Sstevel@tonic-gate fileid_t *filep;
5170Sstevel@tonic-gate
5180Sstevel@tonic-gate dprintf("close %d\n", fd);
5190Sstevel@tonic-gate if (!(filep = find_fp(fd)))
5200Sstevel@tonic-gate return (-1);
5210Sstevel@tonic-gate
5220Sstevel@tonic-gate if (filep->fi_taken == 0 || filep == head) {
523*3446Smrj printf("File descripter %d not allocated!\n", fd);
5240Sstevel@tonic-gate return (-1);
5250Sstevel@tonic-gate }
5260Sstevel@tonic-gate
527*3446Smrj cf_close(filep);
5280Sstevel@tonic-gate /* unlink and deallocate node */
5290Sstevel@tonic-gate filep->fi_forw->fi_back = filep->fi_back;
5300Sstevel@tonic-gate filep->fi_back->fi_forw = filep->fi_forw;
5310Sstevel@tonic-gate if (filep->fi_inode)
5320Sstevel@tonic-gate bkmem_free(filep->fi_inode, sizeof (struct inode));
5330Sstevel@tonic-gate bkmem_free(filep->fi_path, strlen(filep->fi_path) + 1);
5340Sstevel@tonic-gate bkmem_free((char *)filep, sizeof (fileid_t));
5350Sstevel@tonic-gate dprintf("close done\n");
5360Sstevel@tonic-gate return (0);
5370Sstevel@tonic-gate }
5380Sstevel@tonic-gate
5390Sstevel@tonic-gate static void
bhsfs_closeall(void)5400Sstevel@tonic-gate bhsfs_closeall(void)
5410Sstevel@tonic-gate {
5420Sstevel@tonic-gate fileid_t *filep;
5430Sstevel@tonic-gate
5440Sstevel@tonic-gate while ((filep = head->fi_forw) != head)
5450Sstevel@tonic-gate if (filep->fi_taken && bhsfs_close(filep->fi_filedes))
5460Sstevel@tonic-gate printf("Filesystem may be inconsistent.\n");
5470Sstevel@tonic-gate
5480Sstevel@tonic-gate bkmem_free(hsfsp, sizeof (*hsfsp));
5490Sstevel@tonic-gate bkmem_free(head, sizeof (fileid_t));
5500Sstevel@tonic-gate hsfsp = NULL;
5510Sstevel@tonic-gate head = NULL;
5520Sstevel@tonic-gate }
5530Sstevel@tonic-gate
5540Sstevel@tonic-gate /*
5550Sstevel@tonic-gate * This version of seek() only performs absolute seeks (whence == 0).
5560Sstevel@tonic-gate */
5570Sstevel@tonic-gate static off_t
bhsfs_lseek(int fd,off_t addr,int whence)5580Sstevel@tonic-gate bhsfs_lseek(int fd, off_t addr, int whence)
5590Sstevel@tonic-gate {
5600Sstevel@tonic-gate fileid_t *filep;
5610Sstevel@tonic-gate
562*3446Smrj dprintf("lseek %d, ", fd);
563*3446Smrj dprintf("off = %lx\n", addr);
5640Sstevel@tonic-gate if (!(filep = find_fp(fd)))
5650Sstevel@tonic-gate return (-1);
5660Sstevel@tonic-gate
567*3446Smrj if (filep->fi_flags & FI_COMPRESSED) {
568*3446Smrj cf_seek(filep, addr, whence);
569*3446Smrj } else {
570*3446Smrj switch (whence) {
571*3446Smrj case SEEK_CUR:
572*3446Smrj filep->fi_offset += addr;
573*3446Smrj break;
574*3446Smrj case SEEK_SET:
575*3446Smrj filep->fi_offset = addr;
576*3446Smrj break;
577*3446Smrj default:
578*3446Smrj case SEEK_END:
579*3446Smrj printf("lseek(): invalid whence value %d\n", whence);
580*3446Smrj break;
581*3446Smrj }
582*3446Smrj filep->fi_blocknum = addr / DEV_BSIZE;
5830Sstevel@tonic-gate }
5840Sstevel@tonic-gate
5850Sstevel@tonic-gate filep->fi_count = 0;
5860Sstevel@tonic-gate return (0);
5870Sstevel@tonic-gate }
5880Sstevel@tonic-gate
5891544Seschrock static int
bhsfs_fstat(int fd,struct bootstat * stp)5901544Seschrock bhsfs_fstat(int fd, struct bootstat *stp)
5911544Seschrock {
5921544Seschrock fileid_t *filep;
5931544Seschrock struct inode *ip;
5941544Seschrock
5951544Seschrock if (!(filep = find_fp(fd)))
5961544Seschrock return (-1);
5971544Seschrock
5981544Seschrock ip = filep->fi_inode;
5991544Seschrock
6001544Seschrock stp->st_mode = 0;
6011544Seschrock stp->st_size = 0;
6021544Seschrock
6031544Seschrock if (ip == NULL)
6041544Seschrock return (0);
6051544Seschrock
6061544Seschrock switch (ip->i_smode & IFMT) {
6071544Seschrock case IFDIR:
6081544Seschrock stp->st_mode = S_IFDIR;
6091544Seschrock break;
6101544Seschrock case IFREG:
6111544Seschrock stp->st_mode = S_IFREG;
6121544Seschrock break;
6131544Seschrock default:
6141544Seschrock break;
6151544Seschrock }
616*3446Smrj /*
617*3446Smrj * NOTE: this size will be the compressed size for a compressed file
618*3446Smrj * This could confuse the caller since we decompress the file behind
619*3446Smrj * the scenes when the file is read.
620*3446Smrj */
6211544Seschrock stp->st_size = ip->i_size;
6221544Seschrock
6231544Seschrock /* file times */
6241544Seschrock stp->st_atim.tv_sec = ip->i_atime.tv_sec;
6251544Seschrock stp->st_atim.tv_nsec = ip->i_atime.tv_usec * 1000;
6261544Seschrock stp->st_mtim.tv_sec = ip->i_mtime.tv_sec;
6271544Seschrock stp->st_mtim.tv_nsec = ip->i_mtime.tv_usec * 1000;
6281544Seschrock stp->st_ctim.tv_sec = ip->i_ctime.tv_sec;
6291544Seschrock stp->st_ctim.tv_nsec = ip->i_ctime.tv_usec * 1000;
6301544Seschrock
6311544Seschrock return (0);
6321544Seschrock
6331544Seschrock }
6341544Seschrock
6351544Seschrock
6360Sstevel@tonic-gate /*
6370Sstevel@tonic-gate * Parse a directory entry.
6380Sstevel@tonic-gate *
6390Sstevel@tonic-gate */
6400Sstevel@tonic-gate static uint_t
parse_dir(fileid_t * filep,int offset,struct hs_direct * hsdep)6410Sstevel@tonic-gate parse_dir(fileid_t *filep, int offset, struct hs_direct *hsdep)
6420Sstevel@tonic-gate {
6430Sstevel@tonic-gate char *bufp = (char *)(filep->fi_memp + offset);
6440Sstevel@tonic-gate struct direct *udp = &hsdep->hs_ufs_dir; /* ufs-style dir info */
6450Sstevel@tonic-gate struct hs_direntry *hdp = &hsdep->hs_dir; /* hsfs-style dir info */
6460Sstevel@tonic-gate uint_t ce_lbn;
6470Sstevel@tonic-gate uint_t ce_len;
6480Sstevel@tonic-gate uint_t nmlen;
6490Sstevel@tonic-gate uint_t i;
6500Sstevel@tonic-gate uchar_t c;
6510Sstevel@tonic-gate
6520Sstevel@tonic-gate dprintf("parse_dir: offset = %d\n", offset);
6530Sstevel@tonic-gate /* a zero length dir entry terminates the dir block */
6540Sstevel@tonic-gate udp->d_reclen = IDE_DIR_LEN(bufp);
6550Sstevel@tonic-gate if (udp->d_reclen == 0)
6560Sstevel@tonic-gate return (0);
6570Sstevel@tonic-gate
6580Sstevel@tonic-gate /* fill in some basic hsfs info */
6590Sstevel@tonic-gate hdp->ext_lbn = IDE_EXT_LBN(bufp);
6600Sstevel@tonic-gate hdp->ext_size = IDE_EXT_SIZE(bufp);
6610Sstevel@tonic-gate hdp->xar_len = IDE_XAR_LEN(bufp);
6620Sstevel@tonic-gate hdp->intlf_sz = IDE_INTRLV_SIZE(bufp);
6630Sstevel@tonic-gate hdp->intlf_sk = IDE_INTRLV_SKIP(bufp);
6640Sstevel@tonic-gate hdp->sym_link = NULL;
6650Sstevel@tonic-gate
6660Sstevel@tonic-gate /* we use lbn of data extent as an inode # equivalent */
6670Sstevel@tonic-gate udp->d_ino = hdp->ext_lbn;
6680Sstevel@tonic-gate
6690Sstevel@tonic-gate c = IDE_FLAGS(bufp);
6700Sstevel@tonic-gate if (IDE_REGULAR_FILE(c)) {
6710Sstevel@tonic-gate hdp->type = VREG;
6720Sstevel@tonic-gate hdp->mode = IFREG;
6730Sstevel@tonic-gate hdp->nlink = 1;
6740Sstevel@tonic-gate } else if (IDE_REGULAR_DIR(c)) {
6750Sstevel@tonic-gate hdp->type = VDIR;
6760Sstevel@tonic-gate hdp->mode = IFDIR;
6770Sstevel@tonic-gate hdp->nlink = 2;
6780Sstevel@tonic-gate } else {
6790Sstevel@tonic-gate printf("pd(): file type=0x%x unknown.\n", c);
6800Sstevel@tonic-gate }
6810Sstevel@tonic-gate
6820Sstevel@tonic-gate /*
6830Sstevel@tonic-gate * Massage hsfs name, recognizing special entries for . and ..
6840Sstevel@tonic-gate * else lopping off version junk.
6850Sstevel@tonic-gate */
6860Sstevel@tonic-gate
6870Sstevel@tonic-gate /* Some initial conditions */
6880Sstevel@tonic-gate nmlen = IDE_NAME_LEN(bufp);
6890Sstevel@tonic-gate c = *IDE_NAME(bufp);
6900Sstevel@tonic-gate /* Special Case: Current Directory */
6910Sstevel@tonic-gate if (nmlen == 1 && c == '\0') {
6920Sstevel@tonic-gate udp->d_name[0] = '.';
6930Sstevel@tonic-gate udp->d_name[1] = '\0';
6940Sstevel@tonic-gate udp->d_namlen = 1;
6950Sstevel@tonic-gate /* Special Case: Parent Directory */
6960Sstevel@tonic-gate } else if (nmlen == 1 && c == '\001') {
6970Sstevel@tonic-gate udp->d_name[0] = '.';
6980Sstevel@tonic-gate udp->d_name[1] = '.';
6990Sstevel@tonic-gate udp->d_name[2] = '\0';
7000Sstevel@tonic-gate udp->d_namlen = 2;
7010Sstevel@tonic-gate /* Other file name */
7020Sstevel@tonic-gate } else {
7030Sstevel@tonic-gate udp->d_namlen = 0;
7040Sstevel@tonic-gate for (i = 0; i < nmlen; i++) {
7050Sstevel@tonic-gate c = *(IDE_name(bufp)+i);
7060Sstevel@tonic-gate if (c == ';')
7070Sstevel@tonic-gate break;
7080Sstevel@tonic-gate else if (c == ' ')
7090Sstevel@tonic-gate continue;
7100Sstevel@tonic-gate else
7110Sstevel@tonic-gate udp->d_name[udp->d_namlen++] = c;
7120Sstevel@tonic-gate }
7130Sstevel@tonic-gate udp->d_name[udp->d_namlen] = '\0';
7140Sstevel@tonic-gate }
7150Sstevel@tonic-gate
7160Sstevel@tonic-gate /* System Use Fields */
7170Sstevel@tonic-gate ce_len = IDE_SUA_LEN(bufp);
7180Sstevel@tonic-gate
719157Sjg if (ce_len == 0)
7200Sstevel@tonic-gate return (udp->d_reclen);
7210Sstevel@tonic-gate
7220Sstevel@tonic-gate /* there is an SUA for this dir entry; go parse it */
7230Sstevel@tonic-gate ce_lbn = parse_susp((char *)IDE_sys_use_area(bufp), &ce_len, hsdep);
7240Sstevel@tonic-gate
7250Sstevel@tonic-gate if (ce_lbn) {
7260Sstevel@tonic-gate /*
7270Sstevel@tonic-gate * store away current position in dir,
7280Sstevel@tonic-gate * as we will be using the iobuf to reading SUA.
7290Sstevel@tonic-gate */
7300Sstevel@tonic-gate daddr_t save_bn = filep->fi_blocknum;
7310Sstevel@tonic-gate daddr_t save_offset = filep->fi_offset;
7320Sstevel@tonic-gate caddr_t save_ma = filep->fi_memp;
7330Sstevel@tonic-gate int save_cc = filep->fi_count;
7340Sstevel@tonic-gate do {
7350Sstevel@tonic-gate filep->fi_count = ISO_SECTOR_SIZE;
7360Sstevel@tonic-gate filep->fi_offset = 0;
7370Sstevel@tonic-gate filep->fi_blocknum = hdbtodb(ce_lbn);
7380Sstevel@tonic-gate filep->fi_memp = 0;
7390Sstevel@tonic-gate if (diskread(filep)) {
7400Sstevel@tonic-gate printf("failed to read cont. area\n");
7410Sstevel@tonic-gate ce_len = 0;
7420Sstevel@tonic-gate ce_lbn = 0;
7430Sstevel@tonic-gate break;
7440Sstevel@tonic-gate }
7450Sstevel@tonic-gate ce_lbn = parse_susp(filep->fi_memp, &ce_len,
7460Sstevel@tonic-gate hsdep);
7470Sstevel@tonic-gate } while (ce_lbn);
7480Sstevel@tonic-gate filep->fi_count = save_cc;
7490Sstevel@tonic-gate filep->fi_offset = save_offset;
7500Sstevel@tonic-gate filep->fi_blocknum = save_bn;
7510Sstevel@tonic-gate filep->fi_memp = save_ma;
7520Sstevel@tonic-gate }
7530Sstevel@tonic-gate return (udp->d_reclen);
7540Sstevel@tonic-gate }
7550Sstevel@tonic-gate
7560Sstevel@tonic-gate /*
7570Sstevel@tonic-gate * Parse the System Use Fields in this System Use Area.
7580Sstevel@tonic-gate * Return blk number of continuation/SUA, or 0 if no continuation/not a SUA.
7590Sstevel@tonic-gate */
7600Sstevel@tonic-gate static uint_t
parse_susp(char * bufp,uint_t * len,struct hs_direct * hsdep)7610Sstevel@tonic-gate parse_susp(char *bufp, uint_t *len, struct hs_direct *hsdep)
7620Sstevel@tonic-gate {
7630Sstevel@tonic-gate struct direct *udp = &hsdep->hs_ufs_dir; /* ufs-style info */
7640Sstevel@tonic-gate char *susp;
7650Sstevel@tonic-gate uint_t cur_off = 0;
7660Sstevel@tonic-gate uint_t blk_len = *len;
7670Sstevel@tonic-gate uint_t susp_len = 0;
7680Sstevel@tonic-gate uint_t ce_lbn = 0;
7690Sstevel@tonic-gate uint_t i;
7700Sstevel@tonic-gate
7710Sstevel@tonic-gate dprintf("parse_susp: len = %d\n", *len);
7720Sstevel@tonic-gate while (cur_off < blk_len) {
7730Sstevel@tonic-gate susp = (char *)(bufp + cur_off);
7740Sstevel@tonic-gate
7750Sstevel@tonic-gate /*
7760Sstevel@tonic-gate * A null entry, or an entry with zero length
7770Sstevel@tonic-gate * terminates the SUSP.
7780Sstevel@tonic-gate */
7790Sstevel@tonic-gate if (susp[0] == '\0' || susp[1] == '\0' ||
7800Sstevel@tonic-gate (susp_len = SUF_LEN(susp)) == 0)
7810Sstevel@tonic-gate break;
7820Sstevel@tonic-gate
7830Sstevel@tonic-gate /*
7840Sstevel@tonic-gate * Compare current entry to all known signatures.
7850Sstevel@tonic-gate */
7860Sstevel@tonic-gate for (i = 0; i < hsfs_num_sig; i++)
7870Sstevel@tonic-gate if (strncmp(hsfs_sig_tab[i], susp, SUF_SIG_LEN) == 0)
7880Sstevel@tonic-gate break;
7890Sstevel@tonic-gate switch (i) {
7900Sstevel@tonic-gate case SUSP_CE_IX:
7910Sstevel@tonic-gate /*
7920Sstevel@tonic-gate * CE signature: continuation of SUSP.
7930Sstevel@tonic-gate * will want to return new lbn, len.
7940Sstevel@tonic-gate */
7950Sstevel@tonic-gate ce_lbn = CE_BLK_LOC(susp);
7960Sstevel@tonic-gate *len = CE_CONT_LEN(susp);
7970Sstevel@tonic-gate break;
7980Sstevel@tonic-gate case RRIP_NM_IX:
7990Sstevel@tonic-gate /* NM signature: POSIX-style file name */
8000Sstevel@tonic-gate if (!RRIP_NAME_FLAGS(susp)) {
8010Sstevel@tonic-gate udp->d_namlen = RRIP_NAME_LEN(susp);
8020Sstevel@tonic-gate bcopy((char *)RRIP_name(susp),
8030Sstevel@tonic-gate udp->d_name, udp->d_namlen);
8040Sstevel@tonic-gate udp->d_name[udp->d_namlen] = '\0';
8050Sstevel@tonic-gate }
8060Sstevel@tonic-gate break;
8070Sstevel@tonic-gate case HSFS_NUM_SIG:
8080Sstevel@tonic-gate /* couldn't find a legit susp, terminate loop */
8090Sstevel@tonic-gate case SUSP_ST_IX:
8100Sstevel@tonic-gate /* ST signature: terminates SUSP */
8110Sstevel@tonic-gate return (ce_lbn);
8120Sstevel@tonic-gate case SUSP_SP_IX:
8130Sstevel@tonic-gate case RRIP_RR_IX:
8140Sstevel@tonic-gate default:
8150Sstevel@tonic-gate break;
8160Sstevel@tonic-gate }
8170Sstevel@tonic-gate cur_off += susp_len;
8180Sstevel@tonic-gate }
8190Sstevel@tonic-gate return (ce_lbn);
8200Sstevel@tonic-gate }
8210Sstevel@tonic-gate
8220Sstevel@tonic-gate struct boot_fs_ops bhsfs_ops = {
8230Sstevel@tonic-gate "boot_hsfs",
8240Sstevel@tonic-gate bhsfs_mountroot,
8250Sstevel@tonic-gate bhsfs_unmountroot,
8260Sstevel@tonic-gate bhsfs_open,
8270Sstevel@tonic-gate bhsfs_close,
8280Sstevel@tonic-gate bhsfs_read,
8290Sstevel@tonic-gate bhsfs_lseek,
8301544Seschrock bhsfs_fstat,
8310Sstevel@tonic-gate NULL
8320Sstevel@tonic-gate };
833