+ strcpy(filename, class_dev->path);
+ dbg("filename = %s", filename);
+ if (strcmp(class_dev->classname, SYSFS_BLOCK_NAME) == 0) {
+ if (isdigit(class_dev->path[strlen(class_dev->path)-1])) {
+ temp = strrchr(filename, '/');
+ if (temp) {
+ partition = 1;
+ *temp = 0x00;
+ char *temp2 = strrchr(filename, '/');
+ dbg("temp2 = %s", temp2);
+ if (temp2 && (strcmp(temp2, "/block") == 0)) {
+ /* oops, we have no parent block device, so go back to original directory */
+ strcpy(filename, class_dev->path);
+ partition = 0;
+ }
+ }
+ }
+ }
+ strcat(filename, "/device");