Lines Matching defs:fio
94 struct puffs_fctrl_io *fio;
96 LIST_FOREACH(fio, &pu->pu_ios, fio_entries)
97 if (fio->io_fd == fd)
98 return fio;
343 fio = getfiobyfd(pu, fd); \
344 if (fio == NULL) { \
348 if (fio->stat & FIO_WRGONE) { \
359 struct puffs_fctrl_io *fio;
378 TAILQ_INSERT_HEAD(&fio->snd_qing, pufbuf, pfb_entries);
380 TAILQ_INSERT_TAIL(&fio->snd_qing, pufbuf, pfb_entries);
397 struct puffs_fctrl_io *fio;
410 TAILQ_INSERT_HEAD(&fio->snd_qing, pufbuf, pfb_entries);
412 TAILQ_INSERT_TAIL(&fio->snd_qing, pufbuf, pfb_entries);
421 struct puffs_fctrl_io *fio;
437 TAILQ_INSERT_HEAD(&fio->snd_qing, pufbuf, pfb_entries);
439 TAILQ_INSERT_TAIL(&fio->snd_qing, pufbuf, pfb_entries);
450 struct puffs_fctrl_io *fio;
454 fio = getfiobyfd(pu, fd);
455 if (fio == NULL) {
461 assert(fio->cur_in == NULL);
462 fio->cur_in = pufbuf;
486 struct puffs_fctrl_io *fio;
502 TAILQ_INSERT_TAIL(&fio->snd_qing, pufbuf, pfb_entries);
538 struct puffs_fctrl_io *fio;
550 fio = getfiobyfd(pu, fd);
551 if (fio == NULL) {
560 if ((fio->stat & FIO_ENABLE_R) == 0)
561 EV_SET(&kev, fd, EVFILT_READ, EV_ENABLE, 0, 0, fio);
567 fio->rwait++;
569 fio->wwait++;
571 LIST_INSERT_HEAD(&fio->ev_qing, &feb, pfe_entries);
577 fio->rwait--;
578 if (fio->rwait == 0 && (fio->stat & FIO_ENABLE_R) == 0) {
579 EV_SET(&kev, fd, EVFILT_READ, EV_DISABLE, 0, 0, fio);
588 fio->wwait--;
603 puffs__framev_notify(struct puffs_fctrl_io *fio, int what)
608 LIST_FOREACH(fbevp, &fio->ev_qing, pfe_entries) {
621 struct puffs_fctrl_io *fio, struct puffs_framebuf *findme)
626 TAILQ_FOREACH(cand, &fio->res_qing, pfb_entries)
634 TAILQ_REMOVE(&fio->res_qing, cand, pfb_entries);
659 struct puffs_fctrl_io *fio)
664 while ((fio->stat & FIO_DEAD) == 0 && (fio->stat & FIO_ENABLE_R)) {
665 if ((pufbuf = fio->cur_in) == NULL) {
670 fio->cur_in = pufbuf;
674 rv = fctrl->rfb(pu, pufbuf, fio->io_fd, &complete);
678 puffs__framev_readclose(pu, fio, rv);
679 fio->cur_in = NULL;
688 fio->cur_in = NULL;
690 appbuf = findbuf(pu, fctrl, fio, pufbuf);
727 struct puffs_fctrl_io *fio)
732 if (fio->stat & FIO_DEAD)
735 for (pufbuf = TAILQ_FIRST(&fio->snd_qing), done = 0;
736 pufbuf && (fio->stat & FIO_DEAD) == 0 && fio->stat & FIO_ENABLE_W;
737 pufbuf = TAILQ_FIRST(&fio->snd_qing)) {
739 rv = fctrl->wfb(pu, pufbuf, fio->io_fd, &complete);
742 puffs__framev_writeclose(pu, fio, rv);
752 TAILQ_REMOVE(&fio->snd_qing, pufbuf, pfb_entries);
755 if (fio->stat & FIO_RDGONE) {
763 TAILQ_INSERT_TAIL(&fio->res_qing, pufbuf,
780 struct puffs_fctrl_io *fio;
791 fio = malloc(sizeof(struct puffs_fctrl_io));
792 if (fio == NULL)
794 memset(fio, 0, sizeof(struct puffs_fctrl_io));
795 fio->io_fd = fd;
796 fio->cur_in = NULL;
797 fio->fctrl = pfctrl;
798 TAILQ_INIT(&fio->snd_qing);
799 TAILQ_INIT(&fio->res_qing);
800 LIST_INIT(&fio->ev_qing);
812 EV_SET(&kev[nf], fd, EVFILT_READ, EV_ADD|readenable, 0, 0, fio);
816 EV_ADD|EV_DISABLE, 0, 0, fio);
824 fio->stat |= FIO_ENABLE_R;
826 fio->stat |= FIO_ENABLE_W;
828 LIST_INSERT_HEAD(&pu->pu_ios, fio, fio_entries);
833 free(fio);
855 struct puffs_fctrl_io *fio;
860 fio = getfiobyfd(pu, fd);
861 if (fio == NULL) {
867 if (what & PUFFS_FBIO_READ && fio->rwait == 0) {
868 EV_SET(&kev, fd, EVFILT_READ, EV_ENABLE, 0, 0, fio);
874 fio->stat |= FIO_ENABLE_R;
876 fio->stat |= FIO_ENABLE_W;
886 struct puffs_fctrl_io *fio;
892 fio = getfiobyfd(pu, fd);
893 if (fio == NULL) {
899 if (what & PUFFS_FBIO_READ && fio->rwait == 0) {
900 EV_SET(&kev[0], fd, EVFILT_READ, EV_DISABLE, 0, 0, fio);
903 if (what & PUFFS_FBIO_WRITE && fio->stat & FIO_WR && fio->wwait == 0) {
904 EV_SET(&kev[1], fd, EVFILT_WRITE, EV_DISABLE, 0, 0, fio);
914 fio->stat &= ~FIO_ENABLE_R;
916 fio->stat &= ~FIO_ENABLE_W;
924 struct puffs_fctrl_io *fio, int error)
930 if (fio->stat & FIO_RDGONE || fio->stat & FIO_DEAD)
932 fio->stat |= FIO_RDGONE;
934 if (fio->cur_in) {
935 if ((fio->cur_in->istat & ISTAT_DIRECT) == 0) {
936 puffs_framebuf_destroy(fio->cur_in);
937 fio->cur_in = NULL;
939 errnotify(pu, fio->cur_in, error);
943 while ((pufbuf = TAILQ_FIRST(&fio->res_qing)) != NULL) {
944 TAILQ_REMOVE(&fio->res_qing, pufbuf, pfb_entries);
948 EV_SET(&kev, fio->io_fd, EVFILT_READ, EV_DELETE, 0, 0, 0);
952 if (fio->stat & FIO_WRGONE)
955 if (fio->fctrl->fdnotfn)
956 fio->fctrl->fdnotfn(pu, fio->io_fd, notflag);
961 struct puffs_fctrl_io *fio, int error)
967 if (fio->stat & FIO_WRGONE || fio->stat & FIO_DEAD)
969 fio->stat |= FIO_WRGONE;
971 while ((pufbuf = TAILQ_FIRST(&fio->snd_qing)) != NULL) {
972 TAILQ_REMOVE(&fio->snd_qing, pufbuf, pfb_entries);
976 EV_SET(&kev, fio->io_fd, EVFILT_WRITE, EV_DELETE, 0, 0, 0);
980 if (fio->stat & FIO_RDGONE)
983 if (fio->fctrl->fdnotfn)
984 fio->fctrl->fdnotfn(pu, fio->io_fd, notflag);
988 removefio(struct puffs_usermount *pu, struct puffs_fctrl_io *fio, int error)
992 LIST_REMOVE(fio, fio_entries);
994 puffs__framev_readclose(pu, fio, error);
995 puffs__framev_writeclose(pu, fio, error);
998 while ((fbevp = LIST_FIRST(&fio->ev_qing)) != NULL) {
1008 fio->stat |= FIO_DEAD;
1009 LIST_INSERT_HEAD(&pu->pu_ios_rmlist, fio, fio_entries);
1018 struct puffs_fctrl_io *fio;
1020 fio = getfiobyfd(pu, fd);
1021 if (fio == NULL) {
1026 return removefio(pu, fio, error ? error : ECONNRESET);
1066 struct puffs_fctrl_io *fio;
1068 while ((fio = LIST_FIRST(&pu->pu_ios)) != NULL)
1069 removefio(pu, fio, ENXIO);