replacing file contents in a vfs module

Richard Sharpe realrichardsharpe at
Mon Apr 20 22:29:14 MDT 2015

On Mon, Apr 20, 2015 at 5:00 PM, Jakub Szarlat <jakubjs at> wrote:
> Hi Richard
> Thank you for your suggestion. I've added a pread function to my module.
>  However it only returns the data size that is equal to that of the original file. Is
> this defined in the fsp?

This is what you would have to do:

    struct my_struct *p_var = NULL;
    p_var = (struct my_struct *)VFS_FETCH_FSP_EXTENSION(handle, fsp);

   if (!p_var) {
       /* Get the fd for that special file from my_struct and use it
to return the data */
   } else {
      return SMB_VFS_NEXT_PREAD(...);

Of course, in the open routine you will need to detect that the file
is offline and add the FSP extension.

There is some info here:

> cheers,
> Jakub
> ----- Original Message -----
> From: "Richard Sharpe" <realrichardsharpe at>
> To: "Jakub Szarlat" <jakubjs at>
> Cc: "samba-technical" <samba-technical at>
> Sent: Monday, 20 April, 2015 1:05:15 PM
> Subject: Re: replacing file contents in a vfs module
> On Sun, Apr 19, 2015 at 7:36 PM, Jakub Szarlat <jakubjs at> wrote:
>> Hi
>> I'm writing a vfs module to handle the blocking of file access ot our offline files (we use Quantum Stornext as our file system). Everything is working fine except that unlike windows the Mac has no appreciation of offlien files and does not display an icon overlay to visualize the files status. (Blocking does work)
>> So the idea I had is to present a different ._ corresponding file which would contain a custom icon when a file is offline. I attempted this by changing the smb_fname->base_name in my vfs open_fn function. However this causes an inode does not match error. How can I redirect which file is open without modifying the original?
> How about you an an FSP extension for those files that are offline and
> keep the info you need to return the content of the special file in
> the FSP extension?
> --
> Regards,
> Richard Sharpe
> (何以解憂?唯有杜康。--曹操)
> ______________________________________________________________________
> The information in this email is confidential and intended solely for the addressee.
> You must not disclose, forward, print or use it without the permission of the sender.
> ______________________________________________________________________

Richard Sharpe

More information about the samba-technical mailing list