• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ devfsadm_mklink函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中devfsadm_mklink函数的典型用法代码示例。如果您正苦于以下问题:C++ devfsadm_mklink函数的具体用法?C++ devfsadm_mklink怎么用?C++ devfsadm_mklink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了devfsadm_mklink函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: printer_create

/*
 * Handles:
 *	minor node type "ddi_printer".
 * 	rules of the form: type=ddi_printer;name=bpp  \M0
 */
static int
printer_create(di_minor_t minor, di_node_t node)
{
	char *mn;
	char path[PATH_MAX + 1], *buf;
	devfsadm_enumerate_t rules[1] = {"^printers$/^([0-9]+)$", 1, MATCH_ALL};

	mn = di_minor_name(minor);

	if (strcmp(di_driver_name(node), "bpp") == 0) {
		(void) devfsadm_mklink(mn, node, minor, 0);
	}

	if (NULL == (buf = di_devfs_path(node))) {
		return (DEVFSADM_CONTINUE);
	}

	(void) snprintf(path, sizeof (path), "%s:%s", buf, mn);
	di_devfs_path_free(buf);

	if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) {
		return (DEVFSADM_CONTINUE);
	}

	(void) snprintf(path, sizeof (path), "printers/%s", buf);
	free(buf);

	(void) devfsadm_mklink(path, node, minor, 0);

	return (DEVFSADM_CONTINUE);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:36,代码来源:misc_link.c


示例2: lofi

/*
 * For the master device:
 *	/dev/lofictl -> /devices/pseudo/[email protected]:ctl
 * For each other device
 *	/dev/lofi/1 -> /devices/pseudo/[email protected]:1
 *	/dev/rlofi/1 -> /devices/pseudo/[email protected]:1,raw
 */
static int
lofi(di_minor_t minor, di_node_t node)
{
	dev_t	dev;
	char mn[MAXNAMELEN + 1];
	char blkname[MAXNAMELEN + 1];
	char rawname[MAXNAMELEN + 1];
	char path[PATH_MAX + 1];

	(void) strcpy(mn, di_minor_name(minor));

	if (strcmp(mn, "ctl") == 0) {
		(void) devfsadm_mklink(LOFI_CTL_NAME, node, minor, 0);
	} else {
		dev = di_minor_devt(minor);
		(void) snprintf(blkname, sizeof (blkname), "%d",
		    (int)minor(dev));
		(void) snprintf(rawname, sizeof (rawname), "%d,raw",
		    (int)minor(dev));

		if (strcmp(mn, blkname) == 0) {
			(void) snprintf(path, sizeof (path), "%s/%s",
			    LOFI_BLOCK_NAME, blkname);
		} else if (strcmp(mn, rawname) == 0) {
			(void) snprintf(path, sizeof (path), "%s/%s",
			    LOFI_CHAR_NAME, blkname);
		} else {
			return (DEVFSADM_CONTINUE);
		}

		(void) devfsadm_mklink(path, node, minor, 0);
	}
	return (DEVFSADM_CONTINUE);
}
开发者ID:andreiw,项目名称:polaris,代码行数:41,代码来源:lofi_link.c


示例3: ramdisk

/*
 * This function is called for every ramdisk minor node.
 * Calls enumerate to assign a logical ramdisk id, and then
 * devfsadm_mklink to make the link.
 *
 * For pseudo ramdisk devices:
 *
 *	/dev/ramdiskctl      -> /devices/pseudo/[email protected]:ctl
 *	/dev/ramdisk/<name>  -> /devices/pseudo/[email protected]:<name>
 *	/dev/rramdisk/<name> -> /devices/pseudo/[email protected]:<name>,raw
 *
 * For OBP-created ramdisk devices:
 *
 *	/dev/ramdisk/<name>  -> /devices/ramdisk-<name>:a
 *	/dev/rramdisk/<name> -> /devices/ramdisk-<name>:a,raw
 */
