require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_QUOTA_)) {
    eval 'sub _QUOTA_ () {1;}' unless defined(&_QUOTA_);
    eval 'sub MAX_IQ_TIME () {(7*24*60*60);}' unless defined(&MAX_IQ_TIME);
    eval 'sub MAX_DQ_TIME () {(7*24*60*60);}' unless defined(&MAX_DQ_TIME);
    eval 'sub MAXQUOTAS () {2;}' unless defined(&MAXQUOTAS);
    eval 'sub USRQUOTA () {0;}' unless defined(&USRQUOTA);
    eval 'sub GRPQUOTA () {1;}' unless defined(&GRPQUOTA);
    eval 'sub INITQFNAMES () {{ "user", "group", "undefined", };}' unless defined(&INITQFNAMES);
    eval 'sub QUOTAFILENAME () {"quota";}' unless defined(&QUOTAFILENAME);
    eval 'sub QUOTAGROUP () {"operator";}' unless defined(&QUOTAGROUP);
    eval 'sub SUBCMDMASK () {0xff;}' unless defined(&SUBCMDMASK);
    eval 'sub SUBCMDSHIFT () {8;}' unless defined(&SUBCMDSHIFT);
    eval 'sub QCMD {
        my($cmd, $type) = @_;
	    eval q(((($cmd) <<  &SUBCMDSHIFT) | (($type) &  &SUBCMDMASK)));
    }' unless defined(&QCMD);
    eval 'sub Q_QUOTAON () {0x100;}' unless defined(&Q_QUOTAON);
    eval 'sub Q_QUOTAOFF () {0x200;}' unless defined(&Q_QUOTAOFF);
    eval 'sub Q_GETQUOTA () {0x300;}' unless defined(&Q_GETQUOTA);
    eval 'sub Q_SETQUOTA () {0x400;}' unless defined(&Q_SETQUOTA);
    eval 'sub Q_SETUSE () {0x500;}' unless defined(&Q_SETUSE);
    eval 'sub Q_SYNC () {0x600;}' unless defined(&Q_SYNC);
    if(defined(&_KERNEL)) {
	eval("sub UFS_QUOTA_NOUID () { 0x1; }") unless defined(&UFS_QUOTA_NOUID);
	eval("sub UFS_QUOTA_NOGID () { 0x2; }") unless defined(&UFS_QUOTA_NOGID);
	eval("sub UFS_QUOTA_FORCE () { 0x1000; }") unless defined(&UFS_QUOTA_FORCE);
	require 'sys/cdefs.ph';
	eval 'sub ufs_quota_alloc_blocks {
	    my($i, $c, $cr) = @_;
    	    eval q( &ufs_quota_alloc_blocks2($i, $c, $cr, 0));
	}' unless defined(&ufs_quota_alloc_blocks);
	eval 'sub ufs_quota_free_blocks {
	    my($i, $c, $cr) = @_;
    	    eval q( &ufs_quota_free_blocks2($i, $c, $cr, 0));
	}' unless defined(&ufs_quota_free_blocks);
	eval 'sub ufs_quota_alloc_inode {
	    my($i, $cr) = @_;
    	    eval q( &ufs_quota_alloc_inode2($i, $cr, 0));
	}' unless defined(&ufs_quota_alloc_inode);
	eval 'sub ufs_quota_free_inode {
	    my($i, $cr) = @_;
    	    eval q( &ufs_quota_free_inode2($i, $cr, 0));
	}' unless defined(&ufs_quota_free_inode);
    }
}
1;
