Print this page
OS-1566 dataset quota for ZFS datasets


2176         case ZFS_PROP_ORIGIN:
2177                 (void) strlcpy(propbuf, getprop_string(zhp, prop, &source),
2178                     proplen);
2179                 /*
2180                  * If there is no parent at all, return failure to indicate that
2181                  * it doesn't apply to this dataset.
2182                  */
2183                 if (propbuf[0] == '\0')
2184                         return (-1);
2185                 break;
2186 
2187         case ZFS_PROP_CLONES:
2188                 if (get_clones_string(zhp, propbuf, proplen) != 0)
2189                         return (-1);
2190                 break;
2191 
2192         case ZFS_PROP_QUOTA:
2193         case ZFS_PROP_REFQUOTA:
2194         case ZFS_PROP_RESERVATION:
2195         case ZFS_PROP_REFRESERVATION:


2196 
2197                 if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
2198                         return (-1);
2199 
2200                 /*
2201                  * If quota or reservation is 0, we translate this into 'none'
2202                  * (unless literal is set), and indicate that it's the default
2203                  * value.  Otherwise, we print the number nicely and indicate
2204                  * that its set locally.
2205                  */
2206                 if (val == 0) {
2207                         if (literal)
2208                                 (void) strlcpy(propbuf, "0", proplen);
2209                         else
2210                                 (void) strlcpy(propbuf, "none", proplen);
2211                 } else {
2212                         if (literal)
2213                                 (void) snprintf(propbuf, proplen, "%llu",
2214                                     (u_longlong_t)val);
2215                         else




2176         case ZFS_PROP_ORIGIN:
2177                 (void) strlcpy(propbuf, getprop_string(zhp, prop, &source),
2178                     proplen);
2179                 /*
2180                  * If there is no parent at all, return failure to indicate that
2181                  * it doesn't apply to this dataset.
2182                  */
2183                 if (propbuf[0] == '\0')
2184                         return (-1);
2185                 break;
2186 
2187         case ZFS_PROP_CLONES:
2188                 if (get_clones_string(zhp, propbuf, proplen) != 0)
2189                         return (-1);
2190                 break;
2191 
2192         case ZFS_PROP_QUOTA:
2193         case ZFS_PROP_REFQUOTA:
2194         case ZFS_PROP_RESERVATION:
2195         case ZFS_PROP_REFRESERVATION:
2196         case ZFS_PROP_DATASET_QUOTA:
2197         case ZFS_PROP_SNAPSHOT_QUOTA:
2198 
2199                 if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
2200                         return (-1);
2201 
2202                 /*
2203                  * If quota or reservation is 0, we translate this into 'none'
2204                  * (unless literal is set), and indicate that it's the default
2205                  * value.  Otherwise, we print the number nicely and indicate
2206                  * that its set locally.
2207                  */
2208                 if (val == 0) {
2209                         if (literal)
2210                                 (void) strlcpy(propbuf, "0", proplen);
2211                         else
2212                                 (void) strlcpy(propbuf, "none", proplen);
2213                 } else {
2214                         if (literal)
2215                                 (void) snprintf(propbuf, proplen, "%llu",
2216                                     (u_longlong_t)val);
2217                         else