diff --git a/doc/scst_user_spec.txt b/doc/scst_user_spec.txt index 5c67dc0cc..272b88385 100644 --- a/doc/scst_user_spec.txt +++ b/doc/scst_user_spec.txt @@ -60,7 +60,8 @@ argument is: struct scst_user_dev_desc { - uint8_t version; + aligned_u64 version_str; + aligned_u64 license_str; uint8_t type; uint8_t sgv_shared; uint8_t sgv_disable_clustered_pool; @@ -75,9 +76,13 @@ struct scst_user_dev_desc where: - - version - is a protocol version, shall be DEV_USER_VERSION + - version_str - protocol version, shall be DEV_USER_VERSION. - - type - SCSI type of the device + - license_str - license of this module, for instance, "GPL", "GPL v2", or + "Proprietary". This field serves the same purpose as macroses + EXPORT_SYMBOL/EXPORT_SYMBOL_GPL of the Linux kernel. + + - type - SCSI type of the device. - sgv_shared - true, if the SGV cache for this device should be shared with other devices. False, if the SGV cache should be dedicated. diff --git a/scst/include/scst.h b/scst/include/scst.h index 5776e7532..bb1be2c5e 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -2434,6 +2434,21 @@ static inline int scst_register_target_template(struct scst_tgt_template *vtt) return __scst_register_target_template(vtt, SCST_INTERFACE_VERSION); } +/* + * Registers target template, non-GPL version. + * Returns 0 on success or appropriate error code otherwise. + * + * Note: *vtt must be static! + */ +int __scst_register_target_template_non_gpl(struct scst_tgt_template *vtt, + const char *version); +static inline int scst_register_target_template_non_gpl( + struct scst_tgt_template *vtt) +{ + return __scst_register_target_template_non_gpl(vtt, + SCST_INTERFACE_VERSION); +} + void scst_unregister_target_template(struct scst_tgt_template *vtt); struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt, @@ -2443,8 +2458,11 @@ void scst_unregister_target(struct scst_tgt *tgt); struct scst_session *scst_register_session(struct scst_tgt *tgt, int atomic, const char *initiator_name, void *tgt_priv, void *result_fn_data, void (*result_fn) (struct scst_session *sess, void *data, int result)); +struct scst_session *scst_register_session_non_gpl(struct scst_tgt *tgt, + const char *initiator_name, void *tgt_priv); void scst_unregister_session(struct scst_session *sess, int wait, void (*unreg_done_fn) (struct scst_session *sess)); +void scst_unregister_session_non_gpl(struct scst_session *sess); int __scst_register_dev_driver(struct scst_dev_type *dev_type, const char *version); diff --git a/scst/include/scst_user.h b/scst/include/scst_user.h index 11c4edba3..d51853481 100644 --- a/scst/include/scst_user.h +++ b/scst/include/scst_user.h @@ -89,6 +89,7 @@ struct scst_user_opt { struct scst_user_dev_desc { aligned_u64 version_str; + aligned_u64 license_str; uint8_t type; uint8_t sgv_shared; uint8_t sgv_disable_clustered_pool; diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index d7a548f42..5b9b1c2d7 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -2757,23 +2757,46 @@ static void dev_user_setup_functions(struct scst_user_dev *dev) static int dev_user_check_version(const struct scst_user_dev_desc *dev_desc) { - char ver[sizeof(DEV_USER_VERSION)+1]; + char str[max(sizeof(DEV_USER_VERSION)+1, 20U)]; int res = 0, rc; - rc = copy_from_user(ver, + rc = copy_from_user(str, + (void __user *)(unsigned long)dev_desc->license_str, + sizeof(str)); + if (rc != 0) { + PRINT_ERROR("%s", "Unable to get license string"); + res = -EFAULT; + goto out; + } + str[sizeof(str)-1] = '\0'; + + if ((strcmp(str, "GPL") != 0) && + (strcmp(str, "GPL v2") != 0) && + (strcmp(str, "Dual BSD/GPL") != 0) && + (strcmp(str, "Dual MIT/GPL") != 0) && + (strcmp(str, "Dual MPL/GPL") != 0)) { + /* ->name already 0-terminated in dev_user_ioctl() */ + PRINT_ERROR("Unsupported license of user device %s (%s)", + dev_desc->name, str); + res = -EPERM; + goto out; + } + + rc = copy_from_user(str, (void __user *)(unsigned long)dev_desc->version_str, - sizeof(ver)); + sizeof(str)); if (rc != 0) { PRINT_ERROR("%s", "Unable to get version string"); res = -EFAULT; goto out; } - ver[sizeof(ver)-1] = '\0'; + str[sizeof(str)-1] = '\0'; - if (strcmp(ver, DEV_USER_VERSION) != 0) { + if (strcmp(str, DEV_USER_VERSION) != 0) { /* ->name already 0-terminated in dev_user_ioctl() */ - PRINT_ERROR("Incorrect version of user device %s (%s)", - dev_desc->name, ver); + PRINT_ERROR("Incorrect version of user device %s (%s). " + "Expected: %s", dev_desc->name, str, + DEV_USER_VERSION); res = -EINVAL; goto out; } diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 7ff01e68b..156ad68d1 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -1443,7 +1443,7 @@ out: TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_capacity_data_changed); +EXPORT_SYMBOL_GPL(scst_capacity_data_changed); static inline bool scst_is_report_luns_changed_type(int type) { @@ -1988,7 +1988,7 @@ int scst_set_cmd_abnormal_done_state(struct scst_cmd *cmd) TRACE_EXIT_RES(cmd->state); return cmd->state; } -EXPORT_SYMBOL(scst_set_cmd_abnormal_done_state); +EXPORT_SYMBOL_GPL(scst_set_cmd_abnormal_done_state); void scst_zero_write_rest(struct scst_cmd *cmd) { @@ -2101,7 +2101,7 @@ out: TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_set_resp_data_len); +EXPORT_SYMBOL_GPL(scst_set_resp_data_len); void scst_limit_sg_write_len(struct scst_cmd *cmd) { @@ -2293,7 +2293,7 @@ void scst_update_hw_pending_start(struct scst_cmd *cmd) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_update_hw_pending_start); +EXPORT_SYMBOL_GPL(scst_update_hw_pending_start); /* * Supposed to be called under sess_list_lock, but can release/reaquire it. @@ -2620,7 +2620,7 @@ void scst_init_mem_lim(struct scst_mem_lim *mem_lim) mem_lim->max_allowed_pages = ((uint64_t)scst_max_dev_cmd_mem << 10) >> (PAGE_SHIFT - 10); } -EXPORT_SYMBOL(scst_init_mem_lim); +EXPORT_SYMBOL_GPL(scst_init_mem_lim); static struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg, struct scst_device *dev, uint64_t lun) @@ -4873,7 +4873,7 @@ out: TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_copy_sg); +EXPORT_SYMBOL_GPL(scst_copy_sg); int scst_get_full_buf(struct scst_cmd *cmd, uint8_t **buf) { @@ -5231,7 +5231,7 @@ out: TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_get_cdb_info); +EXPORT_SYMBOL_GPL(scst_get_cdb_info); /* Packs SCST LUN back to SCSI form */ __be64 scst_pack_lun(const uint64_t lun, unsigned int addr_method) @@ -5389,7 +5389,7 @@ int scst_calc_block_shift(int sector_size) TRACE_EXIT_RES(block_shift); return block_shift; } -EXPORT_SYMBOL(scst_calc_block_shift); +EXPORT_SYMBOL_GPL(scst_calc_block_shift); /** * scst_sbc_generic_parse() - generic SBC parsing @@ -5452,7 +5452,7 @@ set_timeout: TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_sbc_generic_parse); +EXPORT_SYMBOL_GPL(scst_sbc_generic_parse); /** * scst_cdrom_generic_parse() - generic MMC parse @@ -5512,7 +5512,7 @@ set_timeout: TRACE_EXIT(); return res; } -EXPORT_SYMBOL(scst_cdrom_generic_parse); +EXPORT_SYMBOL_GPL(scst_cdrom_generic_parse); /** * scst_modisk_generic_parse() - generic MO parse @@ -5572,7 +5572,7 @@ set_timeout: TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_modisk_generic_parse); +EXPORT_SYMBOL_GPL(scst_modisk_generic_parse); /** * scst_tape_generic_parse() - generic tape parse @@ -5625,7 +5625,7 @@ int scst_tape_generic_parse(struct scst_cmd *cmd, TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_tape_generic_parse); +EXPORT_SYMBOL_GPL(scst_tape_generic_parse); static int scst_null_parse(struct scst_cmd *cmd) { @@ -5671,7 +5671,7 @@ int scst_changer_generic_parse(struct scst_cmd *cmd, return res; } -EXPORT_SYMBOL(scst_changer_generic_parse); +EXPORT_SYMBOL_GPL(scst_changer_generic_parse); /** * scst_processor_generic_parse - generic SCSI processor parse @@ -5690,7 +5690,7 @@ int scst_processor_generic_parse(struct scst_cmd *cmd, return res; } -EXPORT_SYMBOL(scst_processor_generic_parse); +EXPORT_SYMBOL_GPL(scst_processor_generic_parse); /** * scst_raid_generic_parse() - generic RAID parse @@ -5709,7 +5709,7 @@ int scst_raid_generic_parse(struct scst_cmd *cmd, return res; } -EXPORT_SYMBOL(scst_raid_generic_parse); +EXPORT_SYMBOL_GPL(scst_raid_generic_parse); /** ** Generic dev_done() support routines. @@ -5779,7 +5779,7 @@ out: TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_block_generic_dev_done); +EXPORT_SYMBOL_GPL(scst_block_generic_dev_done); /** * scst_tape_generic_dev_done() - generic tape dev done @@ -5854,7 +5854,7 @@ out: TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_tape_generic_dev_done); +EXPORT_SYMBOL_GPL(scst_tape_generic_dev_done); static void scst_check_internal_sense(struct scst_device *dev, int result, uint8_t *sense, int sense_len) @@ -6049,7 +6049,7 @@ out: TRACE_EXIT(); return 0; } -EXPORT_SYMBOL(scst_obtain_device_parameters); +EXPORT_SYMBOL_GPL(scst_obtain_device_parameters); /* Called under dev_lock and BH off */ void scst_process_reset(struct scst_device *dev, @@ -6498,7 +6498,7 @@ void scst_add_thr_data(struct scst_tgt_dev *tgt_dev, list_add_tail(&data->thr_data_list_entry, &tgt_dev->thr_data_list); spin_unlock(&tgt_dev->thr_data_lock); } -EXPORT_SYMBOL(scst_add_thr_data); +EXPORT_SYMBOL_GPL(scst_add_thr_data); /** * scst_del_all_thr_data() - delete all thread's local data @@ -6520,7 +6520,7 @@ void scst_del_all_thr_data(struct scst_tgt_dev *tgt_dev) spin_unlock(&tgt_dev->thr_data_lock); return; } -EXPORT_SYMBOL(scst_del_all_thr_data); +EXPORT_SYMBOL_GPL(scst_del_all_thr_data); /** * scst_dev_del_all_thr_data() - delete all thread's local data from device @@ -6545,7 +6545,7 @@ void scst_dev_del_all_thr_data(struct scst_device *dev) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_dev_del_all_thr_data); +EXPORT_SYMBOL_GPL(scst_dev_del_all_thr_data); /* thr_data_lock supposed to be held */ static struct scst_thr_data_hdr *__scst_find_thr_data_locked( @@ -6579,7 +6579,7 @@ struct scst_thr_data_hdr *__scst_find_thr_data(struct scst_tgt_dev *tgt_dev, return res; } -EXPORT_SYMBOL(__scst_find_thr_data); +EXPORT_SYMBOL_GPL(__scst_find_thr_data); bool scst_del_thr_data(struct scst_tgt_dev *tgt_dev, struct task_struct *tsk) { @@ -7038,7 +7038,7 @@ char *scst_get_next_lexem(char **token_str) *token_str = q; return p; } -EXPORT_SYMBOL(scst_get_next_lexem); +EXPORT_SYMBOL_GPL(scst_get_next_lexem); /** * scst_restore_token_str() - restore string modified by scst_get_next_lexem() @@ -7053,7 +7053,7 @@ void scst_restore_token_str(char *prev_lexem, char *token_str) prev_lexem[strlen(prev_lexem)] = ' '; return; } -EXPORT_SYMBOL(scst_restore_token_str); +EXPORT_SYMBOL_GPL(scst_restore_token_str); /** * scst_get_next_token_str() - parse and return next token @@ -7082,7 +7082,7 @@ char *scst_get_next_token_str(char **input_str) return p; } -EXPORT_SYMBOL(scst_get_next_token_str); +EXPORT_SYMBOL_GPL(scst_get_next_token_str); static void __init scst_scsi_op_list_init(void) { @@ -7173,7 +7173,7 @@ unsigned long scst_random(void) spin_unlock_irqrestore(&lock, flags); return rv; } -EXPORT_SYMBOL(scst_random); +EXPORT_SYMBOL_GPL(scst_random); #endif /* CONFIG_SCST_DEBUG */ #ifdef CONFIG_SCST_DEBUG_TM diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 298b7d902..cf504a244 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -71,7 +71,7 @@ * flush_scheduled_work(). */ struct mutex scst_mutex; -EXPORT_SYMBOL(scst_mutex); +EXPORT_SYMBOL_GPL(scst_mutex); /* * Secondary level main mutex, inner for scst_mutex. Needed for @@ -321,7 +321,61 @@ out_unlock: mutex_unlock(&scst_mutex); goto out; } -EXPORT_SYMBOL(__scst_register_target_template); +EXPORT_SYMBOL_GPL(__scst_register_target_template); + +static int scst_check_non_gpl_target_template(struct scst_tgt_template *vtt) +{ + int res; + + TRACE_ENTRY(); + + if (vtt->task_mgmt_affected_cmds_done || vtt->threads_num || + vtt->on_hw_pending_cmd_timeout) { + PRINT_ERROR("Not allowed functionality in non-GPL version for " + "target template %s", vtt->name); + res = -EPERM; + goto out; + } + + res = 0; + +out: + TRACE_EXIT_RES(res); + return res; +} + +/** + * __scst_register_target_template_non_gpl() - register target template, + * non-GPL version + * @vtt: target template + * @version: SCST_INTERFACE_VERSION version string to ensure that + * SCST core and the target driver use the same version of + * the SCST interface + * + * Description: + * Registers a target template and returns 0 on success or appropriate + * error code otherwise. + * + * Note: *vtt must be static! + */ +int __scst_register_target_template_non_gpl(struct scst_tgt_template *vtt, + const char *version) +{ + int res; + + TRACE_ENTRY(); + + res = scst_check_non_gpl_target_template(vtt); + if (res != 0) + goto out; + + res = __scst_register_target_template(vtt, version); + +out: + TRACE_EXIT_RES(res); + return res; +} +EXPORT_SYMBOL(__scst_register_target_template_non_gpl); /** * scst_unregister_target_template() - unregister target template @@ -715,7 +769,7 @@ out_clear: smp_mb__after_clear_bit(); goto out_up; } -EXPORT_SYMBOL(scst_suspend_activity); +EXPORT_SYMBOL_GPL(scst_suspend_activity); static void __scst_resume_activity(void) { @@ -773,7 +827,7 @@ void scst_resume_activity(void) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_resume_activity); +EXPORT_SYMBOL_GPL(scst_resume_activity); static int scst_register_device(struct scsi_device *scsidp) { @@ -1115,7 +1169,7 @@ out_resume: scst_resume_activity(); goto out; } -EXPORT_SYMBOL(scst_register_virtual_device); +EXPORT_SYMBOL_GPL(scst_register_virtual_device); /** * scst_unregister_virtual_device() - unegister a virtual device. @@ -1173,7 +1227,7 @@ out_unlock: scst_resume_activity(); goto out; } -EXPORT_SYMBOL(scst_unregister_virtual_device); +EXPORT_SYMBOL_GPL(scst_unregister_virtual_device); /** * __scst_register_dev_driver() - register pass-through dev handler driver @@ -1294,7 +1348,7 @@ out_resume: scst_resume_activity(); goto out; } -EXPORT_SYMBOL(__scst_register_dev_driver); +EXPORT_SYMBOL_GPL(__scst_register_dev_driver); /** * scst_unregister_dev_driver() - unregister pass-through dev handler driver @@ -1352,7 +1406,7 @@ out_up: scst_resume_activity(); goto out; } -EXPORT_SYMBOL(scst_unregister_dev_driver); +EXPORT_SYMBOL_GPL(scst_unregister_dev_driver); /** * __scst_register_virtual_dev_driver() - register virtual dev handler driver @@ -1412,7 +1466,7 @@ out: TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(__scst_register_virtual_dev_driver); +EXPORT_SYMBOL_GPL(__scst_register_virtual_dev_driver); /** * scst_unregister_virtual_dev_driver() - unregister virtual dev driver @@ -1447,7 +1501,7 @@ void scst_unregister_virtual_dev_driver(struct scst_dev_type *dev_type) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_unregister_virtual_dev_driver); +EXPORT_SYMBOL_GPL(scst_unregister_virtual_dev_driver); /* scst_mutex supposed to be held */ int scst_add_threads(struct scst_cmd_threads *cmd_threads, @@ -1779,7 +1833,7 @@ void scst_init_threads(struct scst_cmd_threads *cmd_threads) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_init_threads); +EXPORT_SYMBOL_GPL(scst_init_threads); /** * scst_deinit_threads() - deinitialize SCST processing threads pool @@ -1799,7 +1853,7 @@ void scst_deinit_threads(struct scst_cmd_threads *cmd_threads) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_deinit_threads); +EXPORT_SYMBOL_GPL(scst_deinit_threads); static void scst_stop_global_threads(void) { @@ -1905,7 +1959,7 @@ unsigned int scst_get_setup_id(void) { return scst_setup_id; } -EXPORT_SYMBOL(scst_get_setup_id); +EXPORT_SYMBOL_GPL(scst_get_setup_id); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index 28565e429..cc9ba24f7 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -1157,7 +1157,7 @@ out_uncheck: sgv_uncheck_allowed_mem(mem_lim, pages_to_alloc); goto out; } -EXPORT_SYMBOL(sgv_pool_alloc); +EXPORT_SYMBOL_GPL(sgv_pool_alloc); /** * sgv_get_priv - return the private allocation data @@ -1169,7 +1169,7 @@ void *sgv_get_priv(struct sgv_pool_obj *obj) { return obj->allocator_priv; } -EXPORT_SYMBOL(sgv_get_priv); +EXPORT_SYMBOL_GPL(sgv_get_priv); /** * sgv_pool_free - free previously allocated SG vector @@ -1234,7 +1234,7 @@ void sgv_pool_free(struct sgv_pool_obj *obj, struct scst_mem_lim *mem_lim) sgv_uncheck_allowed_mem(mem_lim, pages); return; } -EXPORT_SYMBOL(sgv_pool_free); +EXPORT_SYMBOL_GPL(sgv_pool_free); /** * scst_alloc() - allocates an SG vector @@ -1303,7 +1303,7 @@ out_uncheck: sgv_hiwmk_uncheck(pages); goto out; } -EXPORT_SYMBOL(scst_alloc); +EXPORT_SYMBOL_GPL(scst_alloc); /** * scst_free() - frees SG vector @@ -1320,7 +1320,7 @@ void scst_free(struct scatterlist *sg, int count) kfree(sg); return; } -EXPORT_SYMBOL(scst_free); +EXPORT_SYMBOL_GPL(scst_free); /* Must be called under sgv_pools_mutex */ static void sgv_pool_init_cache(struct sgv_pool *pool, int cache_num) @@ -1527,7 +1527,7 @@ void sgv_pool_flush(struct sgv_pool *pool) TRACE_EXIT(); return; } -EXPORT_SYMBOL(sgv_pool_flush); +EXPORT_SYMBOL_GPL(sgv_pool_flush); static void sgv_pool_destroy(struct sgv_pool *pool) { @@ -1577,7 +1577,7 @@ void sgv_pool_set_allocator(struct sgv_pool *pool, pool->alloc_fns.free_pages_fn = free_pages_fn; return; } -EXPORT_SYMBOL(sgv_pool_set_allocator); +EXPORT_SYMBOL_GPL(sgv_pool_set_allocator); /** * sgv_pool_create - creates and initializes an SGV pool @@ -1654,7 +1654,7 @@ out_free: kfree(pool); goto out_unlock; } -EXPORT_SYMBOL(sgv_pool_create); +EXPORT_SYMBOL_GPL(sgv_pool_create); /** * sgv_pool_get - increase ref counter for the corresponding SGV pool @@ -1668,7 +1668,7 @@ void sgv_pool_get(struct sgv_pool *pool) pool, atomic_read(&pool->sgv_pool_ref)); return; } -EXPORT_SYMBOL(sgv_pool_get); +EXPORT_SYMBOL_GPL(sgv_pool_get); /** * sgv_pool_put - decrease ref counter for the corresponding SGV pool @@ -1684,7 +1684,7 @@ void sgv_pool_put(struct sgv_pool *pool) sgv_pool_destroy(pool); return; } -EXPORT_SYMBOL(sgv_pool_put); +EXPORT_SYMBOL_GPL(sgv_pool_put); /** * sgv_pool_del - deletes the corresponding SGV pool @@ -1703,7 +1703,7 @@ void sgv_pool_del(struct sgv_pool *pool) TRACE_EXIT(); return; } -EXPORT_SYMBOL(sgv_pool_del); +EXPORT_SYMBOL_GPL(sgv_pool_del); /* Both parameters in pages */ int scst_sgv_pools_init(unsigned long mem_hwmark, unsigned long mem_lwmark) diff --git a/scst/src/scst_proc.c b/scst/src/scst_proc.c index 76275011d..3be42a9a4 100644 --- a/scst/src/scst_proc.c +++ b/scst/src/scst_proc.c @@ -419,7 +419,7 @@ out: TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_proc_log_entry_write); +EXPORT_SYMBOL_GPL(scst_proc_log_entry_write); static ssize_t scst_proc_scsi_tgt_gen_write_log(struct file *file, const char __user *buf, @@ -2576,7 +2576,7 @@ int scst_proc_log_entry_read(struct seq_file *seq, unsigned long log_level, TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_proc_log_entry_read); +EXPORT_SYMBOL_GPL(scst_proc_log_entry_read); static int log_info_show(struct seq_file *seq, void *v) { @@ -2729,7 +2729,7 @@ struct proc_dir_entry *scst_create_proc_entry(struct proc_dir_entry *root, TRACE_EXIT(); return p; } -EXPORT_SYMBOL(scst_create_proc_entry); +EXPORT_SYMBOL_GPL(scst_create_proc_entry); int scst_single_seq_open(struct inode *inode, struct file *file) { @@ -2742,18 +2742,18 @@ int scst_single_seq_open(struct inode *inode, struct file *file) #endif return single_open(file, pdata->show, PDE(inode)->data); } -EXPORT_SYMBOL(scst_single_seq_open); +EXPORT_SYMBOL_GPL(scst_single_seq_open); struct proc_dir_entry *scst_proc_get_tgt_root( struct scst_tgt_template *vtt) { return vtt->proc_tgt_root; } -EXPORT_SYMBOL(scst_proc_get_tgt_root); +EXPORT_SYMBOL_GPL(scst_proc_get_tgt_root); struct proc_dir_entry *scst_proc_get_dev_type_root( struct scst_dev_type *dtt) { return dtt->proc_dev_type_root; } -EXPORT_SYMBOL(scst_proc_get_dev_type_root); +EXPORT_SYMBOL_GPL(scst_proc_get_dev_type_root); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index db47a3e65..6978fbe22 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -581,7 +581,7 @@ struct sysfs_ops *scst_sysfs_get_sysfs_ops(void) { return &scst_sysfs_ops; } -EXPORT_SYMBOL(scst_sysfs_get_sysfs_ops); +EXPORT_SYMBOL_GPL(scst_sysfs_get_sysfs_ops); /** ** Target Template @@ -4975,7 +4975,7 @@ struct scst_sysfs_user_info *scst_sysfs_user_get_info(uint32_t cookie) TRACE_EXIT_HRES(res); return res; } -EXPORT_SYMBOL(scst_sysfs_user_get_info); +EXPORT_SYMBOL_GPL(scst_sysfs_user_get_info); /** ** Helper functionality to help target drivers and dev handlers support @@ -5023,7 +5023,7 @@ out: TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_sysfs_user_add_info); +EXPORT_SYMBOL_GPL(scst_sysfs_user_add_info); /** * scst_sysfs_user_del_info - delete and frees user_info @@ -5044,7 +5044,7 @@ void scst_sysfs_user_del_info(struct scst_sysfs_user_info *info) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_sysfs_user_del_info); +EXPORT_SYMBOL_GPL(scst_sysfs_user_del_info); /* * Returns true if the reply received and being processed by another part of @@ -5129,7 +5129,7 @@ out: TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_wait_info_completion); +EXPORT_SYMBOL_GPL(scst_wait_info_completion); int __init scst_sysfs_init(void) { diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index ace89a195..7c70674db 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -62,7 +62,7 @@ void scst_post_parse(struct scst_cmd *cmd) { scst_set_parse_time(cmd); } -EXPORT_SYMBOL(scst_post_parse); +EXPORT_SYMBOL_GPL(scst_post_parse); /** * scst_post_alloc_data_buf() - do post alloc_data_buf actions @@ -75,7 +75,7 @@ void scst_post_alloc_data_buf(struct scst_cmd *cmd) { scst_set_alloc_buf_time(cmd); } -EXPORT_SYMBOL(scst_post_alloc_data_buf); +EXPORT_SYMBOL_GPL(scst_post_alloc_data_buf); static inline void scst_schedule_tasklet(struct scst_cmd *cmd) { @@ -2447,7 +2447,7 @@ out_uncomplete: res = -1; goto out; } -EXPORT_SYMBOL(scst_check_local_events); +EXPORT_SYMBOL_GPL(scst_check_local_events); /* No locks */ void scst_inc_expected_sn(struct scst_tgt_dev *tgt_dev, atomic_t *slot) @@ -4220,7 +4220,7 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_process_active_cmd); +EXPORT_SYMBOL_GPL(scst_process_active_cmd); /* Called under cmd_list_lock and IRQs disabled */ static void scst_do_job_active(struct list_head *cmd_list, @@ -4528,7 +4528,7 @@ void scst_prepare_async_mcmd(struct scst_mgmt_cmd *mcmd) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_prepare_async_mcmd); +EXPORT_SYMBOL_GPL(scst_prepare_async_mcmd); /** * scst_async_mcmd_completed() - async management command completed @@ -4562,7 +4562,7 @@ void scst_async_mcmd_completed(struct scst_mgmt_cmd *mcmd, int status) TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_async_mcmd_completed); +EXPORT_SYMBOL_GPL(scst_async_mcmd_completed); /* No locks */ static void scst_finish_cmd_mgmt(struct scst_cmd *cmd) @@ -6225,7 +6225,7 @@ bool scst_initiator_has_luns(struct scst_tgt *tgt, const char *initiator_name) TRACE_EXIT_RES(res); return res; } -EXPORT_SYMBOL(scst_initiator_has_luns); +EXPORT_SYMBOL_GPL(scst_initiator_has_luns); static int scst_init_session(struct scst_session *sess) { @@ -6333,7 +6333,8 @@ restart: * e.g. iSCSI name, which used as the key to found appropriate * access control group. Could be NULL, then the default * target's LUNs are used. - * @data: any target driver supplied data + * @tgt_priv: pointer to target driver's private data + * @result_fn_data: any target driver supplied data * @result_fn: pointer to the function that will be asynchronously called * when session initialization finishes. * Can be NULL. Parameters: @@ -6409,7 +6410,27 @@ out_free: sess = NULL; goto out; } -EXPORT_SYMBOL(scst_register_session); +EXPORT_SYMBOL_GPL(scst_register_session); + +/** + * scst_register_session_non_gpl() - register session (non-GPL version) + * @tgt: target + * @initiator_name: remote initiator's name, any NULL-terminated string, + * e.g. iSCSI name, which used as the key to found appropriate + * access control group. Could be NULL, then the default + * target's LUNs are used. + * @tgt_priv: pointer to target driver's private data + * + * Description: + * Registers new session. Returns new session on success or NULL otherwise. + */ +struct scst_session *scst_register_session_non_gpl(struct scst_tgt *tgt, + const char *initiator_name, void *tgt_priv) +{ + return scst_register_session(tgt, 0, initiator_name, tgt_priv, + NULL, NULL); +} +EXPORT_SYMBOL(scst_register_session_non_gpl); /** * scst_unregister_session() - unregister session @@ -6485,7 +6506,26 @@ void scst_unregister_session(struct scst_session *sess, int wait, TRACE_EXIT(); return; } -EXPORT_SYMBOL(scst_unregister_session); +EXPORT_SYMBOL_GPL(scst_unregister_session); + +/** + * scst_unregister_session_non_gpl() - unregister session, non-GPL version + * @sess: session to be unregistered + * + * Unregisters session. + * + * See notes for scst_unregister_session() above. + */ +void scst_unregister_session_non_gpl(struct scst_session *sess) +{ + TRACE_ENTRY(); + + scst_unregister_session(sess, 1, NULL); + + TRACE_EXIT(); + return; +} +EXPORT_SYMBOL(scst_unregister_session_non_gpl); static inline int test_mgmt_list(void) { diff --git a/usr/fileio/fileio.c b/usr/fileio/fileio.c index 45c4de715..b5bd3b27b 100644 --- a/usr/fileio/fileio.c +++ b/usr/fileio/fileio.c @@ -364,6 +364,7 @@ int start(int argc, char **argv) } memset(&desc, 0, sizeof(desc)); + desc.license_str = (unsigned long)"GPL"; desc.version_str = (unsigned long)DEV_USER_VERSION; strncpy(desc.name, devs[i].name, sizeof(desc.name)-1); desc.name[sizeof(desc.name)-1] = '\0';