Refactors aciodrv and related systems to support multiple active ports.
Tested with a SDVX BIO2 and ICCA in aciotest.
This sets the groundwork for aciomgr, which will allow multiple clients to share the same active port.
In GitLab by @xyen on Jan 14, 2021, 08:23
_Merges aciodrv_refactor -> master_
Refactors aciodrv and related systems to support multiple active ports.
Tested with a SDVX BIO2 and ICCA in aciotest.
This sets the groundwork for aciomgr, which will allow multiple clients to share the same active port.
In GitLab by @xyen on Jan 14, 2021, 19:57
added 29 commits
<ul><li>a29ee3c0...f945a2d3 - 27 commits from branch <code>master</code></li><li>241f0f65 - aciodrv: refactor to support multiple active drivers (with specified ports)</li><li>4cba227d - aciodrv: support multi-sized response packets by divining the packet size</li></ul>
[Compare with previous version](/djhackers/bemanitools/-/merge_requests/77/diffs?diff_id=1447&start_sha=a29ee3c0358810c2bf5e7d0e9d02e2a4dc9d97e9)
In GitLab by @xyen on Jan 14, 2021, 20:06
added 1 commit
<ul><li>841d3406 - aciodrv: fix pointer format, and missing close context</li></ul>
[Compare with previous version](/djhackers/bemanitools/-/merge_requests/77/diffs?diff_id=1448&start_sha=4cba227d1cd8c666c7a1de374ebe68ca42029194)
Suggestion for "magic numbers": Move them to defines to make them more self explanatory, e.g. #define ACIO_MAX_NODES 16. I would also suggest move the 4 to a #define ACIO_NODE_PRODUCT_CODE_LEN 4
Suggestion for "magic numbers": Move them to defines to make them more self explanatory, e.g. `#define ACIO_MAX_NODES 16`. I would also suggest move the `4` to a `#define ACIO_NODE_PRODUCT_CODE_LEN 4`
Can you adapt the various log parts guarded by AC_IO_MSG_LOG to include printing the fd? e.g. log_info("[%X] Beginning recv: (%d b)", device->fd, resp_size);
Can you adapt the various log parts guarded by `AC_IO_MSG_LOG` to include printing the fd? e.g. `log_info("[%X] Beginning recv: (%d b)", device->fd, resp_size);`
To improve tracability, add a log_debug("[%X] Closing acio device", device->fd);.
Also, please guard against NULLs on function entry with log_assert(device); -> Apply to other functions as well.
To improve tracability, add a `log_debug("[%X] Closing acio device", device->fd);`.
Also, please guard against NULLs on function entry with `log_assert(device);` -> Apply to other functions as well.
Before this line, I suggest initializing the struct by zero'ing it, e.g. memset(device, 0, sizeof(struct aciodrv_device_ctx));
I think you forgot to initialize the msg_counter which was set to 1 on the old implementation. I can't remember why it was initialized with 1 but I would stick to the old implementation: device->msg_counter = 1.
Before this line, I suggest initializing the struct by zero'ing it, e.g. `memset(device, 0, sizeof(struct aciodrv_device_ctx));`
I think you forgot to initialize the `msg_counter` which was set to `1` on the old implementation. I can't remember why it was initialized with `1` but I would stick to the old implementation:
`device->msg_counter = 1`.
Just an observation/thought: I was wondering what's the best way of treating "invalid" values of HANDLE since windows is also not consistent about it, e.g. using NULL or INVALID_HANDLE_VALUE. At least for our APIs/modules I think we should try our best to stick to one option. Good thing here, the return value on failure is explicitly documented.
Just an observation/thought: I was wondering what's the best way of treating "invalid" values of `HANDLE` since windows is also not consistent about it, e.g. using `NULL` or `INVALID_HANDLE_VALUE`. At least for our APIs/modules I think we should try our best to stick to one option. Good thing here, the return value on failure is explicitly documented.
HANDLE is a void*, I'd rather keep to NULL in this case.
In GitLab by @xyen on Jan 16, 2021, 22:12
Commented on [src/main/aciodrv/port.h line 17](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..6f490d440c420ca66596e995b502f535d8371ac9#diff-3ceaad487c3d210c60e1790417548daeR17)
`HANDLE` is a void*, I'd rather keep to NULL in this case.
I've added it to the section that say beginning send/recv, I don't think it makes sense to add it to the other ones (as they'd be wrapped / preceded by these 2 messages).
In GitLab by @xyen on Jan 20, 2021, 05:45
Commented on [src/main/aciodrv/device.c line 338](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..241f0f65ec109317ee987a7461b8c4c55fb6545f#diff-1c1a2ad8deb60fa4bb473a3e4f9e4732L338)
I've added it to the section that say beginning send/recv, I don't think it makes sense to add it to the other ones (as they'd be wrapped / preceded by these 2 messages).
Sure for the logging in close. The other functions didn't have asserts to begin though, and I'm wary of adding them to code in the critical IO path.
In GitLab by @xyen on Jan 20, 2021, 05:47
Commented on [src/main/aciodrv/device.c line 357](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..6f490d440c420ca66596e995b502f535d8371ac9#diff-1c1a2ad8deb60fa4bb473a3e4f9e4732L357)
Sure for the logging in close. The other functions didn't have asserts to begin though, and I'm wary of adding them to code in the critical IO path.
In GitLab by @xyen on Jan 20, 2021, 05:50
Commented on [src/main/aciodrv/device.c line 334](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..6f490d440c420ca66596e995b502f535d8371ac9#diff-1c1a2ad8deb60fa4bb473a3e4f9e4732R334)
this is already done in port.c
device is forward declared, no namespace outside of device.c have access to it.
In GitLab by @xyen on Jan 20, 2021, 05:56
Commented on [src/main/aciodrv/icca.c line 20](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..6f490d440c420ca66596e995b502f535d8371ac9#diff-771622e1b109b2c63ad64a64f7f8034cL20)
device is forward declared, no namespace outside of `device.c` have access to it.
In GitLab by @xyen on Jan 20, 2021, 05:57
Commented on [src/main/aciodrv/kfca.c line 60](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..6f490d440c420ca66596e995b502f535d8371ac9#diff-8d31ee7b610b97d9222b2c92c080750cL60)
see before
Because it's impossible to extend the fd log messages outside of port/device, I've elected instead to make sure that every possible aciodrv_send_and_recv failure path will make sure to log the fd there instead.
In GitLab by @xyen on Jan 20, 2021, 06:08
Because it's impossible to extend the fd log messages outside of port/device, I've elected instead to make sure that every possible `aciodrv_send_and_recv` failure path will make sure to log the fd there instead.
In GitLab by @xyen on Jan 20, 2021, 06:08
Commented on [src/main/bio2drv/bi2a-iidx.c line 28](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..6f490d440c420ca66596e995b502f535d8371ac9#diff-84c63f8bc3347c0c5d39083f095891a9L28)
cannot
In GitLab by @xyen on Jan 20, 2021, 06:08
Commented on [src/main/bio2drv/bi2a-sdvx.c line 30](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..6f490d440c420ca66596e995b502f535d8371ac9#diff-fe2774e5ce16699a9545ddd85021f03fL30)
cannot
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on [src/main/aciodrv/device.c line 17](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..841d34065da42cd32173274ae9e1f3a3c620587a#diff-1c1a2ad8deb60fa4bb473a3e4f9e4732R17)
changed this line in [version 4 of the diff](/djhackers/bemanitools/-/merge_requests/77/diffs?diff_id=1450&start_sha=841d34065da42cd32173274ae9e1f3a3c620587a#c04cec926c4bc2a62496efc8522ee127583ae23a_17_19)
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on [src/main/aciodrv/device.c line 346](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..841d34065da42cd32173274ae9e1f3a3c620587a#diff-1c1a2ad8deb60fa4bb473a3e4f9e4732L346)
changed this line in [version 4 of the diff](/djhackers/bemanitools/-/merge_requests/77/diffs?diff_id=1450&start_sha=841d34065da42cd32173274ae9e1f3a3c620587a#c04cec926c4bc2a62496efc8522ee127583ae23a_371_380)
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on [src/main/aciodrv/device.c line 340](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..841d34065da42cd32173274ae9e1f3a3c620587a#diff-1c1a2ad8deb60fa4bb473a3e4f9e4732R340)
changed this line in [version 4 of the diff](/djhackers/bemanitools/-/merge_requests/77/diffs?diff_id=1450&start_sha=841d34065da42cd32173274ae9e1f3a3c620587a#c04cec926c4bc2a62496efc8522ee127583ae23a_340_348)
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on [src/main/aciodrv/icca.h line 33](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..841d34065da42cd32173274ae9e1f3a3c620587a#diff-b8e12cf030d961efacf87abea29950a8R33)
changed this line in [version 4 of the diff](/djhackers/bemanitools/-/merge_requests/77/diffs?diff_id=1450&start_sha=841d34065da42cd32173274ae9e1f3a3c620587a#da5d3ceef9e27735b48d6518c7c15a4b7d749b33_33_33)
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on [src/main/aciodrv/port.c line 103](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..841d34065da42cd32173274ae9e1f3a3c620587a#diff-5243a13f56e2aa52ae1f6cead81374f2R103)
changed this line in [version 4 of the diff](/djhackers/bemanitools/-/merge_requests/77/diffs?diff_id=1450&start_sha=841d34065da42cd32173274ae9e1f3a3c620587a#3f8da9d4cc219dcbec88b974ab4b79ef662a320a_103_103)
In GitLab by @xyen on Jan 20, 2021, 06:10
added 1 commit
<ul><li>6f490d44 - aciodrv: address review</li></ul>
[Compare with previous version](/djhackers/bemanitools/-/merge_requests/77/diffs?diff_id=1450&start_sha=841d34065da42cd32173274ae9e1f3a3c620587a)
I would say it does make sense if you have two separate ACIO devices running at the same time and just want to do a grep on the file output for a single device.
I would say it does make sense if you have two separate ACIO devices running at the same time and just want to do a grep on the file output for a single device.
ah, my comment is no longer valid, I ended up adding it to all the log messages in this module.
In GitLab by @xyen on Jan 20, 2021, 21:26
Commented on [src/main/aciodrv/device.c line 338](https://github.com/djhackersdev/bemanitools/compare/f945a2d3e5c64c2950edd91c06b7fa9f425aa8dc..241f0f65ec109317ee987a7461b8c4c55fb6545f#diff-1c1a2ad8deb60fa4bb473a3e4f9e4732L338)
ah, my comment is no longer valid, I ended up adding it to all the log messages in this module.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
In GitLab by @xyen on Jan 14, 2021, 08:23
Merges aciodrv_refactor -> master
Refactors aciodrv and related systems to support multiple active ports.
Tested with a SDVX BIO2 and ICCA in aciotest.
This sets the groundwork for aciomgr, which will allow multiple clients to share the same active port.
In GitLab by @xyen on Jan 14, 2021, 19:57
added 29 commits
master241f0f65- aciodrv: refactor to support multiple active drivers (with specified ports)4cba227d- aciodrv: support multi-sized response packets by divining the packet sizeCompare with previous version
In GitLab by @xyen on Jan 14, 2021, 20:06
added 1 commit
841d3406- aciodrv: fix pointer format, and missing close contextCompare with previous version
Suggestion for "magic numbers": Move them to defines to make them more self explanatory, e.g.
#define ACIO_MAX_NODES 16. I would also suggest move the4to a#define ACIO_NODE_PRODUCT_CODE_LEN 4👍 for not exposing the internal structure.
Nit: Magic number like in the module. The define for the needs to move to the header here.
Can you adapt the various log parts guarded by
AC_IO_MSG_LOGto include printing the fd? e.g.log_info("[%X] Beginning recv: (%d b)", device->fd, resp_size);Here we also need to print the
fdto be able to idenfity multiple devices in the logs.To improve tracability, add a
log_debug("[%X] Closing acio device", device->fd);.Also, please guard against NULLs on function entry with
log_assert(device);-> Apply to other functions as well.Replace magic number
4with define from above.For traceability, add a
log_debug("[%X] acio device opened, path %s, baud %d", device->fd, port_path, baud);.Nit style: Separate control block with if by a new line.
Nit: Instead of
mallocusexmallocfromutil/mem.h. It wraps malloc + null checks.Nit style: Separate control block with new line.
Before this line, I suggest initializing the struct by zero'ing it, e.g.
memset(device, 0, sizeof(struct aciodrv_device_ctx));I think you forgot to initialize the
msg_counterwhich was set to1on the old implementation. I can't remember why it was initialized with1but I would stick to the old implementation:device->msg_counter = 1.Nit style: Separate
node_idandslot_stateby line break.Add the
log_assert(device)guard to all (public) functions in this moduleAgain, for traceability, add the
fdto all log outputs in this module, e.g.log_warning("[%X] ...", device->fd);Like on other modules, add
log_assert(device);guard on all public functionsLogging, add
fd->deviceto outputJust an observation/thought: I was wondering what's the best way of treating "invalid" values of
HANDLEsince windows is also not consistent about it, e.g. usingNULLorINVALID_HANDLE_VALUE. At least for our APIs/modules I think we should try our best to stick to one option. Good thing here, the return value on failure is explicitly documented.For traceability, also log the
fdin the message. See my other comments.Please check other log calls in this module as well.
Nit:
log_assert(bytes);guard.Nit:
log_assert(bytes);guardNit style: Separate control block from other stuff with new line.
Add
log_assert(device);guard to all public functionsExtend log message with device->fd in module.
Extend log messages fd->device in module
Nit: In the other modules, you also adapted the comments.
Add
log_assert(device);guard on all public functions of moduleNit style: Empty line before control block
Nit style: Empty line before control block
Nit style: empty line before control block
Nit style: empty line before control block
In GitLab by @xyen on Jan 16, 2021, 22:12
Commented on src/main/aciodrv/port.h line 17
HANDLEis a void*, I'd rather keep to NULL in this case.In GitLab by @xyen on Jan 20, 2021, 05:45
Commented on src/main/aciodrv/device.c line 338
I've added it to the section that say beginning send/recv, I don't think it makes sense to add it to the other ones (as they'd be wrapped / preceded by these 2 messages).
In GitLab by @xyen on Jan 20, 2021, 05:47
Commented on src/main/aciodrv/device.c line 357
Sure for the logging in close. The other functions didn't have asserts to begin though, and I'm wary of adding them to code in the critical IO path.
In GitLab by @xyen on Jan 20, 2021, 05:50
Commented on src/main/aciodrv/device.c line 334
this is already done in port.c
In GitLab by @xyen on Jan 20, 2021, 05:56
Commented on src/main/aciodrv/icca.c line 20
device is forward declared, no namespace outside of
device.chave access to it.In GitLab by @xyen on Jan 20, 2021, 05:57
Commented on src/main/aciodrv/kfca.c line 60
see before
In GitLab by @xyen on Jan 20, 2021, 06:08
Because it's impossible to extend the fd log messages outside of port/device, I've elected instead to make sure that every possible
aciodrv_send_and_recvfailure path will make sure to log the fd there instead.In GitLab by @xyen on Jan 20, 2021, 06:08
Commented on src/main/bio2drv/bi2a-iidx.c line 28
cannot
In GitLab by @xyen on Jan 20, 2021, 06:08
Commented on src/main/bio2drv/bi2a-sdvx.c line 30
cannot
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on src/main/aciodrv/device.c line 17
changed this line in version 4 of the diff
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on src/main/aciodrv/device.c line 346
changed this line in version 4 of the diff
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on src/main/aciodrv/device.c line 340
changed this line in version 4 of the diff
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on src/main/aciodrv/icca.h line 33
changed this line in version 4 of the diff
In GitLab by @xyen on Jan 20, 2021, 06:10
Commented on src/main/aciodrv/port.c line 103
changed this line in version 4 of the diff
In GitLab by @xyen on Jan 20, 2021, 06:10
added 1 commit
6f490d44- aciodrv: address reviewCompare with previous version
In GitLab by @xyen on Jan 20, 2021, 18:54
resolved all threads
I would say it does make sense if you have two separate ACIO devices running at the same time and just want to do a grep on the file output for a single device.
In GitLab by @xyen on Jan 20, 2021, 21:26
Commented on src/main/aciodrv/device.c line 338
ah, my comment is no longer valid, I ended up adding it to all the log messages in this module.
In GitLab by @xyen on Jan 20, 2021, 21:26
resolved all threads
approved this merge request