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

TOMOYO Linux Cross Reference
Linux/include/linux/zpool.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 /*
  3  * zpool memory storage api
  4  *
  5  * Copyright (C) 2014 Dan Streetman
  6  *
  7  * This is a common frontend for the zbud and zsmalloc memory
  8  * storage pool implementations.  Typically, this is used to
  9  * store compressed memory.
 10  */
 11 
 12 #ifndef _ZPOOL_H_
 13 #define _ZPOOL_H_
 14 
 15 struct zpool;
 16 
 17 /*
 18  * Control how a handle is mapped.  It will be ignored if the
 19  * implementation does not support it.  Its use is optional.
 20  * Note that this does not refer to memory protection, it
 21  * refers to how the memory will be copied in/out if copying
 22  * is necessary during mapping; read-write is the safest as
 23  * it copies the existing memory in on map, and copies the
 24  * changed memory back out on unmap.  Write-only does not copy
 25  * in the memory and should only be used for initialization.
 26  * If in doubt, use ZPOOL_MM_DEFAULT which is read-write.
 27  */
 28 enum zpool_mapmode {
 29         ZPOOL_MM_RW, /* normal read-write mapping */
 30         ZPOOL_MM_RO, /* read-only (no copy-out at unmap time) */
 31         ZPOOL_MM_WO, /* write-only (no copy-in at map time) */
 32 
 33         ZPOOL_MM_DEFAULT = ZPOOL_MM_RW
 34 };
 35 
 36 bool zpool_has_pool(char *type);
 37 
 38 struct zpool *zpool_create_pool(const char *type, const char *name, gfp_t gfp);
 39 
 40 const char *zpool_get_type(struct zpool *pool);
 41 
 42 void zpool_destroy_pool(struct zpool *pool);
 43 
 44 bool zpool_malloc_support_movable(struct zpool *pool);
 45 
 46 int zpool_malloc(struct zpool *pool, size_t size, gfp_t gfp,
 47                         unsigned long *handle);
 48 
 49 void zpool_free(struct zpool *pool, unsigned long handle);
 50 
 51 void *zpool_map_handle(struct zpool *pool, unsigned long handle,
 52                         enum zpool_mapmode mm);
 53 
 54 void zpool_unmap_handle(struct zpool *pool, unsigned long handle);
 55 
 56 u64 zpool_get_total_pages(struct zpool *pool);
 57 
 58 
 59 /**
 60  * struct zpool_driver - driver implementation for zpool
 61  * @type:       name of the driver.
 62  * @list:       entry in the list of zpool drivers.
 63  * @create:     create a new pool.
 64  * @destroy:    destroy a pool.
 65  * @malloc:     allocate mem from a pool.
 66  * @free:       free mem from a pool.
 67  * @sleep_mapped: whether zpool driver can sleep during map.
 68  * @map:        map a handle.
 69  * @unmap:      unmap a handle.
 70  * @total_size: get total size of a pool.
 71  *
 72  * This is created by a zpool implementation and registered
 73  * with zpool.
 74  */
 75 struct zpool_driver {
 76         char *type;
 77         struct module *owner;
 78         atomic_t refcount;
 79         struct list_head list;
 80 
 81         void *(*create)(const char *name, gfp_t gfp);
 82         void (*destroy)(void *pool);
 83 
 84         bool malloc_support_movable;
 85         int (*malloc)(void *pool, size_t size, gfp_t gfp,
 86                                 unsigned long *handle);
 87         void (*free)(void *pool, unsigned long handle);
 88 
 89         bool sleep_mapped;
 90         void *(*map)(void *pool, unsigned long handle,
 91                                 enum zpool_mapmode mm);
 92         void (*unmap)(void *pool, unsigned long handle);
 93 
 94         u64 (*total_pages)(void *pool);
 95 };
 96 
 97 void zpool_register_driver(struct zpool_driver *driver);
 98 
 99 int zpool_unregister_driver(struct zpool_driver *driver);
100 
101 bool zpool_can_sleep_mapped(struct zpool *pool);
102 
103 #endif
104 

~ [ 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