dll: fuse: implement BSD flags support

This commit is contained in:
Bill Zissimopoulos 2017-11-14 09:11:51 -08:00
parent e06fe4153d
commit 895bf67691
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3
3 changed files with 37 additions and 4 deletions

View File

@ -84,7 +84,9 @@ struct fuse_operations
/* S */ int (*utimens)(const char *path, const struct fuse_timespec tv[2]);
/* _ */ int (*bmap)(const char *path, size_t blocksize, uint64_t *idx);
/* _ */ unsigned int flag_nullpath_ok:1;
/* _ */ unsigned int flag_reserved:31;
/* _ */ unsigned int flag_nopath:1;
/* _ */ unsigned int flag_utime_omit_ok:1;
/* _ */ unsigned int flag_reserved:29;
/* _ */ int (*ioctl)(const char *path, int cmd, void *arg, struct fuse_file_info *fi,
unsigned int flags, void *data);
/* _ */ int (*poll)(const char *path, struct fuse_file_info *fi,

View File

@ -80,6 +80,11 @@ extern "C" {
fuse_blksize_t st_blksize; \
fuse_blkcnt_t st_blocks; \
struct fuse_timespec st_birthtim;
#define FSP_FUSE_STAT_EX_FIELD_DEFN \
FSP_FUSE_STAT_FIELD_DEFN \
uint32_t st_flags; \
uint32_t st_reserved32[3]; \
uint64_t st_reserved64[2];
#if defined(_WIN64) || defined(_WIN32)
@ -127,10 +132,17 @@ struct fuse_timespec
};
#endif
#if !defined(FSP_FUSE_USE_STAT_EX)
struct fuse_stat
{
FSP_FUSE_STAT_FIELD_DEFN
};
#else
struct fuse_stat
{
FSP_FUSE_STAT_EX_FIELD_DEFN
};
#endif
#if defined(_WIN64)
struct fuse_statvfs
@ -225,7 +237,14 @@ struct fuse_flock
#define fuse_utimbuf utimbuf
#define fuse_timespec timespec
#if !defined(FSP_FUSE_USE_STAT_EX)
#define fuse_stat stat
#else
struct fuse_stat
{
FSP_FUSE_STAT_EX_FIELD_DEFN
};
#endif
#define fuse_statvfs statvfs
#define fuse_flock flock
@ -251,9 +270,7 @@ struct fuse_flock
struct fuse_stat_ex
{
FSP_FUSE_STAT_FIELD_DEFN
uint32_t st_flags;
uint64_t st_reserved[3];
FSP_FUSE_STAT_EX_FIELD_DEFN
};
struct fsp_fuse_env

View File

@ -1270,6 +1270,7 @@ static NTSTATUS fsp_fuse_intf_SetBasicInfo(FSP_FILE_SYSTEM *FileSystem,
struct fsp_fuse_file_desc *filedesc = FileNode;
UINT32 Uid, Gid, Mode;
struct fuse_file_info fi;
FSP_FSCTL_FILE_INFO FileInfoBuf;
struct fuse_timespec tv[2];
struct fuse_utimbuf timbuf;
int err;
@ -1292,6 +1293,19 @@ static NTSTATUS fsp_fuse_intf_SetBasicInfo(FSP_FILE_SYSTEM *FileSystem,
if ((0 != LastAccessTime || 0 != LastWriteTime) &&
(0 != f->ops.utimens || 0 != f->ops.utime))
{
if (0 == LastAccessTime || 0 == LastWriteTime)
{
Result = fsp_fuse_intf_GetFileInfoEx(FileSystem, filedesc->PosixPath, &fi,
&Uid, &Gid, &Mode, &FileInfoBuf);
if (!NT_SUCCESS(Result))
return Result;
if (0 == LastAccessTime)
LastAccessTime = FileInfoBuf.LastAccessTime;
if (0 == LastWriteTime)
LastWriteTime = FileInfoBuf.LastWriteTime;
}
/* UNIX epoch in 100-ns intervals */
LastAccessTime -= 116444736000000000;
LastWriteTime -= 116444736000000000;