mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-11-03 20:48:08 -06:00 
			
		
		
		
	dll: fuse: implement BSD flags support
This commit is contained in:
		@@ -84,7 +84,9 @@ struct fuse_operations
 | 
				
			|||||||
    /* S */ int (*utimens)(const char *path, const struct fuse_timespec tv[2]);
 | 
					    /* S */ int (*utimens)(const char *path, const struct fuse_timespec tv[2]);
 | 
				
			||||||
    /* _ */ int (*bmap)(const char *path, size_t blocksize, uint64_t *idx);
 | 
					    /* _ */ int (*bmap)(const char *path, size_t blocksize, uint64_t *idx);
 | 
				
			||||||
    /* _ */ unsigned int flag_nullpath_ok:1;
 | 
					    /* _ */ 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,
 | 
					    /* _ */ int (*ioctl)(const char *path, int cmd, void *arg, struct fuse_file_info *fi,
 | 
				
			||||||
        unsigned int flags, void *data);
 | 
					        unsigned int flags, void *data);
 | 
				
			||||||
    /* _ */ int (*poll)(const char *path, struct fuse_file_info *fi,
 | 
					    /* _ */ int (*poll)(const char *path, struct fuse_file_info *fi,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,6 +80,11 @@ extern "C" {
 | 
				
			|||||||
    fuse_blksize_t st_blksize;          \
 | 
					    fuse_blksize_t st_blksize;          \
 | 
				
			||||||
    fuse_blkcnt_t st_blocks;            \
 | 
					    fuse_blkcnt_t st_blocks;            \
 | 
				
			||||||
    struct fuse_timespec st_birthtim;
 | 
					    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)
 | 
					#if defined(_WIN64) || defined(_WIN32)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -127,10 +132,17 @@ struct fuse_timespec
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if !defined(FSP_FUSE_USE_STAT_EX)
 | 
				
			||||||
struct fuse_stat
 | 
					struct fuse_stat
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    FSP_FUSE_STAT_FIELD_DEFN
 | 
					    FSP_FUSE_STAT_FIELD_DEFN
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					struct fuse_stat
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    FSP_FUSE_STAT_EX_FIELD_DEFN
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(_WIN64)
 | 
					#if defined(_WIN64)
 | 
				
			||||||
struct fuse_statvfs
 | 
					struct fuse_statvfs
 | 
				
			||||||
@@ -225,7 +237,14 @@ struct fuse_flock
 | 
				
			|||||||
#define fuse_utimbuf                    utimbuf
 | 
					#define fuse_utimbuf                    utimbuf
 | 
				
			||||||
#define fuse_timespec                   timespec
 | 
					#define fuse_timespec                   timespec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if !defined(FSP_FUSE_USE_STAT_EX)
 | 
				
			||||||
#define fuse_stat                       stat
 | 
					#define fuse_stat                       stat
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					struct fuse_stat
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    FSP_FUSE_STAT_EX_FIELD_DEFN
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#define fuse_statvfs                    statvfs
 | 
					#define fuse_statvfs                    statvfs
 | 
				
			||||||
#define fuse_flock                      flock
 | 
					#define fuse_flock                      flock
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -251,9 +270,7 @@ struct fuse_flock
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct fuse_stat_ex
 | 
					struct fuse_stat_ex
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    FSP_FUSE_STAT_FIELD_DEFN
 | 
					    FSP_FUSE_STAT_EX_FIELD_DEFN
 | 
				
			||||||
    uint32_t st_flags;
 | 
					 | 
				
			||||||
    uint64_t st_reserved[3];
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct fsp_fuse_env
 | 
					struct fsp_fuse_env
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1270,6 +1270,7 @@ static NTSTATUS fsp_fuse_intf_SetBasicInfo(FSP_FILE_SYSTEM *FileSystem,
 | 
				
			|||||||
    struct fsp_fuse_file_desc *filedesc = FileNode;
 | 
					    struct fsp_fuse_file_desc *filedesc = FileNode;
 | 
				
			||||||
    UINT32 Uid, Gid, Mode;
 | 
					    UINT32 Uid, Gid, Mode;
 | 
				
			||||||
    struct fuse_file_info fi;
 | 
					    struct fuse_file_info fi;
 | 
				
			||||||
 | 
					    FSP_FSCTL_FILE_INFO FileInfoBuf;
 | 
				
			||||||
    struct fuse_timespec tv[2];
 | 
					    struct fuse_timespec tv[2];
 | 
				
			||||||
    struct fuse_utimbuf timbuf;
 | 
					    struct fuse_utimbuf timbuf;
 | 
				
			||||||
    int err;
 | 
					    int err;
 | 
				
			||||||
@@ -1292,6 +1293,19 @@ static NTSTATUS fsp_fuse_intf_SetBasicInfo(FSP_FILE_SYSTEM *FileSystem,
 | 
				
			|||||||
    if ((0 != LastAccessTime || 0 != LastWriteTime) &&
 | 
					    if ((0 != LastAccessTime || 0 != LastWriteTime) &&
 | 
				
			||||||
        (0 != f->ops.utimens || 0 != f->ops.utime))
 | 
					        (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 */
 | 
					        /* UNIX epoch in 100-ns intervals */
 | 
				
			||||||
        LastAccessTime -= 116444736000000000;
 | 
					        LastAccessTime -= 116444736000000000;
 | 
				
			||||||
        LastWriteTime -= 116444736000000000;
 | 
					        LastWriteTime -= 116444736000000000;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user