Added support for ARM architecture; Added program zde - ZeX/OS Desktop Environment...
[ZeXOS.git] / kernel / include / vfs.h
blobb584ae9e6d2f267a1bf7dd64a2b7b4d33a66339a
1 /*
2 * ZeX/OS
3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
4 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef _VFS_H
22 #define _VFS_H
24 #define VFS_FILEATTR_FILE 0x1
25 #define VFS_FILEATTR_DIR 0x2
26 #define VFS_FILEATTR_HIDDEN 0x4
27 #define VFS_FILEATTR_SYSTEM 0x8
28 #define VFS_FILEATTR_BIN 0x10
29 #define VFS_FILEATTR_READ 0x20
30 #define VFS_FILEATTR_WRITE 0x40
31 #define VFS_FILEATTR_MOUNTED 0x80
33 #define VFS_FILENAME_LEN 10
34 #define VFS_MOUNTPOINT_LEN 32
36 typedef struct {
37 char *ptr;
38 unsigned long len;
39 } vfs_content_t;
41 /* Virtual filesystem structure */
42 typedef struct vfs_context {
43 struct vfs_context *next, *prev;
45 char *name;
46 char mountpoint[VFS_MOUNTPOINT_LEN];
47 unsigned attrib;
48 vfs_content_t *content;
49 } vfs_t;
51 typedef struct {
52 char *name;
53 unsigned attrib;
54 unsigned char next;
55 unsigned char unused;
56 } __attribute__ ((__packed__)) vfs_dirent_t;
58 /* externs */
59 extern vfs_t *vfs_list_find (char *name, char *mountpoint);
60 extern vfs_t *vfs_list_findbymp (char *mountpoint);
61 extern vfs_t *vfs_list_add (char *name, unsigned attrib, char *mountpoint);
62 extern bool vfs_list_del (vfs_t *vfs);
63 extern bool vfs_list_delbymp (char *mountpoint);
64 extern bool vfs_mmap (char *file, unsigned file_len, char *data, unsigned long len);
65 extern int vfs_read (char *file, unsigned file_len);
66 extern bool vfs_cat (char *file, unsigned file_len);
67 extern bool vfs_ls (char *file, unsigned file_len);
68 extern bool vfs_cd (char *file, unsigned file_len);
69 extern bool vfs_mkdir (char *file, unsigned file_len);
70 extern bool vfs_touch (char *file, unsigned file_len);
71 extern int vfs_rm (char *file, unsigned file_len);
72 extern vfs_dirent_t *vfs_dirent ();
73 extern unsigned int init_vfs ();
75 #endif