* quota system.
*
* $Log$
- * Revision 1.1 1987-09-04 21:32:47 wesommer
- * Initial revision
+ * Revision 1.3 1988-10-06 10:46:08 raeburn
+ * (mar) Don't expire timers on users currently over quota.
*
+ * Revision 1.1 87/09/04 21:32:47 wesommer
+ * Initial revision
+ *
*/
#ifndef lint
{
char *device;
int uid;
- struct dqblk db;
+ struct dqblk db, odb;
+ int uflag = 0;
+
+ while (argc > 4 && *argv[1] == '-') {
+ switch(argv[1][1]) {
+ case 'u':
+ uflag = 1;
+ --argc;
+ ++argv;
+ break;
+ default:
+ goto usage;
+ }
+ }
if (argc != 4) {
usage:
- fprintf(stderr, "usage: setquota special uid quota\n\
+ fprintf(stderr, "usage: setquota [-u] special uid quota\n\
+-u means set limit to <quota> + cur usage\n\
special is a mounted filesystem special device\n\
quota is in 1KB units\n");
exit(1);
device = argv[1];
uid = atoi(argv[2]);
+ if (quotactl(Q_GETQUOTA, device, uid, &odb) != 0) {
+ perror("Can't get current quota info");
+ exit(1);
+ }
+
db.dqb_bsoftlimit = atoi(argv[3]);
db.dqb_bhardlimit = db.dqb_bsoftlimit * 1.2;
db.dqb_fsoftlimit = atoi(argv[3]) * .5;
db.dqb_fhardlimit = db.dqb_fsoftlimit * 1.2;
- db.dqb_btimelimit = DQ_FTIMELIMIT;
- db.dqb_btimelimit = DQ_BTIMELIMIT;
+ db.dqb_btimelimit = odb.dqb_btimelimit;
+ db.dqb_ftimelimit = odb.dqb_ftimelimit;
db.dqb_bsoftlimit *= btodb(1024);
db.dqb_bhardlimit *= btodb(1024);
+ if (uflag) {
+ db.dqb_bhardlimit += odb.dqb_curblocks;
+ db.dqb_bsoftlimit += odb.dqb_curblocks;
+ db.dqb_fhardlimit += odb.dqb_curfiles;
+ db.dqb_fsoftlimit += odb.dqb_curfiles;
+ }
+
if (quotactl(Q_SETQLIM, device, uid, &db) < 0) {
fprintf (stderr, "quotactl: %d on ", uid);
perror (device);