Home | History | Annotate | Download | only in src

Lines Matching refs:dev

92   struct device dev;			/* What struct physical knows about */
108 ng_MessageOut(struct ngdevice *dev, const char *data)
123 dev->dev.name, len, data);
137 dev->dev.name, len + 4, strerror(errno));
154 if (NgSendAsciiMsg(dev->cs, path, fmt, data) < 0) {
156 dev->dev.name, path, fmt, data, strerror(errno));
170 struct ngdevice *dev = device2ng(p->handler);
180 if (dev->cs < 0)
188 FD_SET(dev->cs, r);
190 ret = select(dev->cs + 1, r, NULL, NULL, &t);
197 if (NgRecvAsciiMsg(dev->cs, rep, sizeof msgbuf, path)) {
199 dev->dev.name, strerror(errno));
206 log_Printf(LogWARN, "%s: Unexpected message: %s\n", dev->dev.name,
209 log_Printf(LogDEBUG, "%s: Received message: %s\n", dev->dev.name,
223 struct ngdevice *dev = device2ng(p->handler);
228 return ng_MessageOut(dev, v) ? (ssize_t)n : -1;
230 return NgSendData(p->fd, dev->hook, v, n) == -1 ? -1 : (ssize_t)n;
250 struct ngdevice *dev = device2ng(p->handler);
253 if (r && dev->cs >= 0 && FD_ISSET(dev->cs, r)) {
254 FD_CLR(dev->cs, r);
255 log_Printf(LogTIMER, "%s: fdunset(ctrl) %d\n", p->link.name, dev->cs);
272 struct ngdevice *dev = device2ng(p->handler);
275 if (dev->cs != -1)
276 close(dev->cs);
277 free(dev);
284 struct ngdevice *dev;
295 dev = device2ng(d);
296 *auxfd = dev->cs;
326 struct ngdevice *dev = (struct ngdevice *)iov[(*niov)++].iov_base;
328 dev = realloc(dev, sizeof *dev); /* Reduce to the correct size */
329 if (dev == NULL) {
331 (int)(sizeof *dev));
336 dev->cs = *auxfd;
339 dev->cs = -1;
342 memcpy(&dev->dev, &basengdevice, sizeof dev->dev);
345 physical_SetupStack(p, dev->dev.name, PHYSICAL_FORCE_SYNCNOACF);
346 return &dev->dev;
356 struct ngdevice *dev = device2ng(p->handler);
363 FD_SET(dev->cs, r);
364 log_Printf(LogTIMER, "%s(ctrl): fdset(r) %d\n", p->link.name, dev->cs);
382 struct ngdevice *dev = device2ng(p->handler);
385 result = dev->cs >= 0 && FD_ISSET(dev->cs, fdset);
396 struct ngdevice *dev = device2ng(p->handler);
398 if (dev->cs >= 0 && FD_ISSET(dev->cs, fdset))
406 ng_Abandon(struct ngdevice *dev, struct physical *p)
409 close(dev->cs);
412 free(dev);
461 struct ngdevice *dev;
475 dev = NULL;
480 if ((dev = malloc(sizeof *dev)) == NULL)
486 if (ID0NgMkSockNode(NULL, &dev->cs, &p->fd) == -1) {
489 free(dev);
505 return ng_Abandon(dev, p);
510 return ng_Abandon(dev, p);
516 return ng_Abandon(dev, p);
521 return ng_Abandon(dev, p);
531 return ng_Abandon(dev, p);
539 return ng_Abandon(dev, p);
553 return ng_Abandon(dev, p);
578 return ng_Abandon(dev, p);
582 if (NgSendMsg(dev->cs, path, NGM_GENERIC_COOKIE, NGM_LISTHOOKS,
586 return ng_Abandon(dev, p);
591 if (NgRecvMsg(dev->cs, resp, sizeof rbuf, NULL) <= 0) {
594 return ng_Abandon(dev, p);
615 return ng_Abandon(dev, p);
638 if (NgSendMsg(dev->cs, path, NGM_GENERIC_COOKIE,
642 return ng_Abandon(dev, p);
651 if (NgSendMsg(dev->cs, path, NGM_GENERIC_COOKIE, NGM_LISTHOOKS,
655 return ng_Abandon(dev, p);
660 if (NgRecvMsg(dev->cs, resp, sizeof rbuf, NULL) <= 0) {
663 return ng_Abandon(dev, p);
671 NgNameNode(dev->cs, path, "%s", nodename) < 0) {
674 return ng_Abandon(dev, p);
678 return ng_Abandon(dev, p);
691 snprintf(dev->hook, sizeof dev->hook, "%s", lasthook);
695 snprintf(ngc.ourhook, sizeof ngc.ourhook, "%s", dev->hook);
700 if (NgSendMsg(dev->cs, ".:", NGM_GENERIC_COOKIE,
704 return ng_Abandon(dev, p);
707 /* Hook things up so that we monitor dev->cs */
712 memcpy(&dev->dev, &basengdevice, sizeof dev->dev);
725 if ((dev = malloc(sizeof *dev)) == NULL) {
731 memcpy(&dev->dev, &basengdevice, sizeof dev->dev);
732 dev->cs = -1;
733 *dev->hook = '\0';
737 if (dev) {
738 physical_SetupStack(p, dev->dev.name, PHYSICAL_FORCE_SYNCNOACF);
739 return &dev->dev;