protected Result create (int fid, String name, int perm, int mode, Credential cr) {

		// get directory associated with fid.
		Entry e = assoc.get (fid);
		if (e == null || !(e instanceof Directory))
			return new Result (Result.RC_NO_PARENT_DIRECTORY, e);
		Directory dir = (Directory) e;

		// allocate new entry
		e = dir.create ((mode & 0x80) != 0, name, perm, cr);
		if (e == null)
			return new Result (Result.RC_CREATE_FAILED, null);
		// set new qidPath
		e.setId (ns.getNextId());

		// associate new entry with fid.
		assoc.put  (fid, e);
		
		// open new file
		Handle hdl = e.open (cr, mode);
		if (hdl.rc != Handle.RC_OK) {
			switch (hdl.rc) {
				case Handle.RC_IN_EXCLUSIVE_USE:	return new Result (Result.RC_IN_EXCLUSIVE_USE, e);
				case Handle.RC_NO_PERMISSION:		return new Result (Result.RC_NO_PERMISSION, e);
				default:							return new Result (Result.RC_CREATE_FAILED, e);
			}
		}
		// associate handle with fid
		accessors.put (fid, hdl);

		int rc = (hdl.rc == Handle.RC_OK ? Result.RC_OK : Result.RC_OPEN_FAILED);
		return new Result (rc, e);
	}