Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,3 @@ ModelManifest.xml
.fake/

*.am

5 changes: 2 additions & 3 deletions ZFSin.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
# Visual Studio Version 16

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required

VisualStudioVersion = 16.0.30204.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZFSin", "ZFSin\ZFSin.vcxproj", "{9AFC9A86-1D07-49E1-9296-F7A3979B751D}"
EndProject
Expand Down Expand Up @@ -95,7 +95,6 @@ Global
{9AFC9A86-1D07-49E1-9296-F7A3979B751D}.Debug|ARM64.Deploy.0 = Debug|ARM64
{9AFC9A86-1D07-49E1-9296-F7A3979B751D}.Debug|x64.ActiveCfg = Debug|x64
{9AFC9A86-1D07-49E1-9296-F7A3979B751D}.Debug|x64.Build.0 = Debug|x64
{9AFC9A86-1D07-49E1-9296-F7A3979B751D}.Debug|x64.Deploy.0 = Debug|x64

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not req

{9AFC9A86-1D07-49E1-9296-F7A3979B751D}.Debug|x86.ActiveCfg = Debug|Win32
{9AFC9A86-1D07-49E1-9296-F7A3979B751D}.Debug|x86.Build.0 = Debug|Win32
{9AFC9A86-1D07-49E1-9296-F7A3979B751D}.Debug|x86.Deploy.0 = Debug|Win32
Expand Down
4 changes: 3 additions & 1 deletion ZFSin/ZFSin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@
<ClCompile Include="zfs\module\zfs\zfs_byteswap.c" />
<ClCompile Include="zfs\module\zfs\zfs_debug.c" />
<ClCompile Include="zfs\module\zfs\zfs_dir.c" />
<ClCompile Include="zfs\module\zfs\zfs_file.c" />
<ClCompile Include="zfs\module\zfs\zfs_fm.c" />
<ClCompile Include="zfs\module\zfs\zfs_fuid.c" />
<ClCompile Include="zfs\module\zfs\zfs_ioctl.c">
Expand Down Expand Up @@ -643,6 +644,7 @@
<ClInclude Include="zfs\include\sys\zfs_debug.h" />
<ClInclude Include="zfs\include\sys\zfs_delay.h" />
<ClInclude Include="zfs\include\sys\zfs_dir.h" />
<ClInclude Include="zfs\include\sys\zfs_file.h" />
<ClInclude Include="zfs\include\sys\zfs_fuid.h" />
<ClInclude Include="zfs\include\sys\zfs_ioctl.h" />
<ClInclude Include="zfs\include\sys\zfs_mount.h" />
Expand Down Expand Up @@ -699,4 +701,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions ZFSin/zfs/cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2463,7 +2463,7 @@ static void
dump_cachefile(const char *cachefile)
{
int fd;
struct stat statbuf;
struct _stat64 statbuf;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May not be required

char *buf;
nvlist_t *config;

Expand Down Expand Up @@ -2908,7 +2908,7 @@ dump_label(const char *dev)
int fd;
label_t labels[VDEV_LABELS];
char path[MAXPATHLEN];
struct stat statbuf;
struct _stat64 statbuf;
uint64_t psize, ashift;
int l;
boolean_t label_found = B_FALSE;
Expand Down
2 changes: 1 addition & 1 deletion ZFSin/zfs/include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ typedef struct zpool_load_policy {
* The location of the pool configuration repository, shared between kernel and
* userland.
*/
#define ZPOOL_CACHE "/etc/zfs/zpool.cache"
#define ZPOOL_CACHE "\\SystemRoot\\System32\\drivers\\zpool.cache"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert it for now


/*
* vdev states are ordered from least to most healthy.
Expand Down
68 changes: 68 additions & 0 deletions ZFSin/zfs/include/sys/zfs_file.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

#ifndef _SYS_ZFS_FILE_H
#define _SYS_ZFS_FILE_H

#ifndef _KERNEL

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove the struct for Windows?

typedef struct zfs_file {
int f_fd;
int f_dump_fd;
} zfs_file_t;
#else
typedef HANDLE zfs_file_t;
#endif

#if 0
typedef struct zfs_file_attr {
uint64_t zfa_size; /* file size */
mode_t zfa_mode; /* file type */
} zfs_file_attr_t;
#else
typedef struct zfs_file_attr {
DWORD zfa_size;
DWORD zfa_type;
} zfs_file_attr_t;
#endif

int zfs_file_open(const char *path, int flags, int mode, zfs_file_t *fp);
void zfs_file_close(zfs_file_t *fp);
int zfs_file_write(zfs_file_t *fp, const void *buf, size_t len, ssize_t *resid);
//int zfs_file_pwrite(zfs_file_t *fp, const void *buf, size_t len, loff_t off,
// ssize_t *resid);
//int zfs_file_read(zfs_file_t *fp, void *buf, size_t len, ssize_t *resid);
//int zfs_file_pread(zfs_file_t *fp, void *buf, size_t len, loff_t off,
// ssize_t *resid);

/*

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for commented sections.

int zfs_file_seek(zfs_file_t *fp, loff_t *offp, int whence);
int zfs_file_getattr(zfs_file_t *fp, zfs_file_attr_t *zfattr);
int zfs_file_fsync(zfs_file_t *fp, int flags);
int zfs_file_fallocate(zfs_file_t *fp, int mode, loff_t offset, loff_t len);
loff_t zfs_file_off(zfs_file_t *fp);
int zfs_file_unlink(const char *);

int zfs_file_get(int fd, zfs_file_t **fp);
void zfs_file_put(int fd);
void *zfs_file_private(zfs_file_t *fp);
*/

#endif /* _SYS_ZFS_FILE_H */
6 changes: 5 additions & 1 deletion ZFSin/zfs/lib/libspl/include/wosix.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ extern FILE *wosix_fdopen(int fildes, const char *mode);
#define pwrite64 wosix_pwrite
#undef fstat
#define fstat wosix_fstat
#undef _fstat64
#define _fstat64 wosix_fstat
#undef fstat_blk
#define fstat_blk wosix_fstat_blk
#undef stat
#define stat wosix_stat
#undef fdatasync
#define fdatasync wosix_fdatasync
#undef ftruncate
Expand All @@ -109,4 +113,4 @@ extern FILE *wosix_fdopen(int fildes, const char *mode);
#undef pipe
#define pipe wosix_pipe

#endif /* WOSIX_HEADER */
#endif /* WOSIX_HEADER */
10 changes: 10 additions & 0 deletions ZFSin/zfs/lib/libspl/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,16 @@ int wosix_mkdir(const char *path, mode_t mode)
return _mkdir(path);
}

int wosix_stat(char *path, struct _stat64 *st)
{
int fd;

fd = open(path, O_RDONLY);
if (fd == -1)
return -1;
return wosix_fstat(fd, st);
}

// Only fill in what we actually use in ZFS
// Mostly used to test for existance, st_mode, st_size
// also FIFO and BLK (fixme)
Expand Down
2 changes: 1 addition & 1 deletion ZFSin/zfs/lib/libuuid/gen_uuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ void uuid_generate_random(uuid_t out)
*/
static int have_random_source(void)
{
struct stat s;
struct _stat64 s;

return (!stat("/dev/random", &s) || !stat("/dev/urandom", &s));
}
Expand Down
Loading