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

Some value is missing in transforming such as '((__u64)0xAA)' #1697

Closed
Unlimited-Witchcraft opened this issue Dec 17, 2019 · 2 comments
Closed

Comments

@Unlimited-Witchcraft
Copy link

When I transfrom some C linux system file.

#define UFFD_API ((__u64)0xAA)
#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK |        \
               UFFD_FEATURE_EVENT_REMAP |       \
               UFFD_FEATURE_EVENT_REMOVE |  \
               UFFD_FEATURE_EVENT_UNMAP |       \
               UFFD_FEATURE_MISSING_HUGETLBFS | \
               UFFD_FEATURE_MISSING_SHMEM |     \
               UFFD_FEATURE_SIGBUS |        \
               UFFD_FEATURE_THREAD_ID)
#define UFFD_API_IOCTLS             \
    ((__u64)1 << _UFFDIO_REGISTER |     \
     (__u64)1 << _UFFDIO_UNREGISTER |   \
     (__u64)1 << _UFFDIO_API)
#define UFFD_API_RANGE_IOCTLS           \
    ((__u64)1 << _UFFDIO_WAKE |     \
     (__u64)1 << _UFFDIO_COPY |     \
     (__u64)1 << _UFFDIO_ZEROPAGE)
#define UFFD_API_RANGE_IOCTLS_BASIC     \
    ((__u64)1 << _UFFDIO_WAKE |     \
     (__u64)1 << _UFFDIO_COPY)

Those values above are all missing.

@Unlimited-Witchcraft Unlimited-Witchcraft changed the title Somet value is missing in transforming such as '((__u64)0xAA)' Some value is missing in transforming such as '((__u64)0xAA)' Dec 17, 2019
@emilio
Copy link
Contributor

emilio commented Dec 17, 2019

Dupe of #316. This is hard because how C macros work... You really don't know the value until the macro is evaluated in a context.

But this has a very easy workaround which is using it in a constant somewhere, which bindgen would understand, so:

static const uint64_t kUffdApiRangeIoctls = UFFD_API_RANGE_IOCTLS; // Or whatever name you want

Then it'd work.

@emilio emilio closed this as completed Dec 17, 2019
@Unlimited-Witchcraft
Copy link
Author

Dupe of #316. This is hard because how C macros work... You really don't know the value until the macro is evaluated in a context.

But this has a very easy workaround which is using it in a constant somewhere, which bindgen would understand, so:

static const uint64_t kUffdApiRangeIoctls = UFFD_API_RANGE_IOCTLS; // Or whatever name you want

Then it'd work.

Thank you for reply.

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

No branches or pull requests

2 participants