Tweaked the naming of the ACL functions.
authorWayne Davison <wayned@samba.org>
Mon, 1 May 2006 16:50:31 +0000 (16:50 +0000)
committerWayne Davison <wayned@samba.org>
Mon, 1 May 2006 16:50:31 +0000 (16:50 +0000)
acls.diff

index 7204134..7aad210 100644 (file)
--- a/acls.diff
+++ b/acls.diff
@@ -183,7 +183,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +      return True;
 +}
 +
-+static BOOL rsync_acls_equal(const rsync_acl *racl1, const rsync_acl *racl2)
++static BOOL rsync_acl_equal(const rsync_acl *racl1, const rsync_acl *racl2)
 +{
 +      return (racl1->user_obj == racl2->user_obj
 +           && racl1->group_obj == racl2->group_obj
@@ -198,8 +198,8 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 + * only meaningful for access ACLs!  Note: the 1st arg is a fully-populated
 + * rsync_acl, but the 2nd parameter can be a condensed rsync_acl, which means
 + * that it might have several of its perm objects set to NO_ENTRY. */
-+static BOOL rsync_acls_equal_enough(const rsync_acl *racl1,
-+                                  const rsync_acl *racl2, mode_t m)
++static BOOL rsync_acl_equal_enough(const rsync_acl *racl1,
++                                 const rsync_acl *racl2, mode_t m)
 +{
 +      if ((racl1->mask ^ racl2->mask) & NO_ENTRY)
 +              return False; /* One has a mask and the other doesn't */
@@ -229,7 +229,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +      *racl = empty_rsync_acl;
 +}
 +
-+void free_acls(statx *sxp)
++void free_acl(statx *sxp)
 +{
 +      if (sxp->acc_acl) {
 +              rsync_acl_free(sxp->acc_acl);
@@ -512,7 +512,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              *match = racl_list->count - 1;
 +      while (count--) {
 +              rsync_acl *base = racl_list->items;
-+              if (rsync_acls_equal(base + *match, racl))
++              if (rsync_acl_equal(base + *match, racl))
 +                      return *match;
 +              if (!(*match)--)
 +                      *match = racl_list->count - 1;
@@ -524,7 +524,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +
 +/* Turn the ACL data in statx into cached ACL data, setting the index
 + * values in the file struct. */
-+void cache_acls(struct file_struct *file, statx *sxp)
++void cache_acl(struct file_struct *file, statx *sxp)
 +{
 +      SMB_ACL_TYPE_T type;
 +      rsync_acl *racl;
@@ -557,7 +557,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +}
 +
 +/* Return the ACL(s) for the given filename. */
-+int get_acls(const char *fname, statx *sxp)
++int get_acl(const char *fname, statx *sxp)
 +{
 +      SMB_ACL_TYPE_T type;
 +
@@ -570,7 +570,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              rsync_acl *racl = new(rsync_acl);
 +
 +              if (!racl)
-+                      out_of_memory("get_acls");
++                      out_of_memory("get_acl");
 +              if (type == SMB_ACL_TYPE_ACCESS)
 +                      sxp->acc_acl = racl;
 +              else
@@ -581,7 +581,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +
 +                      sys_acl_free_acl(sacl);
 +                      if (!ok) {
-+                              free_acls(sxp);
++                              free_acl(sxp);
 +                              return -1;
 +                      }
 +              } else if (errno == ENOTSUP) {
@@ -590,9 +590,9 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                      if (type == SMB_ACL_TYPE_ACCESS)
 +                              rsync_acl_fake_perms(racl, sxp->st.st_mode);
 +              } else {
-+                      rsyserr(FERROR, errno, "get_acls: sys_acl_get_file(%s, %s)",
++                      rsyserr(FERROR, errno, "get_acl: sys_acl_get_file(%s, %s)",
 +                              fname, str_acl_type(type));
-+                      free_acls(sxp);
++                      free_acl(sxp);
 +                      return -1;
 +              }
 +      } while (BUMP_TYPE(type) && S_ISDIR(sxp->st.st_mode));
@@ -653,9 +653,9 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +      }
 +}
 +
-+/* Send the ACLs from the statx structure down the indicated file descriptor.
++/* Send the ACL from the statx structure down the indicated file descriptor.
 + * This also frees the ACL data. */
-+void send_acls(statx *sxp, int f)
++void send_acl(statx *sxp, int f)
 +{
 +      SMB_ACL_TYPE_T type;
 +      rsync_acl *racl, *new_racl;
@@ -693,7 +693,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              racl_list = &default_acl_list;
 +      } while (BUMP_TYPE(type) && S_ISDIR(sxp->st.st_mode));
 +
-+      free_acls(sxp);
++      free_acl(sxp);
 +}
 +
 +/* === Receive functions === */
@@ -794,7 +794,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +}
 +
 +/* Receive the ACL info the sender has included for this file-list entry. */
-+void receive_acls(struct file_struct *file, int f)
++void receive_acl(struct file_struct *file, int f)
 +{
 +      SMB_ACL_TYPE_T type;
 +      item_list *racl_list;
@@ -931,7 +931,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 + *
 + * Returns 1 for unchanged, 0 for changed, -1 for failed.  Call this
 + * with fname set to NULL to just check if the ACLs are unchanged. */
-+int set_acls(const char *fname, const struct file_struct *file, statx *sxp)
++int set_acl(const char *fname, const struct file_struct *file, statx *sxp)
 +{
 +      int unchanged = 1;
 +      SMB_ACL_TYPE_T type;
@@ -952,11 +952,11 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              if (type == SMB_ACL_TYPE_ACCESS) {
 +                      duo_item = access_acl_list.items;
 +                      duo_item += ndx;
-+                      eq = rsync_acls_equal_enough(sxp->acc_acl, &duo_item->racl, file->mode);
++                      eq = rsync_acl_equal_enough(sxp->acc_acl, &duo_item->racl, file->mode);
 +              } else {
 +                      duo_item = default_acl_list.items;
 +                      duo_item += ndx;
-+                      eq = rsync_acls_equal(sxp->def_acl, &duo_item->racl);
++                      eq = rsync_acl_equal(sxp->def_acl, &duo_item->racl);
 +              }
 +              if (eq)
 +                      continue;
@@ -1150,8 +1150,8 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                                      continue;
 +#ifdef SUPPORT_ACLS
 +                              if (preserve_acls) {
-+                                      get_acls(rel, &sx);
-+                                      cache_acls(file, &sx);
++                                      get_acl(rel, &sx);
++                                      cache_acl(file, &sx);
 +                              }
 +#endif
 +                              set_file_attrs(fullpath, file, NULL, 0);
@@ -1186,8 +1186,8 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
 +#ifdef SUPPORT_ACLS
 +      if (preserve_acls) {
-+              get_acls(fname, &sx);
-+              cache_acls(file, &sx);
++              get_acl(fname, &sx);
++              cache_acl(file, &sx);
 +      }
 +#endif
 +
@@ -1310,7 +1310,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
        permstring(permbuf, f->mode);
  
-+      /* TODO: indicate '+' if the entry has ACLs. */
++      /* TODO: indicate '+' if the entry has an ACL. */
 +
  #ifdef SUPPORT_LINKS
        if (preserve_links && S_ISLNK(f->mode)) {
@@ -1332,7 +1332,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +#ifdef SUPPORT_ACLS
 +      /* We need one or two index int32s when we're preserving ACLs. */
 +      if (preserve_acls)
-+              xtra_len = (S_ISDIR(mode) ? 2 : 1) * sizeof (int32);
++              xtra_len = (S_ISDIR(mode) ? 2 : 1) * 4;
 +      else
 +              xtra_len = 0;
 +#endif
@@ -1359,7 +1359,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
  
 +#ifdef SUPPORT_ACLS
 +      if (preserve_acls)
-+              receive_acls(file, f);
++              receive_acl(file, f);
 +#endif
 +
        return file;
@@ -1380,9 +1380,9 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                ? MD4_SUM_LENGTH : 0;
  
 +#ifdef SUPPORT_ACLS
-+      /* We need one or two index int32s when we're preserving ACLs. */
++      /* We need one or two index int32s when we're preserving an ACL. */
 +      if (preserve_acls)
-+              xtra_len = (S_ISDIR(st.st_mode) ? 2 : 1) * sizeof (int32);
++              xtra_len = (S_ISDIR(st.st_mode) ? 2 : 1) * 4;
 +      else
 +              xtra_len = 0;
 +#endif
@@ -1424,7 +1424,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +      if (preserve_acls) {
 +              sx.st.st_mode = file->mode;
 +              sx.acc_acl = sx.def_acl = NULL;
-+              if (get_acls(fname, &sx) < 0)
++              if (get_acl(fname, &sx) < 0)
 +                      return NULL;
 +      }
 +#endif
@@ -1438,12 +1438,12 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                send_file_entry(file, f);
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls)
-+                      send_acls(&sx, f);
++                      send_acl(&sx, f);
 +#endif
 +      } else {
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls)
-+                      free_acls(&sx);
++                      free_acl(&sx);
 +#endif
        }
        return file;
@@ -1487,7 +1487,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                return 0;
  
 +#ifdef SUPPORT_ACLS
-+      if (preserve_acls && set_acls(NULL, file, sxp) == 0)
++      if (preserve_acls && set_acl(NULL, file, sxp) == 0)
 +              return 0;
 +#endif
 +
@@ -1522,7 +1522,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                  && sxp->st.st_gid != file->gid)
                        iflags |= ITEM_REPORT_GROUP;
 +#ifdef SUPPORT_ACLS
