summaryrefslogtreecommitdiffstats
path: root/src/dispatch.c
diff options
context:
space:
mode:
authorGravatar Stefan Richter 2012-06-18 00:03:37 +0200
committerGravatar Stefan Richter 2012-06-18 00:19:23 +0200
commit56056a9607b454322759793e260e5d4db9db240e (patch)
treec023dc428c0d3ee9c62a77ce957a4cb4623561cc /src/dispatch.c
parentAdd raw1394_add_config_rom_descriptor() and raw1394_remove_config_rom_descrip... (diff)
Tweak raw1394_add_config_rom_descriptor() API, add documentation and test case
To conform with 'size' arguments of other libraw1394 calls, change the one in raw1394_add_config_rom_descriptor() from quadlets to bytes. This breaks runtime compatibility with potential clients that were written against B.J.'s original patch, hence reorder arguments just to break compatibility also at compile time. Change errno to ENOSYS (function not implemented) when called while running on top of raw1394. Allow &token to be NULL for convenience of clients which don't require raw1394_remove_config_rom_descriptor(). Add exhaustive documentation. Much of it is copied from the documentation of the underlying ioctl. Add example code which doubles as unit test in testlibraw. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'src/dispatch.c')
-rw-r--r--src/dispatch.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/dispatch.c b/src/dispatch.c
index 1cc8e6a..601ee78 100644
--- a/src/dispatch.c
+++ b/src/dispatch.c
@@ -519,27 +519,24 @@ int raw1394_update_config_rom(raw1394handle_t handle, const quadlet_t
new_rom, size, rom_version);
}
-int raw1394_add_config_rom_descriptor(raw1394handle_t handle,
- const quadlet_t immediate_key,
- const quadlet_t key,
- const quadlet_t *new_rom_directory,
- size_t size,
- __u32 *out_token)
+int raw1394_add_config_rom_descriptor(raw1394handle_t handle, u_int32_t *token,
+ quadlet_t immediate_key, quadlet_t key,
+ const quadlet_t *data, size_t size)
{
if (!handle) {
errno = EINVAL;
return -1;
}
if (handle->is_fw)
- return fw_add_config_rom_descriptor(handle->mode.fw,
- immediate_key, key, new_rom_directory, size, out_token);
+ return fw_add_config_rom_descriptor(handle->mode.fw, token,
+ immediate_key, key, data, size);
else {
- errno = EINVAL;
+ errno = ENOSYS;
return -1;
}
}
-int raw1394_remove_config_rom_descriptor(raw1394handle_t handle, __u32 token)
+int raw1394_remove_config_rom_descriptor(raw1394handle_t handle, u_int32_t token)
{
if (!handle) {
errno = EINVAL;
@@ -548,7 +545,7 @@ int raw1394_remove_config_rom_descriptor(raw1394handle_t handle, __u32 token)
if (handle->is_fw)
return fw_remove_config_rom_descriptor(handle->mode.fw, token);
else {
- errno = EINVAL;
+ errno = ENOSYS;
return -1;
}
}