~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/ceph/pagelist.h

Version: ~ [ linux-5.4 ] ~ [ linux-5.3.13 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.86 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.156 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.203 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.202 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.78 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __FS_CEPH_PAGELIST_H
  2 #define __FS_CEPH_PAGELIST_H
  3 
  4 #include <asm/byteorder.h>
  5 #include <linux/atomic.h>
  6 #include <linux/list.h>
  7 #include <linux/types.h>
  8 
  9 struct ceph_pagelist {
 10         struct list_head head;
 11         void *mapped_tail;
 12         size_t length;
 13         size_t room;
 14         struct list_head free_list;
 15         size_t num_pages_free;
 16         atomic_t refcnt;
 17 };
 18 
 19 struct ceph_pagelist_cursor {
 20         struct ceph_pagelist *pl;   /* pagelist, for error checking */
 21         struct list_head *page_lru; /* page in list */
 22         size_t room;                /* room remaining to reset to */
 23 };
 24 
 25 static inline void ceph_pagelist_init(struct ceph_pagelist *pl)
 26 {
 27         INIT_LIST_HEAD(&pl->head);
 28         pl->mapped_tail = NULL;
 29         pl->length = 0;
 30         pl->room = 0;
 31         INIT_LIST_HEAD(&pl->free_list);
 32         pl->num_pages_free = 0;
 33         atomic_set(&pl->refcnt, 1);
 34 }
 35 
 36 extern void ceph_pagelist_release(struct ceph_pagelist *pl);
 37 
 38 extern int ceph_pagelist_append(struct ceph_pagelist *pl, const void *d, size_t l);
 39 
 40 extern int ceph_pagelist_reserve(struct ceph_pagelist *pl, size_t space);
 41 
 42 extern int ceph_pagelist_free_reserve(struct ceph_pagelist *pl);
 43 
 44 extern void ceph_pagelist_set_cursor(struct ceph_pagelist *pl,
 45                                      struct ceph_pagelist_cursor *c);
 46 
 47 extern int ceph_pagelist_truncate(struct ceph_pagelist *pl,
 48                                   struct ceph_pagelist_cursor *c);
 49 
 50 static inline int ceph_pagelist_encode_64(struct ceph_pagelist *pl, u64 v)
 51 {
 52         __le64 ev = cpu_to_le64(v);
 53         return ceph_pagelist_append(pl, &ev, sizeof(ev));
 54 }
 55 static inline int ceph_pagelist_encode_32(struct ceph_pagelist *pl, u32 v)
 56 {
 57         __le32 ev = cpu_to_le32(v);
 58         return ceph_pagelist_append(pl, &ev, sizeof(ev));
 59 }
 60 static inline int ceph_pagelist_encode_16(struct ceph_pagelist *pl, u16 v)
 61 {
 62         __le16 ev = cpu_to_le16(v);
 63         return ceph_pagelist_append(pl, &ev, sizeof(ev));
 64 }
 65 static inline int ceph_pagelist_encode_8(struct ceph_pagelist *pl, u8 v)
 66 {
 67         return ceph_pagelist_append(pl, &v, 1);
 68 }
 69 static inline int ceph_pagelist_encode_string(struct ceph_pagelist *pl,
 70                                               char *s, size_t len)
 71 {
 72         int ret = ceph_pagelist_encode_32(pl, len);
 73         if (ret)
 74                 return ret;
 75         if (len)
 76                 return ceph_pagelist_append(pl, s, len);
 77         return 0;
 78 }
 79 
 80 #endif
 81 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp