summaryrefslogtreecommitdiffstats
path: root/source/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-10-07 00:06:01 +0000
committerJeremy Allison <jra@samba.org>2003-10-07 00:06:01 +0000
commit166efa30d2d680d8c19529c46ace3db115b43532 (patch)
tree00d22edebea977114e91678e7c528af748d81433 /source/smbd
parent7fb8a1bd3880b093a884749fc496cd702480752c (diff)
downloadsamba-166efa30d2d680d8c19529c46ace3db115b43532.tar.gz
samba-166efa30d2d680d8c19529c46ace3db115b43532.tar.xz
samba-166efa30d2d680d8c19529c46ace3db115b43532.zip
Version of patch from nick@isilon.com (Nicholas Kirsch) for bug #564.
Canonicalise SMB_INFO_ALLOCATION in the same was as SMB_FS_FULL_SIZE_INFORMATION. Jeremy.
Diffstat (limited to 'source/smbd')
-rw-r--r--source/smbd/trans2.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index ee63220d188..3d53387c9f1 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -1407,17 +1407,34 @@ static int call_trans2qfsinfo(connection_struct *conn, char *inbuf, char *outbuf
switch (info_level) {
case SMB_INFO_ALLOCATION:
{
- SMB_BIG_UINT dfree,dsize,bsize;
+ SMB_BIG_UINT dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
data_len = 18;
SMB_VFS_DISK_FREE(conn,".",False,&bsize,&dfree,&dsize);
+ block_size = lp_block_size(snum);
+ if (bsize < block_size) {
+ SMB_BIG_UINT factor = block_size/bsize;
+ bsize = block_size;
+ dsize /= factor;
+ dfree /= factor;
+ }
+ if (bsize > block_size) {
+ SMB_BIG_UINT factor = bsize/block_size;
+ bsize = block_size;
+ dsize *= factor;
+ dfree *= factor;
+ }
+ bytes_per_sector = 512;
+ sectors_per_unit = bsize/bytes_per_sector;
+
+ DEBUG(5,("call_trans2qfsinfo : SMB_INFO_ALLOCATION id=%x, bsize=%u, cSectorUnit=%u, \
+cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsigned int)bsize, (unsigned int)sectors_per_unit,
+ (unsigned int)bytes_per_sector, (unsigned int)dsize, (unsigned int)dfree));
+
SIVAL(pdata,l1_idFileSystem,st.st_dev);
- SIVAL(pdata,l1_cSectorUnit,bsize/512);
+ SIVAL(pdata,l1_cSectorUnit,sectors_per_unit);
SIVAL(pdata,l1_cUnit,dsize);
SIVAL(pdata,l1_cUnitAvail,dfree);
- SSVAL(pdata,l1_cbSector,512);
- DEBUG(5,("call_trans2qfsinfo : bsize=%u, id=%x, cSectorUnit=%u, cUnit=%u, cUnitAvail=%u, cbSector=%d\n",
- (unsigned int)bsize, (unsigned int)st.st_dev, ((unsigned int)bsize)/512, (unsigned int)dsize,
- (unsigned int)dfree, 512));
+ SSVAL(pdata,l1_cbSector,bytes_per_sector);
break;
}