Implemented optional 'statfs' for visible df(1) lufs filesystems entry.
[lufs.git] / include / lufs / proto.h
1 /*
2  * proto.h
3  * Copyright (C) 2002 Florin Malita <mali@go.ro>
4  *
5  * This file is part of LUFS, a free userspace filesystem implementation.
6  * See http://lufs.sourceforge.net/ for updates.
7  *
8  * LUFS is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * LUFS is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #ifndef _LU_PROTO_H_
24 #define _LU_PROTO_H_
25
26 #define LU_MAXDATA      4096
27
28 #define PVERSION        0x02
29
30 #define PTYPE_OK        0x00
31 #define PTYPE_MOUNT     0x01
32 #define PTYPE_READ      0x02
33 #define PTYPE_WRITE     0x03
34 #define PTYPE_READDIR   0x04
35 #define PTYPE_STAT      0x05
36 #define PTYPE_UMOUNT    0x06
37 #define PTYPE_SETATTR   0x07
38 #define PTYPE_MKDIR     0x08
39 #define PTYPE_RMDIR     0x09
40 #define PTYPE_CREATE    0x0A
41 #define PTYPE_UNLINK    0x0B
42 #define PTYPE_RENAME    0x0C
43 #define PTYPE_OPEN      0x0D
44 #define PTYPE_RELEASE   0x0E
45 #define PTYPE_READLINK  0x0F
46 #define PTYPE_LINK      0x10
47 #define PTYPE_SYMLINK   0x11
48 #define PTYPE_STATFS    0x12
49
50 #define PTYPE_MAX       0x12
51
52
53 #define PTYPE_ERROR     0x100
54
55 #define PERROR(x)       (-(x & (PTYPE_ERROR - 1)) - 1)
56 #define PIS_ERROR(x)    (x & PTYPE_ERROR)
57
58 struct lu_msg {
59     unsigned short      msg_version;
60     unsigned short      msg_type;
61     unsigned short      msg_datalen;
62     unsigned short      msg_pid;
63 };
64
65
66 struct lufs_fattr{
67     unsigned long       f_ino;
68     unsigned long       f_mode;
69     unsigned long       f_nlink;
70     unsigned long       f_uid;
71     unsigned long       f_gid;
72     long long           f_size;
73     unsigned long       f_atime;
74     unsigned long       f_mtime;
75     unsigned long       f_ctime;
76     unsigned long       f_blksize;
77     unsigned long       f_blocks;
78 };
79
80
81 struct lufs_sbattr{     /* struct statfs64 */
82     unsigned long long sb_bytes;
83     unsigned long long sb_bytes_free;
84     unsigned long long sb_bytes_available;
85     unsigned long long sb_files;
86     unsigned long long sb_ffree;
87 };
88
89
90 struct lufs_req_readdir{
91     unsigned short      offset;
92     char                dirname[0];
93 };
94
95 struct lufs_req_mkdir{
96     int         mode;
97     char        dirname[0];
98 };
99
100 struct lufs_req_rw{
101     long long           offset;
102     unsigned long       count;
103     char                name[0];
104 };
105
106 struct lufs_req_open{
107     unsigned    mode;
108     char        name[0];
109 };
110
111 struct lufs_req_setattr{
112     struct lufs_fattr   fattr;
113     char                name[0];
114 };
115
116 #endif