From a1fbc7debad97c0bdf8a4a010ff13fbb780dcaa4 Mon Sep 17 00:00:00 2001 From: Ivan Rako Date: Wed, 20 May 2009 22:12:41 +0200 Subject: [PATCH] x86_64 prepravke --- debian/changelog | 6 ++++++ quota.h | 2 +- sysadmin.c | 46 ++++++++++++++++++++++++++++++++++++++++------ sysadmin.h | 2 +- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1051266..f80c2a4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sysadmin-cn (1.27) stable; urgency=low + + * Podrska za x86_64 + + -- Ivan Rako Wed, 20 May 2009 13:38:25 +0200 + sysadmin-cn (1.26.2) stable; urgency=low * Prva verzija za lenny diff --git a/quota.h b/quota.h index a39a9ae..259cea3 100644 --- a/quota.h +++ b/quota.h @@ -116,7 +116,7 @@ struct if_dqinfo { #define FIOQSIZE _IOR('f', 128, loff_t) #elif defined(__arm__) || defined(__mc68000__) || defined(__s390__) #define FIOQSIZE 0x545E - #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__ia64__) || defined(__parisc__) || defined(__cris__) || defined(__hppa__) + #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__ia64__) || defined(__parisc__) || defined(__cris__) || defined(__hppa__) || defined(__x86_64__) #define FIOQSIZE 0x5460 #elif defined(__mips__) || defined(__mips64__) #define FIOQSIZE 0x6667 diff --git a/sysadmin.c b/sysadmin.c index e700d9f..c557e4a 100644 --- a/sysadmin.c +++ b/sysadmin.c @@ -15,9 +15,11 @@ * v1.24, 12 Mar 1997, Rewritten code for console checking (I *hate* bloody Digital!!!) * v1.25, 2002-04-28, Initial port to Debian GNU/Linux, limited functionality * v1.26, 2003-12-05, quota for Linux. Only new style quotactl() on i386. + * v1.27, 2009-05-20, x86_64 version * * Written by Zlatko Calusic * Linux port Zoran Dzelajlija + * Linux amd64 port Ivan Rako * * SRCE, University Computing Centre, Croatia * CARNet, Croatian Academic and Research Network @@ -519,7 +521,7 @@ void chquota(void) struct dqblk qval; struct stat statbuf; #elif defined(__linux__) - #if defined(__i386__) + #if defined(__i386__) || defined(__x86_64__) struct if_dqblk qval; /* sys/quota.h is wrong for 2.4.23/i386 */ #elif defined(__sparc__) struct dqblk qval; /* 2.4.23/sparc is different */ @@ -601,9 +603,41 @@ void chquota(void) priv(OFF); time(&now); if (qval.dqb_bsoftlimit && ( - #if defined (__i386__) + #if defined(__i386__) || defined(__x86_64__) qval.dqb_curspace - #elif defined (__sparc__) + #elif defined(__sparc__) + qval.dqb_curblocks + #endif + /1024) >= qval.dqb_bsoftlimit) { + if (!qval.dqb_btime) + qval.dqb_btime = now + MAX_DQ_TIME; + } + else + qval.dqb_btime = 0; + if (qval.dqb_isoftlimit && qval.dqb_curinodes >= qval.dqb_isoftlimit) { + if (!qval.dqb_itime) + qval.dqb_itime = now + MAX_DQ_TIME; + } + else + qval.dqb_itime = 0; + } else { + priv(OFF); + fputs("Ne mogu utvrditi trenutne vrijednosti quote!\n", stderr); + waitkey(); + return; + } + #endif + + #ifdef __x86_64__ + /* get previous quota values and update times */ + priv(ON); + if (!quotactl(QCMD(Q_GETQUOTA, USRQUOTA), devname, pwd->pw_uid, (caddr_t) &qval)) { + priv(OFF); + time(&now); + if (qval.dqb_bsoftlimit && ( + #if defined(__i386__) || defined(__x86_64__) + qval.dqb_curspace + #elif defined(__sparc__) qval.dqb_curblocks #endif /1024) >= qval.dqb_bsoftlimit) { @@ -635,20 +669,20 @@ void chquota(void) if (!soft) fputs("Korisnik ce imati neogranicen pristup diskovnom prostoru!\n", stderr); #if defined(__linux__) - #if defined(__i386__) + #if defined(__i386__) || defined(__x86_64__) /* Actually most of these are u_int64_t. */ qval.dqb_bsoftlimit = (u_int32_t) soft; qval.dqb_bhardlimit = (u_int32_t) hard; qval.dqb_isoftlimit = qval.dqb_ihardlimit = (u_int32_t) 0; qval.dqb_btime = (time_t) now + MAX_DQ_TIME; qval.dqb_itime = (time_t) now + MAX_IQ_TIME; - #if defined(__i386__) + #if defined(__i386__) || defined(__x86_64__) /* Set limits and times */ qval.dqb_valid = QIF_LIMITS | QIF_TIMES; #endif priv(ON); if (! - #if defined (__i386__) + #if defined(__i386__) || defined(__x86_64__) quotactl(QCMD(Q_SETQUOTA, USRQUOTA), devname, pwd->pw_uid, (caddr_t) &qval) #elif defined (__sparc__) quotactl(QCMD(Q_SETQLIM, USRQUOTA), devname, pwd->pw_uid, (caddr_t) &qval) diff --git a/sysadmin.h b/sysadmin.h index b79de61..c8003c3 100644 --- a/sysadmin.h +++ b/sysadmin.h @@ -25,7 +25,7 @@ #if defined(__linux__) #define HM "/home/" - #if defined(__i386__) + #if defined(__i386__) || defined(__x86_64__) #include "quota.h" /* From quota-3.09, works only for new quota! */ #include "quotaio.h" #include "dqblk_v2.h" -- 1.7.10.4