Whamcloud - gitweb
Fix a broken macro.
[fs/lustre-release.git] / lustre / include / linux / obd_class.h
1 #ifndef __LINUX_CLASS_OBD_H
2 #define __LINUX_CLASS_OBD_H
3 /*
4  * Copyright (C) 2001  Cluster File Systems, Inc.
5  *
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  */
9
10 #ifndef __KERNEL__
11 #include <stdint.h>
12 #define __KERNEL__
13 #include <linux/list.h>
14 #undef __KERNEL__
15 #else 
16 #include <asm/segment.h>
17 #include <asm/uaccess.h>
18 #include <linux/types.h>
19 #include <linux/fs.h>
20 #include <linux/time.h>
21
22 #include <linux/lustre_lib.h>
23 #include <linux/lustre_idl.h>
24 #include <linux/obd.h>
25 #endif
26
27 /*
28  *  ======== OBD Device Declarations ===========
29  */
30 #define MAX_OBD_DEVICES 8
31 #define MAX_MULTI       16
32 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
33
34 #define OBD_ATTACHED 0x1
35 #define OBD_SET_UP   0x2
36
37 struct obd_conn {
38         struct obd_device *oc_dev;
39         uint32_t oc_id;
40 };
41
42 typedef struct {
43         uint32_t len;
44         char *   name;
45         struct dentry *dentry;   /* file system obd device names */
46         __u8           _uuid[16]; /* uuid obd device names */
47 } obd_devicename;
48
49 #include <linux/obd_ext2.h>
50 #include <linux/obd_filter.h>
51 #include <linux/lustre_mds.h>
52 #include <linux/obd_snap.h>
53 #include <linux/obd_trace.h>
54 /* #include <linux/obd_fc.h> */
55 #include <linux/obd_raid1.h>
56 #include <linux/obd_ost.h>
57
58 #ifdef __KERNEL__
59 /* corresponds to one of the obdx */
60 struct obd_device {
61         struct obd_type *obd_type;
62         int obd_minor;
63         int obd_flags;
64         int obd_refcnt; 
65         obd_devicename obd_fsname; 
66         struct proc_dir_entry *obd_proc_entry;
67         int obd_multi_count;
68         struct obd_conn obd_multi_conn[MAX_MULTI];
69         unsigned int obd_gen_last_id;
70         unsigned long obd_gen_prealloc_quota;
71         struct list_head obd_gen_clients;
72         union {
73                 struct ext2_obd ext2;
74                 struct filter_obd filter;
75                 struct mds_obd mds;
76                 struct raid1_obd raid1;
77                 struct snap_obd snap;
78                 struct trace_obd trace;
79                 struct ost_obd ost;
80                 struct osc_obd osc;
81         } u;
82 };
83
84 extern struct proc_dir_entry *proc_lustre_register_obd_device(struct obd_device *obd);
85 extern void proc_lustre_release_obd_device(struct obd_device *obd);
86 extern void proc_lustre_remove_obd_entry(const char* name, struct obd_device *obd);
87
88 /*
89  *  ======== OBD Operations Declarations ===========
90  */
91
92 #define OBD_BRW_READ    (READ)
93 #define OBD_BRW_WRITE   (WRITE)
94 #define OBD_BRW_RWMASK  (READ | WRITE)
95 #define OBD_BRW_CREATE  (0x00000010UL)
96
97 struct obd_ops {
98         int (*o_iocontrol)(int cmd, struct obd_conn *, int len, void *karg,
99                            void *uarg);
100         int (*o_get_info)(struct obd_conn *, obd_count keylen, void *key,
101                           obd_count *vallen, void **val);
102         int (*o_set_info)(struct obd_conn *, obd_count keylen, void *key,
103                           obd_count vallen, void *val);
104         int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
105         int (*o_detach)(struct obd_device *dev);
106         int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
107         int (*o_cleanup)(struct obd_device *dev);
108         int (*o_connect)(struct obd_conn *conn);
109         int (*o_disconnect)(struct obd_conn *conn);
110         int (*o_statfs)(struct obd_conn *conn, struct statfs *statfs);
111         int (*o_preallocate)(struct obd_conn *, obd_count *req, obd_id *ids);
112         int (*o_create)(struct obd_conn *conn,  struct obdo *oa);
113         int (*o_destroy)(struct obd_conn *conn, struct obdo *oa);
114         int (*o_setattr)(struct obd_conn *conn, struct obdo *oa);
115         int (*o_getattr)(struct obd_conn *conn, struct obdo *oa);
116         int (*o_read)(struct obd_conn *conn, struct obdo *oa, char *buf,
117                       obd_size *count, obd_off offset);
118         int (*o_write)(struct obd_conn *conn, struct obdo *oa, char *buf,
119                        obd_size *count, obd_off offset);
120         int (*o_brw)(int rw, struct obd_conn *conn, obd_count num_oa,
121                      struct obdo **oa, obd_count *oa_bufs, struct page **buf,
122                      obd_size *count, obd_off *offset, obd_flag *flags);
123         int (*o_punch)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
124                        obd_off offset);
125         int (*o_sync)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
126                       obd_off offset);
127         int (*o_migrate)(struct obd_conn *conn, struct obdo *dst,
128                          struct obdo *src, obd_size count, obd_off offset);
129         int (*o_copy)(struct obd_conn *dstconn, struct obdo *dst,
130                       struct obd_conn *srconn, struct obdo *src,
131                       obd_size count, obd_off offset);
132         int (*o_iterate)(struct obd_conn *conn, int (*)(obd_id, obd_gr, void *),
133                          obd_id *startid, obd_gr group, void *data);
134         int (*o_dmaread)(struct obd_conn *conn, int count, struct obd_buf **dest, 
135                          struct obd_bufref **source); 
136         int (*o_pre_dmawrite)(struct obd_conn *conn, int count, struct obd_buf **dstbufs, 
137                          struct obd_bufref **dest); 
138         int (*o_dmawrite)(struct obd_conn *conn, int count, struct obd_buf **dstbufs, 
139                          struct obd_buf **dest); 
140 };
141
142 struct obd_request {
143         struct obdo *oa;
144         struct obd_conn *conn;
145         __u32 plen1;
146         char *pbuf1;
147 };
148
149 static inline int obd_check_conn(struct obd_conn *conn) 
150 {
151         struct obd_device *obd;
152         if (!conn) {
153                 printk("obd_check_conn: NULL conn\n");
154                 return -ENOTCONN;
155         }
156         obd = conn->oc_dev;
157         if (!obd) {
158                 printk("obd_check_conn: NULL obd\n");
159                 return -ENODEV;
160         }
161
162         if (!obd->obd_flags & OBD_ATTACHED ) {
163                 printk("obd_check_conn: obd %d not attached\n", obd->obd_minor); 
164                 return -ENODEV;
165         }
166
167         if (!obd->obd_flags & OBD_SET_UP) {
168                 printk("obd_check_conn: obd %d not setup\n", obd->obd_minor); 
169                 return -ENODEV;
170         }
171
172         if (!obd->obd_type) {
173                 printk("obd_check_conn: obd %d not typed\n", obd->obd_minor);
174                 return -ENODEV;
175         }
176
177         if (!obd->obd_type->typ_ops) {
178                 printk("obd_check_conn: obd %d no operations\n", obd->obd_minor);
179                 return -EOPNOTSUPP;
180         }
181         return 0;
182 }
183
184 #define OBT(dev)        dev->obd_type->typ_ops
185 #define OBP(dev,op)     dev->obd_type->typ_ops->o_ ## op
186
187 #define OBD_CHECK_OP(conn,op) do { \
188         int rc = obd_check_conn(conn);\
189         if (rc) { printk("obd: error in operation: " #op "\n"); return rc; }\
190         if (!OBP(conn->oc_dev,op)) { printk("obd_" #op ": dev %d no operation\n", conn->oc_dev->obd_minor); \
191                 return -EOPNOTSUPP;\
192         }\
193 } while (0)
194
195 static inline int obd_get_info(struct obd_conn *conn, obd_count keylen, void *key,
196                           obd_count *vallen, void **val)
197 {
198         int rc;
199         OBD_CHECK_OP(conn,get_info);
200         
201         rc = OBP(conn->oc_dev, get_info)(conn, keylen, key, vallen, val);
202         EXIT;
203         return rc;
204 }
205
206 static inline int obd_set_info(struct obd_conn *conn, obd_count keylen, void *key,
207                           obd_count vallen, void *val)
208 {
209         int rc;
210         OBD_CHECK_OP(conn,set_info);
211         
212         rc = OBP(conn->oc_dev, set_info)(conn, keylen, key, vallen, val);
213         EXIT;
214         return rc;
215 }
216
217 static inline int obd_cleanup(struct obd_device *obd)
218 {
219         struct obd_conn conn;
220         int rc;
221         conn.oc_dev = obd;
222
223         OBD_CHECK_OP((&conn),cleanup);
224         
225         rc = OBP(conn.oc_dev, cleanup)(obd);
226         EXIT;
227         return rc;
228 }
229
230 static inline int obd_create(struct obd_conn *conn, struct obdo *obdo) 
231 {
232         int rc;
233         OBD_CHECK_OP(conn,create);
234         
235         rc = OBP(conn->oc_dev, create)(conn, obdo);
236         EXIT;
237         return rc;
238 }
239
240 static inline int obd_destroy(struct obd_conn *conn, struct obdo *obdo) 
241 {
242         int rc;
243         OBD_CHECK_OP(conn,destroy);
244         
245         rc = OBP(conn->oc_dev, destroy)(conn, obdo);
246         EXIT;
247         return rc;
248 }
249
250 static inline int obd_getattr(struct obd_conn *conn, struct obdo *obdo) 
251 {
252         int rc;
253         OBD_CHECK_OP(conn,getattr);
254         
255         rc = OBP(conn->oc_dev, getattr)(conn, obdo);
256         EXIT;
257         return rc;
258 }
259
260 static inline int obd_setattr(struct obd_conn *conn, struct obdo *obdo) 
261 {
262         int rc;
263         OBD_CHECK_OP(conn,setattr);
264         
265         rc = OBP(conn->oc_dev, setattr)(conn, obdo);
266         EXIT;
267         return rc;
268 }
269
270 static inline int obd_connect(struct obd_conn *conn)
271 {
272         int rc;
273         OBD_CHECK_OP(conn,connect);
274         
275         rc = OBP(conn->oc_dev, connect)(conn);
276         EXIT;
277         return rc;
278 }
279
280 static inline int obd_disconnect(struct obd_conn *conn)
281 {
282         int rc;
283         OBD_CHECK_OP(conn,disconnect);
284         
285         rc = OBP(conn->oc_dev, disconnect)(conn);
286         EXIT;
287         return rc;
288 }
289
290 #endif 
291
292 /* This value is not arbitrarily chosen.  KIO_STATIC_PAGES from linux/iobuf.h */
293 #define MAX_IOVEC       (KIO_STATIC_PAGES - 1)
294
295
296 /*
297  *  ======== OBD Metadata Support  ===========
298  */
299
300 extern int obd_init_obdo_cache(void);
301 extern void obd_cleanup_obdo_cache(void);
302
303
304 static inline int obdo_has_inline(struct obdo *obdo)
305 {
306         return (obdo->o_valid & OBD_MD_FLINLINE &&
307                 obdo->o_obdflags & OBD_FL_INLINEDATA);
308 };
309
310 static inline int obdo_has_obdmd(struct obdo *obdo)
311 {
312         return (obdo->o_valid & OBD_MD_FLOBDMD &&
313                 obdo->o_obdflags & OBD_FL_OBDMDEXISTS);
314 };
315
316 #ifdef __KERNEL__
317 /* support routines */
318 extern kmem_cache_t *obdo_cachep;
319
320 static __inline__ struct obdo *obdo_alloc(void)
321 {
322         struct obdo *oa = NULL;
323
324         oa = kmem_cache_alloc(obdo_cachep, SLAB_KERNEL);
325         memset(oa, 0, sizeof (*oa));
326
327         return oa;
328 }
329
330 static __inline__ void obdo_free(struct obdo *oa)
331 {
332         if ( !oa ) 
333                 return;
334         kmem_cache_free(obdo_cachep, oa);
335 }
336
337 static __inline__ struct obdo *obdo_fromid(struct obd_conn *conn, obd_id id,
338                                            obd_mode mode, obd_flag valid)
339 {
340         struct obdo *oa;
341         int err;
342
343         ENTRY;
344         oa = obdo_alloc();
345         if ( !oa ) {
346                 EXIT;
347                 return ERR_PTR(-ENOMEM);
348         }
349
350         oa->o_id = id;
351         oa->o_mode = mode;
352         oa->o_valid = valid;
353         if ((err = OBP(conn->oc_dev, getattr)(conn, oa))) {
354                 obdo_free(oa);
355                 EXIT;
356                 return ERR_PTR(err);
357         }
358         EXIT;
359         return oa;
360 }
361
362 static inline void obdo_from_iattr(struct obdo *oa, struct iattr *attr)
363 {
364         unsigned int ia_valid = attr->ia_valid;
365
366         if (ia_valid & ATTR_ATIME) {
367                 oa->o_atime = attr->ia_atime;
368                 oa->o_valid |= OBD_MD_FLATIME;
369         }
370         if (ia_valid & ATTR_MTIME) {
371                 oa->o_mtime = attr->ia_mtime;
372                 oa->o_valid |= OBD_MD_FLMTIME;
373         }
374         if (ia_valid & ATTR_CTIME) {
375                 oa->o_ctime = attr->ia_ctime;
376                 oa->o_valid |= OBD_MD_FLCTIME;
377         }
378         if (ia_valid & ATTR_SIZE) {
379                 oa->o_size = attr->ia_size;
380                 oa->o_valid |= OBD_MD_FLSIZE;
381         }
382         if (ia_valid & ATTR_MODE) {
383                 oa->o_mode = attr->ia_mode;
384                 oa->o_valid |= OBD_MD_FLMODE;
385                 if (!in_group_p(oa->o_gid) && !capable(CAP_FSETID))
386                         oa->o_mode &= ~S_ISGID;
387         }
388         if (ia_valid & ATTR_UID)
389         {
390                 oa->o_uid = attr->ia_uid;
391                 oa->o_valid |= OBD_MD_FLUID;
392         }
393         if (ia_valid & ATTR_GID) {
394                 oa->o_gid = attr->ia_gid;
395                 oa->o_valid |= OBD_MD_FLGID;
396         }
397 }
398
399
400 static inline void iattr_from_obdo(struct iattr *attr, struct obdo *oa)
401 {
402         unsigned int ia_valid = oa->o_valid;
403         
404         memset(attr, 0, sizeof(*attr));
405         if (ia_valid & OBD_MD_FLATIME) {
406                 attr->ia_atime = oa->o_atime;
407                 attr->ia_valid |= ATTR_ATIME;
408         }
409         if (ia_valid & OBD_MD_FLMTIME) {
410                 attr->ia_mtime = oa->o_mtime;
411                 attr->ia_valid |= ATTR_MTIME;
412         }
413         if (ia_valid & OBD_MD_FLCTIME) {
414                 attr->ia_ctime = oa->o_ctime;
415                 attr->ia_valid |= ATTR_CTIME;
416         }
417         if (ia_valid & OBD_MD_FLSIZE) {
418                 attr->ia_size = oa->o_size;
419                 attr->ia_valid |= ATTR_SIZE;
420         }
421         if (ia_valid & OBD_MD_FLMODE) {
422                 attr->ia_mode = oa->o_mode;
423                 attr->ia_valid |= ATTR_MODE;
424                 if (!in_group_p(oa->o_gid) && !capable(CAP_FSETID))
425                         attr->ia_mode &= ~S_ISGID;
426         }
427         if (ia_valid & OBD_MD_FLUID)
428         {
429                 attr->ia_uid = oa->o_uid;
430                 attr->ia_valid |= ATTR_UID;
431         }
432         if (ia_valid & OBD_MD_FLGID) {
433                 attr->ia_gid = oa->o_gid;
434                 attr->ia_valid |= ATTR_GID;
435         }
436 }
437
438
439 /* WARNING: the file systems must take care not to tinker with
440    attributes they don't manage (such as blocks). */
441
442 static __inline__ void obdo_from_inode(struct obdo *dst, struct inode *src)
443 {
444         if ( dst->o_valid & OBD_MD_FLID )
445                 dst->o_id = src->i_ino;
446         if ( dst->o_valid & OBD_MD_FLATIME )
447                 dst->o_atime = src->i_atime;
448         if ( dst->o_valid & OBD_MD_FLMTIME )
449                 dst->o_mtime = src->i_mtime;
450         if ( dst->o_valid & OBD_MD_FLCTIME )
451                 dst->o_ctime = src->i_ctime;
452         if ( dst->o_valid & OBD_MD_FLSIZE )
453                 dst->o_size = src->i_size;
454         if ( dst->o_valid & OBD_MD_FLBLOCKS )   /* allocation of space */
455                 dst->o_blocks = src->i_blocks;
456         if ( dst->o_valid & OBD_MD_FLBLKSZ )
457                 dst->o_blksize = src->i_blksize;
458         if ( dst->o_valid & OBD_MD_FLMODE )
459                 dst->o_mode = src->i_mode;
460         if ( dst->o_valid & OBD_MD_FLUID )
461                 dst->o_uid = src->i_uid;
462         if ( dst->o_valid & OBD_MD_FLGID )
463                 dst->o_gid = src->i_gid;
464         if ( dst->o_valid & OBD_MD_FLFLAGS )
465                 dst->o_flags = src->i_flags;
466         if ( dst->o_valid & OBD_MD_FLNLINK )
467                 dst->o_nlink = src->i_nlink;
468         if ( dst->o_valid & OBD_MD_FLGENER ) 
469                 dst->o_generation = src->i_generation;
470 }
471
472 static __inline__ void obdo_to_inode(struct inode *dst, struct obdo *src)
473 {
474
475         if ( src->o_valid & OBD_MD_FLID )
476                 dst->i_ino = src->o_id;
477         if ( src->o_valid & OBD_MD_FLATIME ) 
478                 dst->i_atime = src->o_atime;
479         if ( src->o_valid & OBD_MD_FLMTIME ) 
480                 dst->i_mtime = src->o_mtime;
481         if ( src->o_valid & OBD_MD_FLCTIME ) 
482                 dst->i_ctime = src->o_ctime;
483         if ( src->o_valid & OBD_MD_FLSIZE ) 
484                 dst->i_size = src->o_size;
485         if ( src->o_valid & OBD_MD_FLBLOCKS ) /* allocation of space */
486                 dst->i_blocks = src->o_blocks;
487         if ( src->o_valid & OBD_MD_FLBLKSZ )
488                 dst->i_blksize = src->o_blksize;
489         if ( src->o_valid & OBD_MD_FLMODE ) 
490                 dst->i_mode = src->o_mode;
491         if ( src->o_valid & OBD_MD_FLUID ) 
492                 dst->i_uid = src->o_uid;
493         if ( src->o_valid & OBD_MD_FLGID ) 
494                 dst->i_gid = src->o_gid;
495         if ( src->o_valid & OBD_MD_FLFLAGS ) 
496                 dst->i_flags = src->o_flags;
497         if ( src->o_valid & OBD_MD_FLNLINK )
498                 dst->i_nlink = src->o_nlink;
499         if ( src->o_valid & OBD_MD_FLGENER )
500                 dst->i_generation = src->o_generation;
501 }
502
503 #endif 
504
505 static __inline__ void obdo_cpy_md(struct obdo *dst, struct obdo *src)
506 {
507 #ifdef __KERNEL__
508         CDEBUG(D_INODE, "src obdo %Ld valid 0x%x, dst obdo %Ld\n",
509                src->o_id, src->o_valid, dst->o_id);
510 #endif
511         if ( src->o_valid & OBD_MD_FLATIME ) 
512                 dst->o_atime = src->o_atime;
513         if ( src->o_valid & OBD_MD_FLMTIME ) 
514                 dst->o_mtime = src->o_mtime;
515         if ( src->o_valid & OBD_MD_FLCTIME ) 
516                 dst->o_ctime = src->o_ctime;
517         if ( src->o_valid & OBD_MD_FLSIZE ) 
518                 dst->o_size = src->o_size;
519         if ( src->o_valid & OBD_MD_FLBLOCKS ) /* allocation of space */
520                 dst->o_blocks = src->o_blocks;
521         if ( src->o_valid & OBD_MD_FLBLKSZ )
522                 dst->o_blksize = src->o_blksize;
523         if ( src->o_valid & OBD_MD_FLMODE ) 
524                 dst->o_mode = src->o_mode;
525         if ( src->o_valid & OBD_MD_FLUID ) 
526                 dst->o_uid = src->o_uid;
527         if ( src->o_valid & OBD_MD_FLGID ) 
528                 dst->o_gid = src->o_gid;
529         if ( src->o_valid & OBD_MD_FLFLAGS ) 
530                 dst->o_flags = src->o_flags;
531         /*
532         if ( src->o_valid & OBD_MD_FLOBDFLG ) 
533                 dst->o_obdflags = src->o_obdflags;
534         */
535         if ( src->o_valid & OBD_MD_FLNLINK ) 
536                 dst->o_nlink = src->o_nlink;
537         if ( src->o_valid & OBD_MD_FLGENER ) 
538                 dst->o_generation = src->o_generation;
539         if ( src->o_valid & OBD_MD_FLINLINE &&
540              src->o_obdflags & OBD_FL_INLINEDATA) {
541                 memcpy(dst->o_inline, src->o_inline, sizeof(src->o_inline));
542                 dst->o_obdflags |= OBD_FL_INLINEDATA;
543         }
544         if ( src->o_valid & OBD_MD_FLOBDMD &&
545              src->o_obdflags & OBD_FL_OBDMDEXISTS) {
546                 memcpy(dst->o_obdmd, src->o_obdmd, sizeof(src->o_obdmd));
547                 dst->o_obdflags |= OBD_FL_OBDMDEXISTS;
548         }
549
550         dst->o_valid |= src->o_valid;
551 }
552
553
554 /* returns FALSE if comparison (by flags) is same, TRUE if changed */
555 static __inline__ int obdo_cmp_md(struct obdo *dst, struct obdo *src,
556                                   obd_flag compare)
557 {
558         int res = 0;
559
560         if ( compare & OBD_MD_FLATIME )
561                 res = (res || (dst->o_atime != src->o_atime));
562         if ( compare & OBD_MD_FLMTIME )
563                 res = (res || (dst->o_mtime != src->o_mtime));
564         if ( compare & OBD_MD_FLCTIME )
565                 res = (res || (dst->o_ctime != src->o_ctime));
566         if ( compare & OBD_MD_FLSIZE )
567                 res = (res || (dst->o_size != src->o_size));
568         if ( compare & OBD_MD_FLBLOCKS ) /* allocation of space */
569                 res = (res || (dst->o_blocks != src->o_blocks));
570         if ( compare & OBD_MD_FLBLKSZ )
571                 res = (res || (dst->o_blksize != src->o_blksize));
572         if ( compare & OBD_MD_FLMODE )
573                 res = (res || (dst->o_mode != src->o_mode));
574         if ( compare & OBD_MD_FLUID )
575                 res = (res || (dst->o_uid != src->o_uid));
576         if ( compare & OBD_MD_FLGID )
577                 res = (res || (dst->o_gid != src->o_gid));
578         if ( compare & OBD_MD_FLFLAGS ) 
579                 res = (res || (dst->o_flags != src->o_flags));
580         if ( compare & OBD_MD_FLNLINK )
581                 res = (res || (dst->o_nlink != src->o_nlink));
582         if ( compare & OBD_MD_FLGENER )
583                 res = (res || (dst->o_generation != src->o_generation));
584         /* XXX Don't know if thses should be included here - wasn't previously
585         if ( compare & OBD_MD_FLINLINE )
586                 res = (res || memcmp(dst->o_inline, src->o_inline));
587         if ( compare & OBD_MD_FLOBDMD )
588                 res = (res || memcmp(dst->o_obdmd, src->o_obdmd));
589         */
590         return res;
591 }
592
593
594 #ifdef __KERNEL__
595 int obd_register_type(struct obd_ops *ops, char *nm);
596 int obd_unregister_type(char *nm);
597
598 struct obd_client {
599         struct list_head cli_chain;
600         struct obd_device *cli_obd;
601         unsigned int cli_id;
602         unsigned long cli_prealloc_quota;
603         struct list_head cli_prealloc_inodes;
604 };
605
606
607 struct obd_prealloc_inode {
608         struct list_head obd_prealloc_chain;
609         unsigned long inode;
610 };
611
612 /* generic operations shared by various OBD types */
613 int gen_multi_setup(struct obd_device *obddev, uint32_t len, void *data);
614 int gen_multi_cleanup(struct obd_device *obddev);
615 int gen_multi_attach(struct obd_device *obddev, uint32_t len, void *data);
616 int gen_multi_detach(struct obd_device *obddev);
617 int gen_connect (struct obd_conn *conn);
618 int gen_disconnect(struct obd_conn *conn);
619 struct obd_client *gen_client(const struct obd_conn *);
620 int gen_cleanup(struct obd_device *obddev);
621 int gen_copy_data(struct obd_conn *dst_conn, struct obdo *dst,
622                   struct obd_conn *src_conn, struct obdo *src,
623                   obd_size count, obd_off offset);
624
625 #endif
626
627 /* sysctl.c */
628 extern void obd_sysctl_init (void);
629 extern void obd_sysctl_clean (void);
630
631 #define CHKCONN(conn)   do { if (!gen_client(conn)) {\
632                 printk("%s %d invalid client %u\n", __FILE__, __LINE__, \
633                        conn->oc_id);\
634                 return -EINVAL; }} while (0) 
635
636
637
638 #endif /* __LINUX_CLASS_OBD_H */