Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zfs 196 #13

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Zfs 196 #13

wants to merge 4 commits into from

Conversation

aviksildc
Copy link

No description provided.

aviksildc and others added 3 commits July 29, 2020 10:44
implementation of more zfs_file interfaces in user mode seek,flush,getattr and changes in pread,pwrite
@aviksildc aviksildc self-assigned this Jul 29, 2020
mbstowcs(buf, path, sizeof(buf));
HANDLE hFile = CreateFileW(
buf,
GENERIC_READ | GENERIC_WRITE,
Copy link
Author

Choose a reason for hiding this comment

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

You need to set this according to flags and mode params

wchar_t buf[PATH_MAX];
UNICODE_STRING uniName;
mbstowcs(buf, path, sizeof(buf));
HANDLE hFile = CreateFileW(
Copy link
Author

Choose a reason for hiding this comment

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

Can generic CreateFile() be used here instead?

);
if (hFile == INVALID_HANDLE_VALUE)
{
return E_FAIL;
Copy link
Author

Choose a reason for hiding this comment

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

How is E_FAIL defined? Can this be replaced with EIO? Idem for all such uses.

NULL
);
if (hFile == INVALID_HANDLE_VALUE)
{
Copy link
Author

Choose a reason for hiding this comment

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

Follow coding guidelines.
"The opening brace ( { ) should be on the same line as the structure tag, and the
closing brace should be alone on a line in column 1."
Example:

if (condition) {
    statements;
} else {
    statements;
}

/*ARGSUSED*/

DWORD zfs_file_off(zfs_file_t* hFile) // 1
Copy link
Author

Choose a reason for hiding this comment

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

Would be good to document what the interface does, like in ZoL:

/*
 * Request current file pointer offset
 *
 * fp - pointer to file
 *
 * Returns current file offset.
 */

Idem for all other interfaces.

@@ -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
Author

Choose a reason for hiding this comment

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

Not required

@@ -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
Author

Choose a reason for hiding this comment

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

Not req

@@ -2463,7 +2463,7 @@ static void
dump_cachefile(const char *cachefile)
{
int fd;
struct stat statbuf;
struct _stat64 statbuf;
Copy link
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

@@ -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
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

//int zfs_file_pread(zfs_file_t *fp, void *buf, size_t len, loff_t off,
// ssize_t *resid);

/*
Copy link
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.

@@ -771,7 +773,7 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
if (fd == -1)
return (errno);

if (fstat_blk(fd, &st) == -1) {
if (fstat(fd, &st) == -1) {
Copy link
Author

Choose a reason for hiding this comment

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

remove this change

@@ -797,7 +998,7 @@ vn_openat(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2,
int ret;

ASSERT(startvp == rootdir);
(void) sprintf(realpath, "/%s", path);
(void) sprintf(realpath, "%s", path);
Copy link
Author

Choose a reason for hiding this comment

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

not required here

@@ -100,7 +101,7 @@ spa_config_load(void)
(void) snprintf(pathname, MAXPATHLEN, "%s%s",
"", spa_config_path);

file = kobj_open_file(pathname);
file = kobj_open_file("C:\\WINDOWS\\System32\\drivers\\zpool.cache");
Copy link
Author

Choose a reason for hiding this comment

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

not required

return -1;

ntstatus = ZwCreateFile(&handle,
GENERIC_WRITE,
Copy link
Author

Choose a reason for hiding this comment

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

handle flags and mode properly

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