zfs: merge openzfs/zfs@2163cde45
Notable upstream pull request merges:
#13680 Add options to zfs redundant_metadata property
#13758 Allow mounting snapshots in .zfs/snapshot as a regular user
#13838 quota: disable quota check for ZVOL
#13839 quota: extend quota for dataset
#13973 Fix memory leaks in dmu_send()/dmu_send_obj()
#13977 Avoid unnecessary metaslab_check_free calling
#13978 PAM: Fix unchecked return value from zfs_key_config_load()
#13979 Handle possible null pointers from malloc/strdup/strndup()
#13997 zstream: allow decompress to fix metadata for uncompressed
records
#13998 zvol_wait logic may terminate prematurely
#14001 FreeBSD: Fix a pair of bugs in zfs_fhtovp()
#14003 Stop ganging due to past vdev write errors
#14039 Optimize microzaps
#14050 Fix draid2+2s metadata error on simultaneous 2 drive failures
#14062 zed: Avoid core dump if wholedisk property does not exist
#14077 Propagate extent_bytes change to autotrim thread
#14079 FreeBSD: vn_flush_cached_data: observe vnode locking contract
#14093 Fix ARC target collapse when zfs_arc_meta_limit_percent=100
#14106 Add ability to recompress send streams with new compression
algorithm
#14119 Deny receiving into encrypted datasets if the keys are not
loaded
#14120 Fix arc_p aggressive increase
#14129 zed: Prevent special vdev to be replaced by hot spare
#14133 Expose zfs_vdev_open_timeout_ms as a tunable
#14135 FreeBSD: Fix out of bounds read in zfs_ioctl_ozfs_to_legacy()
#14152 Adds the `-p` option to `zfs holds`
#14161 Handle and detect #13709's unlock regression
Obtained from: OpenZFS
OpenZFS commit: 2163cde450
This commit is contained in:
commit
dbd5678dca
@ -14,6 +14,7 @@ SRCS= \
|
||||
zstream.c \
|
||||
zstream_decompress.c \
|
||||
zstream_dump.c \
|
||||
zstream_recompress.c \
|
||||
zstream_redup.c \
|
||||
zstream_token.c
|
||||
|
||||
|
@ -240,7 +240,8 @@ CDDL_CFLAGS= \
|
||||
CDDL_C= ${CC} -c ${CDDL_CFLAGS} ${WERROR} ${.IMPSRC}
|
||||
|
||||
# Special flags for managing the compat compiles for ZFS
|
||||
ZFS_CFLAGS+= ${CDDL_CFLAGS} -DBUILDING_ZFS -DHAVE_UIO_ZEROCOPY \
|
||||
ZFS_CFLAGS+= -I$S/contrib/openzfs/module/icp/include \
|
||||
${CDDL_CFLAGS} -DBUILDING_ZFS -DHAVE_UIO_ZEROCOPY \
|
||||
-DWITH_NETDUMP -D__KERNEL__ -D_SYS_CONDVAR_H_ -DSMP \
|
||||
-DIN_FREEBSD_BASE
|
||||
|
||||
|
@ -8,7 +8,7 @@ jobs:
|
||||
checkstyle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install dependencies
|
||||
@ -49,7 +49,7 @@ jobs:
|
||||
if: failure() && steps.CheckABI.outcome == 'failure'
|
||||
run: |
|
||||
find -name *.abi | tar -cf abi_files.tar -T -
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: failure() && steps.CheckABI.outcome == 'failure'
|
||||
with:
|
||||
name: New ABI files (use only if you're sure about interface changes)
|
||||
|
36
sys/contrib/openzfs/.github/workflows/codeql.yml
vendored
Normal file
36
sys/contrib/openzfs/.github/workflows/codeql.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp', 'python' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
@ -12,7 +12,7 @@ jobs:
|
||||
os: [18.04, 20.04]
|
||||
runs-on: ubuntu-${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Reclaim disk space
|
||||
@ -72,7 +72,7 @@ jobs:
|
||||
sudo chmod +r $RESULTS_PATH/*
|
||||
# Replace ':' in dir names, actions/upload-artifact doesn't support it
|
||||
for f in $(find /var/tmp/test_results -name '*:*'); do mv "$f" "${f//:/__}"; done
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: Test logs Ubuntu-${{ matrix.os }}
|
||||
|
@ -8,7 +8,7 @@ jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Reclaim disk space
|
||||
@ -68,7 +68,7 @@ jobs:
|
||||
sudo chmod +r $RESULTS_PATH/*
|
||||
# Replace ':' in dir names, actions/upload-artifact doesn't support it
|
||||
for f in $(find /var/tmp/test_results -name '*:*'); do mv "$f" "${f//:/__}"; done
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: Test logs Ubuntu-${{ matrix.os }}
|
||||
|
@ -10,7 +10,7 @@ jobs:
|
||||
env:
|
||||
TEST_DIR: /var/tmp/zloop
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install dependencies
|
||||
@ -45,7 +45,7 @@ jobs:
|
||||
if: failure()
|
||||
run: |
|
||||
sudo chmod +r -R $TEST_DIR/
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: Logs
|
||||
@ -53,7 +53,7 @@ jobs:
|
||||
/var/tmp/zloop/*/
|
||||
!/var/tmp/zloop/*/vdev/
|
||||
if-no-files-found: ignore
|
||||
- uses: actions/upload-artifact@v2
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: Pool files
|
||||
|
@ -20,6 +20,7 @@ CONTRIBUTORS:
|
||||
Alec Salazar <alec.j.salazar@gmail.com>
|
||||
Alejandro R. Sedeño <asedeno@mit.edu>
|
||||
Alek Pinchuk <alek@nexenta.com>
|
||||
Aleksa Sarai <cyphar@cyphar.com>
|
||||
Alex Braunegg <alex.braunegg@gmail.com>
|
||||
Alex McWhirter <alexmcwhirter@triadic.us>
|
||||
Alex Reece <alex@delphix.com>
|
||||
@ -236,6 +237,7 @@ CONTRIBUTORS:
|
||||
Paul Dagnelie <pcd@delphix.com>
|
||||
Paul Zuchowski <pzuchowski@datto.com>
|
||||
Pavel Boldin <boldin.pavel@gmail.com>
|
||||
Pavel Snajdr <snajpa@snajpa.net>
|
||||
Pavel Zakharov <pavel.zakharov@delphix.com>
|
||||
Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||
Pedro Giffuni <pfg@freebsd.org>
|
||||
|
@ -6,5 +6,5 @@ Release: 1
|
||||
Release-Tags: relext
|
||||
License: CDDL
|
||||
Author: OpenZFS
|
||||
Linux-Maximum: 5.19
|
||||
Linux-Maximum: 6.0
|
||||
Linux-Minimum: 3.10
|
||||
|
@ -9,6 +9,7 @@ include $(top_srcdir)/config/Rules.am
|
||||
include $(top_srcdir)/config/CppCheck.am
|
||||
include $(top_srcdir)/config/Shellcheck.am
|
||||
include $(top_srcdir)/config/Substfiles.am
|
||||
include $(top_srcdir)/scripts/Makefile.am
|
||||
|
||||
ACLOCAL_AMFLAGS = -I config
|
||||
|
||||
@ -23,7 +24,6 @@ include $(srcdir)/%D%/contrib/Makefile.am
|
||||
include $(srcdir)/%D%/etc/Makefile.am
|
||||
include $(srcdir)/%D%/lib/Makefile.am
|
||||
include $(srcdir)/%D%/man/Makefile.am
|
||||
include $(srcdir)/%D%/scripts/Makefile.am
|
||||
include $(srcdir)/%D%/tests/Makefile.am
|
||||
if BUILD_LINUX
|
||||
include $(srcdir)/%D%/udev/Makefile.am
|
||||
|
@ -678,9 +678,9 @@ def section_archits(kstats_dict):
|
||||
print()
|
||||
print('Cache hits by data type:')
|
||||
dt_todo = (('Demand data:', arc_stats['demand_data_hits']),
|
||||
('Demand prefetch data:', arc_stats['prefetch_data_hits']),
|
||||
('Prefetch data:', arc_stats['prefetch_data_hits']),
|
||||
('Demand metadata:', arc_stats['demand_metadata_hits']),
|
||||
('Demand prefetch metadata:',
|
||||
('Prefetch metadata:',
|
||||
arc_stats['prefetch_metadata_hits']))
|
||||
|
||||
for title, value in dt_todo:
|
||||
@ -689,10 +689,10 @@ def section_archits(kstats_dict):
|
||||
print()
|
||||
print('Cache misses by data type:')
|
||||
dm_todo = (('Demand data:', arc_stats['demand_data_misses']),
|
||||
('Demand prefetch data:',
|
||||
('Prefetch data:',
|
||||
arc_stats['prefetch_data_misses']),
|
||||
('Demand metadata:', arc_stats['demand_metadata_misses']),
|
||||
('Demand prefetch metadata:',
|
||||
('Prefetch metadata:',
|
||||
arc_stats['prefetch_metadata_misses']))
|
||||
|
||||
for title, value in dm_todo:
|
||||
|
@ -146,8 +146,6 @@ static void process_options(int argc, char **argv)
|
||||
memcpy(o, &rto_opts_defaults, sizeof (*o));
|
||||
|
||||
while ((opt = getopt(argc, argv, "TDBSvha:er:o:d:s:t:")) != -1) {
|
||||
value = 0;
|
||||
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
value = strtoull(optarg, NULL, 0);
|
||||
@ -939,7 +937,7 @@ run_sweep(void)
|
||||
opts = umem_zalloc(sizeof (raidz_test_opts_t), UMEM_NOFAIL);
|
||||
opts->rto_ashift = ashift_v[a];
|
||||
opts->rto_dcols = dcols_v[d];
|
||||
opts->rto_offset = (1 << ashift_v[a]) * rand();
|
||||
opts->rto_offset = (1ULL << ashift_v[a]) * rand();
|
||||
opts->rto_dsize = size_v[s];
|
||||
opts->rto_expand = rto_opts.rto_expand;
|
||||
opts->rto_expand_offset = rto_opts.rto_expand_offset;
|
||||
|
@ -128,7 +128,7 @@ uint8_t dump_opt[256];
|
||||
|
||||
typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size);
|
||||
|
||||
uint64_t *zopt_metaslab = NULL;
|
||||
static uint64_t *zopt_metaslab = NULL;
|
||||
static unsigned zopt_metaslab_args = 0;
|
||||
|
||||
typedef struct zopt_object_range {
|
||||
@ -136,7 +136,8 @@ typedef struct zopt_object_range {
|
||||
uint64_t zor_obj_end;
|
||||
uint64_t zor_flags;
|
||||
} zopt_object_range_t;
|
||||
zopt_object_range_t *zopt_object_ranges = NULL;
|
||||
|
||||
static zopt_object_range_t *zopt_object_ranges = NULL;
|
||||
static unsigned zopt_object_args = 0;
|
||||
|
||||
static int flagbits[256];
|
||||
@ -160,7 +161,7 @@ static int flagbits[256];
|
||||
#define ZDB_FLAG_PRINT_BLKPTR 0x0040
|
||||
#define ZDB_FLAG_VERBOSE 0x0080
|
||||
|
||||
uint64_t max_inflight_bytes = 256 * 1024 * 1024; /* 256MB */
|
||||
static uint64_t max_inflight_bytes = 256 * 1024 * 1024; /* 256MB */
|
||||
static int leaked_objects = 0;
|
||||
static range_tree_t *mos_refd_objs;
|
||||
|
||||
@ -2857,9 +2858,11 @@ dump_bookmarks(objset_t *os, int verbosity)
|
||||
zap_cursor_advance(&zc)) {
|
||||
char osname[ZFS_MAX_DATASET_NAME_LEN];
|
||||
char buf[ZFS_MAX_DATASET_NAME_LEN];
|
||||
int len;
|
||||
dmu_objset_name(os, osname);
|
||||
VERIFY3S(0, <=, snprintf(buf, sizeof (buf), "%s#%s", osname,
|
||||
attr.za_name));
|
||||
len = snprintf(buf, sizeof (buf), "%s#%s", osname,
|
||||
attr.za_name);
|
||||
VERIFY3S(len, <, ZFS_MAX_DATASET_NAME_LEN);
|
||||
(void) dump_bookmark(dp, buf, verbosity >= 5, verbosity >= 6);
|
||||
}
|
||||
zap_cursor_fini(&zc);
|
||||
@ -3066,7 +3069,7 @@ open_objset(const char *path, const void *tag, objset_t **osp)
|
||||
}
|
||||
sa_os = *osp;
|
||||
|
||||
return (0);
|
||||
return (err);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -8778,8 +8781,12 @@ main(int argc, char **argv)
|
||||
args.path = searchdirs;
|
||||
args.can_be_active = B_TRUE;
|
||||
|
||||
error = zpool_find_config(NULL, target_pool, &cfg, &args,
|
||||
&libzpool_config_ops);
|
||||
libpc_handle_t lpch = {
|
||||
.lpc_lib_handle = NULL,
|
||||
.lpc_ops = &libzpool_config_ops,
|
||||
.lpc_printerr = B_TRUE
|
||||
};
|
||||
error = zpool_find_config(&lpch, target_pool, &cfg, &args);
|
||||
|
||||
if (error == 0) {
|
||||
|
||||
|
@ -128,6 +128,14 @@ zil_prt_rec_rename(zilog_t *zilog, int txtype, const void *arg)
|
||||
(void) printf("%ssdoid %llu, tdoid %llu\n", tab_prefix,
|
||||
(u_longlong_t)lr->lr_sdoid, (u_longlong_t)lr->lr_tdoid);
|
||||
(void) printf("%ssrc %s tgt %s\n", tab_prefix, snm, tnm);
|
||||
switch (txtype) {
|
||||
case TX_RENAME_EXCHANGE:
|
||||
(void) printf("%sflags RENAME_EXCHANGE\n", tab_prefix);
|
||||
break;
|
||||
case TX_RENAME_WHITEOUT:
|
||||
(void) printf("%sflags RENAME_WHITEOUT\n", tab_prefix);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
@ -182,6 +190,7 @@ zil_prt_rec_write(zilog_t *zilog, int txtype, const void *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT3U(BP_GET_LSIZE(bp), !=, 0);
|
||||
SET_BOOKMARK(&zb, dmu_objset_id(zilog->zl_os),
|
||||
lr->lr_foid, ZB_ZIL_LEVEL,
|
||||
lr->lr_offset / BP_GET_LSIZE(bp));
|
||||
@ -329,6 +338,8 @@ static zil_rec_info_t zil_rec_info[TX_MAX_TYPE] = {
|
||||
{.zri_print = zil_prt_rec_write, .zri_name = "TX_WRITE2 "},
|
||||
{.zri_print = zil_prt_rec_setsaxattr,
|
||||
.zri_name = "TX_SETSAXATTR "},
|
||||
{.zri_print = zil_prt_rec_rename, .zri_name = "TX_RENAME_EXCHANGE "},
|
||||
{.zri_print = zil_prt_rec_rename, .zri_name = "TX_RENAME_WHITEOUT "},
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -616,6 +616,7 @@ fmd_timer_install(fmd_hdl_t *hdl, void *arg, fmd_event_t *ep, hrtime_t delta)
|
||||
sev.sigev_notify_function = _timer_notify;
|
||||
sev.sigev_notify_attributes = NULL;
|
||||
sev.sigev_value.sival_ptr = ftp;
|
||||
sev.sigev_signo = 0;
|
||||
|
||||
timer_create(CLOCK_REALTIME, &sev, &ftp->ft_tid);
|
||||
timer_settime(ftp->ft_tid, 0, &its, NULL);
|
||||
|
@ -74,9 +74,18 @@ fmd_serd_eng_alloc(const char *name, uint64_t n, hrtime_t t)
|
||||
fmd_serd_eng_t *sgp;
|
||||
|
||||
sgp = malloc(sizeof (fmd_serd_eng_t));
|
||||
if (sgp == NULL) {
|
||||
perror("malloc");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
memset(sgp, 0, sizeof (fmd_serd_eng_t));
|
||||
|
||||
sgp->sg_name = strdup(name);
|
||||
if (sgp->sg_name == NULL) {
|
||||
perror("strdup");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sgp->sg_flags = FMD_SERD_DIRTY;
|
||||
sgp->sg_n = n;
|
||||
sgp->sg_t = t;
|
||||
@ -123,6 +132,12 @@ fmd_serd_hash_create(fmd_serd_hash_t *shp)
|
||||
shp->sh_hashlen = FMD_STR_BUCKETS;
|
||||
shp->sh_hash = calloc(shp->sh_hashlen, sizeof (void *));
|
||||
shp->sh_count = 0;
|
||||
|
||||
if (shp->sh_hash == NULL) {
|
||||
perror("calloc");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@ -241,6 +256,10 @@ fmd_serd_eng_record(fmd_serd_eng_t *sgp, hrtime_t hrt)
|
||||
fmd_serd_eng_discard(sgp, list_tail(&sgp->sg_list));
|
||||
|
||||
sep = malloc(sizeof (fmd_serd_elem_t));
|
||||
if (sep == NULL) {
|
||||
perror("malloc");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
sep->se_hrt = hrt;
|
||||
|
||||
list_insert_head(&sgp->sg_list, sep);
|
||||
|
@ -133,6 +133,11 @@ zfs_unavail_pool(zpool_handle_t *zhp, void *data)
|
||||
if (zfs_toplevel_state(zhp) < VDEV_STATE_DEGRADED) {
|
||||
unavailpool_t *uap;
|
||||
uap = malloc(sizeof (unavailpool_t));
|
||||
if (uap == NULL) {
|
||||
perror("malloc");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
uap->uap_zhp = zhp;
|
||||
list_insert_tail((list_t *)data, uap);
|
||||
} else {
|
||||
@ -411,6 +416,11 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
* completed.
|
||||
*/
|
||||
device = malloc(sizeof (pendingdev_t));
|
||||
if (device == NULL) {
|
||||
perror("malloc");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
(void) strlcpy(device->pd_physpath, physpath,
|
||||
sizeof (device->pd_physpath));
|
||||
list_insert_tail(&g_device_list, device);
|
||||
@ -938,14 +948,13 @@ vdev_whole_disk_from_config(zpool_handle_t *zhp, const char *vdev_path)
|
||||
{
|
||||
nvlist_t *nvl = NULL;
|
||||
boolean_t avail_spare, l2cache, log;
|
||||
uint64_t wholedisk;
|
||||
uint64_t wholedisk = 0;
|
||||
|
||||
nvl = zpool_find_vdev(zhp, vdev_path, &avail_spare, &l2cache, &log);
|
||||
if (!nvl)
|
||||
return (0);
|
||||
|
||||
verify(nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_WHOLE_DISK,
|
||||
&wholedisk) == 0);
|
||||
(void) nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk);
|
||||
|
||||
return (wholedisk);
|
||||
}
|
||||
@ -984,7 +993,7 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data)
|
||||
if ((tgt = zpool_find_vdev_by_physpath(zhp, devname,
|
||||
&avail_spare, &l2cache, NULL)) != NULL) {
|
||||
char *path, fullpath[MAXPATHLEN];
|
||||
uint64_t wholedisk;
|
||||
uint64_t wholedisk = 0;
|
||||
|
||||
error = nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &path);
|
||||
if (error) {
|
||||
@ -992,10 +1001,8 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data)
|
||||
return (0);
|
||||
}
|
||||
|
||||
error = nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK,
|
||||
(void) nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK,
|
||||
&wholedisk);
|
||||
if (error)
|
||||
wholedisk = 0;
|
||||
|
||||
if (wholedisk) {
|
||||
path = strrchr(path, '/');
|
||||
@ -1125,6 +1132,7 @@ zfs_deliver_dle(nvlist_t *nvl)
|
||||
strlcpy(name, devname, MAXPATHLEN);
|
||||
zfs_append_partition(name, MAXPATHLEN);
|
||||
} else {
|
||||
sprintf(name, "unknown");
|
||||
zed_log_msg(LOG_INFO, "zfs_deliver_dle: no guid or physpath");
|
||||
}
|
||||
|
||||
|
@ -139,8 +139,12 @@ _bump_event_queue_length(void)
|
||||
if (qlen == orig_qlen)
|
||||
goto done;
|
||||
wr = snprintf(qlen_buf, sizeof (qlen_buf), "%ld", qlen);
|
||||
if (wr >= sizeof (qlen_buf)) {
|
||||
wr = sizeof (qlen_buf) - 1;
|
||||
zed_log_msg(LOG_WARNING, "Truncation in %s()", __func__);
|
||||
}
|
||||
|
||||
if (pwrite(zzlm, qlen_buf, wr, 0) < 0)
|
||||
if (pwrite(zzlm, qlen_buf, wr + 1, 0) < 0)
|
||||
goto done;
|
||||
|
||||
zed_log_msg(LOG_WARNING, "Bumping queue length to %ld", qlen);
|
||||
|
@ -175,6 +175,10 @@ _zed_exec_fork_child(uint64_t eid, const char *dir, const char *prog,
|
||||
node->pid = pid;
|
||||
node->eid = eid;
|
||||
node->name = strdup(prog);
|
||||
if (node->name == NULL) {
|
||||
perror("strdup");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
avl_add(&_launched_processes, node);
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ get_usage(zfs_help_t idx)
|
||||
case HELP_HOLD:
|
||||
return (gettext("\thold [-r] <tag> <snapshot> ...\n"));
|
||||
case HELP_HOLDS:
|
||||
return (gettext("\tholds [-rH] <snapshot> ...\n"));
|
||||
return (gettext("\tholds [-rHp] <snapshot> ...\n"));
|
||||
case HELP_RELEASE:
|
||||
return (gettext("\trelease [-r] <tag> <snapshot> ...\n"));
|
||||
case HELP_DIFF:
|
||||
@ -1453,8 +1453,13 @@ destroy_callback(zfs_handle_t *zhp, void *data)
|
||||
if (zfs_get_type(zhp) == ZFS_TYPE_SNAPSHOT) {
|
||||
cb->cb_snap_count++;
|
||||
fnvlist_add_boolean(cb->cb_batchedsnaps, name);
|
||||
if (cb->cb_snap_count % 10 == 0 && cb->cb_defer_destroy)
|
||||
if (cb->cb_snap_count % 10 == 0 && cb->cb_defer_destroy) {
|
||||
error = destroy_batched(cb);
|
||||
if (error != 0) {
|
||||
zfs_close(zhp);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
error = destroy_batched(cb);
|
||||
if (error != 0 ||
|
||||
@ -2576,7 +2581,7 @@ zfs_do_upgrade(int argc, char **argv)
|
||||
cb.cb_foundone = B_FALSE;
|
||||
cb.cb_newer = B_TRUE;
|
||||
|
||||
ret = zfs_for_each(0, NULL, flags, ZFS_TYPE_FILESYSTEM,
|
||||
ret |= zfs_for_each(0, NULL, flags, ZFS_TYPE_FILESYSTEM,
|
||||
NULL, NULL, 0, upgrade_list_callback, &cb);
|
||||
|
||||
if (!cb.cb_foundone && !found) {
|
||||
@ -4499,6 +4504,7 @@ zfs_do_send(int argc, char **argv)
|
||||
gettext("missing argument for '%s' "
|
||||
"option\n"), argv[optind - 1]);
|
||||
}
|
||||
free(excludes.list);
|
||||
usage(B_FALSE);
|
||||
break;
|
||||
case '?':
|
||||
@ -4517,6 +4523,7 @@ zfs_do_send(int argc, char **argv)
|
||||
argv[optind - 1]);
|
||||
|
||||
}
|
||||
free(excludes.list);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
}
|
||||
@ -4525,6 +4532,7 @@ zfs_do_send(int argc, char **argv)
|
||||
flags.verbosity = 1;
|
||||
|
||||
if (excludes.count > 0 && !flags.replicate) {
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr, gettext("Cannot specify "
|
||||
"dataset exclusion (-X) on a non-recursive "
|
||||
"send.\n"));
|
||||
@ -4538,21 +4546,25 @@ zfs_do_send(int argc, char **argv)
|
||||
if (fromname != NULL || flags.replicate || flags.props ||
|
||||
flags.backup || flags.holds ||
|
||||
flags.saved || redactbook != NULL) {
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid flags combined with -t\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
if (argc > 0) {
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr, gettext("too many arguments\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
} else {
|
||||
if (argc < 1) {
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr,
|
||||
gettext("missing snapshot argument\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
if (argc > 1) {
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr, gettext("too many arguments\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
@ -4563,11 +4575,15 @@ zfs_do_send(int argc, char **argv)
|
||||
flags.doall || flags.backup ||
|
||||
flags.holds || flags.largeblock || flags.embed_data ||
|
||||
flags.compress || flags.raw || redactbook != NULL) {
|
||||
free(excludes.list);
|
||||
|
||||
(void) fprintf(stderr, gettext("incompatible flags "
|
||||
"combined with saved send flag\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
if (strchr(argv[0], '@') != NULL) {
|
||||
free(excludes.list);
|
||||
|
||||
(void) fprintf(stderr, gettext("saved send must "
|
||||
"specify the dataset with partially-received "
|
||||
"state\n"));
|
||||
@ -4576,12 +4592,14 @@ zfs_do_send(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (flags.raw && redactbook != NULL) {
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr,
|
||||
gettext("Error: raw sends may not be redacted.\n"));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (!flags.dryrun && isatty(STDOUT_FILENO)) {
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr,
|
||||
gettext("Error: Stream can not be written to a terminal.\n"
|
||||
"You must redirect standard output.\n"));
|
||||
@ -4590,19 +4608,24 @@ zfs_do_send(int argc, char **argv)
|
||||
|
||||
if (flags.saved) {
|
||||
zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET);
|
||||
if (zhp == NULL)
|
||||
if (zhp == NULL) {
|
||||
free(excludes.list);
|
||||
return (1);
|
||||
}
|
||||
|
||||
err = zfs_send_saved(zhp, &flags, STDOUT_FILENO,
|
||||
resume_token);
|
||||
free(excludes.list);
|
||||
zfs_close(zhp);
|
||||
return (err != 0);
|
||||
} else if (resume_token != NULL) {
|
||||
free(excludes.list);
|
||||
return (zfs_send_resume(g_zfs, &flags, STDOUT_FILENO,
|
||||
resume_token));
|
||||
}
|
||||
|
||||
if (flags.skipmissing && !flags.replicate) {
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr,
|
||||
gettext("skip-missing flag can only be used in "
|
||||
"conjunction with replicate\n"));
|
||||
@ -4645,10 +4668,14 @@ zfs_do_send(int argc, char **argv)
|
||||
}
|
||||
|
||||
zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET);
|
||||
if (zhp == NULL)
|
||||
if (zhp == NULL) {
|
||||
free(excludes.list);
|
||||
return (1);
|
||||
}
|
||||
err = zfs_send_one(zhp, fromname, STDOUT_FILENO, &flags,
|
||||
redactbook);
|
||||
|
||||
free(excludes.list);
|
||||
zfs_close(zhp);
|
||||
return (err != 0);
|
||||
}
|
||||
@ -4657,25 +4684,30 @@ zfs_do_send(int argc, char **argv)
|
||||
(void) fprintf(stderr,
|
||||
gettext("Error: multiple snapshots cannot be "
|
||||
"sent from a bookmark.\n"));
|
||||
free(excludes.list);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (redactbook != NULL) {
|
||||
(void) fprintf(stderr, gettext("Error: multiple snapshots "
|
||||
"cannot be sent redacted.\n"));
|
||||
free(excludes.list);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((cp = strchr(argv[0], '@')) == NULL) {
|
||||
(void) fprintf(stderr, gettext("Error: "
|
||||
"Unsupported flag with filesystem or bookmark.\n"));
|
||||
free(excludes.list);
|
||||
return (1);
|
||||
}
|
||||
*cp = '\0';
|
||||
toname = cp + 1;
|
||||
zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME);
|
||||
if (zhp == NULL)
|
||||
if (zhp == NULL) {
|
||||
free(excludes.list);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* If they specified the full path to the snapshot, chop off
|
||||
@ -4695,6 +4727,8 @@ zfs_do_send(int argc, char **argv)
|
||||
} else {
|
||||
*cp = '\0';
|
||||
if (cp != fromname && strcmp(argv[0], fromname)) {
|
||||
zfs_close(zhp);
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr,
|
||||
gettext("incremental source must be "
|
||||
"in same filesystem\n"));
|
||||
@ -4702,6 +4736,8 @@ zfs_do_send(int argc, char **argv)
|
||||
}
|
||||
fromname = cp + 1;
|
||||
if (strchr(fromname, '@') || strchr(fromname, '/')) {
|
||||
zfs_close(zhp);
|
||||
free(excludes.list);
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid incremental source\n"));
|
||||
usage(B_FALSE);
|
||||
@ -6420,7 +6456,8 @@ typedef struct holds_cbdata {
|
||||
*
|
||||
*/
|
||||
static void
|
||||
print_holds(boolean_t scripted, int nwidth, int tagwidth, nvlist_t *nvl)
|
||||
print_holds(boolean_t scripted, int nwidth, int tagwidth, nvlist_t *nvl,
|
||||
boolean_t parsable)
|
||||
{
|
||||
int i;
|
||||
nvpair_t *nvp = NULL;
|
||||
@ -6457,11 +6494,23 @@ print_holds(boolean_t scripted, int nwidth, int tagwidth, nvlist_t *nvl)
|
||||
gettext(STRFTIME_FMT_STR), &t);
|
||||
|
||||
if (scripted) {
|
||||
(void) printf("%s\t%s\t%s\n", zname,
|
||||
tagname, tsbuf);
|
||||
if (parsable) {
|
||||
(void) printf("%s\t%s\t%ld\n", zname,
|
||||
tagname, time);
|
||||
} else {
|
||||
(void) printf("%s\t%s\t%s\n", zname,
|
||||
tagname, tsbuf);
|
||||
}
|
||||
} else {
|
||||
(void) printf("%-*s %-*s %s\n", nwidth,
|
||||
zname, tagwidth, tagname, tsbuf);
|
||||
if (parsable) {
|
||||
(void) printf("%-*s %-*s %ld\n",
|
||||
nwidth, zname, tagwidth,
|
||||
tagname, time);
|
||||
} else {
|
||||
(void) printf("%-*s %-*s %s\n",
|
||||
nwidth, zname, tagwidth,
|
||||
tagname, tsbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6508,10 +6557,11 @@ holds_callback(zfs_handle_t *zhp, void *data)
|
||||
}
|
||||
|
||||
/*
|
||||
* zfs holds [-rH] <snap> ...
|
||||
* zfs holds [-rHp] <snap> ...
|
||||
*
|
||||
* -r Lists holds that are set on the named snapshots recursively.
|
||||
* -H Scripted mode; elide headers and separate columns by tabs.
|
||||
* -p Display values in parsable (literal) format.
|
||||
*/
|
||||
static int
|
||||
zfs_do_holds(int argc, char **argv)
|
||||
@ -6520,6 +6570,7 @@ zfs_do_holds(int argc, char **argv)
|
||||
boolean_t errors = B_FALSE;
|
||||
boolean_t scripted = B_FALSE;
|
||||
boolean_t recursive = B_FALSE;
|
||||
boolean_t parsable = B_FALSE;
|
||||
|
||||
int types = ZFS_TYPE_SNAPSHOT;
|
||||
holds_cbdata_t cb = { 0 };
|
||||
@ -6529,7 +6580,7 @@ zfs_do_holds(int argc, char **argv)
|
||||
int flags = 0;
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, "rH")) != -1) {
|
||||
while ((c = getopt(argc, argv, "rHp")) != -1) {
|
||||
switch (c) {
|
||||
case 'r':
|
||||
recursive = B_TRUE;
|
||||
@ -6537,6 +6588,9 @@ zfs_do_holds(int argc, char **argv)
|
||||
case 'H':
|
||||
scripted = B_TRUE;
|
||||
break;
|
||||
case 'p':
|
||||
parsable = B_TRUE;
|
||||
break;
|
||||
case '?':
|
||||
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
|
||||
optopt);
|
||||
@ -6590,7 +6644,8 @@ zfs_do_holds(int argc, char **argv)
|
||||
/*
|
||||
* 2. print holds data
|
||||
*/
|
||||
print_holds(scripted, cb.cb_max_namelen, cb.cb_max_taglen, nvl);
|
||||
print_holds(scripted, cb.cb_max_namelen, cb.cb_max_taglen, nvl,
|
||||
parsable);
|
||||
|
||||
if (nvlist_empty(nvl))
|
||||
(void) fprintf(stderr, gettext("no datasets available\n"));
|
||||
@ -8518,7 +8573,7 @@ static int
|
||||
zfs_do_wait(int argc, char **argv)
|
||||
{
|
||||
boolean_t enabled[ZFS_WAIT_NUM_ACTIVITIES];
|
||||
int error, i;
|
||||
int error = 0, i;
|
||||
int c;
|
||||
|
||||
/* By default, wait for all types of activity. */
|
||||
|
@ -140,8 +140,12 @@ zhack_import(char *target, boolean_t readonly)
|
||||
g_importargs.can_be_active = readonly;
|
||||
g_pool = strdup(target);
|
||||
|
||||
error = zpool_find_config(NULL, target, &config, &g_importargs,
|
||||
&libzpool_config_ops);
|
||||
libpc_handle_t lpch = {
|
||||
.lpc_lib_handle = NULL,
|
||||
.lpc_ops = &libzpool_config_ops,
|
||||
.lpc_printerr = B_TRUE
|
||||
};
|
||||
error = zpool_find_config(&lpch, target, &config, &g_importargs);
|
||||
if (error)
|
||||
fatal(NULL, FTAG, "cannot import '%s'", target);
|
||||
|
||||
|
@ -3773,7 +3773,12 @@ zpool_do_import(int argc, char **argv)
|
||||
idata.scan = do_scan;
|
||||
idata.policy = policy;
|
||||
|
||||
pools = zpool_search_import(g_zfs, &idata, &libzfs_config_ops);
|
||||
libpc_handle_t lpch = {
|
||||
.lpc_lib_handle = g_zfs,
|
||||
.lpc_ops = &libzfs_config_ops,
|
||||
.lpc_printerr = B_TRUE
|
||||
};
|
||||
pools = zpool_search_import(&lpch, &idata);
|
||||
|
||||
if (pools != NULL && pool_exists &&
|
||||
(argc == 1 || strcmp(argv[0], argv[1]) == 0)) {
|
||||
@ -3829,7 +3834,7 @@ zpool_do_import(int argc, char **argv)
|
||||
*/
|
||||
idata.scan = B_TRUE;
|
||||
nvlist_free(pools);
|
||||
pools = zpool_search_import(g_zfs, &idata, &libzfs_config_ops);
|
||||
pools = zpool_search_import(&lpch, &idata);
|
||||
|
||||
err = import_pools(pools, props, mntopts, flags,
|
||||
argc >= 1 ? argv[0] : NULL,
|
||||
|
@ -6,6 +6,7 @@ zstream_SOURCES = \
|
||||
%D%/zstream.h \
|
||||
%D%/zstream_decompress.c \
|
||||
%D%/zstream_dump.c \
|
||||
%D%/zstream_recompress.c \
|
||||
%D%/zstream_redup.c \
|
||||
%D%/zstream_token.c
|
||||
|
||||
|
@ -42,6 +42,8 @@ zstream_usage(void)
|
||||
"\n"
|
||||
"\tzstream decompress [-v] [OBJECT,OFFSET[,TYPE]] ...\n"
|
||||
"\n"
|
||||
"\tzstream recompress [ -l level] TYPE\n"
|
||||
"\n"
|
||||
"\tzstream token resume_token\n"
|
||||
"\n"
|
||||
"\tzstream redup [-v] FILE | ...\n");
|
||||
@ -65,6 +67,8 @@ main(int argc, char *argv[])
|
||||
return (zstream_do_dump(argc - 1, argv + 1));
|
||||
} else if (strcmp(subcommand, "decompress") == 0) {
|
||||
return (zstream_do_decompress(argc - 1, argv + 1));
|
||||
} else if (strcmp(subcommand, "recompress") == 0) {
|
||||
return (zstream_do_recompress(argc - 1, argv + 1));
|
||||
} else if (strcmp(subcommand, "token") == 0) {
|
||||
return (zstream_do_token(argc - 1, argv + 1));
|
||||
} else if (strcmp(subcommand, "redup") == 0) {
|
||||
|
@ -30,6 +30,7 @@ extern void *safe_malloc(size_t size);
|
||||
extern int zstream_do_redup(int, char *[]);
|
||||
extern int zstream_do_dump(int, char *[]);
|
||||
extern int zstream_do_decompress(int argc, char *argv[]);
|
||||
extern int zstream_do_recompress(int argc, char *argv[]);
|
||||
extern int zstream_do_token(int, char *[]);
|
||||
extern void zstream_usage(void);
|
||||
|
||||
|
@ -115,7 +115,9 @@ zstream_do_decompress(int argc, char *argv[])
|
||||
if (errno || *end != '\0')
|
||||
errx(1, "invalid value for offset");
|
||||
if (argv[i]) {
|
||||
if (0 == strcmp("lz4", argv[i]))
|
||||
if (0 == strcmp("off", argv[i]))
|
||||
type = ZIO_COMPRESS_OFF;
|
||||
else if (0 == strcmp("lz4", argv[i]))
|
||||
type = ZIO_COMPRESS_LZ4;
|
||||
else if (0 == strcmp("lzjb", argv[i]))
|
||||
type = ZIO_COMPRESS_LZJB;
|
||||
@ -127,8 +129,8 @@ zstream_do_decompress(int argc, char *argv[])
|
||||
type = ZIO_COMPRESS_ZSTD;
|
||||
else {
|
||||
fprintf(stderr, "Invalid compression type %s.\n"
|
||||
"Supported types are lz4, lzjb, gzip, zle, "
|
||||
"and zstd\n",
|
||||
"Supported types are off, lz4, lzjb, gzip, "
|
||||
"zle, and zstd\n",
|
||||
argv[i]);
|
||||
exit(2);
|
||||
}
|
||||
@ -144,7 +146,7 @@ zstream_do_decompress(int argc, char *argv[])
|
||||
p = hsearch(e, ENTER);
|
||||
if (p == NULL)
|
||||
errx(1, "hsearch");
|
||||
p->data = (void*)type;
|
||||
p->data = (void*)(intptr_t)type;
|
||||
}
|
||||
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
@ -240,6 +242,9 @@ zstream_do_decompress(int argc, char *argv[])
|
||||
if (p != NULL) {
|
||||
zio_decompress_func_t *xfunc = NULL;
|
||||
switch ((enum zio_compress)(intptr_t)p->data) {
|
||||
case ZIO_COMPRESS_OFF:
|
||||
xfunc = NULL;
|
||||
break;
|
||||
case ZIO_COMPRESS_LZJB:
|
||||
xfunc = lzjb_decompress;
|
||||
break;
|
||||
@ -258,7 +263,6 @@ zstream_do_decompress(int argc, char *argv[])
|
||||
default:
|
||||
assert(B_FALSE);
|
||||
}
|
||||
assert(xfunc != NULL);
|
||||
|
||||
|
||||
/*
|
||||
@ -266,12 +270,27 @@ zstream_do_decompress(int argc, char *argv[])
|
||||
*/
|
||||
char *lzbuf = safe_calloc(payload_size);
|
||||
(void) sfread(lzbuf, payload_size, stdin);
|
||||
if (0 != xfunc(lzbuf, buf,
|
||||
if (xfunc == NULL) {
|
||||
memcpy(buf, lzbuf, payload_size);
|
||||
drrw->drr_compressiontype =
|
||||
ZIO_COMPRESS_OFF;
|
||||
if (verbose)
|
||||
fprintf(stderr, "Resetting "
|
||||
"compression type to off "
|
||||
"for ino %llu offset "
|
||||
"%llu\n",
|
||||
(u_longlong_t)
|
||||
drrw->drr_object,
|
||||
(u_longlong_t)
|
||||
drrw->drr_offset);
|
||||
} else if (0 != xfunc(lzbuf, buf,
|
||||
payload_size, payload_size, 0)) {
|
||||
/*
|
||||
* The block must not be compressed,
|
||||
* possibly because it gets written
|
||||
* multiple times in this stream.
|
||||
* at least not with this compression
|
||||
* type, possibly because it gets
|
||||
* written multiple times in this
|
||||
* stream.
|
||||
*/
|
||||
warnx("decompression failed for "
|
||||
"ino %llu offset %llu",
|
||||
@ -279,11 +298,16 @@ zstream_do_decompress(int argc, char *argv[])
|
||||
(u_longlong_t)drrw->drr_offset);
|
||||
memcpy(buf, lzbuf, payload_size);
|
||||
} else if (verbose) {
|
||||
drrw->drr_compressiontype =
|
||||
ZIO_COMPRESS_OFF;
|
||||
fprintf(stderr, "successfully "
|
||||
"decompressed ino %llu "
|
||||
"offset %llu\n",
|
||||
(u_longlong_t)drrw->drr_object,
|
||||
(u_longlong_t)drrw->drr_offset);
|
||||
} else {
|
||||
drrw->drr_compressiontype =
|
||||
ZIO_COMPRESS_OFF;
|
||||
}
|
||||
free(lzbuf);
|
||||
} else {
|
||||
|
@ -54,10 +54,10 @@
|
||||
*/
|
||||
#define DUMP_GROUPING 4
|
||||
|
||||
uint64_t total_stream_len = 0;
|
||||
FILE *send_stream = 0;
|
||||
boolean_t do_byteswap = B_FALSE;
|
||||
boolean_t do_cksum = B_TRUE;
|
||||
static uint64_t total_stream_len = 0;
|
||||
static FILE *send_stream = 0;
|
||||
static boolean_t do_byteswap = B_FALSE;
|
||||
static boolean_t do_cksum = B_TRUE;
|
||||
|
||||
void *
|
||||
safe_malloc(size_t size)
|
||||
|
356
sys/contrib/openzfs/cmd/zstream/zstream_recompress.c
Normal file
356
sys/contrib/openzfs/cmd/zstream/zstream_recompress.c
Normal file
@ -0,0 +1,356 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or https://opensource.org/licenses/CDDL-1.0.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2022 Axcient. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/zfs_ioctl.h>
|
||||
#include <sys/zio_checksum.h>
|
||||
#include <sys/zstd/zstd.h>
|
||||
#include "zfs_fletcher.h"
|
||||
#include "zstream.h"
|
||||
|
||||
static int
|
||||
dump_record(dmu_replay_record_t *drr, void *payload, int payload_len,
|
||||
zio_cksum_t *zc, int outfd)
|
||||
{
|
||||
assert(offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum)
|
||||
== sizeof (dmu_replay_record_t) - sizeof (zio_cksum_t));
|
||||
fletcher_4_incremental_native(drr,
|
||||
offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum), zc);
|
||||
if (drr->drr_type != DRR_BEGIN) {
|
||||
assert(ZIO_CHECKSUM_IS_ZERO(&drr->drr_u.
|
||||
drr_checksum.drr_checksum));
|
||||
drr->drr_u.drr_checksum.drr_checksum = *zc;
|
||||
}
|
||||
fletcher_4_incremental_native(&drr->drr_u.drr_checksum.drr_checksum,
|
||||
sizeof (zio_cksum_t), zc);
|
||||
if (write(outfd, drr, sizeof (*drr)) == -1)
|
||||
return (errno);
|
||||
if (payload_len != 0) {
|
||||
fletcher_4_incremental_native(payload, payload_len, zc);
|
||||
if (write(outfd, payload, payload_len) == -1)
|
||||
return (errno);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
zstream_do_recompress(int argc, char *argv[])
|
||||
{
|
||||
int bufsz = SPA_MAXBLOCKSIZE;
|
||||
char *buf = safe_malloc(bufsz);
|
||||
dmu_replay_record_t thedrr;
|
||||
dmu_replay_record_t *drr = &thedrr;
|
||||
zio_cksum_t stream_cksum;
|
||||
int c;
|
||||
int level = -1;
|
||||
|
||||
while ((c = getopt(argc, argv, "l:")) != -1) {
|
||||
switch (c) {
|
||||
case 'l':
|
||||
if (sscanf(optarg, "%d", &level) != 0) {
|
||||
fprintf(stderr,
|
||||
"failed to parse level '%s'\n",
|
||||
optarg);
|
||||
zstream_usage();
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
(void) fprintf(stderr, "invalid option '%c'\n",
|
||||
optopt);
|
||||
zstream_usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc != 1)
|
||||
zstream_usage();
|
||||
int type = 0;
|
||||
zio_compress_info_t *cinfo = NULL;
|
||||
if (0 == strcmp(argv[0], "off")) {
|
||||
type = ZIO_COMPRESS_OFF;
|
||||
cinfo = &zio_compress_table[type];
|
||||
} else if (0 == strcmp(argv[0], "inherit") ||
|
||||
0 == strcmp(argv[0], "empty") ||
|
||||
0 == strcmp(argv[0], "on")) {
|
||||
// Fall through to invalid compression type case
|
||||
} else {
|
||||
for (int i = 0; i < ZIO_COMPRESS_FUNCTIONS; i++) {
|
||||
if (0 == strcmp(zio_compress_table[i].ci_name,
|
||||
argv[0])) {
|
||||
cinfo = &zio_compress_table[i];
|
||||
type = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cinfo == NULL) {
|
||||
fprintf(stderr, "Invalid compression type %s.\n",
|
||||
argv[0]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if (cinfo->ci_compress == NULL) {
|
||||
type = 0;
|
||||
cinfo = &zio_compress_table[0];
|
||||
}
|
||||
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
(void) fprintf(stderr,
|
||||
"Error: The send stream is a binary format "
|
||||
"and can not be read from a\n"
|
||||
"terminal. Standard input must be redirected.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fletcher_4_init();
|
||||
zio_init();
|
||||
zstd_init();
|
||||
while (sfread(drr, sizeof (*drr), stdin) != 0) {
|
||||
struct drr_write *drrw;
|
||||
uint64_t payload_size = 0;
|
||||
|
||||
/*
|
||||
* We need to regenerate the checksum.
|
||||
*/
|
||||
if (drr->drr_type != DRR_BEGIN) {
|
||||
memset(&drr->drr_u.drr_checksum.drr_checksum, 0,
|
||||
sizeof (drr->drr_u.drr_checksum.drr_checksum));
|
||||
}
|
||||
|
||||
|
||||
switch (drr->drr_type) {
|
||||
case DRR_BEGIN:
|
||||
{
|
||||
ZIO_SET_CHECKSUM(&stream_cksum, 0, 0, 0, 0);
|
||||
|
||||
int sz = drr->drr_payloadlen;
|
||||
if (sz != 0) {
|
||||
if (sz > bufsz) {
|
||||
buf = realloc(buf, sz);
|
||||
if (buf == NULL)
|
||||
err(1, "realloc");
|
||||
bufsz = sz;
|
||||
}
|
||||
(void) sfread(buf, sz, stdin);
|
||||
}
|
||||
payload_size = sz;
|
||||
break;
|
||||
}
|
||||
case DRR_END:
|
||||
{
|
||||
struct drr_end *drre = &drr->drr_u.drr_end;
|
||||
/*
|
||||
* Use the recalculated checksum, unless this is
|
||||
* the END record of a stream package, which has
|
||||
* no checksum.
|
||||
*/
|
||||
if (!ZIO_CHECKSUM_IS_ZERO(&drre->drr_checksum))
|
||||
drre->drr_checksum = stream_cksum;
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_OBJECT:
|
||||
{
|
||||
struct drr_object *drro = &drr->drr_u.drr_object;
|
||||
|
||||
if (drro->drr_bonuslen > 0) {
|
||||
payload_size = DRR_OBJECT_PAYLOAD_SIZE(drro);
|
||||
(void) sfread(buf, payload_size, stdin);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_SPILL:
|
||||
{
|
||||
struct drr_spill *drrs = &drr->drr_u.drr_spill;
|
||||
payload_size = DRR_SPILL_PAYLOAD_SIZE(drrs);
|
||||
(void) sfread(buf, payload_size, stdin);
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_WRITE_BYREF:
|
||||
fprintf(stderr,
|
||||
"Deduplicated streams are not supported\n");
|
||||
exit(1);
|
||||
break;
|
||||
|
||||
case DRR_WRITE:
|
||||
{
|
||||
drrw = &thedrr.drr_u.drr_write;
|
||||
payload_size = DRR_WRITE_PAYLOAD_SIZE(drrw);
|
||||
/*
|
||||
* In order to recompress an encrypted block, you have
|
||||
* to decrypt, decompress, recompress, and
|
||||
* re-encrypt. That can be a future enhancement (along
|
||||
* with decryption or re-encryption), but for now we
|
||||
* skip encrypted blocks.
|
||||
*/
|
||||
boolean_t encrypted = B_FALSE;
|
||||
for (int i = 0; i < ZIO_DATA_SALT_LEN; i++) {
|
||||
if (drrw->drr_salt[i] != 0) {
|
||||
encrypted = B_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (encrypted) {
|
||||
(void) sfread(buf, payload_size, stdin);
|
||||
break;
|
||||
}
|
||||
if (drrw->drr_compressiontype >=
|
||||
ZIO_COMPRESS_FUNCTIONS) {
|
||||
fprintf(stderr, "Invalid compression type in "
|
||||
"stream: %d\n", drrw->drr_compressiontype);
|
||||
exit(3);
|
||||
}
|
||||
zio_compress_info_t *dinfo =
|
||||
&zio_compress_table[drrw->drr_compressiontype];
|
||||
|
||||
/* Set up buffers to minimize memcpys */
|
||||
char *cbuf, *dbuf;
|
||||
if (cinfo->ci_compress == NULL)
|
||||
dbuf = buf;
|
||||
else
|
||||
dbuf = safe_calloc(bufsz);
|
||||
|
||||
if (dinfo->ci_decompress == NULL)
|
||||
cbuf = dbuf;
|
||||
else
|
||||
cbuf = safe_calloc(payload_size);
|
||||
|
||||
/* Read and decompress the payload */
|
||||
(void) sfread(cbuf, payload_size, stdin);
|
||||
if (dinfo->ci_decompress != NULL) {
|
||||
if (0 != dinfo->ci_decompress(cbuf, dbuf,
|
||||
payload_size, MIN(bufsz,
|
||||
drrw->drr_logical_size), dinfo->ci_level)) {
|
||||
warnx("decompression type %d failed "
|
||||
"for ino %llu offset %llu",
|
||||
type,
|
||||
(u_longlong_t)drrw->drr_object,
|
||||
(u_longlong_t)drrw->drr_offset);
|
||||
exit(4);
|
||||
}
|
||||
payload_size = drrw->drr_logical_size;
|
||||
free(cbuf);
|
||||
}
|
||||
|
||||
/* Recompress the payload */
|
||||
if (cinfo->ci_compress != NULL) {
|
||||
payload_size = P2ROUNDUP(cinfo->ci_compress(
|
||||
dbuf, buf, drrw->drr_logical_size,
|
||||
MIN(payload_size, bufsz), (level == -1 ?
|
||||
cinfo->ci_level : level)),
|
||||
SPA_MINBLOCKSIZE);
|
||||
if (payload_size != drrw->drr_logical_size) {
|
||||
drrw->drr_compressiontype = type;
|
||||
drrw->drr_compressed_size =
|
||||
payload_size;
|
||||
} else {
|
||||
memcpy(buf, dbuf, payload_size);
|
||||
drrw->drr_compressiontype = 0;
|
||||
drrw->drr_compressed_size = 0;
|
||||
}
|
||||
free(dbuf);
|
||||
} else {
|
||||
drrw->drr_compressiontype = type;
|
||||
drrw->drr_compressed_size = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_WRITE_EMBEDDED:
|
||||
{
|
||||
struct drr_write_embedded *drrwe =
|
||||
&drr->drr_u.drr_write_embedded;
|
||||
payload_size =
|
||||
P2ROUNDUP((uint64_t)drrwe->drr_psize, 8);
|
||||
(void) sfread(buf, payload_size, stdin);
|
||||
break;
|
||||
}
|
||||
|
||||
case DRR_FREEOBJECTS:
|
||||
case DRR_FREE:
|
||||
case DRR_OBJECT_RANGE:
|
||||
break;
|
||||
|
||||
default:
|
||||
(void) fprintf(stderr, "INVALID record type 0x%x\n",
|
||||
drr->drr_type);
|
||||
/* should never happen, so assert */
|
||||
assert(B_FALSE);
|
||||
}
|
||||
|
||||
if (feof(stdout)) {
|
||||
fprintf(stderr, "Error: unexpected end-of-file\n");
|
||||
exit(1);
|
||||
}
|
||||
if (ferror(stdout)) {
|
||||
fprintf(stderr, "Error while reading file: %s\n",
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to recalculate the checksum, and it needs to be
|
||||
* initially zero to do that. BEGIN records don't have
|
||||
* a checksum.
|
||||
*/
|
||||
if (drr->drr_type != DRR_BEGIN) {
|
||||
memset(&drr->drr_u.drr_checksum.drr_checksum, 0,
|
||||
sizeof (drr->drr_u.drr_checksum.drr_checksum));
|
||||
}
|
||||
if (dump_record(drr, buf, payload_size,
|
||||
&stream_cksum, STDOUT_FILENO) != 0)
|
||||
break;
|
||||
if (drr->drr_type == DRR_END) {
|
||||
/*
|
||||
* Typically the END record is either the last
|
||||
* thing in the stream, or it is followed
|
||||
* by a BEGIN record (which also zeros the checksum).
|
||||
* However, a stream package ends with two END
|
||||
* records. The last END record's checksum starts
|
||||
* from zero.
|
||||
*/
|
||||
ZIO_SET_CHECKSUM(&stream_cksum, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
free(buf);
|
||||
fletcher_4_fini();
|
||||
zio_fini();
|
||||
zstd_fini();
|
||||
|
||||
return (0);
|
||||
}
|
@ -252,7 +252,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = {
|
||||
|
||||
extern uint64_t metaslab_force_ganging;
|
||||
extern uint64_t metaslab_df_alloc_threshold;
|
||||
extern unsigned long zfs_deadman_synctime_ms;
|
||||
extern uint64_t zfs_deadman_synctime_ms;
|
||||
extern uint_t metaslab_preload_limit;
|
||||
extern int zfs_compressed_arc_enabled;
|
||||
extern int zfs_abd_scatter_enabled;
|
||||
@ -423,11 +423,11 @@ ztest_func_t ztest_fletcher;
|
||||
ztest_func_t ztest_fletcher_incr;
|
||||
ztest_func_t ztest_verify_dnode_bt;
|
||||
|
||||
uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */
|
||||
uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */
|
||||
uint64_t zopt_often = 1ULL * NANOSEC; /* every second */
|
||||
uint64_t zopt_sometimes = 10ULL * NANOSEC; /* every 10 seconds */
|
||||
uint64_t zopt_rarely = 60ULL * NANOSEC; /* every 60 seconds */
|
||||
static uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */
|
||||
static uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */
|
||||
static uint64_t zopt_often = 1ULL * NANOSEC; /* every second */
|
||||
static uint64_t zopt_sometimes = 10ULL * NANOSEC; /* every 10 seconds */
|
||||
static uint64_t zopt_rarely = 60ULL * NANOSEC; /* every 60 seconds */
|
||||
|
||||
#define ZTI_INIT(func, iters, interval) \
|
||||
{ .zi_func = (func), \
|
||||
@ -435,7 +435,7 @@ uint64_t zopt_rarely = 60ULL * NANOSEC; /* every 60 seconds */
|
||||
.zi_interval = (interval), \
|
||||
.zi_funcname = # func }
|
||||
|
||||
ztest_info_t ztest_info[] = {
|
||||
static ztest_info_t ztest_info[] = {
|
||||
ZTI_INIT(ztest_dmu_read_write, 1, &zopt_always),
|
||||
ZTI_INIT(ztest_dmu_write_parallel, 10, &zopt_always),
|
||||
ZTI_INIT(ztest_dmu_object_alloc_free, 1, &zopt_always),
|
||||
@ -515,7 +515,7 @@ typedef struct ztest_shared {
|
||||
|
||||
static char ztest_dev_template[] = "%s/%s.%llua";
|
||||
static char ztest_aux_template[] = "%s/%s.%s.%llu";
|
||||
ztest_shared_t *ztest_shared;
|
||||
static ztest_shared_t *ztest_shared;
|
||||
|
||||
static spa_t *ztest_spa = NULL;
|
||||
static ztest_ds_t *ztest_ds;
|
||||
@ -2177,6 +2177,7 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)
|
||||
* but not always, because we also want to verify correct
|
||||
* behavior when the data was not recently read into cache.
|
||||
*/
|
||||
ASSERT(doi.doi_data_block_size);
|
||||
ASSERT0(offset % doi.doi_data_block_size);
|
||||
if (ztest_random(4) != 0) {
|
||||
int prefetch = ztest_random(2) ?
|
||||
@ -2346,7 +2347,7 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
|
||||
return (0);
|
||||
}
|
||||
|
||||
zil_replay_func_t *ztest_replay_vector[TX_MAX_TYPE] = {
|
||||
static zil_replay_func_t *ztest_replay_vector[TX_MAX_TYPE] = {
|
||||
NULL, /* 0 no such transaction type */
|
||||
ztest_replay_create, /* TX_CREATE */
|
||||
NULL, /* TX_MKDIR */
|
||||
@ -2368,6 +2369,8 @@ zil_replay_func_t *ztest_replay_vector[TX_MAX_TYPE] = {
|
||||
NULL, /* TX_MKDIR_ACL_ATTR */
|
||||
NULL, /* TX_WRITE2 */
|
||||
NULL, /* TX_SETSAXATTR */
|
||||
NULL, /* TX_RENAME_EXCHANGE */
|
||||
NULL, /* TX_RENAME_WHITEOUT */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -3512,7 +3515,8 @@ ztest_split_pool(ztest_ds_t *zd, uint64_t id)
|
||||
VERIFY0(nvlist_lookup_nvlist_array(tree, ZPOOL_CONFIG_CHILDREN,
|
||||
&child, &children));
|
||||
|
||||
schild = malloc(rvd->vdev_children * sizeof (nvlist_t *));
|
||||
schild = umem_alloc(rvd->vdev_children * sizeof (nvlist_t *),
|
||||
UMEM_NOFAIL);
|
||||
for (c = 0; c < children; c++) {
|
||||
vdev_t *tvd = rvd->vdev_child[c];
|
||||
nvlist_t **mchild;
|
||||
@ -3546,7 +3550,7 @@ ztest_split_pool(ztest_ds_t *zd, uint64_t id)
|
||||
|
||||
for (c = 0; c < schildren; c++)
|
||||
fnvlist_free(schild[c]);
|
||||
free(schild);
|
||||
umem_free(schild, rvd->vdev_children * sizeof (nvlist_t *));
|
||||
fnvlist_free(split);
|
||||
|
||||
spa_config_exit(spa, SCL_VDEV, FTAG);
|
||||
@ -6663,7 +6667,7 @@ join_strings(char **strings, const char *sep)
|
||||
}
|
||||
|
||||
size_t buflen = totallen + 1;
|
||||
char *o = malloc(buflen); /* trailing 0 byte */
|
||||
char *o = umem_alloc(buflen, UMEM_NOFAIL); /* trailing 0 byte */
|
||||
o[0] = '\0';
|
||||
for (char **sp = strings; *sp != NULL; sp++) {
|
||||
size_t would;
|
||||
@ -6925,7 +6929,7 @@ ztest_run_zdb(const char *pool)
|
||||
pool);
|
||||
ASSERT3U(would, <, len);
|
||||
|
||||
free(set_gvars_args_joined);
|
||||
umem_free(set_gvars_args_joined, strlen(set_gvars_args_joined) + 1);
|
||||
|
||||
if (ztest_opts.zo_verbose >= 5)
|
||||
(void) printf("Executing %s\n", zdb);
|
||||
@ -7118,9 +7122,9 @@ ztest_deadman_thread(void *arg)
|
||||
*/
|
||||
if (spa_suspended(spa) || spa->spa_root_vdev == NULL) {
|
||||
fatal(B_FALSE,
|
||||
"aborting test after %lu seconds because "
|
||||
"aborting test after %llu seconds because "
|
||||
"pool has transitioned to a suspended state.",
|
||||
zfs_deadman_synctime_ms / 1000);
|
||||
(u_longlong_t)zfs_deadman_synctime_ms / 1000);
|
||||
}
|
||||
vdev_deadman(spa->spa_root_vdev, FTAG);
|
||||
|
||||
@ -7471,8 +7475,12 @@ ztest_import_impl(void)
|
||||
args.path = searchdirs;
|
||||
args.can_be_active = B_FALSE;
|
||||
|
||||
VERIFY0(zpool_find_config(NULL, ztest_opts.zo_pool, &cfg, &args,
|
||||
&libzpool_config_ops));
|
||||
libpc_handle_t lpch = {
|
||||
.lpc_lib_handle = NULL,
|
||||
.lpc_ops = &libzpool_config_ops,
|
||||
.lpc_printerr = B_TRUE
|
||||
};
|
||||
VERIFY0(zpool_find_config(&lpch, ztest_opts.zo_pool, &cfg, &args));
|
||||
VERIFY0(spa_import(ztest_opts.zo_pool, cfg, NULL, flags));
|
||||
fnvlist_free(cfg);
|
||||
}
|
||||
|
@ -109,6 +109,13 @@ while [ "$outer_loop" -lt 20 ]; do
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# zvol_count made some progress - let's stay in this loop.
|
||||
#
|
||||
if [ "$old_zvols_count" -gt "$zvols_count" ]; then
|
||||
outer_loop=$((outer_loop - 1))
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Timed out waiting on zvol links"
|
||||
|
30
sys/contrib/openzfs/config/kernel-dentry-alias.m4
Normal file
30
sys/contrib/openzfs/config/kernel-dentry-alias.m4
Normal file
@ -0,0 +1,30 @@
|
||||
dnl #
|
||||
dnl # 3.18 API change
|
||||
dnl # Dentry aliases are in d_u struct dentry member
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_DENTRY_ALIAS_D_U], [
|
||||
ZFS_LINUX_TEST_SRC([dentry_alias_d_u], [
|
||||
#include <linux/fs.h>
|
||||
#include <linux/dcache.h>
|
||||
#include <linux/list.h>
|
||||
], [
|
||||
struct inode *inode __attribute__ ((unused)) = NULL;
|
||||
struct dentry *dentry __attribute__ ((unused)) = NULL;
|
||||
hlist_for_each_entry(dentry, &inode->i_dentry,
|
||||
d_u.d_alias) {
|
||||
d_drop(dentry);
|
||||
}
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_DENTRY_ALIAS_D_U], [
|
||||
AC_MSG_CHECKING([whether dentry aliases are in d_u member])
|
||||
ZFS_LINUX_TEST_RESULT([dentry_alias_d_u], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DENTRY_D_U_ALIASES, 1,
|
||||
[dentry aliases are in d_u member])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
24
sys/contrib/openzfs/config/kernel-iattr-vfsid.m4
Normal file
24
sys/contrib/openzfs/config/kernel-iattr-vfsid.m4
Normal file
@ -0,0 +1,24 @@
|
||||
dnl #
|
||||
dnl # 6.0 API change
|
||||
dnl # struct iattr has two unions for the uid and gid
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_IATTR_VFSID], [
|
||||
ZFS_LINUX_TEST_SRC([iattr_vfsid], [
|
||||
#include <linux/fs.h>
|
||||
], [
|
||||
struct iattr ia;
|
||||
ia.ia_vfsuid = (vfsuid_t){0};
|
||||
ia.ia_vfsgid = (vfsgid_t){0};
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_IATTR_VFSID], [
|
||||
AC_MSG_CHECKING([whether iattr->ia_vfsuid and iattr->ia_vfsgid exist])
|
||||
ZFS_LINUX_TEST_RESULT([iattr_vfsid], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IATTR_VFSID, 1,
|
||||
[iattr->ia_vfsuid and iattr->ia_vfsgid exist])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
25
sys/contrib/openzfs/config/kernel-idmap_mnt_api.m4
Normal file
25
sys/contrib/openzfs/config/kernel-idmap_mnt_api.m4
Normal file
@ -0,0 +1,25 @@
|
||||
dnl #
|
||||
dnl # 5.12 API
|
||||
dnl #
|
||||
dnl # Check if APIs for idmapped mount are available
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_IDMAP_MNT_API], [
|
||||
ZFS_LINUX_TEST_SRC([idmap_mnt_api], [
|
||||
#include <linux/fs.h>
|
||||
],[
|
||||
int fs_flags = 0;
|
||||
fs_flags |= FS_ALLOW_IDMAP;
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_IDMAP_MNT_API], [
|
||||
AC_MSG_CHECKING([whether APIs for idmapped mount are present])
|
||||
ZFS_LINUX_TEST_RESULT([idmap_mnt_api], [
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_IDMAP_MNT_API, 1,
|
||||
[APIs for idmapped mount are present])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
])
|
||||
|
@ -1,33 +0,0 @@
|
||||
dnl #
|
||||
dnl # Grsecurity kernel API change
|
||||
dnl # constified parameters of module_param_call() methods
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST], [
|
||||
ZFS_LINUX_TEST_SRC([module_param_call], [
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
|
||||
int param_get(char *b, const struct kernel_param *kp)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int param_set(const char *b, const struct kernel_param *kp)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
module_param_call(p, param_set, param_get, NULL, 0644);
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST], [
|
||||
AC_MSG_CHECKING([whether module_param_call() is hardened])
|
||||
ZFS_LINUX_TEST_RESULT([module_param_call], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(MODULE_PARAM_CALL_CONST, 1,
|
||||
[hardened module_param_call])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
@ -1,8 +1,28 @@
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
|
||||
dnl #
|
||||
dnl # 3.9 (to 4.9) API change,
|
||||
dnl #
|
||||
dnl # A new version of iops->rename() was added (rename2) that takes a flag
|
||||
dnl # argument (to support renameat2). However this separate function was
|
||||
dnl # merged back into iops->rename() in Linux 4.9.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename2], [
|
||||
#include <linux/fs.h>
|
||||
int rename2_fn(struct inode *sip, struct dentry *sdp,
|
||||
struct inode *tip, struct dentry *tdp,
|
||||
unsigned int flags) { return 0; }
|
||||
|
||||
static const struct inode_operations
|
||||
iops __attribute__ ((unused)) = {
|
||||
.rename2 = rename2_fn,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # 4.9 API change,
|
||||
dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants
|
||||
dnl # flags.
|
||||
dnl #
|
||||
dnl # iops->rename2() merged into iops->rename(), and iops->rename() now
|
||||
dnl # wants flags.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [
|
||||
#include <linux/fs.h>
|
||||
@ -16,11 +36,29 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # EL7 compatibility
|
||||
dnl #
|
||||
dnl # EL7 has backported renameat2 support, but it's done by defining a
|
||||
dnl # separate iops wrapper structure that takes the .renameat2 function.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([dir_inode_operations_wrapper_rename2], [
|
||||
#include <linux/fs.h>
|
||||
int rename2_fn(struct inode *sip, struct dentry *sdp,
|
||||
struct inode *tip, struct dentry *tdp,
|
||||
unsigned int flags) { return 0; }
|
||||
|
||||
static const struct inode_operations_wrapper
|
||||
iops __attribute__ ((unused)) = {
|
||||
.rename2 = rename2_fn,
|
||||
};
|
||||
],[])
|
||||
|
||||
dnl #
|
||||
dnl # 5.12 API change,
|
||||
dnl #
|
||||
dnl # Linux 5.12 introduced passing struct user_namespace* as the first argument
|
||||
dnl # of the rename() and other inode_operations members.
|
||||
dnl # Linux 5.12 introduced passing struct user_namespace* as the first
|
||||
dnl # argument of the rename() and other inode_operations members.
|
||||
dnl #
|
||||
ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [
|
||||
#include <linux/fs.h>
|
||||
@ -44,13 +82,30 @@ AC_DEFUN([ZFS_AC_KERNEL_RENAME], [
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether iop->rename() wants flags])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [
|
||||
AC_MSG_CHECKING([whether iops->rename2() exists])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_rename2], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1,
|
||||
[iops->rename() wants flags])
|
||||
AC_DEFINE(HAVE_RENAME2, 1, [iops->rename2() exists])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether iops->rename() wants flags])
|
||||
ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1,
|
||||
[iops->rename() wants flags])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
AC_MSG_CHECKING([whether struct inode_operations_wrapper takes .rename2()])
|
||||
ZFS_LINUX_TEST_RESULT([dir_inode_operations_wrapper_rename2], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_RENAME2_OPERATIONS_WRAPPER, 1,
|
||||
[struct inode_operations_wrapper takes .rename2()])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
@ -96,6 +96,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_SETATTR_PREPARE
|
||||
ZFS_AC_KERNEL_SRC_INSERT_INODE_LOCKED
|
||||
ZFS_AC_KERNEL_SRC_DENTRY
|
||||
ZFS_AC_KERNEL_SRC_DENTRY_ALIAS_D_U
|
||||
ZFS_AC_KERNEL_SRC_TRUNCATE_SETSIZE
|
||||
ZFS_AC_KERNEL_SRC_SECURITY_INODE
|
||||
ZFS_AC_KERNEL_SRC_FST_MOUNT
|
||||
@ -122,7 +123,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_FMODE_T
|
||||
ZFS_AC_KERNEL_SRC_KUIDGID_T
|
||||
ZFS_AC_KERNEL_SRC_KUID_HELPERS
|
||||
ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST
|
||||
ZFS_AC_KERNEL_SRC_RENAME
|
||||
ZFS_AC_KERNEL_SRC_CURRENT_TIME
|
||||
ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES
|
||||
@ -148,6 +148,8 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
||||
ZFS_AC_KERNEL_SRC_ZERO_PAGE
|
||||
ZFS_AC_KERNEL_SRC___COPY_FROM_USER_INATOMIC
|
||||
ZFS_AC_KERNEL_SRC_USER_NS_COMMON_INUM
|
||||
ZFS_AC_KERNEL_SRC_IDMAP_MNT_API
|
||||
ZFS_AC_KERNEL_SRC_IATTR_VFSID
|
||||
|
||||
AC_MSG_CHECKING([for available kernel interfaces])
|
||||
ZFS_LINUX_TEST_COMPILE_ALL([kabi])
|
||||
@ -217,6 +219,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_SETATTR_PREPARE
|
||||
ZFS_AC_KERNEL_INSERT_INODE_LOCKED
|
||||
ZFS_AC_KERNEL_DENTRY
|
||||
ZFS_AC_KERNEL_DENTRY_ALIAS_D_U
|
||||
ZFS_AC_KERNEL_TRUNCATE_SETSIZE
|
||||
ZFS_AC_KERNEL_SECURITY_INODE
|
||||
ZFS_AC_KERNEL_FST_MOUNT
|
||||
@ -243,7 +246,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_FMODE_T
|
||||
ZFS_AC_KERNEL_KUIDGID_T
|
||||
ZFS_AC_KERNEL_KUID_HELPERS
|
||||
ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
|
||||
ZFS_AC_KERNEL_RENAME
|
||||
ZFS_AC_KERNEL_CURRENT_TIME
|
||||
ZFS_AC_KERNEL_USERNS_CAPABILITIES
|
||||
@ -269,6 +271,8 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
||||
ZFS_AC_KERNEL_ZERO_PAGE
|
||||
ZFS_AC_KERNEL___COPY_FROM_USER_INATOMIC
|
||||
ZFS_AC_KERNEL_USER_NS_COMMON_INUM
|
||||
ZFS_AC_KERNEL_IDMAP_MNT_API
|
||||
ZFS_AC_KERNEL_IATTR_VFSID
|
||||
])
|
||||
|
||||
dnl #
|
||||
@ -942,8 +946,15 @@ dnl # like ZFS_LINUX_TRY_COMPILE, except the contents conftest.h are
|
||||
dnl # provided via the fifth parameter
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER], [
|
||||
ZFS_LINUX_COMPILE_IFELSE(
|
||||
[ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], [[ZFS_META_LICENSE]])],
|
||||
[test -f build/conftest/conftest.ko],
|
||||
[$3], [$4], [$5])
|
||||
AS_IF([test "x$enable_linux_builtin" = "xyes"], [
|
||||
ZFS_LINUX_COMPILE_IFELSE(
|
||||
[ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]],
|
||||
[[ZFS_META_LICENSE]])],
|
||||
[test -f build/conftest/conftest.o], [$3], [$4], [$5])
|
||||
], [
|
||||
ZFS_LINUX_COMPILE_IFELSE(
|
||||
[ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]],
|
||||
[[ZFS_META_LICENSE]])],
|
||||
[test -f build/conftest/conftest.ko], [$3], [$4], [$5])
|
||||
])
|
||||
])
|
||||
|
@ -29,11 +29,20 @@
|
||||
|
||||
#define NULL (0)
|
||||
|
||||
typedef enum {
|
||||
B_FALSE = 0,
|
||||
B_TRUE = 1
|
||||
} boolean_t;
|
||||
|
||||
typedef unsigned int uint_t;
|
||||
|
||||
int condition0, condition1;
|
||||
|
||||
int
|
||||
ddi_copyin(const void *from, void *to, size_t len, int flags)
|
||||
{
|
||||
(void) flags;
|
||||
__coverity_negative_sink__(len);
|
||||
__coverity_tainted_data_argument__(from);
|
||||
__coverity_tainted_data_argument__(to);
|
||||
__coverity_writeall__(to);
|
||||
@ -42,13 +51,21 @@ ddi_copyin(const void *from, void *to, size_t len, int flags)
|
||||
void *
|
||||
memset(void *dst, int c, size_t len)
|
||||
{
|
||||
__coverity_writeall__(dst);
|
||||
__coverity_negative_sink__(len);
|
||||
if (c == 0)
|
||||
__coverity_writeall0__(dst);
|
||||
else
|
||||
__coverity_writeall__(dst);
|
||||
return (dst);
|
||||
}
|
||||
|
||||
void *
|
||||
memmove(void *dst, void *src, size_t len)
|
||||
{
|
||||
int first = ((char *)src)[0];
|
||||
int last = ((char *)src)[len-1];
|
||||
|
||||
__coverity_negative_sink__(len);
|
||||
__coverity_writeall__(dst);
|
||||
return (dst);
|
||||
}
|
||||
@ -56,6 +73,10 @@ memmove(void *dst, void *src, size_t len)
|
||||
void *
|
||||
memcpy(void *dst, void *src, size_t len)
|
||||
{
|
||||
int first = ((char *)src)[0];
|
||||
int last = ((char *)src)[len-1];
|
||||
|
||||
__coverity_negative_sink__(len);
|
||||
__coverity_writeall__(dst);
|
||||
return (dst);
|
||||
}
|
||||
@ -63,43 +84,53 @@ memcpy(void *dst, void *src, size_t len)
|
||||
void *
|
||||
umem_alloc_aligned(size_t size, size_t align, int kmflags)
|
||||
{
|
||||
(void) align;
|
||||
__coverity_negative_sink__(size);
|
||||
__coverity_negative_sink__(align);
|
||||
|
||||
if ((UMEM_NOFAIL & kmflags) == UMEM_NOFAIL)
|
||||
return (__coverity_alloc__(size));
|
||||
else if (condition0)
|
||||
return (__coverity_alloc__(size));
|
||||
else
|
||||
return (NULL);
|
||||
if (((UMEM_NOFAIL & kmflags) == UMEM_NOFAIL) || condition0) {
|
||||
void *buf = __coverity_alloc__(size);
|
||||
__coverity_mark_as_uninitialized_buffer__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "umem_free");
|
||||
return (buf);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void *
|
||||
umem_alloc(size_t size, int kmflags)
|
||||
{
|
||||
if ((UMEM_NOFAIL & kmflags) == UMEM_NOFAIL)
|
||||
return (__coverity_alloc__(size));
|
||||
else if (condition0)
|
||||
return (__coverity_alloc__(size));
|
||||
else
|
||||
return (NULL);
|
||||
__coverity_negative_sink__(size);
|
||||
|
||||
if (((UMEM_NOFAIL & kmflags) == UMEM_NOFAIL) || condition0) {
|
||||
void *buf = __coverity_alloc__(size);
|
||||
__coverity_mark_as_uninitialized_buffer__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "umem_free");
|
||||
return (buf);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void *
|
||||
umem_zalloc(size_t size, int kmflags)
|
||||
{
|
||||
if ((UMEM_NOFAIL & kmflags) == UMEM_NOFAIL)
|
||||
return (__coverity_alloc__(size));
|
||||
else if (condition0)
|
||||
return (__coverity_alloc__(size));
|
||||
else
|
||||
return (NULL);
|
||||
__coverity_negative_sink__(size);
|
||||
|
||||
if (((UMEM_NOFAIL & kmflags) == UMEM_NOFAIL) || condition0) {
|
||||
void *buf = __coverity_alloc__(size);
|
||||
__coverity_writeall0__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "umem_free");
|
||||
return (buf);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
umem_free(void *buf, size_t size)
|
||||
{
|
||||
(void) size;
|
||||
|
||||
__coverity_negative_sink__(size);
|
||||
__coverity_free__(buf);
|
||||
}
|
||||
|
||||
@ -113,12 +144,14 @@ umem_cache_alloc(umem_cache_t *skc, int flags)
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((UMEM_NOFAIL & flags) == UMEM_NOFAIL)
|
||||
return (__coverity_alloc_nosize__());
|
||||
else if (condition0)
|
||||
return (__coverity_alloc_nosize__());
|
||||
else
|
||||
return (NULL);
|
||||
if (((UMEM_NOFAIL & flags) == UMEM_NOFAIL) || condition0) {
|
||||
void *buf = __coverity_alloc_nosize__();
|
||||
__coverity_mark_as_uninitialized_buffer__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "umem_cache_free");
|
||||
return (buf);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -135,15 +168,19 @@ spl_kmem_alloc(size_t sz, int fl, const char *func, int line)
|
||||
(void) func;
|
||||
(void) line;
|
||||
|
||||
__coverity_negative_sink__(sz);
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if (fl == 0) {
|
||||
return (__coverity_alloc__(sz));
|
||||
} else if (condition0)
|
||||
return (__coverity_alloc__(sz));
|
||||
else
|
||||
return (NULL);
|
||||
if ((fl == 0) || condition0) {
|
||||
void *buf = __coverity_alloc__(sz);
|
||||
__coverity_mark_as_uninitialized_buffer__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "spl_kmem_free");
|
||||
return (buf);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void *
|
||||
@ -152,22 +189,126 @@ spl_kmem_zalloc(size_t sz, int fl, const char *func, int line)
|
||||
(void) func;
|
||||
(void) line;
|
||||
|
||||
__coverity_negative_sink__(sz);
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if (fl == 0) {
|
||||
return (__coverity_alloc__(sz));
|
||||
} else if (condition0)
|
||||
return (__coverity_alloc__(sz));
|
||||
else
|
||||
return (NULL);
|
||||
if ((fl == 0) || condition0) {
|
||||
void *buf = __coverity_alloc__(sz);
|
||||
__coverity_writeall0__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "spl_kmem_free");
|
||||
return (buf);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
spl_kmem_free(const void *ptr, size_t sz)
|
||||
{
|
||||
(void) sz;
|
||||
__coverity_negative_sink__(sz);
|
||||
__coverity_free__(ptr);
|
||||
}
|
||||
|
||||
char *
|
||||
kmem_vasprintf(const char *fmt, va_list ap)
|
||||
{
|
||||
char *buf = __coverity_alloc_nosize__();
|
||||
(void) ap;
|
||||
|
||||
__coverity_string_null_sink__(fmt);
|
||||
__coverity_string_size_sink__(fmt);
|
||||
|
||||
__coverity_writeall__(buf);
|
||||
|
||||
__coverity_mark_as_afm_allocated__(buf, "kmem_strfree");
|
||||
|
||||
return (buf);
|
||||
}
|
||||
|
||||
char *
|
||||
kmem_asprintf(const char *fmt, ...)
|
||||
{
|
||||
char *buf = __coverity_alloc_nosize__();
|
||||
|
||||
__coverity_string_null_sink__(fmt);
|
||||
__coverity_string_size_sink__(fmt);
|
||||
|
||||
__coverity_writeall__(buf);
|
||||
|
||||
__coverity_mark_as_afm_allocated__(buf, "kmem_strfree");
|
||||
|
||||
return (buf);
|
||||
}
|
||||
|
||||
char *
|
||||
kmem_strdup(const char *str)
|
||||
{
|
||||
char *buf = __coverity_alloc_nosize__();
|
||||
|
||||
__coverity_string_null_sink__(str);
|
||||
__coverity_string_size_sink__(str);
|
||||
|
||||
__coverity_writeall__(buf);
|
||||
|
||||
__coverity_mark_as_afm_allocated__(buf, "kmem_strfree");
|
||||
|
||||
return (buf);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
kmem_strfree(char *str)
|
||||
{
|
||||
__coverity_free__(str);
|
||||
}
|
||||
|
||||
void *
|
||||
spl_vmem_alloc(size_t sz, int fl, const char *func, int line)
|
||||
{
|
||||
(void) func;
|
||||
(void) line;
|
||||
|
||||
__coverity_negative_sink__(sz);
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((fl == 0) || condition0) {
|
||||
void *buf = __coverity_alloc__(sz);
|
||||
__coverity_mark_as_uninitialized_buffer__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "spl_vmem_free");
|
||||
return (buf);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void *
|
||||
spl_vmem_zalloc(size_t sz, int fl, const char *func, int line)
|
||||
{
|
||||
(void) func;
|
||||
(void) line;
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((fl == 0) || condition0) {
|
||||
void *buf = __coverity_alloc__(sz);
|
||||
__coverity_writeall0__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "spl_vmem_free");
|
||||
return (buf);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
spl_vmem_free(const void *ptr, size_t sz)
|
||||
{
|
||||
__coverity_negative_sink__(sz);
|
||||
__coverity_free__(ptr);
|
||||
}
|
||||
|
||||
@ -181,12 +322,12 @@ spl_kmem_cache_alloc(spl_kmem_cache_t *skc, int flags)
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if (flags == 0) {
|
||||
return (__coverity_alloc_nosize__());
|
||||
} else if (condition0)
|
||||
return (__coverity_alloc_nosize__());
|
||||
else
|
||||
return (NULL);
|
||||
if ((flags == 0) || condition0) {
|
||||
void *buf = __coverity_alloc_nosize__();
|
||||
__coverity_mark_as_uninitialized_buffer__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "spl_kmem_cache_free");
|
||||
return (buf);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -197,12 +338,164 @@ spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj)
|
||||
__coverity_free__(obj);
|
||||
}
|
||||
|
||||
void
|
||||
malloc(size_t size)
|
||||
typedef struct {} zfsvfs_t;
|
||||
|
||||
int
|
||||
zfsvfs_create(const char *osname, boolean_t readonly, zfsvfs_t **zfvp)
|
||||
{
|
||||
__coverity_alloc__(size);
|
||||
(void) osname;
|
||||
(void) readonly;
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if (condition0) {
|
||||
*zfvp = __coverity_alloc_nosize__();
|
||||
__coverity_writeall__(*zfvp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
zfsvfs_free(zfsvfs_t *zfsvfs)
|
||||
{
|
||||
__coverity_free__(zfsvfs);
|
||||
}
|
||||
|
||||
typedef struct {} nvlist_t;
|
||||
|
||||
int
|
||||
nvlist_alloc(nvlist_t **nvlp, uint_t nvflag, int kmflag)
|
||||
{
|
||||
(void) nvflag;
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((kmflag == 0) || condition0) {
|
||||
*nvlp = __coverity_alloc_nosize__();
|
||||
__coverity_mark_as_afm_allocated__(*nvlp, "nvlist_free");
|
||||
__coverity_writeall__(*nvlp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (-1);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
nvlist_dup(const nvlist_t *nvl, nvlist_t **nvlp, int kmflag)
|
||||
{
|
||||
nvlist_t read = *nvl;
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((kmflag == 0) || condition0) {
|
||||
nvlist_t *nvl = __coverity_alloc_nosize__();
|
||||
__coverity_mark_as_afm_allocated__(nvl, "nvlist_free");
|
||||
__coverity_writeall__(nvl);
|
||||
*nvlp = nvl;
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
void
|
||||
nvlist_free(nvlist_t *nvl)
|
||||
{
|
||||
__coverity_free__(nvl);
|
||||
}
|
||||
|
||||
int
|
||||
nvlist_pack(nvlist_t *nvl, char **bufp, size_t *buflen, int encoding,
|
||||
int kmflag)
|
||||
{
|
||||
(void) nvl;
|
||||
(void) encoding;
|
||||
|
||||
if (*bufp == NULL) {
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((kmflag == 0) || condition0) {
|
||||
char *buf = __coverity_alloc_nosize__();
|
||||
__coverity_writeall__(buf);
|
||||
/*
|
||||
* We cannot use __coverity_mark_as_afm_allocated__()
|
||||
* because the free function varies between the kernel
|
||||
* and userspace.
|
||||
*/
|
||||
*bufp = buf;
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unfortunately, errors from the buffer being too small are not
|
||||
* possible to model, so we assume success.
|
||||
*/
|
||||
__coverity_negative_sink__(*buflen);
|
||||
__coverity_writeall__(*bufp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
nvlist_unpack(char *buf, size_t buflen, nvlist_t **nvlp, int kmflag)
|
||||
{
|
||||
__coverity_negative_sink__(buflen);
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((kmflag == 0) || condition0) {
|
||||
nvlist_t *nvl = __coverity_alloc_nosize__();
|
||||
__coverity_mark_as_afm_allocated__(nvl, "nvlist_free");
|
||||
__coverity_writeall__(nvl);
|
||||
*nvlp = nvl;
|
||||
int first = buf[0];
|
||||
int last = buf[buflen-1];
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (-1);
|
||||
|
||||
}
|
||||
|
||||
void *
|
||||
malloc(size_t size)
|
||||
{
|
||||
void *buf = __coverity_alloc__(size);
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
__coverity_negative_sink__(size);
|
||||
__coverity_mark_as_uninitialized_buffer__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "free");
|
||||
|
||||
return (buf);
|
||||
}
|
||||
|
||||
void *
|
||||
calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *buf = __coverity_alloc__(size * nmemb);
|
||||
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
__coverity_negative_sink__(size);
|
||||
__coverity_writeall0__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "free");
|
||||
return (buf);
|
||||
}
|
||||
void
|
||||
free(void *buf)
|
||||
{
|
||||
|
7
sys/contrib/openzfs/contrib/debian/changelog
Normal file
7
sys/contrib/openzfs/contrib/debian/changelog
Normal file
@ -0,0 +1,7 @@
|
||||
openzfs-linux (2.1.99-1) unstable; urgency=low
|
||||
|
||||
* Integrate minimally modified Debian packaging from ZFS on Linux
|
||||
(source: https://salsa.debian.org/zfsonlinux-team/zfs)
|
||||
* This packaging is a fork of Debian zfs-linux 2.1.6-2 release.
|
||||
|
||||
-- Umer Saleem <usaleem@ixsystems.com> Fri, 11 Oct 2022 15:00:00 -0400
|
11
sys/contrib/openzfs/contrib/debian/clean
Normal file
11
sys/contrib/openzfs/contrib/debian/clean
Normal file
@ -0,0 +1,11 @@
|
||||
bin/
|
||||
cmd/zed/zed.d/history_event-zfs-list-cacher.sh
|
||||
contrib/pyzfs/build/
|
||||
contrib/pyzfs/libzfs_core/__pycache__/
|
||||
contrib/pyzfs/libzfs_core/bindings/__pycache__/
|
||||
contrib/pyzfs/pyzfs.egg-info/
|
||||
debian/openzfs-libnvpair3.install
|
||||
debian/openzfs-libuutil3.install
|
||||
debian/openzfs-libzfs4.install
|
||||
debian/openzfs-libzfs-dev.install
|
||||
debian/openzfs-libzpool5.install
|
328
sys/contrib/openzfs/contrib/debian/control
Normal file
328
sys/contrib/openzfs/contrib/debian/control
Normal file
@ -0,0 +1,328 @@
|
||||
Source: openzfs-linux
|
||||
Section: contrib/kernel
|
||||
Priority: optional
|
||||
Maintainer: ZFS on Linux specific mailing list <zfs-discuss@list.zfsonlinux.org>
|
||||
Build-Depends: abigail-tools,
|
||||
debhelper-compat (= 12),
|
||||
dh-python,
|
||||
dkms (>> 2.1.1.2-5),
|
||||
libaio-dev,
|
||||
libblkid-dev,
|
||||
libcurl4-openssl-dev,
|
||||
libelf-dev,
|
||||
libpam0g-dev,
|
||||
libssl-dev | libssl1.0-dev,
|
||||
libtool,
|
||||
libudev-dev,
|
||||
lsb-release,
|
||||
po-debconf,
|
||||
python3-all-dev,
|
||||
python3-cffi,
|
||||
python3-setuptools,
|
||||
python3-sphinx,
|
||||
uuid-dev,
|
||||
zlib1g-dev
|
||||
Standards-Version: 4.5.1
|
||||
Homepage: https://openzfs.org/
|
||||
Vcs-Git: https://github.com/openzfs/zfs.git
|
||||
Vcs-Browser: https://github.com/openzfs/zfs
|
||||
Rules-Requires-Root: no
|
||||
XS-Autobuild: yes
|
||||
|
||||
Package: openzfs-libnvpair3
|
||||
Section: contrib/libs
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Breaks: libnvpair1, libnvpair3
|
||||
Replaces: libnvpair1, libnvpair3, libnvpair3linux
|
||||
Conflicts: libnvpair3linux
|
||||
Description: Solaris name-value library for Linux
|
||||
This library provides routines for packing and unpacking nv pairs for
|
||||
transporting data across process boundaries, transporting between
|
||||
kernel and userland, and possibly saving onto disk files.
|
||||
|
||||
Package: openzfs-libpam-zfs
|
||||
Section: contrib/admin
|
||||
Architecture: linux-any
|
||||
Depends: libpam-runtime, ${misc:Depends}, ${shlibs:Depends}
|
||||
Replaces: libpam-zfs
|
||||
Conflicts: libpam-zfs
|
||||
Description: PAM module for managing encryption keys for ZFS
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
This provides a Pluggable Authentication Module (PAM) that automatically
|
||||
unlocks encrypted ZFS datasets upon login.
|
||||
|
||||
Package: openzfs-libuutil3
|
||||
Section: contrib/libs
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Breaks: libuutil1, libuutil3
|
||||
Replaces: libuutil1, libuutil3, libuutil3linux
|
||||
Conflicts: libuutil3linux
|
||||
Description: Solaris userland utility library for Linux
|
||||
This library provides a variety of glue functions for ZFS on Linux:
|
||||
* libspl: The Solaris Porting Layer userland library, which provides APIs
|
||||
that make it possible to run Solaris user code in a Linux environment
|
||||
with relatively minimal modification.
|
||||
* libavl: The Adelson-Velskii Landis balanced binary tree manipulation
|
||||
library.
|
||||
* libefi: The Extensible Firmware Interface library for GUID disk
|
||||
partitioning.
|
||||
* libshare: NFS, SMB, and iSCSI service integration for ZFS.
|
||||
|
||||
Package: openzfs-libzfs-dev
|
||||
Section: contrib/libdevel
|
||||
Architecture: linux-any
|
||||
Depends: libssl-dev | libssl1.0-dev,
|
||||
openzfs-libnvpair3 (= ${binary:Version}),
|
||||
openzfs-libuutil3 (= ${binary:Version}),
|
||||
openzfs-libzfs4 (= ${binary:Version}),
|
||||
openzfs-libzfsbootenv1 (= ${binary:Version}),
|
||||
openzfs-libzpool5 (= ${binary:Version}),
|
||||
${misc:Depends}
|
||||
Replaces: libzfslinux-dev
|
||||
Conflicts: libzfslinux-dev
|
||||
Provides: libnvpair-dev, libuutil-dev
|
||||
Description: OpenZFS filesystem development files for Linux
|
||||
Header files and static libraries for compiling software against
|
||||
libraries of OpenZFS filesystem.
|
||||
.
|
||||
This package includes the development files of libnvpair3, libuutil3,
|
||||
libzpool5 and libzfs4.
|
||||
|
||||
Package: openzfs-libzfs4
|
||||
Section: contrib/libs
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
# The libcurl4 is loaded through dlopen("libcurl.so.4").
|
||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988521
|
||||
Recommends: libcurl4
|
||||
Breaks: libzfs2, libzfs4
|
||||
Replaces: libzfs2, libzfs4, libzfs4linux
|
||||
Conflicts: libzfs4linux
|
||||
Description: OpenZFS filesystem library for Linux - general support
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
The OpenZFS library provides support for managing OpenZFS filesystems.
|
||||
|
||||
Package: openzfs-libzfsbootenv1
|
||||
Section: contrib/libs
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Breaks: libzfs2, libzfs4
|
||||
Replaces: libzfs2, libzfs4, libzfsbootenv1linux
|
||||
Conflicts: libzfsbootenv1linux
|
||||
Description: OpenZFS filesystem library for Linux - label info support
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
The zfsbootenv library provides support for modifying ZFS label information.
|
||||
|
||||
Package: openzfs-libzpool5
|
||||
Section: contrib/libs
|
||||
Architecture: linux-any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Breaks: libzpool2, libzpool5
|
||||
Replaces: libzpool2, libzpool5, libzpool5linux
|
||||
Conflicts: libzpool5linux
|
||||
Description: OpenZFS pool library for Linux
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
This zpool library provides support for managing zpools.
|
||||
|
||||
Package: openzfs-python3-pyzfs
|
||||
Section: contrib/python
|
||||
Architecture: linux-any
|
||||
Depends: python3-cffi,
|
||||
openzfs-zfsutils (= ${binary:Version}),
|
||||
${misc:Depends},
|
||||
${python3:Depends}
|
||||
Replaces: python3-pyzfs
|
||||
Conflicts: python3-pyzfs
|
||||
Description: wrapper for libzfs_core C library
|
||||
libzfs_core is intended to be a stable interface for programmatic
|
||||
administration of ZFS. This wrapper provides one-to-one wrappers for
|
||||
libzfs_core API functions, but the signatures and types are more natural to
|
||||
Python.
|
||||
.
|
||||
nvlists are wrapped as dictionaries or lists depending on their usage.
|
||||
Some parameters have default values depending on typical use for
|
||||
increased convenience. Enumerations and bit flags become strings and lists
|
||||
of strings in Python. Errors are reported as exceptions rather than integer
|
||||
errno-style error codes. The wrapper takes care to provide one-to-many
|
||||
mapping of the error codes to the exceptions by interpreting a context
|
||||
in which the error code is produced.
|
||||
|
||||
Package: openzfs-pyzfs-doc
|
||||
Section: contrib/doc
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, ${sphinxdoc:Depends}
|
||||
Recommends: openzfs-python3-pyzfs
|
||||
Replaces: pyzfs-doc
|
||||
Conflicts: pyzfs-doc
|
||||
Description: wrapper for libzfs_core C library (documentation)
|
||||
libzfs_core is intended to be a stable interface for programmatic
|
||||
administration of ZFS. This wrapper provides one-to-one wrappers for
|
||||
libzfs_core API functions, but the signatures and types are more natural to
|
||||
Python.
|
||||
.
|
||||
nvlists are wrapped as dictionaries or lists depending on their usage.
|
||||
Some parameters have default values depending on typical use for
|
||||
increased convenience. Enumerations and bit flags become strings and lists
|
||||
of strings in Python. Errors are reported as exceptions rather than integer
|
||||
errno-style error codes. The wrapper takes care to provide one-to-many
|
||||
mapping of the error codes to the exceptions by interpreting a context
|
||||
in which the error code is produced.
|
||||
.
|
||||
This package contains the documentation.
|
||||
|
||||
Package: openzfs-zfs-dkms
|
||||
Architecture: all
|
||||
Depends: dkms (>> 2.1.1.2-5),
|
||||
file,
|
||||
libc6-dev | libc-dev,
|
||||
lsb-release,
|
||||
python3-distutils | libpython3-stdlib (<< 3.6.4),
|
||||
${misc:Depends},
|
||||
${perl:Depends}
|
||||
Recommends: openzfs-zfs-zed, openzfs-zfsutils (>= ${source:Version}), ${linux:Recommends}
|
||||
# suggests debhelper because e.g. `dkms mkdeb -m zfs -v 0.8.2` needs dh_testdir (#909183)
|
||||
Suggests: debhelper
|
||||
Breaks: spl-dkms (<< 0.8.0~rc1)
|
||||
Replaces: spl-dkms, zfs-dkms
|
||||
Conflicts: zfs-dkms
|
||||
Provides: openzfs-zfs-modules
|
||||
Description: OpenZFS filesystem kernel modules for Linux
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
This DKMS package includes the SPA, DMU, ZVOL, and ZPL components of
|
||||
OpenZFS.
|
||||
|
||||
Package: openzfs-zfs-initramfs
|
||||
Architecture: all
|
||||
Depends: busybox-initramfs | busybox-static | busybox,
|
||||
initramfs-tools,
|
||||
openzfs-zfs-modules | openzfs-zfs-dkms,
|
||||
openzfs-zfsutils (>= ${source:Version}),
|
||||
${misc:Depends}
|
||||
Breaks: zfsutils-linux (<= 0.7.11-2)
|
||||
Replaces: zfsutils-linux (<= 0.7.11-2), zfs-initramfs
|
||||
Conflicts: zfs-initramfs
|
||||
Description: OpenZFS root filesystem capabilities for Linux - initramfs
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
This package adds OpenZFS to the system initramfs with a hook
|
||||
for the initramfs-tools infrastructure.
|
||||
|
||||
Package: openzfs-zfs-dracut
|
||||
Architecture: all
|
||||
Depends: dracut,
|
||||
openzfs-zfs-modules | openzfs-zfs-dkms,
|
||||
openzfs-zfsutils (>= ${source:Version}),
|
||||
${misc:Depends}
|
||||
Conflicts: zfs-dracut
|
||||
Replaces: zfs-dracut
|
||||
Description: OpenZFS root filesystem capabilities for Linux - dracut
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
This package adds OpenZFS to the system initramfs with a hook
|
||||
for the dracut infrastructure.
|
||||
|
||||
Package: openzfs-zfsutils
|
||||
Section: contrib/admin
|
||||
Architecture: linux-any
|
||||
Pre-Depends: ${misc:Pre-Depends}
|
||||
Depends: openzfs-libnvpair3 (= ${binary:Version}),
|
||||
openzfs-libuutil3 (= ${binary:Version}),
|
||||
openzfs-libzfs4 (= ${binary:Version}),
|
||||
openzfs-libzpool5 (= ${binary:Version}),
|
||||
python3,
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
Recommends: lsb-base, openzfs-zfs-modules | openzfs-zfs-dkms, openzfs-zfs-zed
|
||||
Breaks: openrc,
|
||||
spl (<< 0.7.9-2),
|
||||
spl-dkms (<< 0.8.0~rc1),
|
||||
openzfs-zfs-dkms (<< ${source:Version}),
|
||||
openzfs-zfs-dkms (>> ${source:Version}...)
|
||||
Replaces: spl (<< 0.7.9-2), spl-dkms, zfsutils-linux
|
||||
Conflicts: zfs, zfs-fuse, zfsutils-linux
|
||||
Suggests: nfs-kernel-server,
|
||||
samba-common-bin (>= 3.0.23),
|
||||
openzfs-zfs-initramfs | openzfs-zfs-dracut
|
||||
Provides: openzfsutils
|
||||
Description: command-line tools to manage OpenZFS filesystems
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
This package provides the zfs and zpool commands to create and administer
|
||||
OpenZFS filesystems.
|
||||
|
||||
Package: openzfs-zfs-zed
|
||||
Section: contrib/admin
|
||||
Architecture: linux-any
|
||||
Pre-Depends: ${misc:Pre-Depends}
|
||||
Depends: openzfs-zfs-modules | openzfs-zfs-dkms,
|
||||
openzfs-zfsutils (>= ${binary:Version}),
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
Conflicts: zfs, zfs-zed
|
||||
Replaces: zfs-zed
|
||||
Description: OpenZFS Event Daemon
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
ZED (ZFS Event Daemon) monitors events generated by the ZFS kernel
|
||||
module. When a zevent (ZFS Event) is posted, ZED will run any ZEDLETs
|
||||
(ZFS Event Daemon Linkage for Executable Tasks) that have been enabled
|
||||
for the corresponding zevent class.
|
||||
.
|
||||
This package provides the OpenZFS Event Daemon (zed).
|
||||
|
||||
Package: openzfs-zfs-test
|
||||
Section: contrib/admin
|
||||
Architecture: linux-any
|
||||
Depends: acl,
|
||||
attr,
|
||||
bc,
|
||||
fio,
|
||||
ksh,
|
||||
lsscsi,
|
||||
mdadm,
|
||||
parted,
|
||||
python3,
|
||||
openzfs-python3-pyzfs,
|
||||
sudo,
|
||||
sysstat,
|
||||
openzfs-zfs-modules | openzfs-zfs-dkms,
|
||||
openzfs-zfsutils (>=${binary:Version}),
|
||||
${misc:Depends},
|
||||
${shlibs:Depends}
|
||||
Recommends: nfs-kernel-server
|
||||
Breaks: zfsutils-linux (<= 0.7.9-2)
|
||||
Replaces: zfsutils-linux (<= 0.7.9-2), zfs-test
|
||||
Conflicts: zutils, zfs-test
|
||||
Description: OpenZFS test infrastructure and support scripts
|
||||
OpenZFS is a storage platform that encompasses the functionality of
|
||||
traditional filesystems and volume managers. It supports data checksums,
|
||||
compression, encryption, snapshots, and more.
|
||||
.
|
||||
This package provides the OpenZFS test infrastructure for destructively
|
||||
testing and validating a system using OpenZFS. It is entirely optional
|
||||
and should only be installed and used in test environments.
|
33
sys/contrib/openzfs/contrib/debian/control.modules.in
Normal file
33
sys/contrib/openzfs/contrib/debian/control.modules.in
Normal file
@ -0,0 +1,33 @@
|
||||
Source: openzfs-linux
|
||||
Section: contrib/kernel
|
||||
Priority: optional
|
||||
Maintainer: ZFS on Linux specific mailing list <zfs-discuss@list.zfsonlinux.org>
|
||||
Build-Depends: debhelper-compat (= 10),
|
||||
dkms (>> 2.1.1.2-5),
|
||||
libtool,
|
||||
linux-headers-_KVERS_
|
||||
Standards-Version: 4.3.0
|
||||
Homepage: http://www.openzfs.org/
|
||||
Vcs-Git: https://github.com/openzfs/zfs.git
|
||||
Vcs-Browser: https://github.com/openzfs/zfs
|
||||
|
||||
Package: openzfs-zfs-modules-_KVERS_
|
||||
Architecture: _ARCH_
|
||||
Provides: openzfs-zfs-modules
|
||||
Depends: linux-image-_KVERS_
|
||||
Recommends: openzfsutils
|
||||
Replaces: zfs-modules-_KVERS_
|
||||
Conflicts: zfs-modules-_KVERS_
|
||||
Description: OpenZFS filesystem kernel modules for Linux (kernel _KVERS_)
|
||||
An advanced integrated volume manager and filesystem that is designed for
|
||||
performance and data integrity. Snapshots, clones, checksums, deduplication,
|
||||
compression, and RAID redundancy are built-in features.
|
||||
.
|
||||
This package contains the compiled kernel module for _KVERS_
|
||||
.
|
||||
Includes the SPA, DMU, ZVOL, and ZPL components of OpenZFS.
|
||||
.
|
||||
If you have compiled your own kernel, you will most likely need to build
|
||||
your own zfs-modules. The zfs-source package has been
|
||||
provided for use with the Debian kernel-package utility to produce a
|
||||
version of zfs-module for your kernel.
|
19
sys/contrib/openzfs/contrib/debian/copyright
Normal file
19
sys/contrib/openzfs/contrib/debian/copyright
Normal file
@ -0,0 +1,19 @@
|
||||
This Debian packaging is a derived work of Debian's zfs-linux package [1].
|
||||
The original copy of the Debian-styled copyright file can be found at [2].
|
||||
The detailed contributor information can be found in [2][3].
|
||||
|
||||
Files: contrib/debian/*
|
||||
Copyright:
|
||||
2013-2016, Aron Xu <aron@debian.org>
|
||||
2016, Petter Reinholdtsen <pere@hungry.com>
|
||||
2013, Carlos Alberto Lopez Perez <clopez@igalia.com>
|
||||
2013, Turbo Fredriksson <turbo@bayour.com>
|
||||
2012-2013, Richard Laager <rlaager@wiktel.com>
|
||||
2011-2013, Darik Horn <dajhorn@vanadac.com>
|
||||
2018-2019, Mo Zhou <cdluminate@gmail.com>
|
||||
2018-2020, Mo Zhou <lumin@debian.org>
|
||||
License: GPL-2+
|
||||
|
||||
[1] https://tracker.debian.org/pkg/zfs-linux
|
||||
[2] https://salsa.debian.org/zfsonlinux-team/zfs/-/blob/master/debian/copyright
|
||||
[3] https://salsa.debian.org/zfsonlinux-team/zfs/-/blob/master/debian/changelog
|
13
sys/contrib/openzfs/contrib/debian/not-installed
Normal file
13
sys/contrib/openzfs/contrib/debian/not-installed
Normal file
@ -0,0 +1,13 @@
|
||||
usr/bin/arc_summary.py
|
||||
usr/share/zfs/enum-extract.pl
|
||||
usr/share/zfs/zfs-helpers.sh
|
||||
etc/default/zfs
|
||||
etc/init.d
|
||||
etc/sudoers.d
|
||||
etc/zfs/vdev_id.conf.alias.example
|
||||
etc/zfs/vdev_id.conf.multipath.example
|
||||
etc/zfs/vdev_id.conf.sas_direct.example
|
||||
etc/zfs/vdev_id.conf.sas_switch.example
|
||||
etc/zfs/vdev_id.conf.scsi.example
|
||||
etc/zfs/zfs-functions
|
||||
lib/systemd/system/zfs-import.service
|
@ -0,0 +1,2 @@
|
||||
COPYRIGHT
|
||||
LICENSE
|
@ -0,0 +1 @@
|
||||
lib/@DEB_HOST_MULTIARCH@/libnvpair.so.*
|
@ -0,0 +1,2 @@
|
||||
lib/*/security/pam_zfs_key.so
|
||||
usr/share/pam-configs/zfs_key
|
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
pam-auth-update --package
|
||||
|
||||
#DEBHELPER#
|
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ "$1" = remove ] ; then
|
||||
pam-auth-update --package --remove zfs_key
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
@ -0,0 +1,2 @@
|
||||
COPYRIGHT
|
||||
LICENSE
|
@ -0,0 +1 @@
|
||||
lib/@DEB_HOST_MULTIARCH@/libuutil.so.*
|
@ -0,0 +1,2 @@
|
||||
COPYRIGHT
|
||||
LICENSE
|
@ -0,0 +1,3 @@
|
||||
lib/@DEB_HOST_MULTIARCH@/*.a usr/lib/@DEB_HOST_MULTIARCH@
|
||||
usr/include
|
||||
usr/lib/@DEB_HOST_MULTIARCH@
|
2
sys/contrib/openzfs/contrib/debian/openzfs-libzfs4.docs
Normal file
2
sys/contrib/openzfs/contrib/debian/openzfs-libzfs4.docs
Normal file
@ -0,0 +1,2 @@
|
||||
COPYRIGHT
|
||||
LICENSE
|
@ -0,0 +1,2 @@
|
||||
lib/@DEB_HOST_MULTIARCH@/libzfs.so.*
|
||||
lib/@DEB_HOST_MULTIARCH@/libzfs_core.so.*
|
@ -0,0 +1,2 @@
|
||||
COPYRIGHT
|
||||
LICENSE
|
@ -0,0 +1 @@
|
||||
lib/@DEB_HOST_MULTIARCH@/libzfsbootenv.so.*
|
@ -0,0 +1,2 @@
|
||||
COPYRIGHT
|
||||
LICENSE
|
@ -0,0 +1 @@
|
||||
lib/@DEB_HOST_MULTIARCH@/libzpool.so.*
|
@ -0,0 +1 @@
|
||||
usr/lib/python3*
|
31
sys/contrib/openzfs/contrib/debian/openzfs-zfs-dkms.config
Normal file
31
sys/contrib/openzfs/contrib/debian/openzfs-zfs-dkms.config
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Source debconf library
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
db_input critical zfs-dkms/note-incompatible-licenses || true
|
||||
db_go
|
||||
|
||||
kernelbits=unknown
|
||||
if [ -r /proc/kallsyms ]; then
|
||||
addrlen=$(head -1 /proc/kallsyms|awk '{print $1}'|wc -c)
|
||||
if [ $addrlen = 17 ]; then
|
||||
kernelbits=64
|
||||
elif [ $addrlen = 9 ]; then
|
||||
kernelbits=32
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $kernelbits != 64 ]; then
|
||||
if [ $kernelbits = 32 ]; then
|
||||
db_input critical zfs-dkms/stop-build-for-32bit-kernel || true
|
||||
db_go || true
|
||||
else
|
||||
db_input critical zfs-dkms/stop-build-for-unknown-kernel || true
|
||||
db_go || true
|
||||
fi
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
1
sys/contrib/openzfs/contrib/debian/openzfs-zfs-dkms.dkms
Normal file
1
sys/contrib/openzfs/contrib/debian/openzfs-zfs-dkms.dkms
Normal file
@ -0,0 +1 @@
|
||||
scripts/zfs-dkms.dkms
|
2
sys/contrib/openzfs/contrib/debian/openzfs-zfs-dkms.docs
Normal file
2
sys/contrib/openzfs/contrib/debian/openzfs-zfs-dkms.docs
Normal file
@ -0,0 +1,2 @@
|
||||
COPYRIGHT
|
||||
LICENSE
|
@ -0,0 +1 @@
|
||||
usr/src
|
51
sys/contrib/openzfs/contrib/debian/openzfs-zfs-dkms.postinst
Normal file
51
sys/contrib/openzfs/contrib/debian/openzfs-zfs-dkms.postinst
Normal file
@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Source debconf library (see dh_installdebconf(1) and #106070 #626312)
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
kernelbits=unknown
|
||||
if [ -r /proc/kallsyms ]; then
|
||||
addrlen=$(head -1 /proc/kallsyms| grep -o '^ *[^ ]*' |wc -c)
|
||||
if [ $addrlen = 17 ]; then
|
||||
kernelbits=64
|
||||
elif [ $addrlen = 9 ]; then
|
||||
kernelbits=32
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $kernelbits != 64 ]; then
|
||||
if [ $kernelbits = 32 ]; then
|
||||
db_get zfs-dkms/stop-build-for-32bit-kernel
|
||||
if [ "$RET" = "true" ]; then
|
||||
echo "Ok, aborting, since ZFS is not designed for 32-bit kernels." 1>&2
|
||||
# Exit 0: Tell dpkg that we finished OK but stop here.
|
||||
# (don't build the module)
|
||||
exit 0
|
||||
else
|
||||
echo "WARNING: Building ZFS module on a 32-bit kernel." 1>&2
|
||||
fi
|
||||
else
|
||||
db_get zfs-dkms/stop-build-for-unknown-kernel
|
||||
if [ "$RET" = "true" ]; then
|
||||
echo "Ok, aborting, since ZFS is not designed for 32-bit kernels." 1>&2
|
||||
# Exit 0: (same that above)
|
||||
exit 0
|
||||
else
|
||||
echo "WARNING: Building ZFS module on an unknown kernel." 1>&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Here the module gets built (automatically handled by dh_dkms)
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
|
||||
case $1 in
|
||||
(configure)
|
||||
if [ -x /usr/share/update-notifier/notify-reboot-required ]; then
|
||||
/usr/share/update-notifier/notify-reboot-required
|
||||
fi
|
||||
;;
|
||||
esac
|
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
if [ "$1" = "remove" ]; then
|
||||
rm -f /etc/zfs/zpool.cache
|
||||
fi
|
@ -0,0 +1,40 @@
|
||||
Template: zfs-dkms/stop-build-for-32bit-kernel
|
||||
Type: boolean
|
||||
Default: true
|
||||
_Description: Abort building OpenZFS on a 32-bit kernel?
|
||||
You are attempting to build OpenZFS against a 32-bit running kernel.
|
||||
.
|
||||
Although possible, building in a 32-bit environment is unsupported and
|
||||
likely to cause instability leading to possible data corruption. You
|
||||
are strongly advised to use a 64-bit kernel; if you do decide to
|
||||
proceed with using OpenZFS on this kernel then keep in mind that it is at
|
||||
your own risk.
|
||||
|
||||
Template: zfs-dkms/stop-build-for-unknown-kernel
|
||||
Type: boolean
|
||||
Default: true
|
||||
_Description: Abort building OpenZFS on an unknown kernel?
|
||||
You are attempting to build OpenZFS against a running kernel that could not
|
||||
be identified as 32-bit or 64-bit. If you are not completely sure that
|
||||
the running kernel is a 64-bit one, you should probably stop the build.
|
||||
.
|
||||
Although possible, building in a 32-bit environment is unsupported and
|
||||
likely to cause instability leading to possible data corruption. You
|
||||
are strongly advised to use a 64-bit kernel; if you do decide to
|
||||
proceed with using OpenZFS on this kernel then keep in mind that it is at
|
||||
your own risk.
|
||||
|
||||
Template: zfs-dkms/note-incompatible-licenses
|
||||
Type: note
|
||||
_Description: Licenses of OpenZFS and Linux are incompatible
|
||||
OpenZFS is licensed under the Common Development and Distribution License (CDDL),
|
||||
and the Linux kernel is licensed under the GNU General Public License Version 2
|
||||
(GPL-2). While both are free open source licenses they are restrictive
|
||||
licenses. The combination of them causes problems because it prevents using
|
||||
pieces of code exclusively available under one license with pieces of code
|
||||
exclusively available under the other in the same binary.
|
||||
.
|
||||
You are going to build OpenZFS using DKMS in such a way that they are not going to
|
||||
be built into one monolithic binary. Please be aware that distributing both of
|
||||
the binaries in the same media (disk images, virtual appliances, etc) may
|
||||
lead to infringing.
|
@ -0,0 +1 @@
|
||||
activate-await update-initramfs
|
@ -0,0 +1,2 @@
|
||||
usr/lib/dracut
|
||||
usr/share/man/man7/dracut.zfs.7
|
@ -0,0 +1,2 @@
|
||||
../tree/zfs-initramfs/* /
|
||||
usr/share/initramfs-tools/*
|
@ -0,0 +1,2 @@
|
||||
module/spl.ko lib/modules/_KVERS_/extra/zcommon/
|
||||
module/zfs.ko lib/modules/_KVERS_/extra/zcommon/
|
@ -0,0 +1,2 @@
|
||||
module/spl.ko lib/modules/_KVERS_/extra/zcommon/
|
||||
module/zfs.ko lib/modules/_KVERS_/extra/zcommon/
|
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Run depmod first
|
||||
depmod -a _KVERS_
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
|
||||
case $1 in
|
||||
(configure)
|
||||
if [ -x /usr/share/update-notifier/notify-reboot-required ]; then
|
||||
/usr/share/update-notifier/notify-reboot-required
|
||||
fi
|
||||
;;
|
||||
esac
|
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Run depmod after module uninstallation.
|
||||
depmod
|
||||
|
||||
#DEBHELPER#
|
15
sys/contrib/openzfs/contrib/debian/openzfs-zfs-test.install
Normal file
15
sys/contrib/openzfs/contrib/debian/openzfs-zfs-test.install
Normal file
@ -0,0 +1,15 @@
|
||||
sbin/zinject
|
||||
sbin/ztest
|
||||
usr/bin/raidz_test
|
||||
usr/share/man/man1/raidz_test.1
|
||||
usr/share/man/man1/test-runner.1
|
||||
usr/share/man/man1/ztest.1
|
||||
usr/share/man/man8/zinject.8
|
||||
usr/share/zfs/common.sh
|
||||
usr/share/zfs/runfiles/
|
||||
usr/share/zfs/test-runner
|
||||
usr/share/zfs/zfs-tests.sh
|
||||
usr/share/zfs/zfs-tests/
|
||||
usr/share/zfs/zfs.sh
|
||||
usr/share/zfs/zimport.sh
|
||||
usr/share/zfs/zloop.sh
|
@ -0,0 +1,5 @@
|
||||
etc/zfs/zed.d/*
|
||||
lib/systemd/system/zfs-zed.service
|
||||
usr/lib/zfs-linux/zed.d/*
|
||||
usr/sbin/zed
|
||||
usr/share/man/man8/zed.8
|
20
sys/contrib/openzfs/contrib/debian/openzfs-zfs-zed.postinst
Normal file
20
sys/contrib/openzfs/contrib/debian/openzfs-zfs-zed.postinst
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
zedd="/usr/lib/zfs-linux/zed.d"
|
||||
etcd="/etc/zfs/zed.d"
|
||||
|
||||
# enable all default zedlets that are not overridden
|
||||
while read -r file ; do
|
||||
etcfile="${etcd}/${file}"
|
||||
[ -e "${etcfile}" ] && continue
|
||||
ln -sfT "${zedd}/${file}" "${etcfile}"
|
||||
done < "${zedd}/DEFAULT-ENABLED"
|
||||
|
||||
# remove the overrides created in prerm
|
||||
find "${etcd}" -maxdepth 1 -lname '/dev/null' -delete
|
||||
# remove any dangling symlinks to old zedlets
|
||||
find "${etcd}" -maxdepth 1 -lname "${zedd}/*" -xtype l -delete
|
||||
|
||||
#DEBHELPER#
|
||||
|
17
sys/contrib/openzfs/contrib/debian/openzfs-zfs-zed.postrm
Normal file
17
sys/contrib/openzfs/contrib/debian/openzfs-zfs-zed.postrm
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
zedd="/usr/lib/zfs-linux/zed.d"
|
||||
etcd="/etc/zfs/zed.d"
|
||||
|
||||
if [ "$1" = "purge" ] && [ -d "$etcd" ] ; then
|
||||
# remove the overrides created in prerm
|
||||
find "${etcd}" -maxdepth 1 -lname '/dev/null' -delete
|
||||
# remove any dangling symlinks to old zedlets
|
||||
find "${etcd}" -maxdepth 1 -lname "${zedd}/*" -xtype l -delete
|
||||
# clean up any empty directories
|
||||
( rmdir "$etcd" && rmdir "/etc/zfs" ) || true
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
|
16
sys/contrib/openzfs/contrib/debian/openzfs-zfs-zed.prerm
Normal file
16
sys/contrib/openzfs/contrib/debian/openzfs-zfs-zed.prerm
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
zedd="/usr/lib/zfs-linux/zed.d"
|
||||
etcd="/etc/zfs/zed.d"
|
||||
|
||||
if [ "$1" != "failed-upgrade" ] && [ -d "${etcd}" ] && [ -d "${zedd}" ] ; then
|
||||
while read -r file ; do
|
||||
etcfile="${etcd}/${file}"
|
||||
( [ -L "${etcfile}" ] || [ -e "${etcfile}" ] ) && continue
|
||||
ln -sT /dev/null "${etcfile}"
|
||||
done < "${zedd}/DEFAULT-ENABLED"
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
|
1
sys/contrib/openzfs/contrib/debian/openzfs-zfs-zed.zfs-zed.init
Symbolic link
1
sys/contrib/openzfs/contrib/debian/openzfs-zfs-zed.zfs-zed.init
Symbolic link
@ -0,0 +1 @@
|
||||
../etc/init.d/zfs-zed
|
2
sys/contrib/openzfs/contrib/debian/openzfs-zfsutils.docs
Normal file
2
sys/contrib/openzfs/contrib/debian/openzfs-zfsutils.docs
Normal file
@ -0,0 +1,2 @@
|
||||
COPYRIGHT
|
||||
LICENSE
|
@ -0,0 +1,5 @@
|
||||
etc/zfs/vdev_id.conf.alias.example
|
||||
etc/zfs/vdev_id.conf.multipath.example
|
||||
etc/zfs/vdev_id.conf.sas_direct.example
|
||||
etc/zfs/vdev_id.conf.sas_switch.example
|
||||
etc/zfs/vdev_id.conf.scsi.example
|
135
sys/contrib/openzfs/contrib/debian/openzfs-zfsutils.install
Normal file
135
sys/contrib/openzfs/contrib/debian/openzfs-zfsutils.install
Normal file
@ -0,0 +1,135 @@
|
||||
etc/default/zfs
|
||||
etc/zfs/zfs-functions
|
||||
etc/zfs/zpool.d/
|
||||
etc/bash_completion.d/zfs
|
||||
lib/systemd/system-generators/
|
||||
lib/systemd/system-preset/
|
||||
lib/systemd/system/zfs-import-cache.service
|
||||
lib/systemd/system/zfs-import-scan.service
|
||||
lib/systemd/system/zfs-import.target
|
||||
lib/systemd/system/zfs-load-key.service
|
||||
lib/systemd/system/zfs-mount.service
|
||||
lib/systemd/system/zfs-scrub-monthly@.timer
|
||||
lib/systemd/system/zfs-scrub-weekly@.timer
|
||||
lib/systemd/system/zfs-scrub@.service
|
||||
lib/systemd/system/zfs-trim-monthly@.timer
|
||||
lib/systemd/system/zfs-trim-weekly@.timer
|
||||
lib/systemd/system/zfs-trim@.service
|
||||
lib/systemd/system/zfs-share.service
|
||||
lib/systemd/system/zfs-volume-wait.service
|
||||
lib/systemd/system/zfs-volumes.target
|
||||
lib/systemd/system/zfs.target
|
||||
lib/udev/
|
||||
sbin/fsck.zfs
|
||||
sbin/mount.zfs
|
||||
sbin/zdb
|
||||
sbin/zfs
|
||||
sbin/zfs_ids_to_path
|
||||
sbin/zgenhostid
|
||||
sbin/zhack
|
||||
sbin/zpool
|
||||
sbin/zstream
|
||||
sbin/zstreamdump
|
||||
usr/bin/zvol_wait
|
||||
usr/lib/modules-load.d/ lib/
|
||||
usr/lib/zfs-linux/zpool.d/
|
||||
usr/lib/zfs-linux/zpool_influxdb
|
||||
usr/sbin/arc_summary
|
||||
usr/sbin/arcstat
|
||||
usr/sbin/dbufstat
|
||||
usr/sbin/zilstat
|
||||
usr/share/zfs/compatibility.d/
|
||||
usr/share/bash-completion/completions
|
||||
usr/share/man/man1/arcstat.1
|
||||
usr/share/man/man1/zhack.1
|
||||
usr/share/man/man1/zvol_wait.1
|
||||
usr/share/man/man5/
|
||||
usr/share/man/man8/fsck.zfs.8
|
||||
usr/share/man/man8/mount.zfs.8
|
||||
usr/share/man/man8/vdev_id.8
|
||||
usr/share/man/man8/zdb.8
|
||||
usr/share/man/man8/zfs-allow.8
|
||||
usr/share/man/man8/zfs-bookmark.8
|
||||
usr/share/man/man8/zfs-change-key.8
|
||||
usr/share/man/man8/zfs-clone.8
|
||||
usr/share/man/man8/zfs-create.8
|
||||
usr/share/man/man8/zfs-destroy.8
|
||||
usr/share/man/man8/zfs-diff.8
|
||||
usr/share/man/man8/zfs-get.8
|
||||
usr/share/man/man8/zfs-groupspace.8
|
||||
usr/share/man/man8/zfs-hold.8
|
||||
usr/share/man/man8/zfs-inherit.8
|
||||
usr/share/man/man8/zfs-jail.8
|
||||
usr/share/man/man8/zfs-list.8
|
||||
usr/share/man/man8/zfs-load-key.8
|
||||
usr/share/man/man8/zfs-mount-generator.8
|
||||
usr/share/man/man8/zfs-mount.8
|
||||
usr/share/man/man8/zfs-program.8
|
||||
usr/share/man/man8/zfs-project.8
|
||||
usr/share/man/man8/zfs-projectspace.8
|
||||
usr/share/man/man8/zfs-promote.8
|
||||
usr/share/man/man8/zfs-receive.8
|
||||
usr/share/man/man8/zfs-recv.8
|
||||
usr/share/man/man8/zfs-redact.8
|
||||
usr/share/man/man8/zfs-release.8
|
||||
usr/share/man/man8/zfs-rename.8
|
||||
usr/share/man/man8/zfs-rollback.8
|
||||
usr/share/man/man8/zfs-send.8
|
||||
usr/share/man/man8/zfs-set.8
|
||||
usr/share/man/man8/zfs-share.8
|
||||
usr/share/man/man8/zfs-snapshot.8
|
||||
usr/share/man/man8/zfs-unallow.8
|
||||
usr/share/man/man8/zfs-unjail.8
|
||||
usr/share/man/man8/zfs-unload-key.8
|
||||
usr/share/man/man8/zfs-unmount.8
|
||||
usr/share/man/man8/zfs-unzone.8
|
||||
usr/share/man/man8/zfs-upgrade.8
|
||||
usr/share/man/man8/zfs-userspace.8
|
||||
usr/share/man/man8/zfs-wait.8
|
||||
usr/share/man/man8/zfs-zone.8
|
||||
usr/share/man/man8/zfs.8
|
||||
usr/share/man/man8/zfs_ids_to_path.8
|
||||
usr/share/man/man7/zfsconcepts.7
|
||||
usr/share/man/man7/zfsprops.7
|
||||
usr/share/man/man8/zgenhostid.8
|
||||
usr/share/man/man8/zpool-add.8
|
||||
usr/share/man/man8/zpool-attach.8
|
||||
usr/share/man/man8/zpool-checkpoint.8
|
||||
usr/share/man/man8/zpool-clear.8
|
||||
usr/share/man/man8/zpool-create.8
|
||||
usr/share/man/man8/zpool-destroy.8
|
||||
usr/share/man/man8/zpool-detach.8
|
||||
usr/share/man/man8/zpool-events.8
|
||||
usr/share/man/man8/zpool-export.8
|
||||
usr/share/man/man8/zpool-get.8
|
||||
usr/share/man/man8/zpool-history.8
|
||||
usr/share/man/man8/zpool-import.8
|
||||
usr/share/man/man8/zpool-initialize.8
|
||||
usr/share/man/man8/zpool-iostat.8
|
||||
usr/share/man/man8/zpool-labelclear.8
|
||||
usr/share/man/man8/zpool-list.8
|
||||
usr/share/man/man8/zpool-offline.8
|
||||
usr/share/man/man8/zpool-online.8
|
||||
usr/share/man/man8/zpool-reguid.8
|
||||
usr/share/man/man8/zpool-remove.8
|
||||
usr/share/man/man8/zpool-reopen.8
|
||||
usr/share/man/man8/zpool-replace.8
|
||||
usr/share/man/man8/zpool-resilver.8
|
||||
usr/share/man/man8/zpool-scrub.8
|
||||
usr/share/man/man8/zpool-set.8
|
||||
usr/share/man/man8/zpool-split.8
|
||||
usr/share/man/man8/zpool-status.8
|
||||
usr/share/man/man8/zpool-sync.8
|
||||
usr/share/man/man8/zpool-trim.8
|
||||
usr/share/man/man8/zpool-upgrade.8
|
||||
usr/share/man/man8/zpool-wait.8
|
||||
usr/share/man/man8/zpool.8
|
||||
usr/share/man/man7/zpoolconcepts.7
|
||||
usr/share/man/man7/zpoolprops.7
|
||||
usr/share/man/man8/zstream.8
|
||||
usr/share/man/man8/zstreamdump.8
|
||||
usr/share/man/man4/spl.4
|
||||
usr/share/man/man4/zfs.4
|
||||
usr/share/man/man7/zpool-features.7
|
||||
usr/share/man/man7/dracut.zfs.7
|
||||
usr/share/man/man8/zpool_influxdb.8
|
28
sys/contrib/openzfs/contrib/debian/openzfs-zfsutils.postinst
Normal file
28
sys/contrib/openzfs/contrib/debian/openzfs-zfsutils.postinst
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# The hostname and hostid of the last system to access a ZFS pool are stored in
|
||||
# the ZFS pool itself. A pool is foreign if, during `zpool import`, the
|
||||
# current hostname and hostid are different than the stored values thereof.
|
||||
#
|
||||
# The only way of having a stable hostid is to define it in /etc/hostid.
|
||||
# This postinst helper will check if we already have the hostid stabilized by
|
||||
# checking the existence of the file /etc/hostid to be 4 bytes at least.
|
||||
# If this file don't already exists on our system or has less than 4 bytes, then
|
||||
# a new (random) value is generated with zgenhostid (8) and stored in
|
||||
# /etc/hostid
|
||||
|
||||
if [ ! -f /etc/hostid ] || [ "$(stat -c %s /etc/hostid)" -lt 4 ] ; then
|
||||
zgenhostid
|
||||
fi
|
||||
|
||||
# When processed to here but zfs kernel module is not loaded, the subsequent
|
||||
# services would fail to start. In this case the installation process just
|
||||
# fails at the postinst stage. The user could do
|
||||
# $ sudo modprobe zfs; sudo dpkg --configure -a
|
||||
# to complete the installation.
|
||||
#
|
||||
modprobe -v zfs || true # modprobe zfs does nothing if zfs.ko was already loaded.
|
||||
|
||||
#DEBHELPER#
|
||||
|
@ -0,0 +1 @@
|
||||
../etc/init.d/zfs-import
|
@ -0,0 +1 @@
|
||||
../etc/init.d/zfs-load-key
|
@ -0,0 +1 @@
|
||||
../etc/init.d/zfs-mount
|
@ -0,0 +1 @@
|
||||
../etc/init.d/zfs-share
|
223
sys/contrib/openzfs/contrib/debian/rules
Executable file
223
sys/contrib/openzfs/contrib/debian/rules
Executable file
@ -0,0 +1,223 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
include /usr/share/dpkg/default.mk
|
||||
|
||||
LSB_DISTRIBUTOR := $(shell lsb_release -is)
|
||||
NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
|
||||
LINUX_MIN := $(shell awk '/Linux-Minimum:/{print $$2}' META)
|
||||
LINUX_NEXT := $(shell awk -F'[ .]' '/Linux-Maximum:/{print $$2 "." $$3+1}' META)
|
||||
|
||||
DKMSFILES := module include config zfs.release.in autogen.sh META AUTHORS \
|
||||
COPYRIGHT LICENSE README.md
|
||||
|
||||
ifndef KVERS
|
||||
KVERS=$(shell uname -r)
|
||||
endif
|
||||
|
||||
non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://')
|
||||
PACKAGE=openzfs-zfs
|
||||
pmodules = $(PACKAGE)-modules-$(non_epoch_version)
|
||||
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
|
||||
NUM_CPUS = $(shell nproc 2>/dev/null)
|
||||
PARALLEL = $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
|
||||
NJOBS = -j$(or $(PARALLEL),$(NUM_CPUS),1)
|
||||
|
||||
%:
|
||||
dh $@ --with autoreconf,dkms,python3,sphinxdoc
|
||||
|
||||
override_dh_autoreconf:
|
||||
@# Embed the downstream version in the module.
|
||||
@sed -e 's/^Version:.*/Version: $(DEB_VERSION_UPSTREAM)/' -i.orig META
|
||||
|
||||
dh_autoreconf
|
||||
|
||||
override_dh_auto_configure:
|
||||
@# Build the userland, but don't build the kernel modules.
|
||||
dh_auto_configure -- \
|
||||
--bindir=/usr/bin \
|
||||
--sbindir=/sbin \
|
||||
--libdir=/lib/"$(DEB_HOST_MULTIARCH)" \
|
||||
--with-udevdir=/lib/udev \
|
||||
--with-zfsexecdir=/usr/lib/zfs-linux \
|
||||
--enable-systemd \
|
||||
--enable-pyzfs \
|
||||
--with-python=python3 \
|
||||
--with-pammoduledir='/lib/$(DEB_HOST_MULTIARCH)/security' \
|
||||
--with-pkgconfigdir='/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig' \
|
||||
--with-systemdunitdir=/lib/systemd/system \
|
||||
--with-systemdpresetdir=/lib/systemd/system-preset \
|
||||
--with-systemdgeneratordir=/lib/systemd/system-generators \
|
||||
--with-config=user
|
||||
|
||||
for i in $(wildcard $(CURDIR)/debian/*.install.in) ; do \
|
||||
basename "$$i" | grep _KVERS_ && continue ; \
|
||||
sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' "$$i" > "$${i%%.in}" ; \
|
||||
done
|
||||
|
||||
override_dh_gencontrol:
|
||||
dh_gencontrol -- -Vlinux:Recommends="linux-libc-dev (<< $(LINUX_NEXT)~), linux-libc-dev (>= $(LINUX_MIN)~),"
|
||||
|
||||
override_dh_auto_build:
|
||||
@# Get a bare copy of the source code for DKMS.
|
||||
@# This creates the $(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/ tree, which does not
|
||||
@# contain the userland sources. NB: Remove-userland-dist-rules.patch
|
||||
$(MAKE) distdir
|
||||
|
||||
dh_auto_build
|
||||
|
||||
override_dh_auto_install:
|
||||
@# Install the utilities.
|
||||
$(MAKE) install DESTDIR='$(CURDIR)/debian/tmp'
|
||||
|
||||
# Use upstream's bash completion
|
||||
install -D -t '$(CURDIR)/debian/tmp/usr/share/bash-completion/completions/' \
|
||||
'$(CURDIR)/contrib/bash_completion.d/zfs'
|
||||
|
||||
# Move from bin_dir to /usr/sbin
|
||||
# Remove suffix (.py) as per policy 10.4 - Scripts
|
||||
# https://www.debian.org/doc/debian-policy/ch-files.html#s-scripts
|
||||
mkdir -p '$(CURDIR)/debian/tmp/usr/sbin/'
|
||||
mv '$(CURDIR)/debian/tmp/usr/bin/arc_summary' '$(CURDIR)/debian/tmp/usr/sbin/arc_summary'
|
||||
mv '$(CURDIR)/debian/tmp/usr/bin/arcstat' '$(CURDIR)/debian/tmp/usr/sbin/arcstat'
|
||||
mv '$(CURDIR)/debian/tmp/usr/bin/dbufstat' '$(CURDIR)/debian/tmp/usr/sbin/dbufstat'
|
||||
mv '$(CURDIR)/debian/tmp/usr/bin/zilstat' '$(CURDIR)/debian/tmp/usr/sbin/zilstat'
|
||||
|
||||
@# Zed has dependencies outside of the system root.
|
||||
mv '$(CURDIR)/debian/tmp/sbin/zed' '$(CURDIR)/debian/tmp/usr/sbin/zed'
|
||||
|
||||
@# Install the DKMS source.
|
||||
@# We only want the files needed to build the modules
|
||||
install -D -t '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts' \
|
||||
'$(CURDIR)/scripts/enum-extract.pl' \
|
||||
'$(CURDIR)/scripts/dkms.postbuild'
|
||||
$(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit 1;)
|
||||
|
||||
@# Only ever build Linux modules
|
||||
echo 'SUBDIRS = linux' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/include/os/Makefile.am'
|
||||
|
||||
@# Hellish awk line:
|
||||
@# * Deletes from configure.ac the parts not needed for building the kernel module
|
||||
@# * It deletes from inside AC_CONFIG_FILES([]) everything except:
|
||||
@# - Makefile$
|
||||
@# - include/(Makefile|sys|os/(Makefile|linux))
|
||||
@# - module/
|
||||
@# - zfs.release$
|
||||
@# * Takes care of spaces and tabs
|
||||
@# * Remove reference to ZFS_AC_PACKAGE
|
||||
awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ {\
|
||||
if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/(Makefile|sys|os\/(Makefile|linux))|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/) \
|
||||
{next} } {print}' \
|
||||
'$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' | sed '/ZFS_AC_PACKAGE/d' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac'
|
||||
@# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
|
||||
@# Do not regenerate zfs_gitrev.h during dkms build
|
||||
sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;/make_gitrev.sh/d' \
|
||||
'$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
|
||||
@# Sanity test
|
||||
grep -q 'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
|
||||
sed -i '/rpm.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am
|
||||
sed -i '/cmd.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am
|
||||
sed -i '/contrib.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am
|
||||
sed -i '/etc.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am
|
||||
sed -i '/lib.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am
|
||||
sed -i '/man.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am
|
||||
sed -i '/scripts.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am
|
||||
sed -i '/tests.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am
|
||||
sed -i '/udev.Makefile/d' $(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am
|
||||
@# Run autogen on the stripped source tree
|
||||
cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'; ./autogen.sh
|
||||
rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/autom4te.cache'
|
||||
|
||||
for i in `ls $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/*.so`; do \
|
||||
ln -s '/lib/$(DEB_HOST_MULTIARCH)/'`readlink $${i}` '$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/'`basename $${i}`; \
|
||||
rm $${i}; \
|
||||
done
|
||||
|
||||
chmod a-x '$(CURDIR)/debian/tmp/etc/zfs/zfs-functions'
|
||||
chmod a-x '$(CURDIR)/debian/tmp/etc/default/zfs'
|
||||
chmod a-x '$(CURDIR)/debian/tmp/usr/share/bash-completion/completions/zfs'
|
||||
|
||||
override_dh_python3:
|
||||
dh_python3 -p openzfs-python3-pyzfs
|
||||
|
||||
override_dh_dkms:
|
||||
'$(CURDIR)/scripts/dkms.mkconf' -n $(NAME) -v $(DEB_VERSION_UPSTREAM) -f '$(CURDIR)/scripts/zfs-dkms.dkms'
|
||||
dh_dkms
|
||||
rm -f '$(CURDIR)/scripts/zfs-dkms.dkms'
|
||||
|
||||
override_dh_makeshlibs:
|
||||
dh_makeshlibs -a -V
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip
|
||||
|
||||
override_dh_auto_clean:
|
||||
rm -rf zfs-$(DEB_VERSION_UPSTREAM)
|
||||
dh_auto_clean
|
||||
@if test -e META.orig; then mv META.orig META; fi
|
||||
|
||||
override_dh_install:
|
||||
find debian/tmp/lib -name '*.la' -delete
|
||||
dh_install
|
||||
|
||||
override_dh_missing:
|
||||
dh_missing --fail-missing
|
||||
|
||||
override_dh_installinit:
|
||||
dh_installinit -r --no-restart-after-upgrade --name zfs-import
|
||||
dh_installinit -r --no-restart-after-upgrade --name zfs-mount
|
||||
dh_installinit -r --no-restart-after-upgrade --name zfs-load-key
|
||||
dh_installinit -R --name zfs-share
|
||||
dh_installinit -R --name zfs-zed
|
||||
|
||||
override_dh_installsystemd:
|
||||
mkdir -p debian/openzfs-zfsutils/lib/systemd/system
|
||||
ln -sr /dev/null debian/openzfs-zfsutils/lib/systemd/system/zfs-import.service
|
||||
dh_installsystemd --no-stop-on-upgrade -X zfs-zed.service
|
||||
dh_installsystemd --name zfs-zed
|
||||
|
||||
override_dh_installdocs:
|
||||
dh_installdocs -A
|
||||
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
|
||||
http_proxy='127.0.0.1:9' sphinx-build -N -bhtml "$(CURDIR)/contrib/pyzfs/docs/source/" debian/openzfs-pyzfs-doc/usr/share/doc/openzfs-pyzfs-doc/html/
|
||||
endif
|
||||
|
||||
# ------------
|
||||
|
||||
override_dh_prep-deb-files:
|
||||
for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*.in); do \
|
||||
sed -e 's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/' \
|
||||
< $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
|
||||
done
|
||||
sed -e 's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g' \
|
||||
< debian/control.modules.in > debian/control
|
||||
|
||||
override_dh_configure_modules: override_dh_configure_modules_stamp
|
||||
override_dh_configure_modules_stamp:
|
||||
./configure \
|
||||
--with-config=kernel \
|
||||
--with-linux=$(KSRC) \
|
||||
--with-linux-obj=$(KOBJ)
|
||||
touch override_dh_configure_modules_stamp
|
||||
|
||||
override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_modules
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_prep
|
||||
|
||||
$(MAKE) $(NJOBS) -C $(CURDIR)/module modules
|
||||
|
||||
dh_install -p${pmodules}
|
||||
dh_installdocs -p${pmodules}
|
||||
dh_installchangelogs -p${pmodules}
|
||||
dh_compress -p${pmodules}
|
||||
dh_strip -p${pmodules}
|
||||
dh_fixperms -p${pmodules}
|
||||
dh_installdeb -p${pmodules}
|
||||
dh_gencontrol -p${pmodules}
|
||||
dh_md5sums -p${pmodules}
|
||||
dh_builddeb -p${pmodules}
|
||||
|
||||
debian-copyright:
|
||||
cme update dpkg-copyright -file debian/copyright.cme
|
1
sys/contrib/openzfs/contrib/debian/source/format
Normal file
1
sys/contrib/openzfs/contrib/debian/source/format
Normal file
@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
@ -0,0 +1,8 @@
|
||||
for x in $(cat /proc/cmdline)
|
||||
do
|
||||
case $x in
|
||||
root=ZFS=*)
|
||||
BOOT=zfs
|
||||
;;
|
||||
esac
|
||||
done
|
@ -0,0 +1,67 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Add udev rules for ZoL to the initrd.
|
||||
#
|
||||
|
||||
PREREQ="udev"
|
||||
PREREQ_UDEV_RULES="60-zvol.rules 69-vdev.rules"
|
||||
COPY_EXEC_LIST="/lib/udev/zvol_id /lib/udev/vdev_id"
|
||||
|
||||
# Generic result code.
|
||||
RC=0
|
||||
|
||||
case $1 in
|
||||
prereqs)
|
||||
echo "$PREREQ"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
for ii in $COPY_EXEC_LIST
|
||||
do
|
||||
if [ ! -x "$ii" ]
|
||||
then
|
||||
echo "Error: $ii is not executable."
|
||||
RC=2
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$RC" -ne 0 ]
|
||||
then
|
||||
exit "$RC"
|
||||
fi
|
||||
|
||||
. /usr/share/initramfs-tools/hook-functions
|
||||
|
||||
mkdir -p "$DESTDIR/lib/udev/rules.d/"
|
||||
for ii in $PREREQ_UDEV_RULES
|
||||
do
|
||||
if [ -e "/etc/udev/rules.d/$ii" ]
|
||||
then
|
||||
cp -p "/etc/udev/rules.d/$ii" "$DESTDIR/lib/udev/rules.d/"
|
||||
elif [ -e "/lib/udev/rules.d/$ii" ]
|
||||
then
|
||||
cp -p "/lib/udev/rules.d/$ii" "$DESTDIR/lib/udev/rules.d/"
|
||||
else
|
||||
echo "Error: Missing udev rule: $ii"
|
||||
echo " This file must be in the /etc/udev/rules.d or /lib/udev/rules.d directory."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for ii in $COPY_EXEC_LIST
|
||||
do
|
||||
copy_exec "$ii"
|
||||
done
|
||||
|
||||
if [ -f '/etc/default/zfs' -a -r '/etc/default/zfs' ]
|
||||
then
|
||||
mkdir -p "$DESTDIR/etc/default"
|
||||
cp -a '/etc/default/zfs' "$DESTDIR/etc/default/"
|
||||
fi
|
||||
|
||||
if [ -d '/etc/zfs' -a -r '/etc/zfs' ]
|
||||
then
|
||||
mkdir -p "$DESTDIR/etc"
|
||||
cp -a '/etc/zfs' "$DESTDIR/etc/"
|
||||
fi
|
@ -81,11 +81,30 @@ install() {
|
||||
inst_simple "${moddir}/zfs-env-bootfs.service" "${systemdsystemunitdir}/zfs-env-bootfs.service"
|
||||
systemctl -q --root "${initdir}" add-wants zfs-import.target zfs-env-bootfs.service
|
||||
|
||||
# Add user-provided unit overrides:
|
||||
# - /etc/systemd/system/${_service}
|
||||
# - /etc/systemd/system/${_service}.d/overrides.conf
|
||||
# -H ensures they are marked host-only
|
||||
# -o ensures there is no error upon absence of these files
|
||||
inst_multiple -o -H \
|
||||
"${systemdsystemconfdir}/zfs-import.target" \
|
||||
"${systemdsystemconfdir}/zfs-import.target.d/"*.conf
|
||||
|
||||
for _service in \
|
||||
"zfs-import-scan.service" \
|
||||
"zfs-import-cache.service"; do
|
||||
inst_simple "${systemdsystemunitdir}/${_service}"
|
||||
systemctl -q --root "${initdir}" add-wants zfs-import.target "${_service}"
|
||||
|
||||
# Add user-provided unit overrides:
|
||||
# - /etc/systemd/system/${_service}
|
||||
# - /etc/systemd/system/${_service}.d/overrides.conf
|
||||
# -H ensures they are marked host-only
|
||||
# -o ensures there is no error upon absence of these files
|
||||
inst_multiple -o -H \
|
||||
"${systemdsystemconfdir}/${_service}" \
|
||||
"${systemdsystemconfdir}/${_service}.d/"*.conf
|
||||
|
||||
done
|
||||
|
||||
for _service in \
|
||||
@ -93,6 +112,15 @@ install() {
|
||||
"zfs-rollback-bootfs.service"; do
|
||||
inst_simple "${moddir}/${_service}" "${systemdsystemunitdir}/${_service}"
|
||||
systemctl -q --root "${initdir}" add-wants initrd.target "${_service}"
|
||||
|
||||
# Add user-provided unit overrides:
|
||||
# - /etc/systemd/system/${_service}
|
||||
# - /etc/systemd/system/${_service}.d/overrides.conf
|
||||
# -H ensures they are marked host-only
|
||||
# -o ensures there is no error upon absence of these files
|
||||
inst_multiple -o -H \
|
||||
"${systemdsystemconfdir}/${_service}" \
|
||||
"${systemdsystemconfdir}/${_service}.d/"*.conf
|
||||
done
|
||||
|
||||
inst_simple "${moddir}/import-opts-generator.sh" "${systemdutildir}/system-environment-generators/zfs-import-opts.sh"
|
||||
|
@ -754,7 +754,10 @@ pam_sm_open_session(pam_handle_t *pamh, int flags,
|
||||
return (PAM_SUCCESS);
|
||||
}
|
||||
zfs_key_config_t config;
|
||||
zfs_key_config_load(pamh, &config, argc, argv);
|
||||
if (zfs_key_config_load(pamh, &config, argc, argv) != 0) {
|
||||
return (PAM_SESSION_ERR);
|
||||
}
|
||||
|
||||
if (config.uid < 1000) {
|
||||
zfs_key_config_free(&config);
|
||||
return (PAM_SUCCESS);
|
||||
|
@ -74,6 +74,7 @@ INSTALL_DATA_HOOKS += systemd-install-data-hook
|
||||
systemd-install-data-hook:
|
||||
$(MKDIR_P) "$(DESTDIR)$(systemdunitdir)"
|
||||
ln -sf /dev/null "$(DESTDIR)$(systemdunitdir)/zfs-import.service"
|
||||
ln -sf /dev/null "$(DESTDIR)$(systemdunitdir)/zfs-load-key.service"
|
||||
|
||||
|
||||
systemdgenerator_PROGRAMS = \
|
||||
|
@ -46,21 +46,6 @@ __attribute__((format(printf, 1, 2), __noreturn__))
|
||||
void uu_panic(const char *format, ...);
|
||||
|
||||
|
||||
/*
|
||||
* For debugging purposes, libuutil keeps around linked lists of all uu_lists
|
||||
* and uu_avls, along with pointers to their parents. These can cause false
|
||||
* negatives when looking for memory leaks, so we encode the pointers by
|
||||
* storing them with swapped endianness; this is not perfect, but it's about
|
||||
* the best we can do without wasting a lot of space.
|
||||
*/
|
||||
#ifdef _LP64
|
||||
#define UU_PTR_ENCODE(ptr) BSWAP_64((uintptr_t)(void *)(ptr))
|
||||
#else
|
||||
#define UU_PTR_ENCODE(ptr) BSWAP_32((uintptr_t)(void *)(ptr))
|
||||
#endif
|
||||
|
||||
#define UU_PTR_DECODE(ptr) ((void *)UU_PTR_ENCODE(ptr))
|
||||
|
||||
/*
|
||||
* uu_list structures
|
||||
*/
|
||||
@ -80,11 +65,11 @@ struct uu_list_walk {
|
||||
};
|
||||
|
||||
struct uu_list {
|
||||
uintptr_t ul_next_enc;
|
||||
uintptr_t ul_prev_enc;
|
||||
uu_list_t *ul_next;
|
||||
uu_list_t *ul_prev;
|
||||
|
||||
uu_list_pool_t *ul_pool;
|
||||
uintptr_t ul_parent_enc; /* encoded parent pointer */
|
||||
void *ul_parent;
|
||||
size_t ul_offset;
|
||||
size_t ul_numnodes;
|
||||
uint8_t ul_debug;
|
||||
@ -95,8 +80,6 @@ struct uu_list {
|
||||
uu_list_walk_t ul_null_walk; /* for robust walkers */
|
||||
};
|
||||
|
||||
#define UU_LIST_PTR(ptr) ((uu_list_t *)UU_PTR_DECODE(ptr))
|
||||
|
||||
#define UU_LIST_POOL_MAXNAME 64
|
||||
|
||||
struct uu_list_pool {
|
||||
@ -129,11 +112,11 @@ struct uu_avl_walk {
|
||||
};
|
||||
|
||||
struct uu_avl {
|
||||
uintptr_t ua_next_enc;
|
||||
uintptr_t ua_prev_enc;
|
||||
uu_avl_t *ua_next;
|
||||
uu_avl_t *ua_prev;
|
||||
|
||||
uu_avl_pool_t *ua_pool;
|
||||
uintptr_t ua_parent_enc;
|
||||
void *ua_parent;
|
||||
uint8_t ua_debug;
|
||||
uint8_t ua_index; /* mark for uu_avl_index_ts */
|
||||
|
||||
@ -141,8 +124,6 @@ struct uu_avl {
|
||||
uu_avl_walk_t ua_null_walk;
|
||||
};
|
||||
|
||||
#define UU_AVL_PTR(x) ((uu_avl_t *)UU_PTR_DECODE(x))
|
||||
|
||||
#define UU_AVL_POOL_MAXNAME 64
|
||||
|
||||
struct uu_avl_pool {
|
||||
|
@ -260,10 +260,10 @@ _LIBZFS_H int zpool_add(zpool_handle_t *, nvlist_t *);
|
||||
|
||||
typedef struct splitflags {
|
||||
/* do not split, but return the config that would be split off */
|
||||
int dryrun : 1;
|
||||
unsigned int dryrun : 1;
|
||||
|
||||
/* after splitting, import the pool */
|
||||
int import : 1;
|
||||
unsigned int import : 1;
|
||||
int name_flags;
|
||||
} splitflags_t;
|
||||
|
||||
@ -690,13 +690,13 @@ _LIBZFS_H int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
|
||||
|
||||
typedef struct renameflags {
|
||||
/* recursive rename */
|
||||
int recursive : 1;
|
||||
unsigned int recursive : 1;
|
||||
|
||||
/* don't unmount file systems */
|
||||
int nounmount : 1;
|
||||
unsigned int nounmount : 1;
|
||||
|
||||
/* force unmount file systems */
|
||||
int forceunmount : 1;
|
||||
unsigned int forceunmount : 1;
|
||||
} renameflags_t;
|
||||
|
||||
_LIBZFS_H int zfs_rename(zfs_handle_t *, const char *, renameflags_t);
|
||||
|
@ -59,6 +59,15 @@ typedef const struct pool_config_ops {
|
||||
_LIBZUTIL_H pool_config_ops_t libzfs_config_ops;
|
||||
_LIBZUTIL_H pool_config_ops_t libzpool_config_ops;
|
||||
|
||||
typedef enum lpc_error {
|
||||
LPC_SUCCESS = 0, /* no error -- success */
|
||||
LPC_BADCACHE = 2000, /* out of memory */
|
||||
LPC_BADPATH, /* must be an absolute path */
|
||||
LPC_NOMEM, /* out of memory */
|
||||
LPC_EACCESS, /* some devices require root privileges */
|
||||
LPC_UNKNOWN
|
||||
} lpc_error_t;
|
||||
|
||||
typedef struct importargs {
|
||||
char **path; /* a list of paths to search */
|
||||
int paths; /* number of paths to search */
|
||||
@ -70,10 +79,20 @@ typedef struct importargs {
|
||||
nvlist_t *policy; /* load policy (max txg, rewind, etc.) */
|
||||
} importargs_t;
|
||||
|
||||
_LIBZUTIL_H nvlist_t *zpool_search_import(void *, importargs_t *,
|
||||
pool_config_ops_t *);
|
||||
_LIBZUTIL_H int zpool_find_config(void *, const char *, nvlist_t **,
|
||||
importargs_t *, pool_config_ops_t *);
|
||||
typedef struct libpc_handle {
|
||||
int lpc_error;
|
||||
boolean_t lpc_printerr;
|
||||
boolean_t lpc_open_access_error;
|
||||
boolean_t lpc_desc_active;
|
||||
char lpc_desc[1024];
|
||||
pool_config_ops_t *lpc_ops;
|
||||
void *lpc_lib_handle;
|
||||
} libpc_handle_t;
|
||||
|
||||
_LIBZUTIL_H const char *libpc_error_description(libpc_handle_t *);
|
||||
_LIBZUTIL_H nvlist_t *zpool_search_import(libpc_handle_t *, importargs_t *);
|
||||
_LIBZUTIL_H int zpool_find_config(libpc_handle_t *, const char *, nvlist_t **,
|
||||
importargs_t *);
|
||||
|
||||
_LIBZUTIL_H const char * const * zpool_default_search_paths(size_t *count);
|
||||
_LIBZUTIL_H int zpool_read_label(int, nvlist_t **, int *);
|
||||
|
@ -47,7 +47,7 @@ extern int acltrivial(const char *);
|
||||
extern void adjust_ace_pair(ace_t *pair, mode_t mode);
|
||||
extern void adjust_ace_pair_common(void *, size_t, size_t, mode_t);
|
||||
extern int ace_trivial_common(void *, int,
|
||||
uint64_t (*walk)(void *, uint64_t, int aclcnt, uint16_t *, uint16_t *,
|
||||
uintptr_t (*walk)(void *, uintptr_t, int aclcnt, uint16_t *, uint16_t *,
|
||||
uint32_t *mask));
|
||||
#if !defined(_KERNEL)
|
||||
extern acl_t *acl_alloc(acl_type_t);
|
||||
|
@ -54,6 +54,9 @@
|
||||
/*
|
||||
* Common DEBUG functionality.
|
||||
*/
|
||||
#if defined(__COVERITY__) || defined(__clang_analyzer__)
|
||||
__attribute__((__noreturn__))
|
||||
#endif
|
||||
extern void spl_panic(const char *file, const char *func, int line,
|
||||
const char *fmt, ...) __attribute__((__noreturn__));
|
||||
extern void spl_dumpstack(void);
|
||||
@ -128,7 +131,7 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
|
||||
const int64_t _verify3_right = (int64_t)(RIGHT); \
|
||||
if (unlikely(!(_verify3_left == _verify3_right))) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
|
||||
"VERIFY3(0 == " #RIGHT ") " \
|
||||
"VERIFY0(0 == " #RIGHT ") " \
|
||||
"failed (0 == %lld)\n", \
|
||||
(long long) (_verify3_right)); \
|
||||
} while (0)
|
||||
|
@ -28,467 +28,7 @@
|
||||
#ifndef _OPENSOLARIS_SYS_DKIO_H_
|
||||
#define _OPENSOLARIS_SYS_DKIO_H_
|
||||
|
||||
#include <sys/types.h> /* Needed for NDKMAP define */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_SUNOS_VTOC_16)
|
||||
#define NDKMAP 16 /* # of logical partitions */
|
||||
#define DK_LABEL_LOC 1 /* location of disk label */
|
||||
#elif defined(_SUNOS_VTOC_8)
|
||||
#define NDKMAP 8 /* # of logical partitions */
|
||||
#define DK_LABEL_LOC 0 /* location of disk label */
|
||||
#else
|
||||
#error "No VTOC format defined."
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structures and definitions for disk io control commands
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structures used as data by ioctl calls.
|
||||
*/
|
||||
|
||||
#define DK_DEVLEN 16 /* device name max length, including */
|
||||
/* unit # & NULL (ie - "xyc1") */
|
||||
|
||||
/*
|
||||
* Used for controller info
|
||||
*/
|
||||
struct dk_cinfo {
|
||||
char dki_cname[DK_DEVLEN]; /* controller name (no unit #) */
|
||||
ushort_t dki_ctype; /* controller type */
|
||||
ushort_t dki_flags; /* flags */
|
||||
ushort_t dki_cnum; /* controller number */
|
||||
uint_t dki_addr; /* controller address */
|
||||
uint_t dki_space; /* controller bus type */
|
||||
uint_t dki_prio; /* interrupt priority */
|
||||
uint_t dki_vec; /* interrupt vector */
|
||||
char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */
|
||||
uint_t dki_unit; /* unit number */
|
||||
ushort_t dki_partition; /* partition number */
|
||||
ushort_t dki_maxtransfer; /* max. transfer size in DEV_BSIZE */
|
||||
};
|
||||
|
||||
/*
|
||||
* Controller types
|
||||
*/
|
||||
#define DKC_UNKNOWN 0
|
||||
#define DKC_CDROM 1 /* CD-ROM, SCSI or otherwise */
|
||||
#define DKC_WDC2880 2
|
||||
#define DKC_XXX_0 3 /* unassigned */
|
||||
#define DKC_XXX_1 4 /* unassigned */
|
||||
#define DKC_DSD5215 5
|
||||
#define DKC_ACB4000 7
|
||||
#define DKC_MD21 8
|
||||
#define DKC_XXX_2 9 /* unassigned */
|
||||
#define DKC_NCRFLOPPY 10
|
||||
#define DKC_SMSFLOPPY 12
|
||||
#define DKC_SCSI_CCS 13 /* SCSI CCS compatible */
|
||||
#define DKC_INTEL82072 14 /* native floppy chip */
|
||||
#define DKC_MD 16 /* meta-disk (virtual-disk) driver */
|
||||
#define DKC_INTEL82077 19 /* 82077 floppy disk controller */
|
||||
#define DKC_DIRECT 20 /* Intel direct attached device i.e. IDE */
|
||||
#define DKC_PCMCIA_MEM 21 /* PCMCIA memory disk-like type */
|
||||
#define DKC_PCMCIA_ATA 22 /* PCMCIA AT Attached type */
|
||||
#define DKC_VBD 23 /* virtual block device */
|
||||
|
||||
/*
|
||||
* Sun reserves up through 1023
|
||||
*/
|
||||
|
||||
#define DKC_CUSTOMER_BASE 1024
|
||||
|
||||
/*
|
||||
* Flags
|
||||
*/
|
||||
#define DKI_BAD144 0x01 /* use DEC std 144 bad sector fwding */
|
||||
#define DKI_MAPTRK 0x02 /* controller does track mapping */
|
||||
#define DKI_FMTTRK 0x04 /* formats only full track at a time */
|
||||
#define DKI_FMTVOL 0x08 /* formats only full volume at a time */
|
||||
#define DKI_FMTCYL 0x10 /* formats only full cylinders at a time */
|
||||
#define DKI_HEXUNIT 0x20 /* unit number is printed as 3 hex digits */
|
||||
#define DKI_PCMCIA_PFD 0x40 /* PCMCIA pseudo-floppy memory card */
|
||||
|
||||
/*
|
||||
* partition headers: section 1
|
||||
* Returned in struct dk_allmap by ioctl DKIOC[SG]APART (dkio(7I))
|
||||
*/
|
||||
struct dk_map {
|
||||
uint64_t dkl_cylno; /* starting cylinder */
|
||||
uint64_t dkl_nblk; /* number of blocks; if == 0, */
|
||||
/* partition is undefined */
|
||||
};
|
||||
|
||||
/*
|
||||
* Used for all partitions
|
||||
*/
|
||||
struct dk_allmap {
|
||||
struct dk_map dka_map[NDKMAP];
|
||||
};
|
||||
|
||||
#if defined(_SYSCALL32)
|
||||
struct dk_allmap32 {
|
||||
struct dk_map32 dka_map[NDKMAP];
|
||||
};
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
/*
|
||||
* Definition of a disk's geometry
|
||||
*/
|
||||
struct dk_geom {
|
||||
unsigned short dkg_ncyl; /* # of data cylinders */
|
||||
unsigned short dkg_acyl; /* # of alternate cylinders */
|
||||
unsigned short dkg_bcyl; /* cyl offset (for fixed head area) */
|
||||
unsigned short dkg_nhead; /* # of heads */
|
||||
unsigned short dkg_obs1; /* obsolete */
|
||||
unsigned short dkg_nsect; /* # of data sectors per track */
|
||||
unsigned short dkg_intrlv; /* interleave factor */
|
||||
unsigned short dkg_obs2; /* obsolete */
|
||||
unsigned short dkg_obs3; /* obsolete */
|
||||
unsigned short dkg_apc; /* alternates per cyl (SCSI only) */
|
||||
unsigned short dkg_rpm; /* revolutions per minute */
|
||||
unsigned short dkg_pcyl; /* # of physical cylinders */
|
||||
unsigned short dkg_write_reinstruct; /* # sectors to skip, writes */
|
||||
unsigned short dkg_read_reinstruct; /* # sectors to skip, reads */
|
||||
unsigned short dkg_extra[7]; /* for compatible expansion */
|
||||
};
|
||||
|
||||
/*
|
||||
* These defines are for historic compatibility with old drivers.
|
||||
*/
|
||||
#define dkg_bhead dkg_obs1 /* used to be head offset */
|
||||
#define dkg_gap1 dkg_obs2 /* used to be gap1 */
|
||||
#define dkg_gap2 dkg_obs3 /* used to be gap2 */
|
||||
|
||||
/*
|
||||
* Disk io control commands
|
||||
* Warning: some other ioctls with the DIOC prefix exist elsewhere.
|
||||
* The Generic DKIOC numbers are from 0 - 50.
|
||||
* The Floppy Driver uses 51 - 100.
|
||||
* The Hard Disk (except SCSI) 101 - 106. (these are obsolete)
|
||||
* The CDROM Driver 151 - 200.
|
||||
* The USCSI ioctl 201 - 250.
|
||||
*/
|
||||
#define DKIOC (0x04 << 8)
|
||||
|
||||
/*
|
||||
* The following ioctls are generic in nature and need to be
|
||||
* supported as appropriate by all disk drivers
|
||||
*/
|
||||
#define DKIOCGGEOM (DKIOC|1) /* Get geometry */
|
||||
#define DKIOCINFO (DKIOC|3) /* Get info */
|
||||
#define DKIOCEJECT (DKIOC|6) /* Generic 'eject' */
|
||||
#define DKIOCGVTOC (DKIOC|11) /* Get VTOC */
|
||||
#define DKIOCSVTOC (DKIOC|12) /* Set VTOC & Write to Disk */
|
||||
|
||||
/*
|
||||
* Disk Cache Controls. These ioctls should be supported by
|
||||
* all disk drivers.
|
||||
*
|
||||
* DKIOCFLUSHWRITECACHE when used from user-mode ignores the ioctl
|
||||
* argument, but it should be passed as NULL to allow for future
|
||||
* reinterpretation. From user-mode, this ioctl request is synchronous.
|
||||
*
|
||||
* When invoked from within the kernel, the arg can be NULL to indicate
|
||||
* a synchronous request or can be the address of a struct dk_callback
|
||||
* to request an asynchronous callback when the flush request is complete.
|
||||
* In this case, the flag to the ioctl must include FKIOCTL and the
|
||||
* dkc_callback field of the pointed to struct must be non-null or the
|
||||
* request is made synchronously.
|
||||
*
|
||||
* In the callback case: if the ioctl returns 0, a callback WILL be performed.
|
||||
* If the ioctl returns non-zero, a callback will NOT be performed.
|
||||
* NOTE: In some cases, the callback may be done BEFORE the ioctl call
|
||||
* returns. The caller's locking strategy should be prepared for this case.
|
||||
*/
|
||||
#define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */
|
||||
|
||||
struct dk_callback {
|
||||
void (*dkc_callback)(void *dkc_cookie, int error);
|
||||
void *dkc_cookie;
|
||||
int dkc_flag;
|
||||
};
|
||||
|
||||
/* bit flag definitions for dkc_flag */
|
||||
#define FLUSH_VOLATILE 0x1 /* Bit 0: if set, only flush */
|
||||
/* volatile cache; otherwise, flush */
|
||||
/* volatile and non-volatile cache */
|
||||
|
||||
#define DKIOCGETWCE (DKIOC|36) /* Get current write cache */
|
||||
/* enablement status */
|
||||
#define DKIOCSETWCE (DKIOC|37) /* Enable/Disable write cache */
|
||||
|
||||
/*
|
||||
* The following ioctls are used by Sun drivers to communicate
|
||||
* with their associated format routines. Support of these ioctls
|
||||
* is not required of foreign drivers
|
||||
*/
|
||||
#define DKIOCSGEOM (DKIOC|2) /* Set geometry */
|
||||
#define DKIOCSAPART (DKIOC|4) /* Set all partitions */
|
||||
#define DKIOCGAPART (DKIOC|5) /* Get all partitions */
|
||||
#define DKIOCG_PHYGEOM (DKIOC|32) /* get physical geometry */
|
||||
#define DKIOCG_VIRTGEOM (DKIOC|33) /* get virtual geometry */
|
||||
|
||||
/*
|
||||
* The following ioctl's are removable media support
|
||||
*/
|
||||
#define DKIOCLOCK (DKIOC|7) /* Generic 'lock' */
|
||||
#define DKIOCUNLOCK (DKIOC|8) /* Generic 'unlock' */
|
||||
#define DKIOCSTATE (DKIOC|13) /* Inquire insert/eject state */
|
||||
#define DKIOCREMOVABLE (DKIOC|16) /* is media removable */
|
||||
|
||||
|
||||
/*
|
||||
* ioctl for hotpluggable devices
|
||||
*/
|
||||
#define DKIOCHOTPLUGGABLE (DKIOC|35) /* is hotpluggable */
|
||||
|
||||
/*
|
||||
* Ioctl to force driver to re-read the alternate partition and rebuild
|
||||
* the internal defect map.
|
||||
*/
|
||||
#define DKIOCADDBAD (DKIOC|20) /* Re-read the alternate map (IDE) */
|
||||
#define DKIOCGETDEF (DKIOC|21) /* read defect list (IDE) */
|
||||
|
||||
/*
|
||||
* Used by applications to get disk defect information from IDE
|
||||
* drives.
|
||||
*/
|
||||
#ifdef _SYSCALL32
|
||||
struct defect_header32 {
|
||||
int head;
|
||||
caddr32_t buffer;
|
||||
};
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
struct defect_header {
|
||||
int head;
|
||||
caddr_t buffer;
|
||||
};
|
||||
|
||||
#define DKIOCPARTINFO (DKIOC|22) /* Get partition or slice parameters */
|
||||
|
||||
/*
|
||||
* Used by applications to get partition or slice information
|
||||
*/
|
||||
#ifdef _SYSCALL32
|
||||
struct part_info32 {
|
||||
uint32_t p_start;
|
||||
int p_length;
|
||||
};
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
struct part_info {
|
||||
uint64_t p_start;
|
||||
int p_length;
|
||||
};
|
||||
|
||||
/* The following ioctls are for Optical Memory Device */
|
||||
#define DKIOC_EBP_ENABLE (DKIOC|40) /* enable by pass erase on write */
|
||||
#define DKIOC_EBP_DISABLE (DKIOC|41) /* disable by pass erase on write */
|
||||
|
||||
/*
|
||||
* This state enum is the argument passed to the DKIOCSTATE ioctl.
|
||||
*/
|
||||
enum dkio_state { DKIO_NONE, DKIO_EJECTED, DKIO_INSERTED, DKIO_DEV_GONE };
|
||||
|
||||
#define DKIOCGMEDIAINFO (DKIOC|42) /* get information about the media */
|
||||
|
||||
/*
|
||||
* ioctls to read/write mboot info.
|
||||
*/
|
||||
#define DKIOCGMBOOT (DKIOC|43) /* get mboot info */
|
||||
#define DKIOCSMBOOT (DKIOC|44) /* set mboot info */
|
||||
|
||||
/*
|
||||
* ioctl to get the device temperature.
|
||||
*/
|
||||
#define DKIOCGTEMPERATURE (DKIOC|45) /* get temperature */
|
||||
|
||||
/*
|
||||
* Used for providing the temperature.
|
||||
*/
|
||||
|
||||
struct dk_temperature {
|
||||
uint_t dkt_flags; /* Flags */
|
||||
short dkt_cur_temp; /* Current disk temperature */
|
||||
short dkt_ref_temp; /* reference disk temperature */
|
||||
};
|
||||
|
||||
#define DKT_BYPASS_PM 0x1
|
||||
#define DKT_INVALID_TEMP 0xFFFF
|
||||
|
||||
|
||||
/*
|
||||
* Media types or profiles known
|
||||
*/
|
||||
#define DK_UNKNOWN 0x00 /* Media inserted - type unknown */
|
||||
|
||||
|
||||
/*
|
||||
* SFF 8090 Specification Version 3, media types 0x01 - 0xfffe are retained to
|
||||
* maintain compatibility with SFF8090. The following define the
|
||||
* optical media type.
|
||||
*/
|
||||
#define DK_REMOVABLE_DISK 0x02 /* Removable Disk */
|
||||
#define DK_MO_ERASABLE 0x03 /* MO Erasable */
|
||||
#define DK_MO_WRITEONCE 0x04 /* MO Write once */
|
||||
#define DK_AS_MO 0x05 /* AS MO */
|
||||
#define DK_CDROM 0x08 /* CDROM */
|
||||
#define DK_CDR 0x09 /* CD-R */
|
||||
#define DK_CDRW 0x0A /* CD-RW */
|
||||
#define DK_DVDROM 0x10 /* DVD-ROM */
|
||||
#define DK_DVDR 0x11 /* DVD-R */
|
||||
#define DK_DVDRAM 0x12 /* DVD_RAM or DVD-RW */
|
||||
|
||||
/*
|
||||
* Media types for other rewritable magnetic media
|
||||
*/
|
||||
#define DK_FIXED_DISK 0x10001 /* Fixed disk SCSI or otherwise */
|
||||
#define DK_FLOPPY 0x10002 /* Floppy media */
|
||||
#define DK_ZIP 0x10003 /* IOMEGA ZIP media */
|
||||
#define DK_JAZ 0x10004 /* IOMEGA JAZ media */
|
||||
|
||||
#define DKIOCSETEFI (DKIOC|17) /* Set EFI info */
|
||||
#define DKIOCGETEFI (DKIOC|18) /* Get EFI info */
|
||||
|
||||
#define DKIOCPARTITION (DKIOC|9) /* Get partition info */
|
||||
|
||||
/*
|
||||
* Ioctls to get/set volume capabilities related to Logical Volume Managers.
|
||||
* They include the ability to get/set capabilities and to issue a read to a
|
||||
* specific underlying device of a replicated device.
|
||||
*/
|
||||
|
||||
#define DKIOCGETVOLCAP (DKIOC | 25) /* Get volume capabilities */
|
||||
#define DKIOCSETVOLCAP (DKIOC | 26) /* Set volume capabilities */
|
||||
#define DKIOCDMR (DKIOC | 27) /* Issue a directed read */
|
||||
|
||||
typedef uint_t volcapinfo_t;
|
||||
|
||||
typedef uint_t volcapset_t;
|
||||
|
||||
#define DKV_ABR_CAP 0x00000001 /* Support Appl.Based Recovery */
|
||||
#define DKV_DMR_CAP 0x00000002 /* Support Directed Mirror Read */
|
||||
|
||||
typedef struct volcap {
|
||||
volcapinfo_t vc_info; /* Capabilities available */
|
||||
volcapset_t vc_set; /* Capabilities set */
|
||||
} volcap_t;
|
||||
|
||||
#define VOL_SIDENAME 256
|
||||
|
||||
typedef struct vol_directed_rd {
|
||||
int vdr_flags;
|
||||
offset_t vdr_offset;
|
||||
size_t vdr_nbytes;
|
||||
size_t vdr_bytesread;
|
||||
void *vdr_data;
|
||||
int vdr_side;
|
||||
char vdr_side_name[VOL_SIDENAME];
|
||||
} vol_directed_rd_t;
|
||||
|
||||
#define DKV_SIDE_INIT (-1)
|
||||
#define DKV_DMR_NEXT_SIDE 0x00000001
|
||||
#define DKV_DMR_DONE 0x00000002
|
||||
#define DKV_DMR_ERROR 0x00000004
|
||||
#define DKV_DMR_SUCCESS 0x00000008
|
||||
#define DKV_DMR_SHORT 0x00000010
|
||||
|
||||
#ifdef _MULTI_DATAMODEL
|
||||
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
|
||||
#pragma pack(4)
|
||||
#endif
|
||||
typedef struct vol_directed_rd32 {
|
||||
int32_t vdr_flags;
|
||||
offset_t vdr_offset; /* 64-bit element on 32-bit alignment */
|
||||
size32_t vdr_nbytes;
|
||||
size32_t vdr_bytesread;
|
||||
caddr32_t vdr_data;
|
||||
int32_t vdr_side;
|
||||
char vdr_side_name[VOL_SIDENAME];
|
||||
} vol_directed_rd32_t;
|
||||
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
|
||||
#pragma pack()
|
||||
#endif
|
||||
#endif /* _MULTI_DATAMODEL */
|
||||
|
||||
/*
|
||||
* The ioctl is used to fetch disk's device type, vendor ID,
|
||||
* model number/product ID, firmware revision and serial number together.
|
||||
*
|
||||
* Currently there are two device types - DKD_ATA_TYPE which means the
|
||||
* disk is driven by cmdk/ata or dad/uata driver, and DKD_SCSI_TYPE
|
||||
* which means the disk is driven by sd/scsi hba driver.
|
||||
*/
|
||||
#define DKIOC_GETDISKID (DKIOC|46)
|
||||
|
||||
/* These two labels are for dkd_dtype of dk_disk_id_t */
|
||||
#define DKD_ATA_TYPE 0x01 /* ATA disk or legacy mode SATA disk */
|
||||
#define DKD_SCSI_TYPE 0x02 /* SCSI disk or native mode SATA disk */
|
||||
|
||||
#define DKD_ATA_MODEL 40 /* model number length */
|
||||
#define DKD_ATA_FWVER 8 /* firmware revision length */
|
||||
#define DKD_ATA_SERIAL 20 /* serial number length */
|
||||
|
||||
#define DKD_SCSI_VENDOR 8 /* vendor ID length */
|
||||
#define DKD_SCSI_PRODUCT 16 /* product ID length */
|
||||
#define DKD_SCSI_REVLEVEL 4 /* revision level length */
|
||||
#define DKD_SCSI_SERIAL 12 /* serial number length */
|
||||
|
||||
/*
|
||||
* The argument type for DKIOC_GETDISKID ioctl.
|
||||
*/
|
||||
typedef struct dk_disk_id {
|
||||
uint_t dkd_dtype;
|
||||
union {
|
||||
struct {
|
||||
char dkd_amodel[DKD_ATA_MODEL]; /* 40 bytes */
|
||||
char dkd_afwver[DKD_ATA_FWVER]; /* 8 bytes */
|
||||
char dkd_aserial[DKD_ATA_SERIAL]; /* 20 bytes */
|
||||
} ata_disk_id;
|
||||
struct {
|
||||
char dkd_svendor[DKD_SCSI_VENDOR]; /* 8 bytes */
|
||||
char dkd_sproduct[DKD_SCSI_PRODUCT]; /* 16 bytes */
|
||||
char dkd_sfwver[DKD_SCSI_REVLEVEL]; /* 4 bytes */
|
||||
char dkd_sserial[DKD_SCSI_SERIAL]; /* 12 bytes */
|
||||
} scsi_disk_id;
|
||||
} disk_id;
|
||||
} dk_disk_id_t;
|
||||
|
||||
/*
|
||||
* The ioctl is used to update the firmware of device.
|
||||
*/
|
||||
#define DKIOC_UPDATEFW (DKIOC|47)
|
||||
|
||||
/* The argument type for DKIOC_UPDATEFW ioctl */
|
||||
typedef struct dk_updatefw {
|
||||
caddr_t dku_ptrbuf; /* pointer to firmware buf */
|
||||
uint_t dku_size; /* firmware buf length */
|
||||
uint8_t dku_type; /* firmware update type */
|
||||
} dk_updatefw_t;
|
||||
|
||||
#ifdef _SYSCALL32
|
||||
typedef struct dk_updatefw_32 {
|
||||
caddr32_t dku_ptrbuf; /* pointer to firmware buf */
|
||||
uint_t dku_size; /* firmware buf length */
|
||||
uint8_t dku_type; /* firmware update type */
|
||||
} dk_updatefw_32_t;
|
||||
#endif /* _SYSCALL32 */
|
||||
|
||||
/*
|
||||
* firmware update type - temporary or permanent use
|
||||
*/
|
||||
#define FW_TYPE_TEMP 0x0 /* temporary use */
|
||||
#define FW_TYPE_PERM 0x1 /* permanent use */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _OPENSOLARIS_SYS_DKIO_H_ */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user