[...]
+/* read "buffer" and unload configuration */ +static ssize_t cscfg_cfg_unload_write(struct config_item *item, const void *buffer, size_t size) +{
struct cscfg_fs_configs_grp *configs_grp;struct cscfg_fs_load_descs *load_descs;const char *name;int err;configs_grp = container_of(to_config_group(item), struct cscfg_fs_configs_grp, group);if (size > CSCFG_FILE_MAXSIZE) {scnprintf(configs_grp->status, CSCFG_FS_STATUS_STRLEN,"Unload error: Input file too large\n");return -EINVAL;}err = cscfg_file_read_buffer_first_name(buffer, size, &name);if (err) {scnprintf(configs_grp->status, CSCFG_FS_STATUS_STRLEN,"Unload error: Failed to read input file\n");return err;}load_descs = cscfg_find_fs_owned_cfg_by_name(name);if (!load_descs) {scnprintf(configs_grp->status, CSCFG_FS_STATUS_STRLEN,"Unload error: Failed to find configuration %s from input file\n",name);return err;}err = cscfg_unload_config_sets(load_descs->owner_info);if (err) {scnprintf(configs_grp->status, CSCFG_FS_STATUS_STRLEN,"Unload error: Cannot unload configuration %s\n",name);return err;}scnprintf(configs_grp->status, CSCFG_FS_STATUS_STRLEN,"OK: configuration file unloaded (%s).\n", name);kfree((struct cscfg_load_owner_info *)load_descs->owner_info);kfree(load_descs);return size;+} +CONFIGFS_BIN_ATTR_WO(cscfg_cfg_, unload, NULL, CSCFG_FILE_MAXSIZE);
+/* show the status of the last load / unload operation */ +static ssize_t cscfg_cfg_last_load_status_show(struct config_item *item, char *page) +{
struct cscfg_fs_configs_grp *configs_grp;configs_grp = container_of(to_config_group(item), struct cscfg_fs_configs_grp, group);return scnprintf(page, PAGE_SIZE, "%s\n", configs_grp->status);I am still very ambivalent about this status thing... Especially since it only reports on the last item that was loaded/unloaded.
I guess the priciple use is to give feedback to the user if a load error occurs. An alternative could be pr_err at point of error.
I'd be fine with a pr_err().
Thanks, Mathieu