Google is committed to advancing racial equity for Black communities. See how.

addNode method

int addNode (String name, Vnode node)

Adds a directory entry associating the given name with node. It is ok to add the same Vnode multiple times with different names.

Returns ZX.OK on success. Returns ZX.ERR_INVALID_ARGS if name is illegal object name. Returns ZX.ERR_ALREADY_EXISTS if there is already a node with the given name.

Implementation

int addNode(String name, Vnode node) {
  if (!_isLegalObjectName(name)) {
    return ZX.ERR_INVALID_ARGS;
  }
  if (_entries.containsKey(name)) {
    return ZX.ERR_ALREADY_EXISTS;
  }
  var id = _nextId++;
  var e = _Entry(node, name, id);
  _entries[name] = e;
  _treeEntries.add(e);
  return ZX.OK;
}