Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <unistd.h>
  3. #include <sys/stat.h>
  4.  
  5. std::string UFSPath("/dev/block/platform/ff3b0000.ufs");
  6. std::string TargetPath("/dev/block/bootdevice");
  7.  
  8. bool IsUFS()
  9. {
  10.     struct stat st;
  11.     lstat(UFSPath.c_str(), &st);
  12.  
  13.     if (S_ISDIR(st.st_mode))
  14.         return true;
  15.  
  16.     return false;
  17. }
  18.  
  19. int main()
  20. {
  21.     if(IsUFS) {
  22.         symlink(UFSPath.c_str(), TargetPath.c_str());
  23.         printf("hw_service: ufs storage detected");
  24.     } else {
  25.         symlink("/dev/block/platform/hi_mci.0", TargetPath.c_str());
  26.         printf("hw_service: emmc storage detected");
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement