typedef uint32_t obd_flag;
typedef uint32_t obd_count;
-#define OBD_FL_INLINEDATA (1UL)
-#define OBD_FL_OBDMDEXISTS (1UL << 1)
+#define OBD_FL_INLINEDATA (0x00000001UL)
+#define OBD_FL_OBDMDEXISTS (0x00000002UL)
#define OBD_INLINESZ 60
#define OBD_OBDMDSZ 60
};
#define OBD_MD_FLALL (~0UL)
-#define OBD_MD_FLID (0x0001UL)
-#define OBD_MD_FLATIME (0x0002UL)
-#define OBD_MD_FLMTIME (0x0004UL)
-#define OBD_MD_FLCTIME (0x0008UL)
-#define OBD_MD_FLSIZE (0x0010UL)
-#define OBD_MD_FLBLOCKS (0x0020UL)
-#define OBD_MD_FLBLKSZ (0x0040UL)
-#define OBD_MD_FLMODE (0x0080UL)
-#define OBD_MD_FLUID (0x0100UL)
-#define OBD_MD_FLGID (0x0200UL)
-#define OBD_MD_FLFLAGS (0x0400UL)
-#define OBD_MD_FLOBDFLG (0x0800UL)
-#define OBD_MD_FLNLINK (0x1000UL)
-#define OBD_MD_FLGENER (0x2000UL)
-#define OBD_MD_FLINLINE (0x4000UL)
-#define OBD_MD_FLOBDMD (0x8000UL)
+#define OBD_MD_FLID (0x00000001UL)
+#define OBD_MD_FLATIME (0x00000002UL)
+#define OBD_MD_FLMTIME (0x00000004UL)
+#define OBD_MD_FLCTIME (0x00000008UL)
+#define OBD_MD_FLSIZE (0x00000010UL)
+#define OBD_MD_FLBLOCKS (0x00000020UL)
+#define OBD_MD_FLBLKSZ (0x00000040UL)
+#define OBD_MD_FLMODE (0x00000080UL)
+#define OBD_MD_FLUID (0x00000100UL)
+#define OBD_MD_FLGID (0x00000200UL)
+#define OBD_MD_FLFLAGS (0x00000400UL)
+#define OBD_MD_FLOBDFLG (0x00000800UL)
+#define OBD_MD_FLNLINK (0x00001000UL)
+#define OBD_MD_FLGENER (0x00002000UL)
+#define OBD_MD_FLINLINE (0x00004000UL)
+#define OBD_MD_FLOBDMD (0x00008000UL)
+#define OBD_MD_FLNOTOBD (~(OBD_MD_FLOBDMD | OBD_MD_FLOBDFLG))
/*
* ======== OBD Device Declarations ===========
* ======== OBD Operations Declarations ===========
*/
+#define OBD_BRW_READ (READ)
+#define OBD_BRW_WRITE (WRITE)
+#define OBD_BRW_RWMASK (READ | WRITE)
+#define OBD_BRW_CREATE (0x00000010UL)
struct obd_ops {
int (*o_iocontrol)(int cmd, struct obd_conn *, int len, void *karg,
obd_size *count, obd_off offset);
int (*o_write)(struct obd_conn *conn, struct obdo *oa, char *buf,
obd_size *count, obd_off offset);
- int (*o_brw)(int rw, struct obd_conn *conn, struct obdo *oa,
- char *buf, obd_size *count, obd_off offset, obd_flag flags);
+ int (*o_brw)(int rw, struct obd_conn *conn, obd_count *num_io,
+ struct obdo **oa, char **buf, obd_size **count,
+ obd_off *offset, obd_flag *flags);
int (*o_punch)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
obd_off offset);
int (*o_sync)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
static __inline__ struct obdo *obdo_alloc(void)
{
- struct obdo *res = NULL;
+ struct obdo *oa = NULL;
- res = kmem_cache_alloc(obdo_cachep, SLAB_KERNEL);
- memset(res, 0, sizeof (*res));
+ oa = kmem_cache_alloc(obdo_cachep, SLAB_KERNEL);
+ memset(oa, 0, sizeof (*oa));
- return res;
+ return oa;
}
static __inline__ void obdo_free(struct obdo *oa)
-static __inline__ struct obdo *obdo_fromid(struct obd_conn *conn, obd_id id)
+static __inline__ struct obdo *obdo_fromid(struct obd_conn *conn, obd_id id,
+ obd_flag valid)
{
- struct obdo *res = NULL;
+ struct obdo *oa;
int err;
- res = kmem_cache_alloc(obdo_cachep, SLAB_KERNEL);
- if ( !res ) {
+ ENTRY;
+ oa = obdo_alloc();
+ if ( !oa ) {
EXIT;
return ERR_PTR(-ENOMEM);
}
- memset(res, 0, sizeof(*res));
- res->o_id = id;
- res->o_valid = OBD_MD_FLALL;
- if ((err = OBP(conn->oc_dev, getattr)(conn, res))) {
- OBD_FREE(res, sizeof(*res));
+ memset(oa, 0, sizeof(*oa));
+ oa->o_id = id;
+ oa->o_valid = valid;
+ if ((err = OBP(conn->oc_dev, getattr)(conn, oa))) {
+ obdo_free(oa);
EXIT;
return ERR_PTR(err);
}
EXIT;
- return res;
+ return oa;
}
static inline void obdo_from_iattr(struct obdo *oa, struct iattr *attr)
dst->o_gid = src->o_gid;
if ( src->o_valid & OBD_MD_FLFLAGS )
dst->o_flags = src->o_flags;
+ /*
if ( src->o_valid & OBD_MD_FLOBDFLG )
dst->o_obdflags = src->o_obdflags;
+ */
if ( src->o_valid & OBD_MD_FLNLINK )
dst->o_nlink = src->o_nlink;
if ( src->o_valid & OBD_MD_FLGENER )
dst->o_generation = src->o_generation;
- if ( src->o_valid & OBD_MD_FLINLINE )
+ if ( src->o_valid & OBD_MD_FLINLINE &&
+ src->o_obdflags & OBD_FL_INLINEDATA) {
memcpy(dst->o_inline, src->o_inline, sizeof(src->o_inline));
- if ( src->o_valid & OBD_MD_FLOBDMD )
+ dst->o_obdflags |= OBD_FL_INLINEDATA;
+ }
+ if ( src->o_valid & OBD_MD_FLOBDMD &&
+ src->o_obdflags & OBD_FL_OBDMDEXISTS) {
memcpy(dst->o_obdmd, src->o_obdmd, sizeof(src->o_obdmd));
+ dst->o_obdflags |= OBD_FL_OBDMDEXISTS;
+ }
dst->o_valid |= src->o_valid;
}
* ======== OBD IOCL Declarations ===========
*/
struct oic_generic {
- long att_connid;
+ uint32_t att_connid;
int att_typelen;
void *att_type;
int att_datalen;
/* for preallocation */
struct oic_prealloc_s {
- uint32_t cli_id;
- uint32_t alloc; /* user sets it to the number of inodes
- * requesting to be preallocated. kernel
- * sets it to the actual number of
- * succesfully preallocated inodes */
- obd_id ids[32]; /* actual inode numbers */
+ uint32_t conn_id;
+ uint32_t alloc; /* user sets it to the number of inodes
+ * requesting to be preallocated. kernel
+ * sets it to the actual number of
+ * succesfully preallocated inodes */
+ obd_id ids[32]; /* actual inode numbers */
};
/* for getattr, setattr, create, destroy */
struct oic_attr_s {
- uint32_t conn_id;
- struct obdo obdo;
+ uint32_t conn_id;
+ struct obdo obdo;
};
/* for copy, migrate */
struct ioc_mv_s {
- uint32_t src_conn_id;
- struct obdo src;
- uint32_t dst_conn_id;
- struct obdo dst;
+ uint32_t src_conn_id;
+ struct obdo src;
+ uint32_t dst_conn_id;
+ struct obdo dst;
};
/* for read/write */
struct oic_rw_s {
- uint32_t conn_id;
- struct obdo obdo;
- char * buf;
- obd_size count;
- obd_off offset;
+ uint32_t conn_id;
+ struct obdo obdo;
+ char *buf;
+ obd_size count;
+ obd_off offset;
};
/* for punch, sync */
struct oic_range_s {
- uint32_t conn_id;
- struct obdo obdo;
- obd_size count;
- obd_off offset;
+ uint32_t conn_id;
+ struct obdo obdo;
+ obd_size count;
+ obd_off offset;
};