Deleted Added
full compact
zfs_ioctl.c (231946) zfs_ioctl.c (235951)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 11 unchanged lines hidden (view full) ---

20 */
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
24 * All rights reserved.
25 * Portions Copyright 2011 Martin Matuska <mm@FreeBSD.org>
26 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 * Copyright (c) 2011 by Delphix. All rights reserved.
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 11 unchanged lines hidden (view full) ---

20 */
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
24 * All rights reserved.
25 * Portions Copyright 2011 Martin Matuska <mm@FreeBSD.org>
26 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
27 * Copyright (c) 2011 by Delphix. All rights reserved.
28 * Copyright (c) 2012, Joyent, Inc. All rights reserved.
28 */
29
30#include <sys/types.h>
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/conf.h>
34#include <sys/kernel.h>
35#include <sys/lock.h>

--- 16 unchanged lines hidden (view full) ---

52#include <sys/spa_impl.h>
53#include <sys/vdev.h>
54#include <sys/dmu.h>
55#include <sys/dsl_dir.h>
56#include <sys/dsl_dataset.h>
57#include <sys/dsl_prop.h>
58#include <sys/dsl_deleg.h>
59#include <sys/dmu_objset.h>
29 */
30
31#include <sys/types.h>
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/conf.h>
35#include <sys/kernel.h>
36#include <sys/lock.h>

--- 16 unchanged lines hidden (view full) ---

53#include <sys/spa_impl.h>
54#include <sys/vdev.h>
55#include <sys/dmu.h>
56#include <sys/dsl_dir.h>
57#include <sys/dsl_dataset.h>
58#include <sys/dsl_prop.h>
59#include <sys/dsl_deleg.h>
60#include <sys/dmu_objset.h>
61#include <sys/dmu_impl.h>
60#include <sys/sunddi.h>
61#include <sys/policy.h>
62#include <sys/zone.h>
63#include <sys/nvpair.h>
64#include <sys/mount.h>
65#include <sys/taskqueue.h>
66#include <sys/sdt.h>
67#include <sys/varargs.h>

--- 3860 unchanged lines hidden (view full) ---

3928 if (fp == NULL) {
3929 dsl_dataset_rele(ds, FTAG);
3930 if (dsfrom)
3931 dsl_dataset_rele(dsfrom, FTAG);
3932 return (EBADF);
3933 }
3934
3935 off = fp->f_offset;
62#include <sys/sunddi.h>
63#include <sys/policy.h>
64#include <sys/zone.h>
65#include <sys/nvpair.h>
66#include <sys/mount.h>
67#include <sys/taskqueue.h>
68#include <sys/sdt.h>
69#include <sys/varargs.h>

--- 3860 unchanged lines hidden (view full) ---

