FreeBSD ZFS
The Zettabyte File System
Defines | Typedefs | Enumerations | Functions

dsl_prop.c File Reference

#include <sys/zfs_context.h>
#include <sys/dmu.h>
#include <sys/dmu_objset.h>
#include <sys/dmu_tx.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_dir.h>
#include <sys/dsl_prop.h>
#include <sys/dsl_synctask.h>
#include <sys/spa.h>
#include <sys/zap.h>
#include <sys/fs/zfs.h>
#include "zfs_prop.h"
Include dependency graph for dsl_prop.c:

Go to the source code of this file.

Defines

#define ZPROP_INHERIT_SUFFIX   "$inherit"
#define ZPROP_RECVD_SUFFIX   "$recvd"

Typedefs

typedef enum dsl_prop_getflags dsl_prop_getflags_t

Enumerations

enum  dsl_prop_getflags { DSL_PROP_GET_INHERITING = 0x1, DSL_PROP_GET_SNAPSHOT = 0x2, DSL_PROP_GET_LOCAL = 0x4, DSL_PROP_GET_RECEIVED = 0x8 }

Functions

static int dodefault (const char *propname, int intsz, int numints, void *buf)
int dsl_prop_get_dd (dsl_dir_t *dd, const char *propname, int intsz, int numints, void *buf, char *setpoint, boolean_t snapshot)
int dsl_prop_get_ds (dsl_dataset_t *ds, const char *propname, int intsz, int numints, void *buf, char *setpoint)
int dsl_prop_register (dsl_dataset_t *ds, const char *propname, dsl_prop_changed_cb_t *callback, void *cbarg)
 Register interest in the named property.
int dsl_prop_get (const char *dsname, const char *propname, int intsz, int numints, void *buf, char *setpoint)
int dsl_prop_get_integer (const char *ddname, const char *propname, uint64_t *valuep, char *setpoint)
 Get the current property value.
void dsl_prop_setarg_init_uint64 (dsl_prop_setarg_t *psa, const char *propname, zprop_source_t source, uint64_t *value)
int dsl_prop_predict_sync (dsl_dir_t *dd, dsl_prop_setarg_t *psa)
 Predict the effective value of the given special property if it were set with the given value and source.
int dsl_prop_unregister (dsl_dataset_t *ds, const char *propname, dsl_prop_changed_cb_t *callback, void *cbarg)
 Unregister this callback.
int dsl_prop_numcb (dsl_dataset_t *ds)
 Return the number of callbacks that are registered for this dataset.
static void dsl_prop_changed_notify (dsl_pool_t *dp, uint64_t ddobj, const char *propname, uint64_t value, int first)
void dsl_prop_set_sync (void *arg1, void *arg2, dmu_tx_t *tx)
void dsl_props_set_sync (void *arg1, void *arg2, dmu_tx_t *tx)
void dsl_dir_prop_set_uint64_sync (dsl_dir_t *dd, const char *name, uint64_t val, dmu_tx_t *tx)
int dsl_prop_set (const char *dsname, const char *propname, zprop_source_t source, int intsz, int numints, const void *buf)
int dsl_props_set (const char *dsname, zprop_source_t source, nvlist_t *props)
static int dsl_prop_get_all_impl (objset_t *mos, uint64_t propobj, const char *setpoint, dsl_prop_getflags_t flags, nvlist_t *nv)
static int dsl_prop_get_all_ds (dsl_dataset_t *ds, nvlist_t **nvp, dsl_prop_getflags_t flags)
 Iterate over all properties for this dataset and return them in an nvlist.
boolean_t dsl_prop_get_hasrecvd (objset_t *os)
static void dsl_prop_set_hasrecvd_impl (objset_t *os, zprop_source_t source)
void dsl_prop_set_hasrecvd (objset_t *os)
 Call after successfully receiving properties to ensure that only the first receive on or after SPA_VERSION_RECVD_PROPS blows away local properties.
void dsl_prop_unset_hasrecvd (objset_t *os)
int dsl_prop_get_all (objset_t *os, nvlist_t **nvp)
int dsl_prop_get_received (objset_t *os, nvlist_t **nvp)
void dsl_prop_nvlist_add_uint64 (nvlist_t *nv, zfs_prop_t prop, uint64_t value)
void dsl_prop_nvlist_add_string (nvlist_t *nv, zfs_prop_t prop, const char *value)

Define Documentation

#define ZPROP_INHERIT_SUFFIX   "$inherit"

Definition at line 39 of file dsl_prop.c.

#define ZPROP_RECVD_SUFFIX   "$recvd"

Definition at line 40 of file dsl_prop.c.


Typedef Documentation


Enumeration Type Documentation

Enumerator:
DSL_PROP_GET_INHERITING 
DSL_PROP_GET_SNAPSHOT 
DSL_PROP_GET_LOCAL 
DSL_PROP_GET_RECEIVED 

Definition at line 872 of file dsl_prop.c.


Function Documentation

static int dodefault ( const char *  propname,
int  intsz,
int  numints,
void *  buf 
) [static]

Definition at line 43 of file dsl_prop.c.

void dsl_dir_prop_set_uint64_sync ( dsl_dir_t dd,
const char *  name,
uint64_t  val,
dmu_tx_t tx 
)

