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

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

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php