-+              if (preserve_acls && set_acls(NULL, file, sxp) == 0)
++              if (preserve_acls && set_acl(NULL, file, sxp) == 0)
 +                      iflags |= ITEM_REPORT_ACL;
 +#endif
        } else
@@ -1560,7 +1560,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 -                      if (!unchanged_attrs(file, stp))
 +#ifdef SUPPORT_ACLS
 +                      if (preserve_acls)
-+                              get_acls(cmpbuf, sxp);
++                              get_acl(cmpbuf, sxp);
 +#endif
 +                      if (!unchanged_attrs(file, sxp))
                                continue;
@@ -1595,7 +1595,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              } else if (itemizing) {
 +#ifdef SUPPORT_ACLS
 +                      if (preserve_acls && !ACL_READY(*sxp))
-+                              get_acls(fname, sxp);
++                              get_acl(fname, sxp);
 +#endif
 +                      itemize(file, ndx, 0, sxp, 0, 0, NULL);
 +              }
@@ -1611,7 +1611,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              if (itemizing) {
 +#ifdef SUPPORT_ACLS
 +                      if (preserve_acls && !ACL_READY(*sxp))
-+                              get_acls(fname, sxp);
++                              get_acl(fname, sxp);
 +#endif
 +                      itemize(file, ndx, 0, sxp, ITEM_LOCAL_CHANGE, 0, NULL);
 +              }