Definition at line 761 of file dsl_prop.c.

static void dsl_prop_changed_notify ( dsl_pool_t dp,
uint64_t  ddobj,
const char *  propname,
uint64_t  value,
int  first 
) [static]

Definition at line 490 of file dsl_prop.c.

int dsl_prop_get ( const char *  dsname,
const char *  propname,
int  intsz,
int  numints,
void *  buf,
char *  setpoint 
)

Definition at line 268 of file dsl_prop.c.

int dsl_prop_get_all ( objset_t os,
nvlist_t **  nvp 
)

Definition at line 1099 of file dsl_prop.c.

static int dsl_prop_get_all_ds ( dsl_dataset_t ds,
nvlist_t **  nvp,
dsl_prop_getflags_t  flags 
) [static]

Iterate over all properties for this dataset and return them in an nvlist.

Definition at line 1005 of file dsl_prop.c.

static int dsl_prop_get_all_impl ( objset_t mos,
uint64_t  propobj,
const char *  setpoint,
dsl_prop_getflags_t  flags,
nvlist_t *  nv 
) [static]

Definition at line 880 of file dsl_prop.c.

int dsl_prop_get_dd ( dsl_dir_t dd,
const char *  propname,
int  intsz,
int  numints,
void *  buf,
char *  setpoint,
boolean_t  snapshot 
)

Definition at line 72 of file dsl_prop.c.

int dsl_prop_get_ds ( dsl_dataset_t ds,
const char *  propname,
int  intsz,
int  numints,
void *  buf,
char *  setpoint 
)

Definition at line 161 of file dsl_prop.c.

boolean_t dsl_prop_get_hasrecvd ( objset_t os)

Definition at line 1049 of file dsl_prop.c.

int dsl_prop_get_integer ( const char *  ddname,
const char *  propname,
uint64_t *  valuep,
char *  setpoint 
)

Get the current property value.

It may have changed by the time this function returns, so it is NOT safe to follow up with dsl_prop_register() and assume that the value has not changed in between.

Returns:
0 on success or ENOENT if ddname is invalid.

Definition at line 295 of file dsl_prop.c.

int dsl_prop_get_received ( objset_t os,
nvlist_t **  nvp 
)

Definition at line 1105 of file dsl_prop.c.

int dsl_prop_numcb ( dsl_dataset_t ds)

Return the number of callbacks that are registered for this dataset.

Definition at line 472 of file dsl_prop.c.

void dsl_prop_nvlist_add_string ( nvlist_t *  nv,
zfs_prop_t  prop,
const char *  value 
)

Definition at line 1141 of file dsl_prop.c.

void dsl_prop_nvlist_add_uint64 ( nvlist_t *  nv,
zfs_prop_t  prop,
uint64_t  value 
)

Definition at line 1118 of file dsl_prop.c.

int dsl_prop_predict_sync ( dsl_dir_t dd,
dsl_prop_setarg_t psa 
)

Predict the effective value of the given special property if it were set with the given value and source.

This is not a general purpose function. It exists only to handle the special requirements of the quota and reservation properties. The fact that these properties are non-inheritable greatly simplifies the prediction logic.

Returns:
0 on success, a positive error code on failure, or -1 if called with a property not handled by this function.

Definition at line 325 of file dsl_prop.c.

int dsl_prop_register ( dsl_dataset_t ds,
const char *  propname,
dsl_prop_changed_cb_t callback,
void *  cbarg 
)

Register interest in the named property.

We'll call the callback once to notify it of the current property value, and again each time the property changes, until this callback is unregistered.

Returns:
0 on success or errno if the prop is not an integer value.

Definition at line 229 of file dsl_prop.c.

int dsl_prop_set ( const char *  dsname,
const char *  propname,
zprop_source_t  source,
int  intsz,
int  numints,
const void *  buf 
)

Definition at line 779 of file dsl_prop.c.

void dsl_prop_set_hasrecvd ( objset_t os)

Call after successfully receiving properties to ensure that only the first receive on or after SPA_VERSION_RECVD_PROPS blows away local properties.

Definition at line 1083 of file dsl_prop.c.

static void dsl_prop_set_hasrecvd_impl ( objset_t os,
zprop_source_t  source 
) [static]

Definition at line 1063 of file dsl_prop.c.

void dsl_prop_set_sync ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
)

Definition at line 551 of file dsl_prop.c.

void dsl_prop_setarg_init_uint64 ( dsl_prop_setarg_t psa,
const char *  propname,
zprop_source_t  source,
uint64_t *  value 
)

Definition at line 302 of file dsl_prop.c.

int dsl_prop_unregister ( dsl_dataset_t ds,
const char *  propname,
dsl_prop_changed_cb_t callback,
void *  cbarg 
)

Unregister this callback.

Returns:
0 on success, ENOENT if ddname is invalid, or ENOMSG if no matching callback registered.

Definition at line 439 of file dsl_prop.c.

void dsl_prop_unset_hasrecvd ( objset_t os)

Definition at line 1093 of file dsl_prop.c.

int dsl_props_set ( const char *  dsname,
zprop_source_t  source,
nvlist_t *  props 
)

Definition at line 825 of file dsl_prop.c.

void dsl_props_set_sync ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
)

Definition at line 718 of file dsl_prop.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines