Skip to content

Enhance SCST user space device handler interface for better compatibility older release #187

@ssmuch

Description

@ssmuch

Hi Team,

When upgrading the SCST version(to 3.7), we discover that the device handler(which compiled with scst 3.6 user space) is not compatible.

In the scst_user spect file and source file, the current logic, before dev_user_register_dev registering a device, it will check the protocol version: DEV_USER_VERSION,
https://scst.sourceforge.net/scst_user_spec.pdf
https://github.com/SCST-project/scst/blob/master/scst/src/dev_handlers/scst_user.c#L3265

And the DEV_USER_VERSION is defined by retrieving sha1sum value of $(SCST_INC_DIR)/scst_user.h, this hash value is different, even the changes of scst_user.h is very limited.
https://github.com/SCST-project/scst/blob/master/scst/src/Makefile#L79

Could we enhance the DEV_USER_VERSION check logic for supporting older release device handler?

Here's the diff of scst_user.h/c file:
bash-3.2$ diff scst-3.6/scst/include/scst_user.h scst-3.7/scst/include/scst_user.h
357c357
< struct scst_user_get_cmd cmds[0]; /* out */

struct scst_user_get_cmd cmds[]; /* out */
bash-3.2$ diff scst-3.6/scst/src/dev_handlers/scst_user.c scst-3.7/scst/src/dev_handlers/scst_user.c
4123,4125d4122
< #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
< struct class_device *class_member;
< #else
4127d4123
< #endif
4177,4184d4172
< #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
< class_member = class_device_create(dev_user_sysfs_class, NULL,
< MKDEV(dev_user_major, 0), NULL, DEV_USER_NAME);
< if (IS_ERR(class_member)) {
< res = PTR_ERR(class_member);
< goto out_chrdev;
< }
< #else
4187d4174
< #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
4189d4175
< #endif
4195d4180
< #endif
4210,4212d4194
< #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
< class_device_destroy(dev_user_sysfs_class, MKDEV(dev_user_major, 0));
< #else
4214d4195
< #endif
4245,4247d4225
< #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
< class_device_destroy(dev_user_sysfs_class, MKDEV(dev_user_major, 0));
< #else
4249d4226
< #endif
bash-3.2$
Thanks
Kyle

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions