]> git.ozlabs.org Git - yaboot.git/blob - include/file.h
8717dd3caebab76f1303084692cceddb6e6e655a
[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 struct boot_fspec_t {
35         char*   dev;            /* OF device path */
36         int     part;           /* Partition number or -1 */
37         char*   file;           /* File path */
38 };
39
40 struct boot_file_t {
41
42         /* File access methods */
43         const struct fs_t *fs;
44
45         /* Filesystem private (to be broken once we have a
46          * better malloc'ator)
47          */
48
49         int             device_kind;
50         ihandle         of_device;
51         ino_t           inode;
52         __u64           pos;
53         unsigned char*  buffer;
54         __u64           len;
55 //      unsigned int    dev_blk_size;
56 //      unsigned int    part_start;
57 //      unsigned int    part_count;
58 };
59
60 extern int
61 open_file(const struct boot_fspec_t*    spec,
62           struct boot_file_t*           file);
63
64 extern int
65 parse_device_path(char *imagepath, char *defdevice, int defpart,
66                   char *deffile, struct boot_fspec_t *result);
67
68 #if 0
69 extern int validate_fspec(
70                         struct boot_fspec_t*    spec,
71                         char*                   default_device,
72                         int                     default_part);
73 extern char *parse_device_path(
74                         char*                   of_device,
75                         char**                  file_spec,
76                         int*                    partition);
77 #endif
78
79
80 #endif