I?m trying to add a new zpool property to the ZFS code base, but I am confused 
by the mismatched lengths of zfs_prop_t and zfs_prop_table. For more details, 
read on?

In the file usr/src/uts/common/sys/fs/zfs.h, I add a new value to the 
zfs_prop_t enum. The comment at the beginning of zfs_prop_t states that I must 
add my new property to the end of the enum in order to ?ensure that external 
consumers are not affected by the change?. I assume this means that some users 
of zfs.h might not be recompiled, and so I should not disrupt the existing enum 
values for zfs_prop_t. So, I add my new property, ZPOOL_PROP_NEWPROP, to the 
end of the zfs_prop_t, i.e., after ZPOOL_PROP_NAME.

The comment at the beginning of zfs_prop_t also states that I must update 
zfs_prop_table in usr/src/common/zfs/zfs_prop.c. However, zfs_prop_table has 
entries for all zfs and zpool properties except for ZPOOL_PROP_NAME. If I add a 
zfs_prop_table entry for ZPOOL_PROP_NEWPROP, its table index will not match the 
ZPOOL_PROP_NEWPROP enum and hence will cause the property code to break.

Should I add ZPOOL_PROP_NEWPROP just before ZPOOL_PROP_NAME in zfs_prop_table 
and not at the end of the enum as the comment states? This would result in 
generating the proper zfs_prop_table index. Also, I can?t find a place where 
ZPOOL_PROP_NAME is actually used to index into zfs_prop_table so the missing 
zfs_prop_table entry may be tolerable. However, ZPOOL_PROP_NAME is used in 
usr/src/lib/libzfs/common/libzfs_pool.c, and if I change its enum value, I will 
have to rebuild it and all its users.

In order to complete the task of adding a new pool property, I will have to 
re-build not only the kernel, but also modify and rebuild the zpool executable. 
Are there other executables that I will have to rebuild?

Duff
--
This messages posted from opensolaris.org

Reply via email to