383 Fixed masks for major and minor in fuse-lite for OpenIndiana

On Solaris/OpenIndiana, the major and minor fields in st_rdev have to
be represented on 14 bits and 18 bits respectively. They must have
the same representation on 32-bit and 64-bit builds as the kernel
and the library do not know the word size of each other.
This commit is contained in:
Jean-Pierre André 2016-05-04 10:08:06 +02:00
parent 34f7bd7ff0
commit a7ce195489

View File

@ -22,6 +22,12 @@
#include <limits.h>
#include <errno.h>
#if defined(__sun) && defined (__SVR4)
#ifdef HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
#endif /* defined(__sun) && defined (__SVR4) */
#define PARAM(inarg) (((const char *)(inarg)) + sizeof(*(inarg)))
#define OFFSET_MAX 0x7fffffffffffffffLL
@ -561,10 +567,13 @@ static void do_mknod(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
if (req->f->op.mknod) {
#if defined(__SOLARIS__) && defined(_LP64)
/* Must unpack the device, as arg->rdev is limited to 32 bits */
/*
* Must unpack the device, as arg->rdev is limited to 32 bits,
* and must have the same format in 32-bit and 64-bit builds.
*/
req->f->op.mknod(req, nodeid, name, arg->mode,
makedev((arg->rdev >> 18) & 0x3ffff,
arg->rdev & 0x3fff));
makedev((arg->rdev >> 18) & 0x3fff,
arg->rdev & 0x3ffff));
#else
req->f->op.mknod(req, nodeid, name, arg->mode, arg->rdev);
#endif