diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-06-20 18:03:33 +0200 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2010-09-07 11:26:56 +0200 |
commit | a29d69af5d8fa981722a92a058c24f4af4059702 (patch) | |
tree | 4a111bae6fbb5f9f900c333d3a6106166978a904 | |
parent | 8af54fd97d43de388b687115f4ca5e6645c3777e (diff) | |
download | libraw1394-a29d69af5d8fa981722a92a058c24f4af4059702.tar.gz |
Do not use a random FW_CDEV_VERSION as our implemented ABI version
Since linux/firewire-cdev.h header file and libraw1394 sources are
distributed separately, it is wrong to fill in a constant from that
header into the FW_CDEV_IOC_GET_INFO ioctl as the ABI version which
libraw1394 supports. This may not be forward compatible if an old
libraw1394 is compiled with a new kernel header and ran on top of a
kernel that implements new features that require a compatible
userland.
OK, the damage is already done in released versions of libraw1394.
Hence the FW_CDEV_VERSION of the kernel header file is not going to
be updated anymore in future kernel versions. (Only the version
internally to firewire-core will be incremented further.)
But let's remove the buggy usage of FW_CDEV_VERSION nevertheless.
Developers of other firewire-cdev client programs might look at
libraw1394 sources. The libraw1394 sources should not teach them
how to do it wrong.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r-- | src/fw.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -25,6 +25,11 @@ #include "fw.h" #include "raw1394_private.h" +/* + * ABI version history is documented in linux/firewire-cdev.h. + */ +#define IMPLEMENTED_CDEV_ABI_VERSION 2 + int fw_errcode_to_errno(raw1394_errcode_t errcode) { @@ -150,7 +155,7 @@ scan_devices(fw_handle_t handle) continue; memset(&get_info, 0, sizeof(get_info)); memset(&reset, 0, sizeof(reset)); - get_info.version = FW_CDEV_VERSION; + get_info.version = IMPLEMENTED_CDEV_ABI_VERSION; get_info.rom = 0; get_info.rom_length = 0; get_info.bus_reset = ptr_to_u64(&reset); @@ -355,7 +360,7 @@ handle_inotify(raw1394handle_t handle, struct epoll_closure *ec, } } - info.version = FW_CDEV_VERSION; + info.version = IMPLEMENTED_CDEV_ABI_VERSION; info.rom = 0; info.rom_length = 0; info.bus_reset = ptr_to_u64(&reset); @@ -607,7 +612,7 @@ int fw_set_port(fw_handle_t handle, int port) memset(&get_info, 0, sizeof(get_info)); memset(&reset, 0, sizeof(reset)); - get_info.version = FW_CDEV_VERSION; + get_info.version = IMPLEMENTED_CDEV_ABI_VERSION; get_info.rom = 0; get_info.rom_length = 0; get_info.bus_reset = ptr_to_u64(&reset); @@ -1378,7 +1383,7 @@ fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer, } memset(&get_info, 0, sizeof(get_info)); - get_info.version = FW_CDEV_VERSION; + get_info.version = IMPLEMENTED_CDEV_ABI_VERSION; get_info.rom = ptr_to_u64(buffer); get_info.rom_length = buffersize; get_info.bus_reset = 0; |