NetworkBlockDevice / nbd

Network Block Device
GNU General Public License v2.0
450 stars 116 forks source link

use uint32_t & uint64_t instead of u32 & u64, and fix #includes #164

Open RokerHRO opened 4 months ago

RokerHRO commented 4 months ago

I'd favor to get rid of the non-standard typedefs u32 and u64 and use C99 standard types uint32_t and uint64_t everywhere. These types are already used in the project, but mixed wildly with the old types.

During this I also moved some #include directives so each .h includes only the headers to fulfill its own needs (e.g. to use foreign declarations for its own declarations). Headers that are only needed for the implementation are included only in the .c file.

Redundant or unneeded includes are removed at all.

ebblake commented 4 months ago

I would suggest breaking this into multiple commits (each patch should do one thing well, rather than doing multiple things mashed together); it makes it easier if someone wants to backport one change but not the other. But that's not a hard requirement. In this case, an obvious split would be: patch 1: clean up #include directives patch 2: consistent use of uint32_t/uint64_t

ebblake commented 4 months ago

I'm not sure if Wouter has a Signed-off-by policy for userspace nbd; but given that the Linux kernel has a policy on S-o-b and this interacts closely with the kernel nbd.ko, I personally like using S-o-b on all my commits in this project.

ebblake commented 4 months ago

Overall, the changes look sane to me.

RokerHRO commented 4 months ago

I would suggest breaking this into multiple commits (each patch should do one thing well, rather than doing multiple things mashed together); it makes it easier if someone wants to backport one change but not the other. But that's not a hard requirement. In this case, an obvious split would be: patch 1: clean up #include directives patch 2: consistent use of uint32_t/uint64_t

Good point. I'll try, if the #include dependencies would not change again by the removal of u64 & u32, because the header where they are defined are no longer necessary after the change. I'll see.

Btw, do github's merge requests work well with reset & rebase when I replace the one commit by two different commits?

RokerHRO commented 4 months ago

I'm not sure if Wouter has a Signed-off-by policy for userspace nbd; but given that the Linux kernel has a policy on S-o-b and this interacts closely with the kernel nbd.ko, I personally like using S-o-b on all my commits in this project.

What is that? I don't know either. But of course I can add such a Signed-off-by line in my commit(s) if desired or necessary.