Whamcloud - gitweb
ext2obd/ext2_obd.c, snap/snap.c: change parameters for create
[fs/lustre-release.git] / lustre / include / linux / obd_class.h
index 50e4b68..ae618f7 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/obd_rpc.h>
 
 
-#define OBD_PSDEV_MAJOR 120
+#define OBD_PSDEV_MAJOR 186
 #define MAX_OBD_DEVICES 8
 #define MAX_MULTI 16
 
@@ -84,23 +84,24 @@ struct obd_ops {
        int (*o_setattr)(struct obd_conn *, obdattr *oa);
        int (*o_getattr)(struct obd_conn *, obdattr *oa);
        int (*o_statfs)(struct obd_conn *, struct statfs *statfs);
-       int (*o_create)(struct obd_conn *, int prealloc_ino, int *er);
+       int (*o_create)(struct obd_conn *, int prealloc_obj, objid *id);
        int (*o_destroy)(struct obd_conn *, obdattr *oa);
-       int (*o_read)(struct obd_conn *, obdattr *ino, char *buf, unsigned long *count, loff_t offset);
+       int (*o_read)(struct obd_conn *, obdattr *oa, char *buf, unsigned long *count, loff_t offset);
        int (*o_read2)(struct obd_conn *, obdattr *oa, char *buf, unsigned long *count, loff_t offset);
        int (*o_write)(struct obd_conn *, obdattr *oa, char *buf, unsigned long *count, loff_t offset);
-       int (*o_brw)(int rw, struct obd_conn * conn, obdattr *obj, struct page *page, int create);
+       int (*o_brw)(int rw, struct obd_conn * conn, obdattr *oa, struct page *page, int create);
        int (*o_preallocate)(struct obd_conn *, unsigned long *req, long inodes[32]);
-       int  (*o_get_info)(struct obd_conn *, int keylen, void *key, int *vallen, void **val);
-       int  (*o_set_info)(struct obd_conn *, int keylen, void *key, int vallen, void *val);
-       int (*o_migrate)(struct obd_conn *, obdattr *src, obdattr *dst);
-       int (*o_copy)(struct obd_conn *dev, obdattr *source, obdattr *target);
+       int (*o_get_info)(struct obd_conn *, int keylen, void *key, int *vallen, void **val);
+       int (*o_set_info)(struct obd_conn *, int keylen, void *key, int vallen, void *val);
+       int (*o_migrate)(struct obd_conn *, obdattr *dst, obdattr *src);
+       int (*o_copy)(struct obd_conn *dev, obdattr *dst, obdattr *src);
        int (*o_iocontrol)(int cmd, struct obd_conn *, int len, void *karg, void *uarg);
        int (*o_iterate)(struct obd_conn *, int (*)(objid, void *), objid, void *);
 
 };
 
-#define OBP(dev,op) dev->obd_type->typ_ops->o_ ## op
+#define OBT(dev)       dev->obd_type->typ_ops
+#define OBP(dev,op)    dev->obd_type->typ_ops->o_ ## op
 
 int obd_register_type(struct obd_ops *ops, char *nm);
 int obd_unregister_type(char *nm);
