long vtfilewrite(VtFile *f, void *data, long count, vlong offset) { long tot, m; assert(ISLOCKED(f)); tot = 0; m = 0; while(tot < count){ m = filewrite1(f, (char*)data+tot, count-tot, offset+tot); if(m <= 0) break; tot += m; } if(tot==0) return m; return tot; }
int32_t vtfilewrite(VtFile *f, void *data, int32_t count, int64_t offset) { int32_t tot, m; assert(ISLOCKED(f)); tot = 0; m = 0; while(tot < count){ m = filewrite1(f, (char*)data+tot, count-tot, offset+tot); if(m <= 0) break; tot += m; } if(tot==0) return m; return tot; }