Print this page
3742 zfs comments need cleaner, more consistent style
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Alan Somers <alans@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>
Reviewed by:    George Wilson <george.wilson@delphix.com>
Reviewed by:    Eric Schrock <eric.schrock@delphix.com>


1034         ZFS_ENTER(zfsvfs);
1035 
1036         if (zfsvfs->z_shares_dir == 0) {
1037                 ZFS_EXIT(zfsvfs);
1038                 return (SET_ERROR(ENOTSUP));
1039         }
1040         if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) {
1041                 error = VOP_READDIR(ZTOV(dzp), uiop, cr, eofp, ct, flags);
1042                 VN_RELE(ZTOV(dzp));
1043         } else {
1044                 *eofp = 1;
1045                 error = SET_ERROR(ENOENT);
1046         }
1047 
1048         ZFS_EXIT(zfsvfs);
1049         return (error);
1050 }
1051 
1052 /*
1053  * pvp is the '.zfs' directory (zfsctl_node_t).

1054  * Creates vp, which is '.zfs/snapshot' (zfsctl_snapdir_t).
1055  *
1056  * This function is the callback to create a GFS vnode for '.zfs/snapshot'
1057  * when a lookup is performed on .zfs for "snapshot".
1058  */
1059 vnode_t *
1060 zfsctl_mknode_snapdir(vnode_t *pvp)
1061 {
1062         vnode_t *vp;
1063         zfsctl_snapdir_t *sdp;
1064 
1065         vp = gfs_dir_create(sizeof (zfsctl_snapdir_t), pvp,
1066             zfsctl_ops_snapdir, NULL, NULL, MAXNAMELEN,
1067             zfsctl_snapdir_readdir_cb, NULL);
1068         sdp = vp->v_data;
1069         sdp->sd_node.zc_id = ZFSCTL_INO_SNAPDIR;
1070         sdp->sd_node.zc_cmtime = ((zfsctl_node_t *)pvp->v_data)->zc_cmtime;
1071         mutex_init(&sdp->sd_lock, NULL, MUTEX_DEFAULT, NULL);
1072         avl_create(&sdp->sd_snaps, snapentry_compare,
1073             sizeof (zfs_snapentry_t), offsetof(zfs_snapentry_t, se_node));




1034         ZFS_ENTER(zfsvfs);
1035 
1036         if (zfsvfs->z_shares_dir == 0) {
1037                 ZFS_EXIT(zfsvfs);
1038                 return (SET_ERROR(ENOTSUP));
1039         }
1040         if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) {
1041                 error = VOP_READDIR(ZTOV(dzp), uiop, cr, eofp, ct, flags);
1042                 VN_RELE(ZTOV(dzp));
1043         } else {
1044                 *eofp = 1;
1045                 error = SET_ERROR(ENOENT);
1046         }
1047 
1048         ZFS_EXIT(zfsvfs);
1049         return (error);
1050 }
1051 
1052 /*
1053  * pvp is the '.zfs' directory (zfsctl_node_t).
1054  *
1055  * Creates vp, which is '.zfs/snapshot' (zfsctl_snapdir_t).
1056  *
1057  * This function is the callback to create a GFS vnode for '.zfs/snapshot'
1058  * when a lookup is performed on .zfs for "snapshot".
1059  */
1060 vnode_t *
1061 zfsctl_mknode_snapdir(vnode_t *pvp)
1062 {
1063         vnode_t *vp;
1064         zfsctl_snapdir_t *sdp;
1065 
1066         vp = gfs_dir_create(sizeof (zfsctl_snapdir_t), pvp,
1067             zfsctl_ops_snapdir, NULL, NULL, MAXNAMELEN,
1068             zfsctl_snapdir_readdir_cb, NULL);
1069         sdp = vp->v_data;
1070         sdp->sd_node.zc_id = ZFSCTL_INO_SNAPDIR;
1071         sdp->sd_node.zc_cmtime = ((zfsctl_node_t *)pvp->v_data)->zc_cmtime;
1072         mutex_init(&sdp->sd_lock, NULL, MUTEX_DEFAULT, NULL);
1073         avl_create(&sdp->sd_snaps, snapentry_compare,
1074             sizeof (zfs_snapentry_t), offsetof(zfs_snapentry_t, se_node));