MCPcopy Create free account
hub / github.com/F-Stack/f-stack / quota_read64

Function quota_read64

tools/libutil/quotafile.c:310–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310static int
311quota_read64(struct quotafile *qf, struct dqblk *dqb, int id)
312{
313 struct dqblk64 dqb64;
314 off_t off;
315
316 off = sizeof(struct dqhdr64) + id * sizeof(struct dqblk64);
317 if (lseek(qf->fd, off, SEEK_SET) == -1)
318 return (-1);
319 switch (read(qf->fd, &dqb64, sizeof(dqb64))) {
320 case 0:
321 memset(dqb, 0, sizeof(*dqb));
322 return (0);
323 case sizeof(dqb64):
324 dqb->dqb_bhardlimit = be64toh(dqb64.dqb_bhardlimit);
325 dqb->dqb_bsoftlimit = be64toh(dqb64.dqb_bsoftlimit);
326 dqb->dqb_curblocks = be64toh(dqb64.dqb_curblocks);
327 dqb->dqb_ihardlimit = be64toh(dqb64.dqb_ihardlimit);
328 dqb->dqb_isoftlimit = be64toh(dqb64.dqb_isoftlimit);
329 dqb->dqb_curinodes = be64toh(dqb64.dqb_curinodes);
330 dqb->dqb_btime = be64toh(dqb64.dqb_btime);
331 dqb->dqb_itime = be64toh(dqb64.dqb_itime);
332 return (0);
333 default:
334 return (-1);
335 }
336}
337
338int
339quota_read(struct quotafile *qf, struct dqblk *dqb, int id)

Callers 1

quota_readFunction · 0.85

Calls 2

memsetFunction · 0.85
readFunction · 0.50

Tested by

no test coverage detected