8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / stand / sys / bootvfs.h
blobadb44f4e9a22b4d676e820777debee8b102ad175
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_BOOTVFS_H
27 #define _SYS_BOOTVFS_H
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 #include <sys/filep.h>
36 #include <sys/dirent.h>
37 #include <sys/bootstat.h>
39 /* same as those in /usr/include/unistd.h */
40 #define SEEK_SET 0 /* Offset */
41 #define SEEK_CUR 1 /* Current + Offset */
42 #define SEEK_END 2 /* EOF + Offset */
44 /* mountroot/unmountroot return values */
45 #define VFS_SUCCESS 0
46 #define VFS_FAILURE -1
49 * unified (vfs-like) file system operations for booters
52 struct boot_fs_ops {
53 char *fsw_name;
54 int (*fsw_mountroot)(char *str);
55 int (*fsw_unmountroot)(void);
56 int (*fsw_open)(char *filename, int flags);
57 int (*fsw_close)(int fd);
58 ssize_t (*fsw_read)(int fd, caddr_t buf, size_t size);
59 off_t (*fsw_lseek)(int filefd, off_t addr, int whence);
60 int (*fsw_fstat)(int filefd, struct bootstat *buf);
61 void (*fsw_closeall)(int flag);
62 int (*fsw_getdents)(int fd, struct dirent *buf, unsigned size);
66 * Function prototypes
68 * fstat() (if exists) supports size and mode right now.
71 extern int mountroot(char *str);
72 extern int unmountroot(void);
73 extern int open(const char *filename, int flags);
74 extern int close(int fd);
75 extern ssize_t read(int fd, void *buf, size_t size);
76 extern off_t lseek(int filefd, off_t addr, int whence);
77 extern int fstat(int fd, struct stat *buf);
78 extern int stat(const char *filename, struct stat *buf);
81 * The compfs filesystem provides additional fsswitch-like entry points,
82 * though these are not yet hooked properly into the fsswitch.
85 extern void closeall(int flag);
87 extern ssize_t kern_read(int fd, caddr_t buf, size_t size);
88 extern int kern_open(char *filename, int flags);
89 extern off_t kern_seek(int fd, off_t hi, off_t lo);
90 extern off_t kern_lseek(int fd, off_t hi, off_t lo);
91 extern int kern_close(int fd);
92 extern int kern_fstat(int fd, struct bootstat *buf);
93 extern int kern_getdents(int fd, struct dirent *buf, size_t size);
94 extern int kern_mountroot(char *path);
95 extern int kern_unmountroot(void);
98 * these are for common fs switch interface routines
100 extern int boot_no_ops(void); /* no ops entry */
101 extern void boot_no_ops_void(void); /* no ops entry */
103 extern struct boot_fs_ops *get_default_fs(void);
104 extern struct boot_fs_ops *get_fs_ops_pointer(char *fsw_name);
105 extern void set_default_fs(char *fsw_name);
106 extern void clr_default_fs(void);
107 extern char *set_fstype(char *v2path, char *bpath);
109 #ifdef __cplusplus
111 #endif
113 #endif /* _SYS_BOOTVFS_H */