EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Updated File Not Opening

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#14147
Posted: 08/10/2010 02:19:11
by Mezeo Support (Basic support level)
Joined: 12/29/2009
Posts: 40

A file on a mapped drive does not open if the file on the local drive is updated.

OS used - Windows 7

Steps to reproduce using Mapper Sample:

1. Add Mounting Point
2. Copy a file(for eg. .pdf, .doc,...) to the local folder which has been mapped
3. Open the file from the Mount Point created by the mapper sample. The file opens as expected.
4. Now, overwrite the file in the local folder (that has been mapped) by copying a file of different size.
5. Perform Step 3. However, in this case the file does not open on the mount point and shows as corrupted, where as the file on the local folder is opening as expected.

Note: Refreshing the mount point drive does not solve the issue.However after following the steps below the file opens as expected:
1. Delete Mount Point
2. Unmount
3. Mount the same folder
4. Add Mount Point
5. Open File

Is this an expected behavior or a defect? Let me know.
#14148
Posted: 08/10/2010 02:38:58
by Volodymyr Zinin (EldoS Corp.)

Hello,

After updating files/directories outside CallbackFS use NotifyDirectoryChange to tell CallbackFS about it.
#14149
Posted: 08/10/2010 03:11:22
by Mezeo Support (Basic support level)
Joined: 12/29/2009
Posts: 40

Can you provide a pointer as to where in the Mapper Sample NotifyDirectoryChange should be called?
#14153
Posted: 08/10/2010 04:03:37
by Volodymyr Zinin (EldoS Corp.)

You can call NotifyDirectoryChange inside the callbacks as well as outside them (but in the former case it will be processed asynchronously).
Just call this API for each file that has been added/changed/modified outside CallbackFS. In your case it's step 4 - i.e. "overwrite the file in the local folder (that has been mapped) by copying a file of different size".

The call looks like this:
NotifyDirectoryChange("\dir1\dir2\filename", fanModified);
#14155
Posted: 08/10/2010 06:16:42
by Mezeo Support (Basic support level)
Joined: 12/29/2009
Posts: 40

When a file is overwritten in the local folder the Mapper sample does not get any notification of the change. Once the file that has been changed is opened from the mapped drive, CbFsOpenFile is called. There are subsequent calls to CbFsReadFile in which the position parameter value is incorrect.

Could it be possible to identify where in CbFsOpenFile callback can we call NotifyDirectoryChange (with reference to your Mapper Sample) or any other appropriate callback where NotifyDirectoryChange can be called?
#14156
Posted: 08/10/2010 07:23:25
by Eugene Mayevski (EldoS Corp.)

Quote
Mezeo Support wrote:
When a file is overwritten in the local folder the Mapper sample does not get any notification of the change


This is correct. You need to modify the sample by tracking the changes in the backend directory (which you map) and call NotifyDirectoryChange in response. Tracking can be done using FileSystemWatcher (in .NET) or corresponding Windows API function (don't remember it's name or using our CallbackFilter product (but this would probably be an overkill).

Quote
Mezeo Support wrote:
Could it be possible to identify where in CbFsOpenFile callback can we call NotifyDirectoryChange (with reference to your Mapper Sample) or any other appropriate callback where NotifyDirectoryChange can be called?


No, it will be too late to call NotifyDirectoryChange in OnOpenFile callback. You need to run a separate thread and monitor changes in backend storage.


Sincerely yours
Eugene Mayevski
#14157
Posted: 08/10/2010 07:35:11
by Mezeo Support (Basic support level)
Joined: 12/29/2009
Posts: 40

I got the change done successfully. Thanks for the information.
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

Topic viewed 1477 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!