lkml.org 
[lkml]   [2022]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/4] scsi: core: constify pointer to scsi_host_template
From
On 4/25/22 06:04, John Garry wrote:
> On 25/04/2022 10:22, Krzysztof Kozlowski wrote:
>> For example scsi_proc_hostdir_rm(): 'present' and 'proc_dir' members.
>> Where should they be stored? Should they be moved to the Scsi_Host?
>>
>
> I don't think scsi_Host is appropriate as this is per-scsi host
> template, unless you see a way to do it that way. Alternatively we could
> keep a separate list of registered sht, like this:
>
> struct sht_proc_dir {
>     int cnt;
>     struct list_head list;
>     struct proc_dir_entry *proc_dir;
>     struct scsi_host_template *sht;
> };
> static LIST_HEAD(sht_proc_dir_list);
>
> void scsi_proc_hostdir_add(struct scsi_host_template *sht)
> {
>     struct sht_proc_dir *dir;
>
>     if (!sht->show_info)
>         return;
>
>     mutex_lock(&global_host_template_mutex);
>     list_for_each_entry(dir, &sht_proc_dir_list, list) {
>         if (dir->sht == sht) {
>             dir->cnt++;
>             goto out;
>         }
>     }
>     dir = kzalloc(sizeof(*dir), GFP_KERNEL);
>     if (!dir)
>         goto out;
>
>     dir->proc_dir = proc_mkdir(sht->proc_name, proc_scsi);
>     if (!dir->proc_dir) {
>         printk(KERN_ERR "%s: proc_mkdir failed for %s\n",
>                    __func__, sht->proc_name);
>         kfree(dir);
>         goto out;
>     }
>
>     dir->cnt++;
>     list_add_tail(&dir->list, &sht_proc_dir_list);
> out:
>     mutex_unlock(&global_host_template_mutex);
> }

How about removing scsi_proc_hostdir_add(), scsi_proc_hostdir_rm() and
all other code that creates files or directories under /proc/scsi? There
should be corresponding entries in sysfs for all /proc/scsi entries.
Some tools in sg3_utils use that directory so sg3_utils will have to be
updated.

Thanks,

Bart.

\
 
 \ /
  Last update: 2022-04-26 03:17    [W:0.267 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site