]> git.ozlabs.org Git - yaboot.git/blob - include/file.h
ca76a52238559f62028a60abc290f2fa3acd00ee
[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*   siaddr;         /* Server address */
43         char*   file;           /* File path */
44         char*   ciaddr;         /* Client address */
45         char*   giaddr;         /* Gateway address */
46         char*   bootp_retries;  /* Bootp retries */
47         char*   tftp_retries;   /* TFTP retries */
48         char*   addl_params;    /* copy all additional parameters */
49 };
50
51 struct boot_file_t {
52
53         /* File access methods */
54         const struct fs_t *fs;
55
56         /* Filesystem private (to be broken once we have a
57          * better malloc'ator)
58          */
59
60         int             device_kind;
61         ihandle         of_device;
62         ino_t           inode;
63         __u64           pos;
64         unsigned char*  buffer;
65         __u64           len;
66 //      unsigned int    dev_blk_size;
67 //      unsigned int    part_start;
68 //      unsigned int    part_count;
69 };
70
71 extern int
72 open_file(struct boot_fspec_t*  spec,
73           struct boot_file_t*           file);
74
75 extern int
76 parse_device_path(char *imagepath, char *defdevice, int defpart,
77                   char *deffile, struct boot_fspec_t *result);
78
79
80 #endif