drm/i915: Fix oops on HWS unload
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / fs / ceph / pagelist.h
blobe8a4187e1087aa7fbc86a2620764f87f234dfe0a
1 #ifndef __FS_CEPH_PAGELIST_H
2 #define __FS_CEPH_PAGELIST_H
4 #include <linux/list.h>
6 struct ceph_pagelist {
7 struct list_head head;
8 void *mapped_tail;
9 size_t length;
10 size_t room;
13 static inline void ceph_pagelist_init(struct ceph_pagelist *pl)
15 INIT_LIST_HEAD(&pl->head);
16 pl->mapped_tail = NULL;
17 pl->length = 0;
18 pl->room = 0;
20 extern int ceph_pagelist_release(struct ceph_pagelist *pl);
22 extern int ceph_pagelist_append(struct ceph_pagelist *pl, void *d, size_t l);
24 static inline int ceph_pagelist_encode_64(struct ceph_pagelist *pl, u64 v)
26 __le64 ev = cpu_to_le64(v);
27 return ceph_pagelist_append(pl, &ev, sizeof(ev));
29 static inline int ceph_pagelist_encode_32(struct ceph_pagelist *pl, u32 v)
31 __le32 ev = cpu_to_le32(v);
32 return ceph_pagelist_append(pl, &ev, sizeof(ev));
34 static inline int ceph_pagelist_encode_16(struct ceph_pagelist *pl, u16 v)
36 __le16 ev = cpu_to_le16(v);
37 return ceph_pagelist_append(pl, &ev, sizeof(ev));
39 static inline int ceph_pagelist_encode_8(struct ceph_pagelist *pl, u8 v)
41 return ceph_pagelist_append(pl, &v, 1);
43 static inline int ceph_pagelist_encode_string(struct ceph_pagelist *pl,
44 char *s, size_t len)
46 int ret = ceph_pagelist_encode_32(pl, len);
47 if (ret)
48 return ret;
49 if (len)
50 return ceph_pagelist_append(pl, s, len);
51 return 0;
54 #endif