Skip to content

use struct stat from cygwin as struct FUSE_STAT for better compatibility#88

Merged
Liryna merged 2 commits intodokan-dev:masterfrom
zzhiyi:master
Oct 14, 2015
Merged

use struct stat from cygwin as struct FUSE_STAT for better compatibility#88
Liryna merged 2 commits intodokan-dev:masterfrom
zzhiyi:master

Conversation

@zzhiyi
Copy link
Contributor

@zzhiyi zzhiyi commented Oct 13, 2015

The original struct stat lacks members like st_blksize etc and uses atime/mtime/ctime, which can only have accuracy in seconds. What's more, the difference with the struct FUSE_STAT in DokanFUSE and struct stat in user program causes stack overflows. The new struct FUSE_STAT is ported from msys2 64bits, which is actually ported from cygwin 64bits. With this modification, users with msys/cygwin(64-bit)toolchains can compile their FUSE programs with DokanFUSE library directly without any more modification other than changing their header files. However, for other toolchains like MSVC,mingw and cygwin 32bits, you need to explicitly replace struct stat in your FUSE program to use struct FUSE_STAT from fuse_win.h. Because the implementation of stat.h varies from operating systems and toolchains, it's hard to find a simply way to be compatible with all of them.

@Liryna
Copy link
Member

Liryna commented Oct 14, 2015

Hi @x1596357 ,

Thanks alot for the contribution !
Everything seems to be alright 👍

I just wanted to ask of you could change the place of st_blksize and st_blocks for having the same memory struct than the linux struct stat ?

By the way, I will change dokan fuse to become a dynamic library as you asked.

@zzhiyi
Copy link
Contributor Author

zzhiyi commented Oct 14, 2015

Hi @Liryna,
Thanks for your efforts for changing to dokan fuse library.
Yes, I could make struct FUSE_STAT the same as Linux struct stat but that would require all user programs to explicitly change their struct stat to struct FUSE_STAT, regardless of what compiler they are using. By using a cygwin struct stat, we can at least have msys2 and cygwin being compatible. And since mingw and MSVC have their incomplete struct stat, users who uses them would have to use struct FUSE_STAT anyway. I think the point is the struct stat in dokan fuse needs to match the one from user program.
What do you think? Should I make it the same as Linux struct stat and require all users to change their source codes or at least make one compiler compatible?

@Liryna
Copy link
Member

Liryna commented Oct 14, 2015

Oh ok ! Well yes, as you made it seems to be the best choice :)
Could you add this build directive to the dokan fuse wiki https://github.com/dokan-dev/dokany/wiki/FUSE ?

Dokan fuse has been changed to dynamic library: 4953160
Since I do not use it, could you tell me if it is enough or do we have to add some export ?

Liryna added a commit that referenced this pull request Oct 14, 2015
use struct stat from cygwin as struct FUSE_STAT for better compatibility
@Liryna Liryna merged commit a941afd into dokan-dev:master Oct 14, 2015
@zzhiyi
Copy link
Contributor Author

zzhiyi commented Oct 14, 2015

Wiki is already updated.
It's enough. Exporting is not needed.

@Liryna
Copy link
Member

Liryna commented Oct 14, 2015

Perfect ! Thanks a lot ! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants