docs: function wrapMethod(method, pathArgPos, setUnsyncedFn, type) {
      return function() {
        var args = Array.prototype.slice.call(arguments, 0);
        var lastIdx = args.length - 1;
        var callback = args[lastIdx];
  
        // Grab the path or fd so we can use it to set the xattribute.
        // Most methods take `path` or `fd` as the first arg, but it's
        // second for some.
        var pathOrFD = args[pathArgPos];
  
        function wrappedCallback() {
          var args = Array.prototype.slice.call(arguments, 0);
          if(args[0] || type === syncTypes.DELETE) {
            return callback.apply(null, args);
          }
  
          setUnsyncedFn(pathOrFD, function(err) {
            if(err) {
              return callback(err);
            }
            callback.apply(null, args);
          });
        }
  
        args[lastIdx] = wrappedCallback;
  
        if(type === syncTypes.DELETE && pathOrFD === root) {
          // Deal with deletion of the sync root
          // https://github.com/mozilla/makedrive/issues/465
          log.warn('Tried to delete the sync root ' + root);
        }
  
        // Don't record extra sync-level details about modifications to an
        // existing conflicted copy, since we don't sync them.
        conflict.isConflictedCopy(fs, pathOrFD, function(err, conflicted) {
          // Deal with errors other than the path not existing (this fs
          // call might be creating it, in which case it's also not conflicted).
          if(err && err.code !== 'ENOENT') {
            return callback.apply(null, [err]);
          }
  
          conflicted = !!conflicted;
  
          // Check to see if it is a path or an open file descriptor
          // and do not record the path if it is not contained
          // in the specified syncing root of the filesystem, or if it is conflicted.
          // TODO: Deal with a case of fs.open for a path with a write flag
          // https://github.com/mozilla/makedrive/issues/210.
          if(fs.openFiles[pathOrFD] || pathOrFD.indexOf(root) !== 0 || conflicted) {
            fs[method].apply(fs, args);
            return;
          }
  
          if(trackedPaths.indexOf(pathOrFD) !== -1 && self.changesDuringDownstream.indexOf(pathOrFD) === -1) {
            self.changesDuringDownstream.push(pathOrFD);
          }
  
          // Queue the path for syncing in the pathsToSync
          // xattr on the sync root
          fsUtils.getPathsToSync(fs, root, function(err, pathsToSync) {
            if(err) {
              return callback(err);
            }
  
            var syncPath = {
              path: pathOrFD,
              type: type
            };
            if(type === syncTypes.RENAME) {
              syncPath.oldPath = args[pathArgPos - 1];
            }
            var indexInPathsToSync;
  
  
            pathsToSync = pathsToSync || {};
            pathsToSync.toSync = pathsToSync.toSync || [];
            indexInPathsToSync = findPathIndexInArray(pathsToSync.toSync, pathOrFD);
  
            if(indexInPathsToSync === 0 && pathsToSync.toSync[0].syncing) {
              // If at the top of pathsToSync, the path is
              // currently syncing so change the modified path
              pathsToSync.modified = pathOrFD;
            } else if(indexInPathsToSync === -1) {
              pathsToSync.toSync.push(syncPath);
            }
  
            fsUtils.setPathsToSync(fs, root, pathsToSync, function(err) {
              if(err) {
                return callback(err);
              }
  
              fs[method].apply(fs, args);
            });
          });
        });
      };
    }