source: mainline/uspace/libc/include/io/file.h@ ea7890e7

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since ea7890e7 was ff3a34b, checked in by Martin Decky <martin@…>, 18 years ago

initial merge of branches/fs
(not finished, huge cleanup is needed)

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 * Copyright (c) 2007 Michal Konopa
3 * Copyright (c) 2007 Martin Jelen
4 * Copyright (c) 2007 Peter Majer
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * - Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * - The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/** @addtogroup libc
32 * @{
33 */
34
35/**
36 * @file file.h
37 * @brief The main header for the user library for working with the file system
38 */
39
40#ifndef _FILE_H
41#define _FILE_H
42
43#include "../../../fs/const.h"
44#include "../../../fs/type.h"
45#include "../../../fs/stat.h"
46#include "../../../fs/dir.h"
47#include "../../../share/message.h"
48
49#define F_OK 0x00
50#define F_FILE_NOT_FOUND 0x01
51#define F_FILE_NOT_OPEN 0x02
52#define F_READ_ERROR 0x10
53#define F_READ_OVERFLOW 0x11
54#define F_SYSTEM_ERROR 0xf0
55#define F_IPC_FAILURE 0xf1
56#define F_MMAP_FAILURE 0xf2
57#define F_COMM_FAILURE 0xf3
58
59#define F_ERRTYPE_MASK 0xf0
60
61#define F_MODE_READ 0x01
62#define F_MODE_WRITE 0x02
63#define F_MODE_READ_WRITE F_MODE_READ | F_MODE_WRITE
64#define F_MODE_APPEND 0x04
65
66/**
67 *
68 */
69typedef struct {
70 char name[30];
71 unsigned short inode_num;
72} dir_item_t;
73
74/**
75 *
76 */
77typedef struct {
78 size_t size;
79 dir_item_t base_info;
80 void *share;
81 message_params_t *params;
82 unsigned int handle;
83 stat_t stat;
84} file_t;
85
86static int f_err;
87
88dir_item_t *ls(unsigned int *length);
89int chdir(char *new_dir);
90
91file_t *fopen(char *name, int mode);
92int fstat(file_t *file);
93int fread(file_t *file, void *buffer, unsigned int size);
94int fseek(file_t * file, int offset, int whence);
95int fclose(file_t *file);
96
97#endif
98
99/**
100 *@}
101 /
Note: See TracBrowser for help on using the repository browser.