Adopt pyzfs from ClusterHQ
This commit introduces several changes:
* Update LICENSE and project information
* Give a good PEP8 talk to existing Python source code
* Add RPM/DEB packaging for pyzfs
* Fix some outstanding issues with the existing pyzfs code caused by
changes in the ABI since the last time the code was updated
* Integrate pyzfs Python unittest with the ZFS Test Suite
* Add missing libzfs_core functions: lzc_change_key,
lzc_channel_program, lzc_channel_program_nosync, lzc_load_key,
lzc_receive_one, lzc_receive_resumable, lzc_receive_with_cmdprops,
lzc_receive_with_header, lzc_reopen, lzc_send_resume, lzc_sync,
lzc_unload_key, lzc_remap
Note: this commit slightly changes zfs_ioc_unload_key() ABI. This allow
to differentiate the case where we tried to unload a key on a
non-existing dataset (ENOENT) from the situation where a dataset has
no key loaded: this is consistent with the "change" case where trying
to zfs_ioc_change_key() from a dataset with no key results in EACCES.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #7230
2018-03-18 08:34:45 +00:00
|
|
|
#
|
|
|
|
# Copyright 2015 ClusterHQ
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
2018-03-03 10:10:34 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
Important `libzfs_core` constants.
|
|
|
|
"""
|
|
|
|
|
Adopt pyzfs from ClusterHQ
This commit introduces several changes:
* Update LICENSE and project information
* Give a good PEP8 talk to existing Python source code
* Add RPM/DEB packaging for pyzfs
* Fix some outstanding issues with the existing pyzfs code caused by
changes in the ABI since the last time the code was updated
* Integrate pyzfs Python unittest with the ZFS Test Suite
* Add missing libzfs_core functions: lzc_change_key,
lzc_channel_program, lzc_channel_program_nosync, lzc_load_key,
lzc_receive_one, lzc_receive_resumable, lzc_receive_with_cmdprops,
lzc_receive_with_header, lzc_reopen, lzc_send_resume, lzc_sync,
lzc_unload_key, lzc_remap
Note: this commit slightly changes zfs_ioc_unload_key() ABI. This allow
to differentiate the case where we tried to unload a key on a
non-existing dataset (ENOENT) from the situation where a dataset has
no key loaded: this is consistent with the "change" case where trying
to zfs_ioc_change_key() from a dataset with no key results in EACCES.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #7230
2018-03-18 08:34:45 +00:00
|
|
|
|
|
|
|
# https://stackoverflow.com/a/1695250
|
|
|
|
def enum(*sequential, **named):
|
|
|
|
enums = dict(zip(sequential, range(len(sequential))), **named)
|
|
|
|
return type('Enum', (), enums)
|
|
|
|
|
|
|
|
|
2018-03-03 10:10:34 +00:00
|
|
|
#: Maximum length of any ZFS name.
|
|
|
|
MAXNAMELEN = 255
|
Adopt pyzfs from ClusterHQ
This commit introduces several changes:
* Update LICENSE and project information
* Give a good PEP8 talk to existing Python source code
* Add RPM/DEB packaging for pyzfs
* Fix some outstanding issues with the existing pyzfs code caused by
changes in the ABI since the last time the code was updated
* Integrate pyzfs Python unittest with the ZFS Test Suite
* Add missing libzfs_core functions: lzc_change_key,
lzc_channel_program, lzc_channel_program_nosync, lzc_load_key,
lzc_receive_one, lzc_receive_resumable, lzc_receive_with_cmdprops,
lzc_receive_with_header, lzc_reopen, lzc_send_resume, lzc_sync,
lzc_unload_key, lzc_remap
Note: this commit slightly changes zfs_ioc_unload_key() ABI. This allow
to differentiate the case where we tried to unload a key on a
non-existing dataset (ENOENT) from the situation where a dataset has
no key loaded: this is consistent with the "change" case where trying
to zfs_ioc_change_key() from a dataset with no key results in EACCES.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #7230
2018-03-18 08:34:45 +00:00
|
|
|
#: Default channel program limits
|
|
|
|
ZCP_DEFAULT_INSTRLIMIT = 10 * 1000 * 1000
|
|
|
|
ZCP_DEFAULT_MEMLIMIT = 10 * 1024 * 1024
|
|
|
|
#: Encryption wrapping key length
|
|
|
|
WRAPPING_KEY_LEN = 32
|
|
|
|
#: Encryption key location enum
|
|
|
|
zfs_key_location = enum(
|
|
|
|
'ZFS_KEYLOCATION_NONE',
|
|
|
|
'ZFS_KEYLOCATION_PROMPT',
|
|
|
|
'ZFS_KEYLOCATION_URI'
|
|
|
|
)
|
|
|
|
#: Encryption key format enum
|
|
|
|
zfs_keyformat = enum(
|
|
|
|
'ZFS_KEYFORMAT_NONE',
|
|
|
|
'ZFS_KEYFORMAT_RAW',
|
|
|
|
'ZFS_KEYFORMAT_HEX',
|
|
|
|
'ZFS_KEYFORMAT_PASSPHRASE'
|
|
|
|
)
|
|
|
|
# Encryption algorithms enum
|
|
|
|
zio_encrypt = enum(
|
|
|
|
'ZIO_CRYPT_INHERIT',
|
|
|
|
'ZIO_CRYPT_ON',
|
|
|
|
'ZIO_CRYPT_OFF',
|
|
|
|
'ZIO_CRYPT_AES_128_CCM',
|
|
|
|
'ZIO_CRYPT_AES_192_CCM',
|
|
|
|
'ZIO_CRYPT_AES_256_CCM',
|
|
|
|
'ZIO_CRYPT_AES_128_GCM',
|
|
|
|
'ZIO_CRYPT_AES_192_GCM',
|
|
|
|
'ZIO_CRYPT_AES_256_GCM'
|
|
|
|
)
|
2018-03-03 10:10:34 +00:00
|
|
|
|
|
|
|
# vim: softtabstop=4 tabstop=4 expandtab shiftwidth=4
|