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