3930 if (fp == NULL) {
3931 dsl_dataset_rele(ds, FTAG);
3932 if (dsfrom)
3933 dsl_dataset_rele(dsfrom, FTAG);
3934 return (EBADF);
3935 }
3936
3937 off = fp->f_offset;
3936 error = dmu_sendbackup(tosnap, fromsnap, zc->zc_obj, fp, &off);
3938 error = dmu_send(tosnap, fromsnap, zc->zc_obj,
3939 zc->zc_cookie, fp, &off);
3937
3938 if (off >= 0 && off <= MAXOFFSET_T)
3939 fp->f_offset = off;
3940 releasef(zc->zc_cookie);
3941 }
3942 if (dsfrom)
3943 dsl_dataset_rele(dsfrom, FTAG);
3944 dsl_dataset_rele(ds, FTAG);
3945 return (error);
3946}
3947
3940
3941 if (off >= 0 && off <= MAXOFFSET_T)
3942 fp->f_offset = off;
3943 releasef(zc->zc_cookie);
3944 }
3945 if (dsfrom)
3946 dsl_dataset_rele(dsfrom, FTAG);
3947 dsl_dataset_rele(ds, FTAG);
3948 return (error);
3949}
3950
3951/*
3952 * inputs:
3953 * zc_name name of snapshot on which to report progress
3954 * zc_cookie file descriptor of send stream
3955 *
3956 * outputs:
3957 * zc_cookie number of bytes written in send stream thus far
3958 */
3948static int
3959static int
3960zfs_ioc_send_progress(zfs_cmd_t *zc)
3961{
3962 dsl_dataset_t *ds;
3963 dmu_sendarg_t *dsp = NULL;
3964 int error;
3965
3966 if ((error = dsl_dataset_hold(zc->zc_name, FTAG, &ds)) != 0)
3967 return (error);
3968
3969 mutex_enter(&ds->ds_sendstream_lock);
3970
3971 /*
3972 * Iterate over all the send streams currently active on this dataset.
3973 * If there's one which matches the specified file descriptor _and_ the
3974 * stream was started by the current process, return the progress of
3975 * that stream.
3976 */
3977 for (dsp = list_head(&ds->ds_sendstreams); dsp != NULL;
3978 dsp = list_next(&ds->ds_sendstreams, dsp)) {
3979 if (dsp->dsa_outfd == zc->zc_cookie &&
3980 dsp->dsa_proc == curproc)
3981 break;
3982 }
3983
3984 if (dsp != NULL)
3985 zc->zc_cookie = *(dsp->dsa_off);
3986 else
3987 error = ENOENT;
3988
3989 mutex_exit(&ds->ds_sendstream_lock);
3990 dsl_dataset_rele(ds, FTAG);
3991 return (error);
3992}
3993
3994static int
3949zfs_ioc_inject_fault(zfs_cmd_t *zc)
3950{
3951 int id, error;
3952
3953 error = zio_inject_fault(zc->zc_name, (int)zc->zc_guid, &id,
3954 &zc->zc_inject_record);
3955
3956 if (error == 0)

--- 984 unchanged lines hidden (view full) ---

4941 B_TRUE },
4942 { zfs_ioc_jail, zfs_secpolicy_config, DATASET_NAME, B_TRUE, B_FALSE },
4943 { zfs_ioc_unjail, zfs_secpolicy_config, DATASET_NAME, B_TRUE, B_FALSE },
4944 { zfs_ioc_pool_reguid, zfs_secpolicy_config, POOL_NAME, B_TRUE,
4945 B_TRUE },
4946 { zfs_ioc_space_written, zfs_secpolicy_read, DATASET_NAME, B_FALSE,
4947 B_TRUE },
4948 { zfs_ioc_space_snaps, zfs_secpolicy_read, DATASET_NAME, B_FALSE,
3995zfs_ioc_inject_fault(zfs_cmd_t *zc)
3996{
3997 int id, error;
3998
3999 error = zio_inject_fault(zc->zc_name, (int)zc->zc_guid, &id,
4000 &zc->zc_inject_record);
4001
4002 if (error == 0)

--- 984 unchanged lines hidden (view full) ---

4987 B_TRUE },
4988 { zfs_ioc_jail, zfs_secpolicy_config, DATASET_NAME, B_TRUE, B_FALSE },
4989 { zfs_ioc_unjail, zfs_secpolicy_config, DATASET_NAME, B_TRUE, B_FALSE },
4990 { zfs_ioc_pool_reguid, zfs_secpolicy_config, POOL_NAME, B_TRUE,
4991 B_TRUE },
4992 { zfs_ioc_space_written, zfs_secpolicy_read, DATASET_NAME, B_FALSE,
4993 B_TRUE },
4994 { zfs_ioc_space_snaps, zfs_secpolicy_read, DATASET_NAME, B_FALSE,
4949 B_TRUE }
4995 B_TRUE },
4996 { zfs_ioc_send_progress, zfs_secpolicy_read, DATASET_NAME, B_FALSE,
4997 B_FALSE }
4950};
4951
4952int
4953pool_status_check(const char *name, zfs_ioc_namecheck_t type)
4954{
4955 spa_t *spa;
4956 int error;
4957

--- 468 unchanged lines hidden ---
4998};
4999
5000int
5001pool_status_check(const char *name, zfs_ioc_namecheck_t type)
5002{
5003 spa_t *spa;
5004 int error;
5005

--- 468 unchanged lines hidden ---