dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / arch / x86 / include / sys / bootvfs.h
blob5120a6733e8ad777dd6ee349ce075ebd18858ebb
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 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_BOOTVFS_H
27 #define _SYS_BOOTVFS_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 #include <sys/bootstat.h>
34 #include <sys/dirent.h>
36 /* same as those in /usr/include/unistd.h */
37 #define SEEK_SET 0 /* Offset */
38 #define SEEK_CUR 1 /* Current + Offset */
39 #define SEEK_END 2 /* EOF + Offset */
41 /* mountroot/unmountroot return values */
42 #define VFS_SUCCESS 0
43 #define VFS_FAILURE -1
46 * unified (vfs-like) file system operations for booters
49 struct boot_fs_ops {
50 char *fsw_name;
51 int (*fsw_mountroot)(char *str);
52 int (*fsw_unmountroot)(void);
53 int (*fsw_open)(char *filename, int flags);
54 int (*fsw_close)(int fd);
55 ssize_t (*fsw_read)(int fd, caddr_t buf, size_t size);
56 off_t (*fsw_lseek)(int filefd, off_t addr, int whence);
57 int (*fsw_fstat)(int filefd, struct bootstat *buf);
58 void (*fsw_closeall)(int flag);
59 int (*fsw_getdents)(int fd, struct dirent *buf, unsigned size);
63 * Function prototypes
65 * fstat() (if exists) supports size and mode right now.
68 extern struct boot_fs_ops *bfs_ops;
70 #ifdef _KERNEL
72 extern int BRD_MOUNTROOT(struct boot_fs_ops *, char *);
73 extern int BRD_UNMOUNTROOT(struct boot_fs_ops *);
74 extern int BRD_OPEN(struct boot_fs_ops *, char *, int);
75 extern int BRD_CLOSE(struct boot_fs_ops *, int);
76 extern ssize_t BRD_READ(struct boot_fs_ops *, int, caddr_t, size_t);
77 extern off_t BRD_SEEK(struct boot_fs_ops *, int, off_t, int);
78 extern int BRD_FSTAT(struct boot_fs_ops *, int, struct bootstat *);
80 #else
82 #define BRD_MOUNTROOT(ops, str) ((ops)->fsw_mountroot)(str)
83 #define BRD_UNMOUNTROOT(ops) ((ops)->fsw_unmountroot)()
84 #define BRD_OPEN(ops, file, flag) ((ops)->fsw_open)(file, flag)
85 #define BRD_CLOSE(ops, fd) ((ops)->fsw_close)(fd)
86 #define BRD_READ(ops, fd, buf, s) ((ops)->fsw_read)(fd, buf, s)
87 #define BRD_SEEK(ops, fd, addr, w) ((ops)->fsw_lseek)(fd, addr, w)
88 #define BRD_FSTAT(ops, fd, stp) ((ops)->fsw_fstat)(fd, stp)
90 #endif
92 #define SYSTEM_BOOT_PATH "/system/boot"
93 #define BFD_F_SYSTEM_BOOT 0x40000000
95 #ifdef _BOOT
97 extern int mountroot(char *str);
98 extern int unmountroot(void);
99 extern int open(const char *filename, int flags);
100 extern int close(int fd);
101 extern ssize_t read(int fd, void *buf, size_t size);
102 extern off_t lseek(int filefd, off_t addr, int whence);
103 extern void closeall(int flag);
105 #endif /* _BOOT */
107 #ifdef __cplusplus
109 #endif
111 #endif /* _SYS_BOOTVFS_H */