aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/exofs.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exofs/exofs.h')
-rw-r--r--fs/exofs/exofs.h87
1 files changed, 84 insertions, 3 deletions
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h
index 5ec72e020b2..2e08859a89e 100644
--- a/fs/exofs/exofs.h
+++ b/fs/exofs/exofs.h
@@ -30,14 +30,13 @@
30 * along with exofs; if not, write to the Free Software 30 * along with exofs; if not, write to the Free Software
31 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 */ 32 */
33#ifndef __EXOFS_H__
34#define __EXOFS_H__
33 35
34#include <linux/fs.h> 36#include <linux/fs.h>
35#include <linux/time.h> 37#include <linux/time.h>
36#include "common.h" 38#include "common.h"
37 39
38#ifndef __EXOFS_H__
39#define __EXOFS_H__
40
41#define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a) 40#define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a)
42 41
43#ifdef CONFIG_EXOFS_DEBUG 42#ifdef CONFIG_EXOFS_DEBUG
@@ -56,6 +55,7 @@
56 */ 55 */
57struct exofs_sb_info { 56struct exofs_sb_info {
58 struct osd_dev *s_dev; /* returned by get_osd_dev */ 57 struct osd_dev *s_dev; /* returned by get_osd_dev */
58 struct exofs_fscb s_fscb; /* Written often, pre-allocate*/
59 osd_id s_pid; /* partition ID of file system*/ 59 osd_id s_pid; /* partition ID of file system*/
60 int s_timeout; /* timeout for OSD operations */ 60 int s_timeout; /* timeout for OSD operations */
61 uint64_t s_nextid; /* highest object ID used */ 61 uint64_t s_nextid; /* highest object ID used */
@@ -79,6 +79,50 @@ struct exofs_i_info {
79 struct inode vfs_inode; /* normal in-memory inode */ 79 struct inode vfs_inode; /* normal in-memory inode */
80}; 80};
81 81
82static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
83{
84 return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF;
85}
86
87struct exofs_io_state;
88typedef void (*exofs_io_done_fn)(struct exofs_io_state *or, void *private);
89
90struct exofs_io_state {
91 struct kref kref;
92
93 void *private;
94 exofs_io_done_fn done;
95
96 struct exofs_sb_info *sbi;
97 struct osd_obj_id obj;
98 u8 *cred;
99
100 /* Global read/write IO*/
101 loff_t offset;
102 unsigned long length;
103 void *kern_buff;
104 struct bio *bio;
105
106 /* Attributes */
107 unsigned in_attr_len;
108 struct osd_attr *in_attr;
109 unsigned out_attr_len;
110 struct osd_attr *out_attr;
111
112 /* Variable array of size numdevs */
113 unsigned numdevs;
114 struct exofs_per_dev_state {
115 struct osd_request *or;
116 struct bio *bio;
117 } per_dev[];
118};
119
120static inline unsigned exofs_io_state_size(unsigned numdevs)
121{
122 return sizeof(struct exofs_io_state) +
123 sizeof(struct exofs_per_dev_state) * numdevs;
124}
125
82/* 126/*
83 * our inode flags 127 * our inode flags
84 */ 128 */
@@ -130,6 +174,42 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode)
130/************************* 174/*************************
131 * function declarations * 175 * function declarations *
132 *************************/ 176 *************************/
177
178/* ios.c */
179void exofs_make_credential(u8 cred_a[OSD_CAP_LEN],
180 const struct osd_obj_id *obj);
181int exofs_read_kern(struct osd_dev *od, u8 *cred, struct osd_obj_id *obj,
182 u64 offset, void *p, unsigned length);
183
184int exofs_get_io_state(struct exofs_sb_info *sbi, struct exofs_io_state** ios);
185void exofs_put_io_state(struct exofs_io_state *ios);
186
187int exofs_check_io(struct exofs_io_state *ios, u64 *resid);
188
189int exofs_sbi_create(struct exofs_io_state *ios);
190int exofs_sbi_remove(struct exofs_io_state *ios);
191int exofs_sbi_write(struct exofs_io_state *ios);
192int exofs_sbi_read(struct exofs_io_state *ios);
193
194int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr);
195
196int exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
197static inline int exofs_oi_write(struct exofs_i_info *oi,
198 struct exofs_io_state *ios)
199{
200 ios->obj.id = exofs_oi_objno(oi);
201 ios->cred = oi->i_cred;
202 return exofs_sbi_write(ios);
203}
204
205static inline int exofs_oi_read(struct exofs_i_info *oi,
206 struct exofs_io_state *ios)
207{
208 ios->obj.id = exofs_oi_objno(oi);
209 ios->cred = oi->i_cred;
210 return exofs_sbi_read(ios);
211}
212
133/* inode.c */ 213/* inode.c */
134void exofs_truncate(struct inode *inode); 214void exofs_truncate(struct inode *inode);
135int exofs_setattr(struct dentry *, struct iattr *); 215int exofs_setattr(struct dentry *, struct iattr *);
@@ -169,6 +249,7 @@ extern const struct file_operations exofs_file_operations;
169 249
170/* inode.c */ 250/* inode.c */
171extern const struct address_space_operations exofs_aops; 251extern const struct address_space_operations exofs_aops;
252extern const struct osd_attr g_attr_logical_length;
172 253
173/* namei.c */ 254/* namei.c */
174extern const struct inode_operations exofs_dir_inode_operations; 255extern const struct inode_operations exofs_dir_inode_operations;