Lines Matching refs:f
37 reg Sfio_t* f; in _sfall() local
53 f = p->sf[n]; in _sfall()
55 if(f->flags&SF_STRING ) in _sfall()
57 if(SFFROZEN(f)) in _sfall()
59 if((f->mode&SF_READ) && (f->mode&SF_SYNCED) ) in _sfall()
61 if((f->mode&SF_READ) && !(f->bits&SF_MMAP) && in _sfall()
62 f->next == f->endb) in _sfall()
64 if((f->mode&SF_WRITE) && !(f->bits&SF_HOLE) && in _sfall()
65 f->next == f->data) in _sfall()
68 if(sfsync(f) < 0) in _sfall()
83 int sfsync(reg Sfio_t* f) in sfsync() argument
85 int sfsync(f) in sfsync()
86 reg Sfio_t* f; /* stream to be synchronized */ in sfsync()
91 SFMTXDECL(f);
93 if(!(origf = f) )
114 for(; f; f = f->push)
116 if((f->flags&SF_IOCHECK) && f->disc && f->disc->exceptf)
117 (void)(*f->disc->exceptf)(f,SF_SYNC,(Void_t*)((int)1),f->disc);
119 SFLOCK(f,local);
122 mode = f->mode&SF_PUSH;
123 f->mode &= ~SF_PUSH;
126 if((f->flags&SF_STRING) || (f->mode&SF_SYNCED))
129 if((f->mode&SF_WRITE) && (f->next > f->data || (f->bits&SF_HOLE)) )
131 reg int pool = f->mode&SF_POOL;
132 f->mode &= ~SF_POOL;
133 if(f->next > f->data && (SFWRALL(f), SFFLSBUF(f,-1)) < 0)
135 if(!SFISNULL(f) && (f->bits&SF_HOLE) )
137 if(SFSK(f,(Sfoff_t)(-1),SEEK_CUR,f->disc) >= 0)
138 (void)SFWR(f,"",1,f->disc);
139 f->bits &= ~SF_HOLE;
141 f->mode |= pool;
144 if((f->mode&SF_READ) && f->extent >= 0 &&
145 ((f->bits&SF_MMAP) || f->next < f->endb) )
147 f->here -= (f->endb-f->next);
148 f->endr = f->endw = f->data;
149 f->mode = SF_READ|SF_SYNCED|lock;
150 (void)SFSK(f,f->here,SEEK_SET,f->disc);
152 if((f->flags&SF_SHARE) && !(f->flags&SF_PUBLIC) &&
153 !(f->bits&SF_MMAP) )
154 { f->endb = f->next = f->data;
155 f->mode &= ~SF_SYNCED;
160 f->mode |= mode;
161 SFOPEN(f,local);
163 if((f->flags&SF_IOCHECK) && f->disc && f->disc->exceptf)
164 (void)(*f->disc->exceptf)(f,SF_SYNC,(Void_t*)((int)0),f->disc);
168 if(!local && f && (f->mode&SF_POOL) && f->pool && f != f->pool->sf[0])
169 SFSYNC(f->pool->sf[0]);