Skip to content

Add support for zos/s390x#582

Merged
drakkan merged 4 commits into
pkg:masterfrom
dustin-ward:master
Apr 6, 2024
Merged

Add support for zos/s390x#582
drakkan merged 4 commits into
pkg:masterfrom
dustin-ward:master

Conversation

@dustin-ward

Copy link
Copy Markdown
Contributor

Closes #581 #579 #578

  • Created stat_zos.go to alter the syscall constants that were not consistent with other platforms

  • toPflags also needed a minor change to support platforms that have different values for os.O_WRONLY, os.O_RDONLY & os.O_RDWR (0x1, 0x2, 0x3 on zos respectively)

  • Some other small modifications were made to tests so that they pass on zos/s390x

Comment thread client.go
switch f & os.O_WRONLY {
case os.O_WRONLY:
out |= sshFxfWrite
switch f & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Consider that POSIX standard requires the assertion: O_RDONLY | O_WRONLY == O_RDWR[1]

However, due to constant folding, I think we’re still fine here regardless.

1: https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

Comment thread stat_zos.go Outdated
Comment thread stat_zos.go Outdated
@dustin-ward

dustin-ward commented Apr 5, 2024

Copy link
Copy Markdown
Contributor Author

Removed stat_zos and changed up stat_posix. Im not really happy with all of the type casting... But I still want to make the changes as small as possible. I also dont like renaming the "io/fs" import... but "fs" is already taken. Would you prefer we rename kr/fs? Any ideas?

@puellanivis puellanivis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

On the lines where you’re adding io/fs for something, there are available os aliases. I’m not saying to use the os version, but it is a possible way to skirt the name clash between io/fs and github.com/kr/fs.

Alternatively, I would recommend renaming kr/fs rather than the standard library. (Even though this probably is a larger change surface.)

Comment thread client.go Outdated
Comment thread client_integration_test.go Outdated

@puellanivis puellanivis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great. So much thanks.

Comment thread stat.go Outdated
s_ISVTX = uint32(sshfx.ModeSticky)
)

// Legacy export:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[golint] godoc should start with S_IFMT

(I know the comments on the pre-existing code wasn’t ideal, and you’re just moving it around.)

@dustin-ward

Copy link
Copy Markdown
Contributor Author

Thanks for your feedback! ✌️

Comment thread stat.go
// Go defines S_IFMT on windows, plan9 and js/wasm as 0x1f000 instead of
// 0xf000. None of the the other S_IFxyz values include the "1" (in 0x1f000)
// which prevents them from matching the bitmask.
// S_IFMT is a legacy export. `sshfx.ModeType` should be used instead

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The problem is that the sshfx package is internal and so no one else can import it. So, the given alternative isn’t useful.

I would say that the local OS might use a different value from what we need to use internally, and there is no reason anyone should need this specific internal value.

We can also merge, and then I can adjust it after.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah I see. That makes more sense. Better to have you leave the comment anyways. Thanks again

@drakkan drakkan merged commit 3c39a36 into pkg:master Apr 6, 2024
@dustin-ward

Copy link
Copy Markdown
Contributor Author

Would it also be possible to get a new tag that includes the recent changes?

@puellanivis

Copy link
Copy Markdown
Collaborator

I want to get the WithWindowsRootEnumeratesDrives also checked in before I cut another release.

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.

Proposal: Standardized FileInfo Structure. RE: z/OS performance investigation

3 participants