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

Refactor use of size_t #602

Closed
wants to merge 1 commit into from

Conversation

javacruft
Copy link

Use uint64_t in preference to size_t to avoid size mismatches
on architectures that are not 64bit. This generates compilation
errors on most modern gcc compiler version.

Signed-off-by: James Page james.page@ubuntu.com

Use uint64_t in preference to size_t to avoid size mismatches
on architectures that are not 64bit.  This generates compilation
errors on most modern gcc compiler version.

Signed-off-by: James Page <james.page@ubuntu.com>
@@ -86,7 +86,7 @@ void tcmur_cmd_complete(struct tcmu_device *dev, void *data, int rc)
}

static void tcmur_cmd_iovec_reset(struct tcmur_cmd *tcmur_cmd,
size_t data_length)
uint64_t data_length)
Copy link
Collaborator

Choose a reason for hiding this comment

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

size_t is 32 bits on 32bit archs, right? If so, above we will use a uint64_t, but the iov_len field on a struct iovec is size_t, so will that cause a compilation error?

Copy link
Author

Choose a reason for hiding this comment

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

Hmm - it does not create a compile error but I think that the code needs alignment around this fact - i.e size_t should be the basic assumption rather than uint64_t

@mikechristie
Copy link
Collaborator

Hey, thanks for the patch. One other question I had is are using tcmu-runner on a 32bit arch or just handling build issues?

We had another 32 bit issue here:

#360

so I am just wondering if you also hit that.

@javacruft
Copy link
Author

I'm mainly just dealing with build issues in Ubuntu; the packaging had disabled errors relating to type mismatches due to size_t != uint64_t on 32 bit architectures.

I had not hit the issue in #360.

@javacruft javacruft closed this Dec 9, 2019
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.

2 participants