@@ -1634,7 +1634,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                      continue;
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls)
-+                      get_acls(fnamebuf, &sx);
++                      get_acl(fnamebuf, &sx);
 +#endif
 +              if (!unchanged_attrs(file, &sx))
                        continue;
@@ -1660,12 +1660,12 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 -                      itemize(file, ndx, 0, &st, changes, 0, lp);
 +#ifdef SUPPORT_ACLS
 +                      if (preserve_acls)
-+                              get_acls(fname, &sx);
++                              get_acl(fname, &sx);
 +#endif
 +                      itemize(file, ndx, 0, &sx, changes, 0, lp);
 +#ifdef SUPPORT_ACLS
 +                      if (preserve_acls)
-+                              free_acls(&sx);
++                              free_acl(&sx);
 +#endif
                }
                if (verbose > 1 && maybe_ATTRS_REPORT) {
@@ -1757,7 +1757,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 -                      itemize(file, ndx, statret, &st,
 +#ifdef SUPPORT_ACLS
 +                      if (preserve_acls && statret == 0)
-+                              get_acls(fname, &sx);
++                              get_acl(fname, &sx);
 +#endif
 +                      itemize(file, ndx, statret, &sx,
                                statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
@@ -1846,7 +1846,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                }
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls && statret == 0)
-+                      get_acls(fname, &sx);
++                      get_acl(fname, &sx);
 +#endif
                if (statret != 0
 -               || (st.st_mode & ~CHMOD_BITS) != (file->mode & ~CHMOD_BITS)
@@ -1977,7 +1977,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 -                      itemize(file, ndx, real_ret, &real_st,
 +#ifdef SUPPORT_ACLS
 +                      if (preserve_acls && real_ret == 0)
-+                              get_acls(fname, &real_sx);
++                              get_acl(fname, &real_sx);
 +#endif
 +                      itemize(file, ndx, real_ret, &real_sx,
                                0, 0, NULL);
@@ -1987,7 +1987,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                                      sx.acc_acl = real_sx.acc_acl;
 +                                      sx.def_acl = real_sx.def_acl;
 +                              } else
-+                                      free_acls(&real_sx);
++                                      free_acl(&real_sx);
 +                      }
 +#endif
                }
