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