+ else
+ RET_ERR(EINVAL);
+ return 0;
+}
+
+struct odes *
+obj_read_bucket(struct buck2obj_buf *buf, struct mempool *pool, uns buck_type, uns buck_len, struct fastbuf *body, uns *body_start)
+{
+ struct odes *o = obj_new(pool);
+ if (buck2obj_parse(buf, buck_type, buck_len, body, o, body_start, o) < 0)
+ return NULL;
+ else
+ return o;
+}
+
+int
+obj_read(struct fastbuf *f, struct odes *o)
+{
+ byte buf[MAX_ATTR_SIZE];
+
+ while (bgets(f, buf, sizeof(buf)))
+ {
+ if (!buf[0])
+ return 1;
+ obj_add_attr(o, buf[0], buf+1);
+ }
+ return 0;
+}
+
+void
+obj_read_multi(struct fastbuf *f, struct odes *o)
+{
+ /* Read a multi-part object ending with either EOF or a NUL character */
+ byte buf[MAX_ATTR_SIZE];
+ while (bpeekc(f) > 0 && bgets(f, buf, sizeof(buf)))
+ if (buf[0])
+ obj_add_attr(o, buf[0], buf+1);