@@ -2018,7 +2018,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
                statret = real_ret = -1;
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls && ACL_READY(sx))
-+                      free_acls(&sx);
++                      free_acl(&sx);
 +#endif
                goto notify_others;
        }
@@ -2064,13 +2064,13 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 -              itemize(file, -1, real_ret, &real_st, iflags, fnamecmp_type,
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls && real_ret == 0)
-+                      get_acls(fname, &real_sx);
++                      get_acl(fname, &real_sx);
 +#endif
 +              itemize(file, -1, real_ret, &real_sx, iflags, fnamecmp_type,
                        fuzzy_file ? fuzzy_file->basename : NULL);
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls)
-+                      free_acls(&real_sx);
++                      free_acl(&real_sx);
 +#endif
        }
  
@@ -2103,7 +2103,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +  cleanup:
 +#ifdef SUPPORT_ACLS
 +      if (preserve_acls)
-+              free_acls(&sx);
++              free_acl(&sx);
 +#endif
 +      return;
  }
@@ -2146,7 +2146,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 -                              itemize(file, ndx, statret, st,
 +#ifdef SUPPORT_ACLS
 +                              if (preserve_acls && !ACL_READY(*sxp))
-+                                      get_acls(fname, sxp);
++                                      get_acl(fname, sxp);
 +#endif
 +                              itemize(file, ndx, statret, sxp,
                                        ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
@@ -2186,7 +2186,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                                      sxp->st = st3;
 +#ifdef SUPPORT_ACLS
 +                                      if (preserve_acls)
-+                                              get_acls(cmpbuf, sxp);
++                                              get_acl(cmpbuf, sxp);
 +#endif
 +                                      if (unchanged_attrs(file, sxp))
                                                break;
@@ -2213,7 +2213,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 -              itemize(file, ndx, statret, st,
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls && statret == 0 && !ACL_READY(*sxp))
-+                      get_acls(fname, sxp);
++                      get_acl(fname, sxp);
 +#endif
 +              itemize(file, ndx, statret, sxp,
                        ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
@@ -2246,7 +2246,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +                              hlink1, &st, itemizing, code);
 +#ifdef SUPPORT_ACLS
 +              if (preserve_acls)
-+                      free_acls(&sx);
++                      free_acl(&sx);
 +#endif
                file->F_HLINDEX = FINISHED_LINK;
        } while (!(file->flags & FLAG_HLINK_EOL));
@@ -5754,7 +5754,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 -      if (!preserve_times || (S_ISDIR(st->st_mode) && omit_dir_times))
 +#ifdef SUPPORT_ACLS
 +      if (preserve_acls && !ACL_READY(*sxp))
-+              get_acls(fname, sxp);
++              get_acl(fname, sxp);
 +#endif
 +
 +      if (!preserve_times || (S_ISDIR(sxp->st.st_mode) && omit_dir_times))
@@ -5827,13 +5827,13 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
        }
  
 +#ifdef SUPPORT_ACLS
-+      /* It's OK to call set_acls() now, even for a dir, as the generator
++      /* It's OK to call set_acl() now, even for a dir, as the generator
 +       * will enable owner-writability using chmod, if necessary.
 +       * 
-+       * If set_acl changes permission bits in the process of setting
++       * If set_acl() changes permission bits in the process of setting
 +       * an access ACL, it changes sxp->st.st_mode so we know whether we
-+       * need to chmod. */
-+      if (preserve_acls && set_acls(fname, file, sxp) == 0)
++       * need to chmod(). */
++      if (preserve_acls && set_acl(fname, file, sxp) == 0)
 +              updated = 1;
 +#endif
 +
@@ -5859,7 +5859,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +  cleanup:
 +#ifdef SUPPORT_ACLS
 +      if (preserve_acls && sxp == &sx2)
-+              free_acls(&sx2);
++              free_acl(&sx2);
 +#endif
        return updated;
  }
@@ -6742,7 +6742,7 @@ latest ACL-enabling patch to send files to an older ACL-enabled rsync.
 +              size_t new_size = lp->malloced;
 +              if (incr < 0)
 +                      new_size -= incr; /* increase slowly */
-+              else if (new_size < incr)
++              else if (new_size < (size_t)incr)
 +                      new_size += incr;
 +              else
 +                      new_size *= 2;