@@ -165,7 +166,7 @@ struct oic_attr_s {
 struct ioc_mv_s {
        unsigned int conn_id;
        objid  src;
-       objid  tgt;
+       objid  dst;
 };
 
 struct oic_rw_s {
@@ -255,70 +256,89 @@ static __inline__ obdattr *obd_oa_fromid(struct obd_conn *conn,  objid id)
        return res;
 }
 
-#define OBD_MD_FLMODE   (1UL<<1)
-#define OBD_MD_FLUID    (1UL<<2)
-#define OBD_MD_FLGID    (1UL<<3)
-#define OBD_MD_FLSIZE   (1UL<<4)
-#define OBD_MD_FLATIME  (1UL<<5)
-#define OBD_MD_FLMTIME  (1UL<<6)
-#define OBD_MD_FLCTIME  (1UL<<7)
-#define OBD_MD_FLFLAGS  (1UL<<8)
-#define OBD_MD_FLBLOCKS (1UL<<9)
-#define OBD_MD_FLOBDMD  (1UL<<10)
+#define OBD_MD_NO      (1UL)       /* negates meaning of all flags */
+#define OBD_MD_ALL     (OBD_MD_NO) /* passing NO with no other flags == ALL */
+#define OBD_MD_FLMODE  (1UL<<1)
+#define OBD_MD_FLUID   (1UL<<2)
+#define OBD_MD_FLGID   (1UL<<3)
+#define OBD_MD_FLSIZE  (1UL<<4)
+#define OBD_MD_FLATIME (1UL<<5)
+#define OBD_MD_FLMTIME (1UL<<6)
+#define OBD_MD_FLCTIME (1UL<<7)
+#define OBD_MD_FLFLAGS (1UL<<8)
+#define OBD_MD_FLBLOCKS        (1UL<<9)
+#define OBD_MD_FLOBDMD (1UL<<10)
 
 
 static __inline__ void obdo_cpy_md(obdattr *dst, obdattr *src, int mask)
 {
+       /* If the OBD_MD_NO flag is set, then we copy all EXCEPT those
+        * fields given by the flags.  The default is to copy the field
+        * given by the flags.
+        */
+       if (mask & OBD_MD_NO)
+               mask = ~mask;
+
        CDEBUG(D_INODE, "flags %x\n", mask);
-       if ( ! (mask & OBD_MD_FLMODE) ) 
+       if ( mask & OBD_MD_FLMODE ) 
                dst->i_mode = src->i_mode;
-       if ( ! (mask & OBD_MD_FLUID) ) 
+       if ( mask & OBD_MD_FLUID ) 
                dst->i_uid = src->i_uid;
-       if ( ! (mask & OBD_MD_FLGID) ) 
+       if ( mask & OBD_MD_FLGID ) 
                dst->i_gid = src->i_gid;
-       if ( ! (mask & OBD_MD_FLSIZE) ) 
+       if ( mask & OBD_MD_FLSIZE ) 
                dst->i_size = src->i_size;
-       if ( ! (mask & OBD_MD_FLATIME) ) 
+       if ( mask & OBD_MD_FLATIME ) 
                dst->i_atime = src->i_atime;
-       if ( ! (mask & OBD_MD_FLMTIME) ) 
+       if ( mask & OBD_MD_FLMTIME ) 
                dst->i_mtime = src->i_mtime;
-       if ( ! (mask & OBD_MD_FLCTIME) ) 
+       if ( mask & OBD_MD_FLCTIME ) 
                dst->i_ctime = src->i_ctime;
-       if ( ! (mask & OBD_MD_FLFLAGS) ) 
+       if ( mask & OBD_MD_FLFLAGS ) 
                dst->i_flags = src->i_flags;
        /* allocation of space */
-       if ( ! (mask & OBD_MD_FLBLOCKS) ) 
+       if ( mask & OBD_MD_FLBLOCKS ) 
                dst->i_blocks = src->i_blocks;
-       if ( ! (mask & OBD_MD_FLOBDMD)  &&  !src->i_blocks ) {
+       if ( mask & OBD_MD_FLOBDMD  &&  src->i_blocks == 0 ) {
                CDEBUG(D_IOCTL, "copying inline data: ino %ld\n", dst->i_ino);
                memcpy(&dst->u.ext2_i.i_data, &src->u.ext2_i.i_data, 
                       sizeof(src->u.ext2_i.i_data));
        } else {
-                       CDEBUG(D_INODE, "XXXX cpy_obdmd: ino %ld iblocks not 0!\n", src->i_ino);
+               CDEBUG(D_INODE, "XXXX cpy_obdmd: ino %ld iblocks not 0!\n",
+                      src->i_ino);
        }
 }
 
+
 static __inline__ int obdo_cmp_md(obdattr *dst, obdattr *src, int mask)
 {
        int res = 1;
-       if ( ! (mask & OBD_MD_FLMODE) ) 
+
+       /* If the OBD_MD_NO flag is set, then we copy all EXCEPT those
+        * fields given by the flags.  The default is to copy the field
+        * given by the flags.
+        */
+       if (mask & OBD_MD_NO)
+               mask = ~mask;
+
+       if ( mask & OBD_MD_FLMODE )
                res = (res && (dst->i_mode == src->i_mode));
-       if ( ! (mask & OBD_MD_FLUID) ) 
+       if ( mask & OBD_MD_FLUID )
                res = (res && (dst->i_uid == src->i_uid));
-       if ( ! (mask & OBD_MD_FLGID) ) 
+       if ( mask & OBD_MD_FLGID )
                res = (res && (dst->i_gid == src->i_gid));
-       if ( ! (mask & OBD_MD_FLSIZE) ) 
+       if ( mask & OBD_MD_FLSIZE )
                res = (res && (dst->i_size == src->i_size));
-       if ( ! (mask & OBD_MD_FLATIME) ) 
+       if ( mask & OBD_MD_FLATIME )
                res = (res && (dst->i_atime == src->i_atime));
-       if ( ! (mask & OBD_MD_FLMTIME) ) 
+       if ( mask & OBD_MD_FLMTIME )
                res = (res && (dst->i_mtime == src->i_mtime));
-       if ( ! (mask & OBD_MD_FLCTIME) ) 
+       if ( mask & OBD_MD_FLCTIME )
                res = (res && (dst->i_ctime == src->i_ctime));
-       if ( ! (mask & OBD_MD_FLFLAGS) ) 
+       if ( mask & OBD_MD_FLFLAGS )
                res = (res && (dst->i_flags == src->i_flags));
        /* allocation of space */
-       if ( ! (mask & OBD_MD_FLBLOCKS) ) 
+       if ( mask & OBD_MD_FLBLOCKS )
                res = (res && (dst->i_blocks == src->i_blocks));
        return res;
 }