Find device host_no in Linux 2.6.26.

This commit is contained in:
blitter
2022-12-04 13:07:52 -08:00
parent 8f9eb4c064
commit c810bd8d07

View File

@@ -164,6 +164,7 @@ int32_t GetDeviceType(void* device_ctx)
char* fc_path;
char* sas_path;
int ret;
char delim;
char* chrptr;
char* sysfs_path_scr;
FILE* file;
@@ -242,11 +243,15 @@ int32_t GetDeviceType(void* device_ctx)
}
ret = 0;
chrptr = strchr(dev_path, ':');
delim = '.';
chrptr = strrchr(dev_path, delim);
if(!chrptr)
{
chrptr = strrchr(dev_path, '.');
delim = ':';
chrptr = strrchr(dev_path, delim);
}
if(!chrptr)
{
free((void*)sysfs_path);
@@ -259,7 +264,6 @@ int32_t GetDeviceType(void* device_ctx)
free((void*)sas_path);
return dev_type;
}
}
chrptr--;
@@ -270,8 +274,15 @@ int32_t GetDeviceType(void* device_ctx)
chrptr++;
break;
}
else if(chrptr[0] == delim)
{
ret = 0;
}
else
{
ret++;
}
chrptr--;
}