[Samba] VFS module and file size problem

Roman Bouchner phaphe at seznam.cz
Wed Mar 21 13:00:33 GMT 2007


Finally I have found solution in samba source files.  I need to add
these flags to my Makefile for VFS module:
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
It depends how your Samba is compiled..
Roman

>Hi
>I am writing opaque VFS module and have file size problem in stat
>function. My stat function looks like this:
>
>static int mystat(SMB_STRUCT_STAT *sbuf) {
>    memset(sbuf, 0, sizeof(SMB_STRUCT_STAT));
>    sbuf->st_dev = 770;             // just some number
>    sbuf->st_ino = 2;               // fake inode
>    sbuf->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH; //file with
>read permission
>    sbuf->st_uid = 10;
>    sbuf->st_gid = 10;
>    sbuf->st_nlink = 1;             // number of hard links
>    sbuf->st_size = 2473;
>    sbuf->st_blksize = 4096;        // Physical block size
>    sbuf->st_blocks = 16;            // Number of blocks allocated
>    sbuf->st_atime = 1027382400;  //fake time
>    sbuf->st_mtime = 1027382400;
>    sbuf->st_ctime = 1027382400;
>    return 0;
>}
>
>When I check the file size throught samba, I see 16TB file size instead
>of 2437 bytes. Also in the log file there are lot of calling stat
>function on the same file so it looks like I am returning invalid sbuf
>structure.
>Thanks for any idea.
>Roman
>
>  
>




More information about the samba mailing list