]> git.proxmox.com Git - mirror_zfs.git/blame - contrib/pyzfs/libzfs_core/_constants.py
pyzfs: add missing libzfs_core functions
[mirror_zfs.git] / contrib / pyzfs / libzfs_core / _constants.py
CommitLineData
85ce3f4f 1#
2# Copyright 2015 ClusterHQ
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
6abf9225
AG
16
17"""
18Important `libzfs_core` constants.
19"""
20
85ce3f4f 21
22# https://stackoverflow.com/a/1695250
23def enum(*sequential, **named):
24 enums = dict(zip(sequential, range(len(sequential))), **named)
25 return type('Enum', (), enums)
26
27
6abf9225
AG
28#: Maximum length of any ZFS name.
29MAXNAMELEN = 255
85ce3f4f 30#: Default channel program limits
31ZCP_DEFAULT_INSTRLIMIT = 10 * 1000 * 1000
32ZCP_DEFAULT_MEMLIMIT = 10 * 1024 * 1024
33#: Encryption wrapping key length
34WRAPPING_KEY_LEN = 32
35#: Encryption key location enum
36zfs_key_location = enum(
37 'ZFS_KEYLOCATION_NONE',
38 'ZFS_KEYLOCATION_PROMPT',
39 'ZFS_KEYLOCATION_URI'
40)
41#: Encryption key format enum
42zfs_keyformat = enum(
43 'ZFS_KEYFORMAT_NONE',
44 'ZFS_KEYFORMAT_RAW',
45 'ZFS_KEYFORMAT_HEX',
46 'ZFS_KEYFORMAT_PASSPHRASE'
47)
48# Encryption algorithms enum
49zio_encrypt = enum(
50 'ZIO_CRYPT_INHERIT',
51 'ZIO_CRYPT_ON',
52 'ZIO_CRYPT_OFF',
53 'ZIO_CRYPT_AES_128_CCM',
54 'ZIO_CRYPT_AES_192_CCM',
55 'ZIO_CRYPT_AES_256_CCM',
56 'ZIO_CRYPT_AES_128_GCM',
57 'ZIO_CRYPT_AES_192_GCM',
58 'ZIO_CRYPT_AES_256_GCM'
59)
c962fd6c 60# ZFS-specific error codes
61ZFS_ERR_CHECKPOINT_EXISTS = 1024
62ZFS_ERR_DISCARDING_CHECKPOINT = 1025
63ZFS_ERR_NO_CHECKPOINT = 1026
64ZFS_ERR_DEVRM_IN_PROGRESS = 1027
65ZFS_ERR_VDEV_TOO_BIG = 1028
66
6abf9225
AG
67
68# vim: softtabstop=4 tabstop=4 expandtab shiftwidth=4