Follow CL 63090 and change the Makedev function on Darwin and *BSD to
convert to uint64 before shifting/masking. This avoids a potential
overflow.
Change-Id: I5b566329695cc5edcf82f0ff2366033011b0625b
Reviewed-on: https://go-review.googlesource.com/63112
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Add Major, Minor and Mkdev functions for converting devices numbers to
their major/minor components and vice versa.
The functions follow the behavior of the macros defined in FreeBSD's
sys/types.h header. However, the parameter and return types are changed
to match the existing implementations of these functions.
Because FreeBSD dynamically allocates major/minor device numbers through
devfs at runtime, testing the conversion macros against well-known
device numbers is not possible.
Updates golang/go#8106
Change-Id: I9874e63f388cfc5c0d5cc47d4d0f6ccc489b28f2
Reviewed-on: https://go-review.googlesource.com/61631
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>