Missing boot loader headers.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4462 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f659db057c
commit
6f7c2dc677
35
headers/private/kernel/boot/partitions.h
Normal file
35
headers/private/kernel/boot/partitions.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
#ifndef KERNEL_BOOT_PARTITIONS_H
|
||||
#define KERNEL_BOOT_PARTITIONS_H
|
||||
|
||||
|
||||
#include <boot/vfs.h>
|
||||
#include <disk_device_manager.h>
|
||||
|
||||
|
||||
class Partition : public partition_data, Node {
|
||||
public:
|
||||
Partition(int deviceFD);
|
||||
virtual ~Partition();
|
||||
|
||||
virtual ssize_t ReadAt(void *cookie, off_t offset, void *buffer, size_t bufferSize);
|
||||
virtual ssize_t WriteAt(void *cookie, off_t offset, const void *buffer, size_t bufferSize);
|
||||
|
||||
private:
|
||||
int fFD;
|
||||
};
|
||||
|
||||
// DiskDeviceTypes we need/support in the boot loader
|
||||
#define kPartitionTypeAmiga "Amiga RDB"
|
||||
#define kPartitionTypeIntel "Intel"
|
||||
#define kPartitionTypeApple "Apple"
|
||||
|
||||
struct partition_module_info;
|
||||
extern partition_module_info gAmigaPartitionModule;
|
||||
extern partition_module_info gIntelPartitionModule;
|
||||
extern partition_module_info gApplePartitionModule;
|
||||
|
||||
#endif /* KERNEL_BOOT_PARTITIONS_H */
|
66
headers/private/kernel/boot/stdio.h
Executable file
66
headers/private/kernel/boot/stdio.h
Executable file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
#ifndef _STDIO_H_
|
||||
#define _STDIO_H_
|
||||
// must match the one of the real stdio.h
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct FILE FILE;
|
||||
// dummy definition of FILE
|
||||
// In the boot loader, it really is a ConsoleNode
|
||||
|
||||
extern FILE *stdin;
|
||||
extern FILE *stdout;
|
||||
extern FILE *stderr;
|
||||
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0
|
||||
#endif
|
||||
#ifndef SEEK_CUR
|
||||
# define SEEK_CUR 1
|
||||
#endif
|
||||
#ifndef SEEK_END
|
||||
# define SEEK_END 2
|
||||
#endif
|
||||
|
||||
#define EOF -1
|
||||
|
||||
#define __PRINTFLIKE(a, b)
|
||||
|
||||
extern int printf(char const *format, ...) __PRINTFLIKE(1,2);
|
||||
extern int fprintf(FILE *stream, char const *format, ...) __PRINTFLIKE(2,3);
|
||||
extern int sprintf(char *str, char const *format, ...) __PRINTFLIKE(2,3);
|
||||
extern int snprintf(char *str, size_t size, char const *format, ...) __PRINTFLIKE(3,4);
|
||||
extern int asprintf(char **ret, char const *format, ...) __PRINTFLIKE(2,3);
|
||||
extern int vprintf(char const *format, va_list ap);
|
||||
extern int vfprintf(FILE *stream, char const *format, va_list ap);
|
||||
extern int vsprintf(char *str, char const *format, va_list ap);
|
||||
extern int vsnprintf(char *str, size_t size, char const *format, va_list ap);
|
||||
extern int vasprintf(char **ret, char const *format, va_list ap);
|
||||
|
||||
// ToDo: not everything is or should be implemented here
|
||||
extern int fgetc(FILE *);
|
||||
extern char *fgets(char *, int, FILE *);
|
||||
extern int fputc(int, FILE *);
|
||||
extern int fputs(const char *, FILE*);
|
||||
extern int getc(FILE *);
|
||||
extern char *gets(char *);
|
||||
extern int getw(FILE *);
|
||||
extern int getchar(void);
|
||||
extern int putc(int, FILE *);
|
||||
extern int putchar(int);
|
||||
extern int puts(const char *);
|
||||
extern int putw(int, FILE *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _STDIO_H_ */
|
83
headers/private/kernel/boot/vfs.h
Normal file
83
headers/private/kernel/boot/vfs.h
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
#ifndef KERNEL_BOOT_VFS_H
|
||||
#define KERNEL_BOOT_VFS_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <list.h>
|
||||
#include <boot/stage2_args.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/** This is the base class for all VFS nodes */
|
||||
|
||||
class Node {
|
||||
public:
|
||||
Node();
|
||||
virtual ~Node();
|
||||
|
||||
virtual status_t Open(void **_cookie, int mode);
|
||||
virtual status_t Close(void *cookie);
|
||||
|
||||
virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) = 0;
|
||||
virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) = 0;
|
||||
|
||||
protected:
|
||||
list_link fLink;
|
||||
int32 fRefCount;
|
||||
};
|
||||
|
||||
|
||||
/** The console based nodes don't need cookies for I/O, they
|
||||
* also don't support to change the stream position.
|
||||
* Live is simple in the boot loader :-)
|
||||
*/
|
||||
|
||||
class ConsoleNode : public Node {
|
||||
public:
|
||||
ConsoleNode();
|
||||
|
||||
virtual ssize_t Read(void *buffer, size_t bufferSize);
|
||||
virtual ssize_t Write(const void *buffer, size_t bufferSize);
|
||||
};
|
||||
|
||||
class Descriptor {
|
||||
public:
|
||||
Descriptor(Node *node, void *cookie);
|
||||
~Descriptor();
|
||||
|
||||
ssize_t Read(off_t pos, void *buffer, size_t bufferSize);
|
||||
ssize_t Read(void *buffer, size_t bufferSize);
|
||||
ssize_t Write(off_t pos, const void *buffer, size_t bufferSize);
|
||||
ssize_t Write(const void *buffer, size_t bufferSize);
|
||||
|
||||
off_t Offset() const { return fOffset; }
|
||||
int32 RefCount() const { return fRefCount; }
|
||||
|
||||
status_t Acquire();
|
||||
status_t Release();
|
||||
|
||||
private:
|
||||
Node *fNode;
|
||||
void *fCookie;
|
||||
off_t fOffset;
|
||||
int32 fRefCount;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern status_t vfs_init(stage2_args *args);
|
||||
extern status_t mount_boot_file_systems();
|
||||
extern status_t add_partitions_for(int fd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* KERNEL_BOOT_VFS_H */
|
Loading…
x
Reference in New Issue
Block a user