You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dev_zos.go 830B

12345678910111213141516171819202122232425262728
  1. // Copyright 2020 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. //go:build zos && s390x
  5. // Functions to access/create device major and minor numbers matching the
  6. // encoding used by z/OS.
  7. //
  8. // The information below is extracted and adapted from <sys/stat.h> macros.
  9. package unix
  10. // Major returns the major component of a z/OS device number.
  11. func Major(dev uint64) uint32 {
  12. return uint32((dev >> 16) & 0x0000FFFF)
  13. }
  14. // Minor returns the minor component of a z/OS device number.
  15. func Minor(dev uint64) uint32 {
  16. return uint32(dev & 0x0000FFFF)
  17. }
  18. // Mkdev returns a z/OS device number generated from the given major and minor
  19. // components.
  20. func Mkdev(major, minor uint32) uint64 {
  21. return (uint64(major) << 16) | uint64(minor)
  22. }