static int
ramdisk(di_minor_t di_minor, di_node_t node)
{
	char	*name;
	char	devnm[MAXNAMELEN + 1];
	char	path[PATH_MAX];

	/*
	 * If this is an OBP-created ramdisk use the node name, having first
	 * stripped the "ramdisk-" prefix.  For pseudo ramdisks use the minor
	 * name, having first stripped any ",raw" suffix.
	 */
	if (di_nodeid(node) == DI_PROM_NODEID) {
		RD_STRIP_PREFIX(name, di_node_name(node));
		(void) strlcpy(devnm, name, sizeof (devnm));
	} else {
		(void) strlcpy(devnm, di_minor_name(di_minor), sizeof (devnm));
		RD_STRIP_SUFFIX(devnm);
	}

	if (strcmp(devnm, RD_CTL_NODE) == 0) {
		(void) devfsadm_mklink(RD_CTL_NAME, node, di_minor, 0);
	} else {
		/*
		 * Make the link in /dev/ramdisk or /dev/rramdisk.
		 */
		(void) snprintf(path, sizeof (path), "%s/%s",
		    di_minor_spectype(di_minor) == S_IFBLK ?
		    RD_BLOCK_NAME : RD_CHAR_NAME, devnm);
		(void) devfsadm_mklink(path, node, di_minor, 0);
	}

	return (DEVFSADM_CONTINUE);
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:50,代码来源:ramdisk_link.c


示例4: tsalarm_create

/*
 * Creates /dev/lom and /dev/tsalarm:ctl for tsalarm node
 */
static int
tsalarm_create(di_minor_t minor, di_node_t node)
{
	char buf[PATH_MAX + 1];
	char *mn = di_minor_name(minor);

	(void) snprintf(buf, sizeof (buf), "%s%s", di_node_name(node), ":ctl");

	(void) devfsadm_mklink(mn, node, minor, 0);
	(void) devfsadm_mklink(buf, node, minor, 0);

	return (DEVFSADM_CONTINUE);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:16,代码来源:misc_link.c


示例5: pcmcia_dialout_create

/*
 * PCMCIA dialout serial ports
 * Creates links of the form "/dev/cua/pcN", where N is the PCMCIA
 * socket number the device is plugged into.
 */
static int
pcmcia_dialout_create(di_minor_t minor, di_node_t node)
{
	char l_path[MAXPATHLEN];
	char  *devfspath;
	int socket, *intp;

	devfspath = di_devfs_path(node);
	if (devfspath == NULL) {
		devfsadm_errprint("%s: di_devfs_path() failed\n", modname);
		return (DEVFSADM_TERMINATE);
	}

	if (di_prop_lookup_ints(DDI_DEV_T_ANY, node, "socket", &intp) <= 0) {
		devfsadm_errprint("%s: failed socket lookup\n\t%s\n",
		    modname, devfspath);
		di_devfs_path_free(devfspath);
		return (DEVFSADM_TERMINATE);
	}

	socket = PCMCIA_SOCKETNO(*intp);

	di_devfs_path_free(devfspath);
	(void) sprintf(l_path, "cua/pc%d", socket);
	(void) devfsadm_mklink(l_path, node, minor, 0);

	return (DEVFSADM_TERMINATE);
}
开发者ID:alhazred,项目名称:onarm,代码行数:33,代码来源:port_link.c


示例6: lom_port_create

/*
 * Lights Out Management (LOM) serial ports
 * Creates links of the form "/dev/term/lom-console".
 */
static int
lom_port_create(di_minor_t minor, di_node_t node)
{
	char  *devfspath;
	char  *minor_name;

	devfspath = di_devfs_path(node);
	if (devfspath == NULL) {
		devfsadm_errprint("%s: di_devfs_path() failed\n", modname);
		return (DEVFSADM_CONTINUE);
	}

	if ((minor_name = di_minor_name(minor)) == NULL) {
		devfsadm_errprint("%s: NULL minor name\n\t%s\n",
		    modname, devfspath);
		di_devfs_path_free(devfspath);
		return (DEVFSADM_CONTINUE);
	}

	/*
	 * if this is the LOM console serial port (i.e. the minor
	 * name == lom-console ), create /dev/term/lom-console link and
	 * then we are done with this node.
	 */
	if (strcmp(minor_name, "lom-console") == 0) {
		(void) devfsadm_mklink("term/lom-console", node, minor, 0);
		di_devfs_path_free(devfspath);
		return (DEVFSADM_TERMINATE);
	}

	/* This is not a LOM node, continue... */
	di_devfs_path_free(devfspath);
	return (DEVFSADM_CONTINUE);
}
开发者ID:alhazred,项目名称:onarm,代码行数:38,代码来源:port_link.c


示例7: onbrd_dialout_create

/*
 * Onboard dialout devices
 * Creates links of the form "/dev/cua/[a..z]"
 */
static int
onbrd_dialout_create(di_minor_t minor, di_node_t node)
{
	char l_path[MAXPATHLEN], p_path[MAXPATHLEN];
	char  *devfspath, *buf, *mn;

	devfspath = di_devfs_path(node);
	if (devfspath == NULL) {
		devfsadm_errprint("%s: di_devfs_path() failed\n", modname);
		return (DEVFSADM_CONTINUE);
	}

	if ((mn = di_minor_name(minor)) == NULL) {
		devfsadm_errprint("%s: NULL minor name\n\t%s\n",
		    modname, devfspath);
		di_devfs_path_free(devfspath);
		return (DEVFSADM_CONTINUE);
	}

	/*
	 * verify this is a dialout port
	 */
	if (!is_dialout(mn)) {
		devfsadm_errprint("%s: not a dialout device\n\t%s:%s\n",
		    modname, devfspath, mn);
		di_devfs_path_free(devfspath);
		return (DEVFSADM_CONTINUE);
	}

	(void) strcpy(p_path, devfspath);
	(void) strcat(p_path, ":");
	(void) strcat(p_path, mn);
	di_devfs_path_free(devfspath);

	buf = NULL;

#ifdef __i386
	buf = check_compat_ports(p_path, mn);
#endif

	/*
	 * devfsadm_enumerate_char_start() is a private interface
	 * for use by the ports module only.
	 */
	if (!buf && devfsadm_enumerate_char_start(p_path, 0, &buf, obport_rules,
	    1, start_id)) {
		devfsadm_errprint("%s: devfsadm_enumerate_char_start() failed"
		    "\n\t%s\n", modname, p_path);
		return (DEVFSADM_CONTINUE);
	}

	/*
	 * create the logical link
	 */
	(void) strcpy(l_path, "cua/");
	(void) strcat(l_path, buf);
	(void) devfsadm_mklink(l_path, node, minor, 0);
	free(buf);
	return (DEVFSADM_CONTINUE);
}
开发者ID:alhazred,项目名称:onarm,代码行数:64,代码来源:port_link.c


示例8: dcam1394_process

/*
 * This function is called for every dcam1394 minor node.
 * Calls enumerate to assign a logical dcam1394 id, and then
 * devfsadm_mklink to make the link.
 */
static int
dcam1394_process(di_minor_t minor, di_node_t node)
{
	char m_name[PATH_MAX], restring0[DCAM_RE_STRING_LEN];
	char l_path[PATH_MAX], p_path[PATH_MAX], *buf, *devfspath;
	devfsadm_enumerate_t re[1];

	(void) strcpy(m_name, di_minor_name(minor));

	if (strcmp(di_driver_name(node), "dcam1394") != 0) {
	    return (DEVFSADM_CONTINUE);
	}

	if (strncmp(m_name, "dcamctl", 7) == 0) {
		(void) snprintf(restring0, DCAM_RE_STRING_LEN,
				DCAM_CTL_LINK_RE);
	} else if (strncmp(m_name, "dcam", 4) == 0) {
		(void) snprintf(restring0, DCAM_RE_STRING_LEN,
				DCAM_STR_LINK_RE);
	} else {
		return (DEVFSADM_CONTINUE);
	}

	re[0].re	= restring0;
	re[0].subexp	= 1;
	re[0].flags	= MATCH_ALL;

	devfsadm_print(debug_mid,
	    "dcam1394_process: path %s\n", di_devfs_path(node));

	(void) strcpy(p_path, devfspath = di_devfs_path(node));
	(void) strcat(p_path, ":");
	(void) strcat(p_path, di_minor_name(minor));
	di_devfs_path_free(devfspath);

	/*
	 * Build the physical path from the components, omitting
	 * minor name field.  Find the logical dcam1394 id, and
	 * stuff it in buf.
	 */
	if (devfsadm_enumerate_int(p_path, 0, &buf, re, 1)) {
		devfsadm_print(debug_mid,
		    "dcam1394_process: exit/continue\n");
		return (DEVFSADM_CONTINUE);
	}

	devfsadm_print(debug_mid, "dcam1394_process: p_path=%s buf=%s\n",
	    p_path, buf);

	if (strncmp(di_minor_name(minor), "dcamctl", 7) == 0)
		(void) snprintf(l_path, PATH_MAX, "dcamctl%s", buf);
	else
		(void) snprintf(l_path, PATH_MAX, "dcam%s", buf);

	(void) devfsadm_mklink(l_path, node, minor, 0);

	free(buf);

	return (DEVFSADM_CONTINUE);
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:65,代码来源:dcam1394_link.c


示例9: mc_node

static int
mc_node(di_minor_t minor, di_node_t node)
{
	char path[PATH_MAX], l_path[PATH_MAX], *buf, *devfspath;
	char *minor_nm;

	minor_nm = di_minor_name(minor);

	if (minor_nm == NULL) {
		return (DEVFSADM_CONTINUE);
	}

	devfspath = di_devfs_path(node);

	(void) strcpy(path, devfspath);
	(void) strcat(path, ":");
	(void) strcat(path, minor_nm);
	di_devfs_path_free(devfspath);

	/* build the physical path from the components */
	if (devfsadm_enumerate_int(path, 0, &buf, mc_rules, 1)) {
		return (DEVFSADM_CONTINUE);
	}

	(void) strcpy(l_path, "mc/mc");
	(void) strcat(l_path, buf);

	free(buf);

	(void) devfsadm_mklink(l_path, node, minor, 0);
	return (DEVFSADM_CONTINUE);
}
开发者ID:andreiw,项目名称:polaris,代码行数:32,代码来源:misc_link_sparc.c


示例10: parallel

/*
 * Handles minor node type "ddi_parallel".
 * type=ddi_parallel;name=mcpp     mcpp\N0
 */
static int
parallel(di_minor_t minor, di_node_t node)
{
	char path[PATH_MAX + 1], *buf;
	devfsadm_enumerate_t rules[1] = {"mcpp([0-9]+)$", 1, MATCH_ALL};


	if (strcmp(di_node_name(node), "mcpp") != 0) {
		return (DEVFSADM_CONTINUE);
	}

	if (NULL == (buf = di_devfs_path(node))) {
		return (DEVFSADM_CONTINUE);
	}

	(void) snprintf(path, sizeof (path), "%s:%s",
	    buf, di_minor_name(minor));

	di_devfs_path_free(buf);

	if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) {
		return (DEVFSADM_CONTINUE);
	}
	(void) snprintf(path, sizeof (path), "mcpp%s", buf);
	free(buf);

	(void) devfsadm_mklink(path, node, minor, 0);
	return (DEVFSADM_CONTINUE);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:33,代码来源:misc_link.c


示例11: ses_callback

static int
ses_callback(di_minor_t minor, di_node_t node)
{
	char l_path[PATH_MAX];
	char *buf;
	char *devfspath;
	char p_path[PATH_MAX];
	devfsadm_enumerate_t re[] = {"^es$/^ses([0-9]+)$", 1, MATCH_ALL};

	/* find devices path -- need to free mem */
	if (NULL == (devfspath = di_devfs_path(node))) {
		return (DEVFSADM_CONTINUE);
	}

	(void) snprintf(p_path, sizeof (p_path), "%s:%s", devfspath,
	    di_minor_name(minor));


	/* find next number to use; buf is an ascii number */
	if (devfsadm_enumerate_int(p_path, 0, &buf, re, 1)) {
		/* free memory */
		di_devfs_path_free(devfspath);
		return (DEVFSADM_CONTINUE);
	}

	(void) snprintf(l_path, sizeof (l_path), "es/ses%s", buf);

	(void) devfsadm_mklink(l_path, node, minor, 0);
	/* free memory */
	free(buf);
	di_devfs_path_free(devfspath);
	return (DEVFSADM_CONTINUE);

}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:34,代码来源:misc_link.c


示例12: av_create

/*
 * Handles:
 *	/dev/av/[0-9]+/(async|isoch)
 */
static int
av_create(di_minor_t minor, di_node_t node)
{
	devfsadm_enumerate_t rules[1] = {"^av$/^([0-9]+)$", 1, MATCH_ADDR};
	char	*minor_str;
	char	path[PATH_MAX + 1];
	char	*buf;

	if ((buf = di_devfs_path(node)) == NULL) {
		return (DEVFSADM_CONTINUE);
	}

	minor_str = di_minor_name(minor);
	(void) snprintf(path, sizeof (path), "%s:%s", buf, minor_str);
	di_devfs_path_free(buf);

	if (devfsadm_enumerate_int(path, 0, &buf, rules, 1)) {
		return (DEVFSADM_CONTINUE);
	}

	(void) snprintf(path, sizeof (path), "av/%s/%s", buf, minor_str);
	free(buf);

	(void) devfsadm_mklink(path, node, minor, 0);

	return (DEVFSADM_CONTINUE);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:31,代码来源:misc_link.c


示例13: gpio

static int
gpio(di_minor_t minor, di_node_t node)
{
	char l_path[PATH_MAX], p_path[PATH_MAX], *buf, *devfspath;
	char *minor_nm, *drvr_nm;


	minor_nm = di_minor_name(minor);
	drvr_nm = di_driver_name(node);
	if ((minor_nm == NULL) || (drvr_nm == NULL)) {
		return (DEVFSADM_CONTINUE);
	}

	devfspath = di_devfs_path(node);

	(void) strcpy(p_path, devfspath);
	(void) strcat(p_path, ":");
	(void) strcat(p_path, minor_nm);
	di_devfs_path_free(devfspath);

	/* build the physical path from the components */
	if (devfsadm_enumerate_int(p_path, 0, &buf, gpio_rules, 1)) {
		return (DEVFSADM_CONTINUE);
	}

	(void) snprintf(l_path, sizeof (l_path), "%s%s", "gpio", buf);

	free(buf);

	(void) devfsadm_mklink(l_path, node, minor, 0);

	return (DEVFSADM_CONTINUE);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:33,代码来源:misc_link.c


示例14: kmdrv_create

/*
 * Handles links of the form:
 * type=ddi_pseudo;name=sckmdrv		kmdrv\M0
 * type=ddi_pseudo;name=oplkmdrv	kmdrv\M0
 */
static int
kmdrv_create(di_minor_t minor, di_node_t node)
{

	(void) devfsadm_mklink("kmdrv", node, minor, 0);
	return (DEVFSADM_CONTINUE);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:12,代码来源:misc_link.c


示例15: fc_port

static int
fc_port(di_minor_t minor, di_node_t node)
{
	devfsadm_enumerate_t rules[1] = {"fc/fp([0-9]+)$", 1, MATCH_ALL};
	char *buf, path[PATH_MAX + 1];
	char *ptr;

	if (NULL == (ptr = di_devfs_path(node))) {
		return (DEVFSADM_CONTINUE);
	}

	(void) strcpy(path, ptr);
	(void) strcat(path, ":");
	(void) strcat(path, di_minor_name(minor));

	di_devfs_path_free(ptr);

	if (devfsadm_enumerate_int(path, 0, &buf, rules, 1) != 0) {
		return (DEVFSADM_CONTINUE);
	}

	(void) strcpy(path, "fc/fp");
	(void) strcat(path, buf);
	free(buf);

	(void) devfsadm_mklink(path, node, minor, 0);
	return (DEVFSADM_CONTINUE);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:28,代码来源:misc_link.c


示例16: minor_name

/*
 * Handles links of the form:
 * type=ddi_pseudo;name=xyz  \M0
 */
static int
minor_name(di_minor_t minor, di_node_t node)
{
	char *mn = di_minor_name(minor);

	(void) devfsadm_mklink(mn, node, minor, 0);
	if (strcmp(mn, "icmp") == 0) {
		(void) devfsadm_mklink("rawip", node, minor, 0);
	}
	if (strcmp(mn, "icmp6") == 0) {
		(void) devfsadm_mklink("rawip6", node, minor, 0);
	}
	if (strcmp(mn, "ipf") == 0) {
		(void) devfsadm_mklink("ipl", node, minor, 0);
	}
	return (DEVFSADM_CONTINUE);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:21,代码来源:misc_link.c


示例17: ddi_other

/*
 * Handles minor node type "ddi_other"
 * type=ddi_other;name=SUNW,pmc    pmc
 * type=ddi_other;name=SUNW,mic    mic\M0
 */
static int
ddi_other(di_minor_t minor, di_node_t node)
{
	char path[PATH_MAX + 1];
	char *nn = di_node_name(node);
	char *mn = di_minor_name(minor);

	if (strcmp(nn, "SUNW,pmc") == 0) {
		(void) devfsadm_mklink("pcm", node, minor, 0);
	} else if (strcmp(nn, "SUNW,mic") == 0) {
		(void) strcpy(path, "mic");
		(void) strcat(path, mn);
		(void) devfsadm_mklink(path, node, minor, 0);
	}

	return (DEVFSADM_CONTINUE);
}
开发者ID:andreiw,项目名称:polaris,代码行数:22,代码来源:misc_link_sparc.c


示例18: zfs

/*
 * For the zfs control node:
 *	/dev/zfs -> /devices/pseudo/[email protected]:zfs
 * For zvols:
 *	/dev/zvol/dsk/<pool>/<dataset> -> /devices/pseudo/[email protected]:1
 *	/dev/zvol/rdsk/<pool>/<dataset> -> /devices/pseudo/[email protected]:1,raw
 */
static int
zfs(di_minor_t minor, di_node_t node)
{
	dev_t	dev;
	int	err;
	char mn[MAXNAMELEN + 1];
	char blkname[MAXNAMELEN + 1];
	char rawname[MAXNAMELEN + 1];
	char path[PATH_MAX + 1];
	char *name;

	(void) strcpy(mn, di_minor_name(minor));

	if (strcmp(mn, ZFS_DRIVER) == 0) {
		(void) devfsadm_mklink(ZFS_DRIVER, node, minor, 0);
	} else {
		dev = di_minor_devt(minor);
		err = di_prop_lookup_strings(dev, node, ZVOL_PROP_NAME, &name);
		if (err < 0) {
			/* property not defined so can't do anything */
			return (DEVFSADM_CONTINUE);
		}
		(void) snprintf(blkname, sizeof (blkname), "%dc",
		    (int)minor(dev));
		(void) snprintf(rawname, sizeof (rawname), "%dc,raw",
		    (int)minor(dev));

		/*
		 * This is where the actual public name gets constructed.
		 * Change the snprintf format to change the public
		 * path that gets constructed.
		 */
		if (strcmp(mn, blkname) == 0) {
			(void) snprintf(path, sizeof (path), "%s/%s",
			    ZVOL_DEV_DIR, name);
		} else if (strcmp(mn, rawname) == 0) {
			(void) snprintf(path, sizeof (path), "%s/%s",
			    ZVOL_RDEV_DIR, name);
		} else {
			return (DEVFSADM_CONTINUE);
		}

		(void) devfsadm_mklink(path, node, minor, 0);
	}
	return (DEVFSADM_CONTINUE);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:53,代码来源:zfs_link.c


示例19: ugen_create_link

static void
ugen_create_link(char *p_path, char *node_name,
    di_node_t node, di_minor_t minor)
{
	char *buf, s[MAXPATHLEN];
	char *lasts = s;
	char *vid, *pid;
	char *minor_name;
	char ugen_RE[128];
	devfsadm_enumerate_t ugen_rules[1];
	char l_path[PATH_MAX];
	int flags = 0;

	devfsadm_print(debug_mid, "ugen_create_link: p_path=%s name=%s\n",
	    p_path, node_name);

	(void) strlcpy(s, node_name, sizeof (s));

	/* get vid, pid and minor name strings */
	vid = strtok_r(lasts, ".", &lasts);
	pid = strtok_r(NULL, ".", &lasts);
	minor_name = lasts;

	if ((vid == NULL) || (pid == NULL) || (minor_name == NULL)) {
		return;
	}

	/* create regular expression contain vid and pid */
	(void) snprintf(ugen_RE, sizeof (ugen_RE),
	    "^usb$/^%s\\.%s$/^([0-9]+)$", vid, pid);
	devfsadm_print(debug_mid,
	    "ugen_create_link: ugen_RE=%s minor_name=%s\n",
	    ugen_RE, minor_name);

	bzero(ugen_rules, sizeof (ugen_rules));

	ugen_rules[0].re = ugen_RE;
	ugen_rules[0].subexp = 1;
	ugen_rules[0].flags = MATCH_ADDR;

	/*
	 *  build the physical path from the components.
	 *  find the logical usb id, and stuff it in buf
	 */
	if (devfsadm_enumerate_int(p_path, 0, &buf, ugen_rules, 1)) {
		devfsadm_print(debug_mid, "ugen_create_link: exit/continue\n");
		return;
	}

	(void) snprintf(l_path, sizeof (l_path), "usb/%s.%s/%s/%s",
	    vid, pid, buf, minor_name);

	devfsadm_print(debug_mid, "mklink %s -> %s\n", l_path, p_path);

	(void) devfsadm_mklink(l_path, node, minor, flags);

	free(buf);
}
开发者ID:rheostat2718,项目名称:devicemanagerofsjtu,代码行数:58,代码来源:usb_link.c


示例20: rsc_port_create

/*
 * Remote System Controller (RSC) serial ports
 * Creates links of the form "/dev/rsc-control" | "/dev/term/rsc-console".
 */
static int
rsc_port_create(di_minor_t minor, di_node_t node)
{
	char  *devfspath;
	char  *minor_name;


	devfspath = di_devfs_path(node);
	if (devfspath == NULL) {
		devfsadm_errprint("%s: di_devfs_path() failed\n", modname);
		return (DEVFSADM_CONTINUE);
	}

	if ((minor_name = di_minor_name(minor)) == NULL) {
		devfsadm_errprint("%s: NULL minor name\n\t%s\n",
		    modname, devfspath);
		di_devfs_path_free(devfspath);
		return (DEVFSADM_CONTINUE);
	}

	/*
	 * if this is the RSC console serial port (i.e. the minor name == ssp),
	 * create /dev/term/rsc-console link and then we are done with this
	 * node.
	 */
	if (strcmp(minor_name, "ssp") == 0) {
		(void) devfsadm_mklink("term/rsc-console", node, minor, 0);
		di_devfs_path_free(devfspath);
		return (DEVFSADM_TERMINATE);

	/*
	 * else if this is the RSC control serial port (i.e. the minor name ==
	 * sspctl), create /dev/rsc-control link and then we are done with this
	 * node.
	 */
	} else if (strcmp(minor_name, "sspctl") == 0) {
		(void) devfsadm_mklink("rsc-control", node, minor, 0);
		di_devfs_path_free(devfspath);
		return (DEVFSADM_TERMINATE);
	}

	/* This is not an RSC node, continue... */
	di_devfs_path_free(devfspath);
	return (DEVFSADM_CONTINUE);
}
开发者ID:alhazred,项目名称:onarm,代码行数:49,代码来源:port_link.c



注:本文中的devfsadm_mklink函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ device函数代码示例发布时间:2022-05-30
下一篇:
C++ devfs_unregister函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap