-
Notifications
You must be signed in to change notification settings - Fork 2
Generate accessor functions (setter/getter) #106
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
Generate accessor functions (setter/getter) #106
Conversation
Just added only functions frequently used in nvme-cli. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com> [wagi: - addded documentation] Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace the struct args approach by providing init function for initializing the passthru commands. This reduces the dependency between callside and library. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Refactore so we maintain nvme_get_log_partial easier. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Since the following warnings output. $ ./scripts/kernel-doc-check test/zns.c test/zns.c:3: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst test/zns.c:10: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
examples/mi-mctp.c:3: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Since checked by kernel-doc-check then the warning message output. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
To fix the warning message below. test/mi.c:3: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
The api-types.h include file provided struct args definition. These are all gone. But some basic types have been added in the meantime, which need to be present when using the types.h header. Signed-off-by: Daniel Wagner <wagi@kernel.org>
As we have renamed nvme_root to nvme_global_ctx, the Python bindings example needs to be adjusted to reflect the refactoring. Signed-off-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
The error handling has changed from returning -1 and errno set to just returing the error code. Negative values are internal errors, e.g. -ENOMEM. Positive values are status code from the transport. Signed-off-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
This is to resolve the build warnings below.
In function ‘nvme_init_app_tag’,
inlined from ‘test_verify’ at ../test/ioctl/misc.c:961:2:
../src/nvme/ioctl.h:4514:20: warning: array subscript ‘struct nvme_passthru_cmd64[0]’ is partly outside array bounds of ‘struct nvme_passthru_cmd[1]’ [-Warray-bounds=]
4514 | cmd->cdw15 = NVME_FIELD_ENCODE(lbat,
| ^
../test/ioctl/misc.c: In function ‘test_verify’:
../test/ioctl/misc.c:955:34: note: object ‘cmd’ of size 72
955 | struct nvme_passthru_cmd cmd;
| ^~~
In function ‘nvme_init_app_tag’,
inlined from ‘test_compare’ at ../test/ioctl/misc.c:865:2:
../src/nvme/ioctl.h:4514:20: warning: array subscript ‘struct nvme_passthru_cmd64[0]’ is partly outside array bounds of ‘struct nvme_passthru_cmd[1]’ [-Warray-bounds=]
4514 | cmd->cdw15 = NVME_FIELD_ENCODE(lbat,
| ^
../test/ioctl/misc.c: In function ‘test_compare’:
../test/ioctl/misc.c:857:34: note: object ‘cmd’ of size 72
857 | struct nvme_passthru_cmd cmd;
| ^~~
In function ‘nvme_init_app_tag’,
inlined from ‘test_write’ at ../test/ioctl/misc.c:830:2:
../src/nvme/ioctl.h:4514:20: warning: array subscript ‘struct nvme_passthru_cmd64[0]’ is partly outside array bounds of ‘struct nvme_passthru_cmd[1]’ [-Warray-bounds=]
4514 | cmd->cdw15 = NVME_FIELD_ENCODE(lbat,
| ^
../test/ioctl/misc.c: In function ‘test_write’:
../test/ioctl/misc.c:823:34: note: object ‘cmd’ of size 72
823 | struct nvme_passthru_cmd cmd;
| ^~~
In function ‘nvme_init_app_tag’,
inlined from ‘test_read’ at ../test/ioctl/misc.c:794:2:
../src/nvme/ioctl.h:4514:20: warning: array subscript ‘struct nvme_passthru_cmd64[0]’ is partly outside array bounds of ‘struct nvme_passthru_cmd[1]’ [-Warray-bounds=]
4514 | cmd->cdw15 = NVME_FIELD_ENCODE(lbat,
| ^
../test/ioctl/misc.c: In function ‘test_read’:
../test/ioctl/misc.c:787:34: note: object ‘cmd’ of size 72
787 | struct nvme_passthru_cmd cmd;
| ^~~
In function ‘nvme_init_app_tag’,
inlined from ‘test_write_zeros’ at ../test/ioctl/misc.c:898:2:
../src/nvme/ioctl.h:4514:20: warning: array subscript ‘struct nvme_passthru_cmd64[0]’ is partly outside array bounds of ‘struct nvme_passthru_cmd[1]’ [-Warray-bounds=]
4514 | cmd->cdw15 = NVME_FIELD_ENCODE(lbat,
| ^
../test/ioctl/misc.c: In function ‘test_write_zeros’:
../test/ioctl/misc.c:892:34: note: object ‘cmd’ of size 72
892 | struct nvme_passthru_cmd cmd;
| ^~~
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Since the almost nvme-cli caller functions expected the base name. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
bd3ef32 to
30936bd
Compare
|
@igaw - Note: The remaining checkpatch errors cannot be fixed easily (or at all). I do not plan to fix them. |
|
I run into a build issue. I'm trying to figure out what's going on: # ./scripts/build.sh
[...]
[18/116] Compiling C object src/libnvme.so.1.15.0.p/meson-generated_.._generated_accessors.c.o
FAILED: src/libnvme.so.1.15.0.p/meson-generated_.._generated_accessors.c.o
gcc -Isrc/libnvme.so.1.15.0.p -Isrc -I../src -I. -I.. -Iccan -I../ccan -I../src/nvme -Iinternal -I../internal -Isrc/generated -I/usr/include/json-c -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -std=gnu99 -O3 -fomit-frame-pointer -D_GNU_SOURCE -fPIC -include /home/wagi/work/libnvme/.build-ci/internal/config.h -include /home/wagi/work/libnvme/.build-ci/src/generated/accessor.h -MD -MQ src/libnvme.so.1.15.0.p/meson-generated_.._generated_accessors.c.o -MF src/libnvme.so.1.15.0.p/meson-generated_.._generated_accessors.c.o.d -o src/libnvme.so.1.15.0.p/meson-generated_.._generated_accessors.c.o -c src/generated/accessors.c
<command-line>: fatal error: /home/wagi/work/libnvme/.build-ci/src/generated/accessor.h: No such file or directory
compilation terminated.I see your comments in the |
Weird. This is working fine on my computer. Let me see if I can figure it out. I suspect it's the #include in the generated code that has the wrong path. |
|
Maybe it's a meson version thing? $ meson --version
1.7.2 |
|
Good point. Let me try with the same version as you. |
|
@igaw - I just want to confirm that the setter/getter code gets generated. Do you see any files in: You should see this: |
|
The $ ls -go .build-ci/src/generated/
total 40
-rw-r--r--. 1 21193 Oct 29 15:49 accessors.c
-rw-r--r--. 1 13713 Oct 29 15:49 _accessors.h |
|
Ah! That points to the "special" This gives me something to investigate further. |
30936bd to
1d856e4
Compare
This adds the ability to automatically generate accessor functions (setter/getter functions) by parsing structs definitions in header files. Two files are generated: [accessors.c, accessors.h]. Signed-off-by: Martin Belanger <martin.belanger@dell.com>
1d856e4 to
eed2a80
Compare
|
Applied the patch. Thanks! |
This adds the ability to automatically generate accessor functions (setter/getter functions) by parsing structs definitions in header files. Two files are generated: [accessors.c, accessors.h].
Fixes: #54