]> git.ozlabs.org Git - yaboot.git/blob - include/file.h
Commit yaboot 1.3.4-pre1
[yaboot.git] / include / file.h
1 /*
2     Definitions for talking to the Open Firmware PROM on
3     Power Macintosh computers.
4
5     Copyright (C) 1999 Benjamin Herrenschmidt
6
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 */
21
22 #ifndef FILE_H
23 #define FILE_H
24
25 #include "types.h"
26 #include "stddef.h"
27 #include "prom.h"
28
29 struct boot_file_t;
30 #include "fs.h"
31
32 #define FILE_MAX_PATH           1024
33
34 /* Device kind */
35 #define FILE_DEVICE_BLOCK       1
36 #define FILE_DEVICE_NET         2
37
38 struct boot_fspec_t {
39         char*   dev;            /* OF device path */
40         int     part;           /* Partition number or -1 */
41         char*   file;           /* File path */
42 };
43
44 struct boot_file_t {
45
46         /* File access methods */
47         const struct fs_t *fs;
48
49         /* Filesystem private (to be broken once we have a
50          * better malloc'ator)
51          */
52
53         int             device_kind;
54         ihandle         of_device;
55         ino_t           inode;
56         __u64           pos;
57         unsigned char*  buffer;
58         __u64           len;
59 //      unsigned int    dev_blk_size;
60 //      unsigned int    part_start;
61 //      unsigned int    part_count;
62 };
63
64 extern int
65 open_file(const struct boot_fspec_t*    spec,
66           struct boot_file_t*           file);
67
68 extern int
69 parse_device_path(char *imagepath, char *defdevice, int defpart,
70                   char *deffile, struct boot_fspec_t *result);
71
72 #if 0
73 extern int validate_fspec(
74                         struct boot_fspec_t*    spec,
75                         char*                   default_device,
76                         int                     default_part);
77 extern char *parse_device_path(
78                         char*                   of_device,
79                         char**                  file_spec,
80                         int*                    partition);
81 #endif
82
83
84 #endif