265 boolean_table); |
265 boolean_table); |
266 |
266 |
267 /* default index properties */ |
267 /* default index properties */ |
268 zprop_register_index(ZFS_PROP_VERSION, "version", 0, PROP_DEFAULT, |
268 zprop_register_index(ZFS_PROP_VERSION, "version", 0, PROP_DEFAULT, |
269 ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, |
269 ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, |
270 "1 | 2 | 3 | 4 | current", "VERSION", version_table); |
270 "1 | 2 | 3 | 4 | 5 | current", "VERSION", version_table); |
271 zprop_register_index(ZFS_PROP_CANMOUNT, "canmount", ZFS_CANMOUNT_ON, |
271 zprop_register_index(ZFS_PROP_CANMOUNT, "canmount", ZFS_CANMOUNT_ON, |
272 PROP_DEFAULT, ZFS_TYPE_FILESYSTEM, "on | off | noauto", |
272 PROP_DEFAULT, ZFS_TYPE_FILESYSTEM, "on | off | noauto", |
273 "CANMOUNT", canmount_table); |
273 "CANMOUNT", canmount_table); |
274 |
274 |
275 /* readonly index (boolean) properties */ |
275 /* readonly index (boolean) properties */ |
295 "on | off", "UTF8ONLY", boolean_table); |
295 "on | off", "UTF8ONLY", boolean_table); |
296 |
296 |
297 /* string properties */ |
297 /* string properties */ |
298 zprop_register_string(ZFS_PROP_ORIGIN, "origin", NULL, PROP_READONLY, |
298 zprop_register_string(ZFS_PROP_ORIGIN, "origin", NULL, PROP_READONLY, |
299 ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "<snapshot>", "ORIGIN"); |
299 ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "<snapshot>", "ORIGIN"); |
|
300 zprop_register_string(ZFS_PROP_CLONES, "clones", NULL, PROP_READONLY, |
|
301 ZFS_TYPE_SNAPSHOT, "<dataset>[,...]", "CLONES"); |
300 zprop_register_string(ZFS_PROP_MOUNTPOINT, "mountpoint", "/", |
302 zprop_register_string(ZFS_PROP_MOUNTPOINT, "mountpoint", "/", |
301 PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "<path> | legacy | none", |
303 PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "<path> | legacy | none", |
302 "MOUNTPOINT"); |
304 "MOUNTPOINT"); |
303 zprop_register_string(ZFS_PROP_SHARENFS, "sharenfs", "off", |
305 zprop_register_string(ZFS_PROP_SHARENFS, "sharenfs", "off", |
304 PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "on | off | share(1M) options", |
306 PROP_INHERIT, ZFS_TYPE_FILESYSTEM, "on | off | share(1M) options", |
340 zprop_register_number(ZFS_PROP_USEDREFRESERV, "usedbyrefreservation", 0, |
342 zprop_register_number(ZFS_PROP_USEDREFRESERV, "usedbyrefreservation", 0, |
341 PROP_READONLY, |
343 PROP_READONLY, |
342 ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "<size>", "USEDREFRESERV"); |
344 ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "<size>", "USEDREFRESERV"); |
343 zprop_register_number(ZFS_PROP_USERREFS, "userrefs", 0, PROP_READONLY, |
345 zprop_register_number(ZFS_PROP_USERREFS, "userrefs", 0, PROP_READONLY, |
344 ZFS_TYPE_SNAPSHOT, "<count>", "USERREFS"); |
346 ZFS_TYPE_SNAPSHOT, "<count>", "USERREFS"); |
|
347 zprop_register_number(ZFS_PROP_WRITTEN, "written", 0, PROP_READONLY, |
|
348 ZFS_TYPE_DATASET, "<size>", "WRITTEN"); |
345 |
349 |
346 /* default number properties */ |
350 /* default number properties */ |
347 zprop_register_number(ZFS_PROP_QUOTA, "quota", 0, PROP_DEFAULT, |
351 zprop_register_number(ZFS_PROP_QUOTA, "quota", 0, PROP_DEFAULT, |
348 ZFS_TYPE_FILESYSTEM, "<size> | none", "QUOTA"); |
352 ZFS_TYPE_FILESYSTEM, "<size> | none", "QUOTA"); |
349 zprop_register_number(ZFS_PROP_RESERVATION, "reservation", 0, |
353 zprop_register_number(ZFS_PROP_RESERVATION, "reservation", 0, |
466 |
470 |
467 return (B_FALSE); |
471 return (B_FALSE); |
468 } |
472 } |
469 |
473 |
470 /* |
474 /* |
|
475 * Returns true if this is a valid written@ property. |
|
476 * Note that after the @, any character is valid (eg, another @, for |
|
477 * written@pool/fs@origin). |
|
478 */ |
|
479 boolean_t |
|
480 zfs_prop_written(const char *name) |
|
481 { |
|
482 static const char *prefix = "written@"; |
|
483 return (strncmp(name, prefix, strlen(prefix)) == 0); |
|
484 } |
|
485 |
|
486 /* |
471 * Tables of index types, plus functions to convert between the user view |
487 * Tables of index types, plus functions to convert between the user view |
472 * (strings) and internal representation (uint64_t). |
488 * (strings) and internal representation (uint64_t). |
473 */ |
489 */ |
474 int |
490 int |
475 zfs_prop_string_to_index(zfs_prop_t prop, const char *string, uint64_t *index) |
491 zfs_prop_string_to_index(zfs_prop_t prop, const char *string, uint64_t *index) |