[Samba] more 'Quota/disk space display in windows'

DA Forsyth iwrTech at iwr.ru.ac.za
Fri Nov 12 10:33:27 GMT 2004


See my note from yesterday about quota size displays for reference

I have just been looking at the source code.  (long time since I did 
C, so forgive me if I stuff something up royally)

in source/smbd/ntquotas.c there is code that corrects for block sizes 
other than 1024, which would work correctly IFF the *bsize is set 
correctly (should be 512 on my FreeBSD system but i don't know how to 
debug stuff on FreeBSD to see the value actually used).

ie
if ((*bsize) < 1024) {
   dfree_retval = (*dfree)/(1024/(*bsize));
} else {
   dfree_retval = ((*bsize)/1024)*(*dfree);

would do the job to report the correct number of 1024 byte blocks to 
Windows.
however, I'm seeing a report of twice the size, which indicates that 
*bsize is set to 1024.

in /source/smbd/quotas.c I find this

#if defined(__FreeBSD__) || defined(__OpenBSD__)
  *bsize = DEV_BSIZE;

great.  so the blocksize is set,  however I am failing miserably to 
find the actual definition of DEV_BSIZE, except to see it seems to 
come from STAT_ST_BLOCKSIZE, which may or may not be set to 512, the 
'configure' file is out of my league, and that is where it seems to 
be defined.

I see things like
configure.in: AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
configure.in: AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a 
block])

but I find nowhere where DEV_BSIZE is set to anything other just a 
#define DEV_BSIZE
which as far as I can recall sets it to '1'

So, I conclude there is definitely something buggy in this code that 
is causing smbd to return the raw count of blocks to Windows clients 
when a quota is set on FreeBSD 5.2.1.  Yet, the size is correct when 
no quota is set on a share.

Please can the people who know how to fix this, fix it.


--
       DA Fo rsyth            Network Supervisor
Principal Technical Officer  -- Institute for Water Research
http://www.ru.ac.za/institutes/iwr/





More information about the samba mailing list