+/* --------------------- */
+int setfilunixmode (const struct vol *vol, struct path* path, mode_t mode)
+{
+ if (!path->st_valid) {
+ of_stat(path);
+ }
+
+ if (path->st_errno) {
+ return -1;
+ }
+
+ mode |= vol->v_fperm;
+
+ if (setfilmode( path->u_name, mode, &path->st, vol->v_umask) < 0)
+ return -1;
+ /* we need to set write perm if read set for resource fork */
+ return vol->vfs->vfs_setfilmode(vol, path->u_name, mode, &path->st);
+}
+
+
+/* --------------------- */
+int setdirunixmode(const struct vol *vol, const char *name, mode_t mode)
+{
+
+ int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
+ mode |= vol->v_dperm;
+
+ if (dir_rx_set(mode)) {
+ /* extending right? dir first then .AppleDouble in rf_setdirmode */
+ if ( stickydirmode(name, DIRBITS | mode, dropbox, vol->v_umask) < 0 )
+ return -1;
+ }
+ if (vol->vfs->vfs_setdirunixmode(vol, name, mode, NULL) < 0 && !vol_noadouble(vol)) {
+ return -1 ;
+ }
+ if (!dir_rx_set(mode)) {
+ if ( stickydirmode(name, DIRBITS | mode, dropbox, vol->v_umask) < 0 )
+ return -1;
+ }
+ return 0;
+}
+
+/* --------------------- */
+int setdirmode(const struct vol *vol, const char *name, mode_t mode)