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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfs_acl.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_acl.c
↓ open down ↓ 1354 lines elided ↑ open up ↑
1355 1355          acl_trivial_access_masks((mode_t)mode, isdir, &masks);
1356 1356  
1357 1357          newnode = zfs_acl_node_alloc((abstract_size * 6) + aclp->z_acl_bytes);
1358 1358  
1359 1359          zacep = newnode->z_acldata;
1360 1360          if (masks.allow0) {
1361 1361                  zfs_set_ace(aclp, zacep, masks.allow0, ALLOW, -1, ACE_OWNER);
1362 1362                  zacep = (void *)((uintptr_t)zacep + abstract_size);
1363 1363                  new_count++;
1364 1364                  new_bytes += abstract_size;
1365      -        } if (masks.deny1) {
     1365 +        }
     1366 +        if (masks.deny1) {
1366 1367                  zfs_set_ace(aclp, zacep, masks.deny1, DENY, -1, ACE_OWNER);
1367 1368                  zacep = (void *)((uintptr_t)zacep + abstract_size);
1368 1369                  new_count++;
1369 1370                  new_bytes += abstract_size;
1370 1371          }
1371 1372          if (masks.deny2) {
1372 1373                  zfs_set_ace(aclp, zacep, masks.deny2, DENY, -1, OWNING_GROUP);
1373 1374                  zacep = (void *)((uintptr_t)zacep + abstract_size);
1374 1375                  new_count++;
1375 1376                  new_bytes += abstract_size;
↓ open down ↓ 383 lines elided ↑ open up ↑
1759 1760  }
1760 1761  
1761 1762  boolean_t
1762 1763  zfs_acl_ids_overquota(zfsvfs_t *zfsvfs, zfs_acl_ids_t *acl_ids)
1763 1764  {
1764 1765          return (zfs_fuid_overquota(zfsvfs, B_FALSE, acl_ids->z_fuid) ||
1765 1766              zfs_fuid_overquota(zfsvfs, B_TRUE, acl_ids->z_fgid));
1766 1767  }
1767 1768  
1768 1769  /*
1769      - * Retrieve a files ACL
     1770 + * Retrieve a file's ACL
1770 1771   */
1771 1772  int
1772 1773  zfs_getacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr)
1773 1774  {
1774 1775          zfs_acl_t       *aclp;
1775 1776          ulong_t         mask;
1776 1777          int             error;
1777 1778          int             count = 0;
1778 1779          int             largeace = 0;
1779 1780  
↓ open down ↓ 134 lines elided ↑ open up ↑
1914 1915                  if (vsecp->vsa_aclflags & ACL_AUTO_INHERIT)
1915 1916                          aclp->z_hints |= ZFS_ACL_AUTO_INHERIT;
1916 1917          }
1917 1918  
1918 1919          *zaclp = aclp;
1919 1920  
1920 1921          return (0);
1921 1922  }
1922 1923  
1923 1924  /*
1924      - * Set a files ACL
     1925 + * Set a file's ACL
1925 1926   */
1926 1927  int
1927 1928  zfs_setacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr)
1928 1929  {
1929 1930          zfsvfs_t        *zfsvfs = zp->z_zfsvfs;
1930 1931          zilog_t         *zilog = zfsvfs->z_log;
1931 1932          ulong_t         mask = vsecp->vsa_mask & (VSA_ACE | VSA_ACECNT);
1932 1933          dmu_tx_t        *tx;
1933 1934          int             error;
1934 1935          zfs_acl_t       *aclp;
↓ open down ↓ 400 lines elided ↑ open up ↑
2335 2336  slow:
2336 2337          DTRACE_PROBE(zfs__fastpath__execute__access__miss);
2337 2338          ZFS_ENTER(zdp->z_zfsvfs);
2338 2339          error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr);
2339 2340          ZFS_EXIT(zdp->z_zfsvfs);
2340 2341          return (error);
2341 2342  }
2342 2343  
2343 2344  /*
2344 2345   * Determine whether Access should be granted/denied.
     2346 + *
2345 2347   * The least priv subsytem is always consulted as a basic privilege
2346 2348   * can define any form of access.
2347 2349   */
2348 2350  int
2349 2351  zfs_zaccess(znode_t *zp, int mode, int flags, boolean_t skipaclchk, cred_t *cr)
2350 2352  {
2351 2353          uint32_t        working_mode;
2352 2354          int             error;
2353 2355          int             is_attr;
2354 2356          boolean_t       check_privs;
↓ open down ↓ 175 lines elided ↑ open up ↑
2530 2532          if (error == 0)
2531 2533                  error = zfs_sticky_remove_access(dzp, zp, cr);
2532 2534  
2533 2535          return (error);
2534 2536  }
2535 2537  
2536 2538  /*
2537 2539   * Determine whether Access should be granted/deny, without
2538 2540   * consulting least priv subsystem.
2539 2541   *
2540      - *
2541 2542   * The following chart is the recommended NFSv4 enforcement for
2542 2543   * ability to delete an object.
2543 2544   *
2544 2545   *      -------------------------------------------------------
2545 2546   *      |   Parent Dir  |           Target Object Permissions |
2546 2547   *      |  permissions  |                                     |
2547 2548   *      -------------------------------------------------------
2548 2549   *      |               | ACL Allows | ACL Denies| Delete     |
2549 2550   *      |               |  Delete    |  Delete   | unspecified|
2550 2551   *      -------------------------------------------------------
↓ open down ↓ 146 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX