本文整理汇总了C++中prop_dictionary_get函数的典型用法代码示例。如果您正苦于以下问题:C++ prop_dictionary_get函数的具体用法?C++ prop_dictionary_get怎么用?C++ prop_dictionary_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prop_dictionary_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: settunnel
static int
settunnel(prop_dictionary_t env, prop_dictionary_t oenv)
{
const struct paddr_prefix *srcpfx, *dstpfx;
struct if_laddrreq req;
prop_data_t srcdata, dstdata;
srcdata = (prop_data_t)prop_dictionary_get(env, "tunsrc");
dstdata = (prop_data_t)prop_dictionary_get(env, "tundst");
if (srcdata == NULL || dstdata == NULL) {
warnx("%s.%d", __func__, __LINE__);
errno = ENOENT;
return -1;
}
srcpfx = prop_data_data_nocopy(srcdata);
dstpfx = prop_data_data_nocopy(dstdata);
if (srcpfx->pfx_addr.sa_family != dstpfx->pfx_addr.sa_family)
errx(EXIT_FAILURE,
"source and destination address families do not match");
memset(&req, 0, sizeof(req));
memcpy(&req.addr, &srcpfx->pfx_addr,
MIN(sizeof(req.addr), srcpfx->pfx_addr.sa_len));
memcpy(&req.dstaddr, &dstpfx->pfx_addr,
MIN(sizeof(req.dstaddr), dstpfx->pfx_addr.sa_len));
#ifdef INET6
if (req.addr.ss_family == AF_INET6) {
struct sockaddr_in6 *s6, *d;
s6 = (struct sockaddr_in6 *)&req.addr;
d = (struct sockaddr_in6 *)&req.dstaddr;
if (s6->sin6_scope_id != d->sin6_scope_id) {
errx(EXIT_FAILURE, "scope mismatch");
/* NOTREACHED */
}
if (IN6_IS_ADDR_MULTICAST(&d->sin6_addr) ||
IN6_IS_ADDR_MULTICAST(&s6->sin6_addr))
errx(EXIT_FAILURE, "tunnel src/dst is multicast");
/* embed scopeid */
if (s6->sin6_scope_id &&
IN6_IS_ADDR_LINKLOCAL(&s6->sin6_addr)) {
*(u_int16_t *)&s6->sin6_addr.s6_addr[2] =
htons(s6->sin6_scope_id);
}
if (d->sin6_scope_id && IN6_IS_ADDR_LINKLOCAL(&d->sin6_addr)) {
*(u_int16_t *)&d->sin6_addr.s6_addr[2] =
htons(d->sin6_scope_id);
}
}
#endif /* INET6 */
if (direct_ioctl(env, SIOCSLIFPHYADDR, &req) == -1)
warn("SIOCSLIFPHYADDR");
return 0;
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:59,代码来源:tunnel.c
示例2: npf_mk_natlist
static int __noinline
npf_mk_natlist(npf_ruleset_t *nset, prop_array_t natlist,
prop_dictionary_t errdict)
{
prop_object_iterator_t it;
prop_dictionary_t natdict;
int error;
/* NAT policies - array. */
if (prop_object_type(natlist) != PROP_TYPE_ARRAY) {
NPF_ERR_DEBUG(errdict);
return EINVAL;
}
error = 0;
it = prop_array_iterator(natlist);
while ((natdict = prop_object_iterator_next(it)) != NULL) {
npf_rule_t *rl = NULL;
npf_natpolicy_t *np;
/* NAT policy - dictionary. */
if (prop_object_type(natdict) != PROP_TYPE_DICTIONARY) {
NPF_ERR_DEBUG(errdict);
error = EINVAL;
break;
}
/*
* NAT policies are standard rules, plus additional
* information for translation. Make a rule.
*/
error = npf_mk_singlerule(natdict, NULL, &rl, errdict);
if (error) {
break;
}
npf_ruleset_insert(nset, rl);
/* If rule is named, it is a group with NAT policies. */
if (prop_dictionary_get(natdict, "name") &&
prop_dictionary_get(natdict, "subrules")) {
continue;
}
/* Allocate a new NAT policy and assign to the rule. */
np = npf_nat_newpolicy(natdict, nset);
if (np == NULL) {
NPF_ERR_DEBUG(errdict);
error = ENOMEM;
break;
}
npf_rule_setnat(rl, np);
}
prop_object_iterator_release(it);
/*
* Note: in a case of error, caller will free entire NAT ruleset
* with assigned NAT policies.
*/
return error;
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:59,代码来源:npf_ctl.c
示例3: npf_mk_rules
static int __noinline
npf_mk_rules(npf_ruleset_t *rlset, prop_array_t rules, prop_array_t rprocs,
prop_dictionary_t errdict)
{
prop_object_iterator_t it;
prop_dictionary_t rldict, rpdict;
int error;
/* Rule procedures and the ruleset - arrays. */
if (prop_object_type(rprocs) != PROP_TYPE_ARRAY ||
prop_object_type(rules) != PROP_TYPE_ARRAY) {
NPF_ERR_DEBUG(errdict);
return EINVAL;
}
it = prop_array_iterator(rprocs);
while ((rpdict = prop_object_iterator_next(it)) != NULL) {
if (prop_dictionary_get(rpdict, "rproc-ptr")) {
prop_object_iterator_release(it);
NPF_ERR_DEBUG(errdict);
return EINVAL;
}
}
prop_object_iterator_release(it);
error = 0;
it = prop_array_iterator(rules);
while ((rldict = prop_object_iterator_next(it)) != NULL) {
prop_array_t subrules;
npf_ruleset_t *rlsetsub;
npf_rule_t *rl;
/* Generate a single rule. */
error = npf_mk_singlerule(rldict, rprocs, &rl, errdict);
if (error) {
break;
}
npf_ruleset_insert(rlset, rl);
/* Check for sub-rules and generate, if any. */
subrules = prop_dictionary_get(rldict, "subrules");
if (subrules == NULL) {
/* No subrules, next.. */
continue;
}
rlsetsub = npf_rule_subset(rl);
error = npf_mk_subrules(rlsetsub, subrules, rprocs, errdict);
if (error)
break;
}
prop_object_iterator_release(it);
/*
* Note: in a case of error, caller will free the ruleset.
*/
return error;
}
开发者ID:zoltan,项目名称:npf-gsoc-2012,代码行数:56,代码来源:npf_ctl.c
示例4: xbps_pkg_find_conflicts
void HIDDEN
xbps_pkg_find_conflicts(struct xbps_handle *xhp, prop_dictionary_t pkg_repod)
{
prop_array_t pkg_cflicts, trans_cflicts;
prop_dictionary_t pkgd;
const char *cfpkg, *repopkgver, *pkgver;
char *buf;
size_t i;
pkg_cflicts = prop_dictionary_get(pkg_repod, "conflicts");
if (pkg_cflicts == NULL || prop_array_count(pkg_cflicts) == 0)
return;
trans_cflicts = prop_dictionary_get(xhp->transd, "conflicts");
prop_dictionary_get_cstring_nocopy(pkg_repod, "pkgver", &repopkgver);
for (i = 0; i < prop_array_count(pkg_cflicts); i++) {
prop_array_get_cstring_nocopy(pkg_cflicts, i, &cfpkg);
/*
* Check if current pkg conflicts with an installed package.
*/
if ((pkgd = xbps_pkgdb_get_pkgd(xhp, cfpkg, true))) {
prop_dictionary_get_cstring_nocopy(pkgd,
"pkgver", &pkgver);
buf = xbps_xasprintf("%s conflicts with "
"installed pkg %s", repopkgver, pkgver);
assert(buf != NULL);
prop_array_add_cstring(trans_cflicts, buf);
free(buf);
continue;
}
/*
* Check if current pkg conflicts with any pkg in transaction.
*/
pkgd = xbps_find_pkg_in_dict_by_pattern(xhp, xhp->transd,
"unsorted_deps", cfpkg);
if (pkgd != NULL) {
prop_dictionary_get_cstring_nocopy(pkgd,
"pkgver", &pkgver);
buf = xbps_xasprintf("%s conflicts with "
"%s in transaction", repopkgver, pkgver);
assert(buf != NULL);
prop_array_add_cstring(trans_cflicts, buf);
free(buf);
continue;
}
}
}
开发者ID:xdave,项目名称:xbps,代码行数:48,代码来源:package_conflicts.c
示例5: acpi_debug_sysctl_level
static int
acpi_debug_sysctl_level(SYSCTLFN_ARGS)
{
char buf[ACPI_DEBUG_MAX];
struct sysctlnode node;
prop_object_t obj;
int error;
node = *rnode;
node.sysctl_data = buf;
(void)memcpy(node.sysctl_data, rnode->sysctl_data, ACPI_DEBUG_MAX);
error = sysctl_lookup(SYSCTLFN_CALL(&node));
if (error || newp == NULL)
return error;
obj = prop_dictionary_get(acpi_debug_level_d, node.sysctl_data);
if (obj == NULL)
return EINVAL;
AcpiDbgLevel = prop_number_unsigned_integer_value(obj);
(void)memcpy(rnode->sysctl_data, node.sysctl_data, ACPI_DEBUG_MAX);
return 0;
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:29,代码来源:acpi_debug.c
示例6: dm_cmd_to_fun
/*
* Translate command sent from libdevmapper to func.
*/
static int
dm_cmd_to_fun(prop_dictionary_t dm_dict) {
int i, r;
prop_string_t command;
r = 0;
if ((command = prop_dictionary_get(dm_dict, DM_IOCTL_COMMAND)) == NULL)
return EINVAL;
for(i = 0; cmd_fn[i].cmd != NULL; i++)
if (prop_string_equals_cstring(command, cmd_fn[i].cmd))
break;
if (!cmd_fn[i].allowed &&
(r = kauth_authorize_system(kauth_cred_get(),
KAUTH_SYSTEM_DEVMAPPER, 0, NULL, NULL, NULL)) != 0)
return r;
if (cmd_fn[i].cmd == NULL)
return EINVAL;
aprint_debug("ioctl %s called\n", cmd_fn[i].cmd);
r = cmd_fn[i].fn(dm_dict);
return r;
}
开发者ID:ryoon,项目名称:netbsd-xhci,代码行数:30,代码来源:device-mapper.c
示例7: npfctl_sessions_load
/*
* npfctl_sessions_load: import a list of sessions, reconstruct them and load.
*/
int
npfctl_sessions_load(u_long cmd, void *data)
{
const struct plistref *pref = data;
npf_sehash_t *sehasht = NULL;
prop_dictionary_t sesdict, sedict;
prop_object_iterator_t it;
prop_array_t selist;
int error;
/* Retrieve the dictionary containing session and NAT policy lists. */
error = prop_dictionary_copyin_ioctl(pref, cmd, &sesdict);
if (error)
return error;
/*
* Note: session objects contain the references to the NAT policy
* entries. Therefore, no need to directly access it.
*/
selist = prop_dictionary_get(sesdict, "session-list");
if (prop_object_type(selist) != PROP_TYPE_ARRAY) {
error = EINVAL;
goto fail;
}
/* Create a session hash table. */
sehasht = sess_htable_create();
if (sehasht == NULL) {
error = ENOMEM;
goto fail;
}
/*
* Iterate through and construct each session.
*/
error = 0;
it = prop_array_iterator(selist);
npf_core_enter();
while ((sedict = prop_object_iterator_next(it)) != NULL) {
/* Session - dictionary. */
if (prop_object_type(sedict) != PROP_TYPE_DICTIONARY) {
error = EINVAL;
goto fail;
}
/* Construct and insert real session structure. */
error = npf_session_restore(sehasht, sedict);
if (error) {
goto fail;
}
}
npf_core_exit();
sess_htable_reload(sehasht);
fail:
prop_object_release(selist);
if (error && sehasht) {
/* Destroy session table. */
sess_htable_destroy(sehasht);
}
return error;
}
开发者ID:zoltan,项目名称:npf-gsoc-2012,代码行数:63,代码来源:npf_ctl.c
示例8: npfctl_remove_rule
int
npfctl_remove_rule(u_long cmd, void *data)
{
struct plistref *pref = data;
prop_dictionary_t dict, errdict;
prop_object_t obj;
const char *name;
int error, numrules;
/* Retrieve and construct the rule. */
error = prop_dictionary_copyin_ioctl(pref, cmd, &dict);
if (error) {
return error;
}
/* Dictionary for error reporting. */
errdict = prop_dictionary_create();
obj = prop_dictionary_get(dict, "name");
name = prop_string_cstring_nocopy(obj);
npf_rule_t *rl;
error = npf_mk_singlerule(dict, prop_array_create(), &rl, errdict);
npf_core_enter();
numrules = npf_named_ruleset_remove(name, npf_core_ruleset(), rl);
npf_core_exit();
prop_object_release(dict);
/* Error report. */
prop_dictionary_set_int32(errdict, "errno", error);
prop_dictionary_set_int32(errdict, "numrules", numrules);
prop_dictionary_copyout_ioctl(pref, cmd, errdict);
prop_object_release(errdict);
return error;
}
开发者ID:zoltan,项目名称:npf-gsoc-2012,代码行数:35,代码来源:npf_ctl.c
示例9: npf_mk_table_entries
static int __noinline
npf_mk_table_entries(npf_table_t *t, prop_array_t entries)
{
prop_object_iterator_t eit;
prop_dictionary_t ent;
int error = 0;
if (prop_object_type(entries) != PROP_TYPE_ARRAY) {
return EINVAL;
}
eit = prop_array_iterator(entries);
while ((ent = prop_object_iterator_next(eit)) != NULL) {
const npf_addr_t *addr;
npf_netmask_t mask;
int alen;
/* Get address and mask. Add a table entry. */
prop_object_t obj = prop_dictionary_get(ent, "addr");
addr = (const npf_addr_t *)prop_data_data_nocopy(obj);
prop_dictionary_get_uint8(ent, "mask", &mask);
alen = prop_data_size(obj);
error = npf_table_insert(t, alen, addr, mask);
if (error)
break;
}
prop_object_iterator_release(eit);
return error;
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:29,代码来源:npf_ctl.c
示例10: npf_mk_singlerproc
static npf_rproc_t *
npf_mk_singlerproc(prop_dictionary_t rpdict)
{
prop_object_iterator_t it;
prop_dictionary_t extdict;
prop_array_t extlist;
npf_rproc_t *rp;
extlist = prop_dictionary_get(rpdict, "extcalls");
if (prop_object_type(extlist) != PROP_TYPE_ARRAY) {
return NULL;
}
rp = npf_rproc_create(rpdict);
if (rp == NULL) {
return NULL;
}
it = prop_array_iterator(extlist);
while ((extdict = prop_object_iterator_next(it)) != NULL) {
const char *name;
if (!prop_dictionary_get_cstring_nocopy(extdict,
"name", &name) || npf_ext_construct(name, rp, extdict)) {
npf_rproc_release(rp);
rp = NULL;
break;
}
}
prop_object_iterator_release(it);
return rp;
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:32,代码来源:npf_ctl.c
示例11: via_mapchan
static void
via_mapchan(const struct pci_attach_args *pa, struct pciide_channel *cp,
pcireg_t interface, int (*pci_intr)(void *))
{
struct ata_channel *wdc_cp;
struct pciide_softc *sc;
prop_bool_t compat_nat_enable;
wdc_cp = &cp->ata_channel;
sc = CHAN_TO_PCIIDE(&cp->ata_channel);
compat_nat_enable = prop_dictionary_get(
device_properties(sc->sc_wdcdev.sc_atac.atac_dev),
"use-compat-native-irq");
if (interface & PCIIDE_INTERFACE_PCI(wdc_cp->ch_channel)) {
/* native mode with irq 14/15 requested? */
if (compat_nat_enable != NULL &&
prop_bool_true(compat_nat_enable))
via_mapregs_compat_native(pa, cp);
else
pciide_mapregs_native(pa, cp, pci_intr);
} else {
pciide_mapregs_compat(pa, cp, wdc_cp->ch_channel);
if ((cp->ata_channel.ch_flags & ATACH_DISABLED) == 0)
pciide_map_compat_intr(pa, cp, wdc_cp->ch_channel);
}
wdcattach(wdc_cp);
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:28,代码来源:viaide.c
示例12: ibm4xx_device_register
void
ibm4xx_device_register(struct device *dev, void *aux)
{
struct device *parent = device_parent(dev);
if (device_is_a(dev, "emac") && device_is_a(parent, "opb")) {
/* Set the mac-addr of the on-chip Ethernet. */
struct opb_attach_args *oaa = aux;
if (oaa->opb_instance < 10) {
prop_data_t pd;
unsigned char prop_name[15];
snprintf(prop_name, sizeof(prop_name),
"emac%d-mac-addr", oaa->opb_instance);
pd = prop_dictionary_get(board_properties, prop_name);
if (pd == NULL) {
printf("WARNING: unable to get mac-addr "
"property from board properties\n");
return;
}
if (prop_dictionary_set(device_properties(dev),
"mac-addr", pd) == false) {
printf("WARNING: unable to set mac-addr "
"property for %s\n", dev->dv_xname);
}
}
return;
}
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:31,代码来源:ibm4xx_autoconf.c
示例13: npfctl_update_rule
/*
* npfctl_update_rule: reload a specific rule identified by the name.
*/
int
npfctl_update_rule(u_long cmd, void *data)
{
struct plistref *pref = data;
prop_dictionary_t dict, errdict;
prop_array_t subrules;
prop_object_t obj;
npf_ruleset_t *rlset;
const char *name;
int error;
/* Retrieve and construct the rule. */
error = prop_dictionary_copyin_ioctl(pref, cmd, &dict);
if (error) {
return error;
}
/* Dictionary for error reporting. */
errdict = prop_dictionary_create();
/* Create the ruleset and construct sub-rules. */
rlset = npf_ruleset_create();
subrules = prop_dictionary_get(dict, "subrules");
error = npf_mk_subrules(rlset, subrules, NULL, errdict);
if (error) {
goto out;
}
/* Lookup the rule by name, and replace its subset (sub-rules). */
obj = prop_dictionary_get(dict, "name");
name = prop_string_cstring_nocopy(obj);
if (npf_ruleset_replace(name, rlset) == NULL) {
/* Not found. */
error = ENOENT;
out: /* Error path. */
npf_ruleset_destroy(rlset);
}
prop_object_release(dict);
/* Error report. */
prop_dictionary_set_int32(errdict, "errno", error);
prop_dictionary_copyout_ioctl(pref, cmd, errdict);
prop_object_release(errdict);
return error;
}
开发者ID:zoltan,项目名称:npf-gsoc-2012,代码行数:48,代码来源:npf_ctl.c
示例14: npf_mk_singlerule
static int __noinline
npf_mk_singlerule(prop_dictionary_t rldict, npf_rprocset_t *rpset,
npf_rule_t **rlret, prop_dictionary_t errdict)
{
npf_rule_t *rl;
const char *rname;
prop_object_t obj;
int p, error = 0;
/* Rule - dictionary. */
if (prop_object_type(rldict) != PROP_TYPE_DICTIONARY) {
NPF_ERR_DEBUG(errdict);
return EINVAL;
}
if ((rl = npf_rule_alloc(rldict)) == NULL) {
NPF_ERR_DEBUG(errdict);
return EINVAL;
}
/* Assign rule procedure, if any. */
if (prop_dictionary_get_cstring_nocopy(rldict, "rproc", &rname)) {
npf_rproc_t *rp;
if (rpset == NULL) {
error = EINVAL;
goto err;
}
if ((rp = npf_rprocset_lookup(rpset, rname)) == NULL) {
NPF_ERR_DEBUG(errdict);
error = EINVAL;
goto err;
}
npf_rule_setrproc(rl, rp);
}
/* Filter code (binary data). */
if ((obj = prop_dictionary_get(rldict, "code")) != NULL) {
int type;
size_t len;
void *code;
prop_dictionary_get_int32(rldict, "code-type", &type);
error = npf_mk_code(obj, type, &code, &len, errdict);
if (error) {
goto err;
}
npf_rule_setcode(rl, type, code, len);
}
*rlret = rl;
return 0;
err:
npf_rule_free(rl);
prop_dictionary_get_int32(rldict, "prio", &p); /* XXX */
prop_dictionary_set_int32(errdict, "id", p);
return error;
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:57,代码来源:npf_ctl.c
示例15: dm_dev_rename_ioctl
/*
* Rename selected devices old name is in struct dm_ioctl.
* newname is taken from dictionary
*
* <key>cmd_data</key>
* <array>
* <string>...</string>
* </array>
*/
int
dm_dev_rename_ioctl(prop_dictionary_t dm_dict)
{
#if 0
prop_array_t cmd_array;
dm_dev_t *dmv;
const char *name, *uuid, *n_name;
uint32_t flags, minor;
name = NULL;
uuid = NULL;
minor = 0;
/* Get needed values from dictionary. */
prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_NAME, &name);
prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_UUID, &uuid);
prop_dictionary_get_uint32(dm_dict, DM_IOCTL_FLAGS, &flags);
prop_dictionary_get_uint32(dm_dict, DM_IOCTL_MINOR, &minor);
dm_dbg_print_flags(flags);
cmd_array = prop_dictionary_get(dm_dict, DM_IOCTL_CMD_DATA);
prop_array_get_cstring_nocopy(cmd_array, 0, &n_name);
if (strlen(n_name) + 1 > DM_NAME_LEN)
return EINVAL;
if ((dmv = dm_dev_rem(NULL, name, uuid, minor)) == NULL) {
DM_REMOVE_FLAG(flags, DM_EXISTS_FLAG);
return ENOENT;
}
/* change device name */
/*
* XXX How to deal with this change, name only used in
* dm_dev_routines, should I add dm_dev_change_name which will run
* under the dm_dev_list mutex ?
*/
strlcpy(dmv->name, n_name, DM_NAME_LEN);
prop_dictionary_set_uint32(dm_dict, DM_IOCTL_OPEN, dmv->table_head.io_cnt);
prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
prop_dictionary_set_cstring(dm_dict, DM_IOCTL_UUID, dmv->uuid);
dm_dev_insert(dmv);
#endif
/*
* XXX: the rename is not yet implemented. The main complication
* here is devfs. We'd probably need a new function, rename_dev()
* that would trigger a node rename in devfs.
*/
kprintf("dm_dev_rename_ioctl called, but not implemented!\n");
return 0;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:65,代码来源:dm_ioctl.c
示例16: npf_mk_singlerule
static int __noinline
npf_mk_singlerule(prop_dictionary_t rldict, prop_array_t rps, npf_rule_t **rl,
prop_dictionary_t errdict)
{
const char *rnm;
npf_rproc_t *rp;
prop_object_t obj;
size_t nc_size;
void *nc;
int p, error;
/* Rule - dictionary. */
if (prop_object_type(rldict) != PROP_TYPE_DICTIONARY) {
NPF_ERR_DEBUG(errdict);
return EINVAL;
}
error = 0;
obj = prop_dictionary_get(rldict, "ncode");
if (obj) {
/* N-code (binary data). */
error = npf_mk_ncode(obj, &nc, &nc_size, errdict);
if (error) {
goto err;
}
} else {
/* No n-code. */
nc = NULL;
nc_size = 0;
}
/* Check for rule procedure. */
if (rps && prop_dictionary_get_cstring_nocopy(rldict, "rproc", &rnm)) {
rp = npf_mk_rproc(rps, rnm);
if (rp == NULL) {
if (nc) {
npf_ncode_free(nc, nc_size); /* XXX */
}
NPF_ERR_DEBUG(errdict);
error = EINVAL;
goto err;
}
} else {
rp = NULL;
}
/* Finally, allocate and return the rule. */
*rl = npf_rule_alloc(rldict, rp, nc, nc_size);
KASSERT(*rl != NULL);
return 0;
err:
prop_dictionary_get_int32(rldict, "priority", &p); /* XXX */
prop_dictionary_set_int32(errdict, "id", p);
return error;
}
开发者ID:zoltan,项目名称:npf-gsoc-2012,代码行数:55,代码来源:npf_ctl.c
示例17: dispatch_power_event_state_change
static void
dispatch_power_event_state_change(int fd, power_event_t *pev)
{
prop_dictionary_t dict;
prop_object_t obj;
const char *argv[6];
char *buf = NULL;
int error;
error = prop_dictionary_recv_ioctl(fd, POWER_EVENT_RECVDICT, &dict);
if (error) {
if (debug)
printf("%s: prop_dictionary_recv_ioctl error=%d\n",
__func__, error);
return;
}
if (debug) {
buf = prop_dictionary_externalize(dict);
printf("%s", buf);
free(buf);
}
obj = prop_dictionary_get(dict, "powerd-script-name");
argv[0] = prop_string_cstring_nocopy(obj);
obj = prop_dictionary_get(dict, "driver-name");
argv[1] = prop_string_cstring_nocopy(obj);
obj = prop_dictionary_get(dict, "powerd-event-name");
argv[2] = prop_string_cstring_nocopy(obj);
obj = prop_dictionary_get(dict, "sensor-name");
argv[3] = prop_string_cstring_nocopy(obj);
obj = prop_dictionary_get(dict, "state-description");
argv[4] = prop_string_cstring_nocopy(obj);
argv[5] = NULL;
run_script(argv);
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:42,代码来源:powerd.c
示例18: prop_dictionary_get_dict
bool
prop_dictionary_get_dict(prop_dictionary_t dict, const char *key, prop_dictionary_t *dp)
{
prop_object_t o;
o = prop_dictionary_get(dict, key);
if (o == NULL || prop_object_type(o) != PROP_TYPE_DICTIONARY)
return false;
*dp = o;
return true;
}
开发者ID:0xffea,项目名称:MINIX3,代码行数:11,代码来源:prop_dictionary_util.c
示例19: bthidev_match
static int
bthidev_match(device_t self, struct cfdata *cfdata, void *aux)
{
prop_dictionary_t dict = aux;
prop_object_t obj;
obj = prop_dictionary_get(dict, BTDEVservice);
if (prop_string_equals_cstring(obj, "HID"))
return 1;
return 0;
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:12,代码来源:bthidev.c
示例20: match_dev_dict
int
match_dev_dict(prop_dictionary_t dict, prop_dictionary_t match_dict)
{
prop_number_t pn, pn2;
prop_string_t ps, ps2;
if (dict == NULL)
return 0;
if ((ps = prop_dictionary_get(dict, "name")) == NULL)
return 0;
if ((ps2 = prop_dictionary_get(match_dict, "name")) == NULL)
return 0;
if (!prop_string_equals(ps, ps2))
return 0;
if ((pn = prop_dictionary_get(dict, "devnum")) == NULL)
return 0;
if ((pn2 = prop_dictionary_get(match_dict, "devnum")) == NULL)
return 0;
if (!prop_number_equals(pn, pn2))
return 0;
if ((pn = prop_dictionary_get(dict, "kptr")) == NULL)
return 0;
if ((pn2 = prop_dictionary_get(match_dict, "kptr")) == NULL)
return 0;
if (!prop_number_equals(pn, pn2))
return 0;
return 1;
}
开发者ID:alexandermerritt,项目名称:dragonfly,代码行数:32,代码来源:udevd.c
注:本文中的prop_dictionary_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论