Lines Matching defs:qup
209 struct quotause *qup;
212 qup = malloc(sizeof(*qup));
213 if (qup == NULL) {
217 qup->next = NULL;
218 qup->found = 0;
219 qup->xgrace = 0;
220 qup->isdefault = 0;
222 quotaval_clear(&qup->qv[i]);
223 qup->source[i] = SRC_CLEAR;
225 qup->fsname[0] = '\0';
227 return qup;
234 quotause_destroy(struct quotause *qup)
236 free(qup);
268 struct quotause *qup, *nextqup;
270 for (qup = qlist->head; qup; qup = nextqup) {
271 nextqup = qup->next;
272 quotause_destroy(qup);
287 quotalist_append(struct quotalist *qlist, struct quotause *qup)
290 assert(qup->next == NULL);
293 qlist->head = qup;
295 qlist->tail->next = qup;
297 qlist->tail = qup;
305 putprivs1(uint32_t id, int idtype, struct quotause *qup)
310 quotavals_to_dqblk(&qup->qv[QUOTA_LIMIT_BLOCK],
311 &qup->qv[QUOTA_LIMIT_FILE],
313 assert((qup->flags & DEFAULT) == 0);
315 if ((fd = open(qup->qfname, O_WRONLY)) < 0) {
316 warnx("open `%s'", qup->qfname);
323 warnx("writing `%s'", qup->qfname);
334 struct quotause *qup;
358 qup = quotause_create();
359 strcpy(qup->fsname, fs->fs_file);
364 quotause_destroy(qup);
390 quotause_destroy(qup);
394 qup->qfname = qfpathname;
397 &qup->qv[QUOTA_LIMIT_BLOCK],
398 &qup->qv[QUOTA_LIMIT_FILE]);
399 return qup;
408 int objtype, struct quotause *qup)
415 if (quota_get(qh, &qk, &qup->qv[objtype]) == 0) {
417 qup->source[objtype] = SRC_QUOTA;
427 if (quota_get(qh, &qk, &qup->qv[objtype]) == 0) {
429 qup->source[objtype] = SRC_DEFAULT;
437 quotaval_clear(&qup->qv[objtype]);
438 qup->source[objtype] = SRC_CLEAR;
446 struct quotause *qup;
453 qup = quotause_create();
454 strcpy(qup->fsname, filesys);
456 qup->isdefault = 1;
461 quotause_destroy(qup);
470 strlcpy(qup->implementation, impl, sizeof(qup->implementation));
474 qup->xgrace = 1;
485 if (dogetprivs2(qh, idtype, id, defaultq, QUOTA_OBJTYPE_BLOCKS, qup)) {
488 quotause_destroy(qup);
493 if (dogetprivs2(qh, idtype, id, defaultq, QUOTA_OBJTYPE_FILES, qup)) {
496 quotause_destroy(qup);
503 return qup;
507 putprivs2(uint32_t id, int idtype, struct quotause *qup)
513 if (qup->isdefault) {
522 qh = quota_open(qup->fsname);
524 err(1, "%s: quota_open", qup->fsname);
527 if (source_is_real(qup->source[QUOTA_OBJTYPE_BLOCKS])) {
531 if (quota_put(qh, &qk, &qup->qv[QO_BLK])) {
532 err(1, "%s: quota_put (%s blocks)", qup->fsname,
537 if (source_is_real(qup->source[QUOTA_OBJTYPE_FILES])) {
541 if (quota_put(qh, &qk, &qup->qv[QO_FL])) {
542 err(1, "%s: quota_put (%s files)", qup->fsname,
562 struct quotause *qup;
579 qup = getprivs2(id, idtype, fst[i].f_mntonname, defaultq,
581 if (qup == NULL) {
587 quotalist_append(qlist, qup);
599 qup = getprivs1(id, idtype, filesys);
600 if (qup == NULL) {
604 quotalist_append(qlist, qup);
616 struct quotause *qup;
618 for (qup = qlist->head; qup; qup = qup->next) {
620 if (qup->qfname != NULL)
621 putprivs1(id, idtype, qup);
624 putprivs2(id, idtype, qup);
779 struct quotause *qup;
793 for (qup = qlist->head; qup; qup = qup->next) {
794 struct quotaval *q = qup->qv;
796 fprintf(fd, "%s (%s):\n", qup->fsname, qup->implementation);
798 comm = source_is_real(qup->source[QO_BLK]) ? "" : "#";
809 if (qup->xgrace || qup->isdefault) {
814 comm = source_is_real(qup->source[QO_FL]) ? "" : "#";
824 if (qup->xgrace || qup->isdefault) {
844 struct quotause *qup; /* current filesystem */
857 qup = NULL;
910 if (qup == NULL) {
920 qv = &qup->qv[objtype];
1000 qup->source[objtype] = SRC_EDITED;
1002 qup->found = 1;
1014 if (qup->isdefault || qup->xgrace) {
1017 qup->source[objtype] =
1020 qup->found = 1;
1067 for (qup = qlist->head; qup; qup = qup->next) {
1068 if (!strcmp(line, qup->fsname))
1071 if (qup == NULL) {
1089 for (qup = qlist->head; qup; qup = qup->next) {
1090 if (qup->found) {
1091 qup->found = 0;
1095 if (source_is_real(qup->source[QUOTA_OBJTYPE_BLOCKS])) {
1096 quotaval_clear(&qup->qv[QUOTA_OBJTYPE_BLOCKS]);
1097 qup->source[QUOTA_OBJTYPE_BLOCKS] = SRC_EDITED;
1100 if (source_is_real(qup->source[QUOTA_OBJTYPE_FILES])) {
1101 quotaval_clear(&qup->qv[QUOTA_OBJTYPE_FILES]);
1102 qup->source[QUOTA_OBJTYPE_FILES] = SRC_EDITED;
1122 struct quotause *qup;
1128 for (qup = protoprivs->head; qup; qup = qup->next) {
1129 qup->qv[QO_BLK].qv_expiretime = 0;
1130 qup->qv[QO_FL].qv_expiretime = 0;
1131 qup->source[QO_BLK] = SRC_EDITED;
1132 qup->source[QO_FL] = SRC_EDITED;