Beispiel #1
0
static bool bothdowncandidates(node_t * u, node_t * v)
{
    edge_t *e, *f;
    e = ND_in(u).list[0];
    f = ND_in(v).list[0];
    if (downcandidate(v) && (e->tail == f->tail)) {
	return samedir(e, f)
	    && (portcmp(ED_tail_port(e), ED_tail_port(f)) == 0);
    }
    return FALSE;
}
Beispiel #2
0
static bool bothupcandidates(node_t * u, node_t * v)
{
    edge_t *e, *f;
    e = ND_out(u).list[0];
    f = ND_out(v).list[0];
    if (upcandidate(v) && (e->head == f->head)) {
	return samedir(e, f)
	    && (portcmp(ED_head_port(e), ED_head_port(f)) == 0);
    }
    return FALSE;
}
Beispiel #3
0
/*
 * If the minor name begins with [a-d] and the
 * links in /dev/term/<char> and /dev/cua/<char>
 * don't point at a different minor, then we can
 * create compatibility links for this minor.
 * Returns:
 *	port id if a compatibility link can be created.
 *	NULL otherwise
 */
static char *
check_compat_ports(char *phys_path, char *minor)
{
	char portid = *minor;
	char port[PATH_MAX];
	char *devfs_path;

	if (portid < 'a' || portid >  'd')
		return (NULL);

	(void) snprintf(port, sizeof (port), "term/%c", portid);
	if (devfsadm_read_link(port, &devfs_path) == DEVFSADM_SUCCESS &&
	    portcmp(devfs_path, phys_path) != 0) {
		free(devfs_path);
		return (NULL);
	}

	free(devfs_path);

	(void) snprintf(port, sizeof (port), "cua/%c", portid);
	if (devfsadm_read_link(port, &devfs_path) == DEVFSADM_SUCCESS &&
	    portcmp(devfs_path, phys_path) != 0) {
		free(devfs_path);
		return (NULL);
	}

	free(devfs_path);

	/*
	 * Neither link exists or both links point at "phys_path"
	 * We can safely create compatibility links.
	 */
	port[0] = portid;
	port[1] = '\0';

	return (s_strdup(port));
}