U盘插拔、挂载

sgdisk 创建分区
mke2fs 格式化文件系统
e2fsck 检查文件系统的正确性
blkid 检查sdcard是什么格式的

mmc1 : card|mmc1 : new|vold : Disk at|sgdisk|blkid|mke2fs|/dev/block/dm-2|e2fsck

0.识别挂载过程


// 1. get uevent from kernel

NetlinkHandler::onEvent    							/*-----------NetlinkHandler.cpp--------*/	

	VolumeManager::handleBlockEvent				/*-----------VolumeManager.cpp------*/
		case NetlinkEvent::Action::kAdd: 
				Disk ::create();    					/*------------disk.cpp---------------*/
					 Disk ::  readMetadata()
					 Disk :: readPartitions()   // sgdisk  read partation
					  	ReadMetadataUntrusted(mDevPath, fsType, unused, unused)    /*----------Utils.cpp------------*/
					  		readMetadata    // blkid -c /dev/null -s TYPE -s UUID -s LABEL  /dev/block/mmcblk1p1           (get sdcard type)
								createPublicVolume        // fat32
									void Disk::createPublicVolume(dev_t device) {
										    auto vol = std::shared_ptr<VolumeBase>(new PublicVolume(device));
										    if (mJustPartitioned)  
										    {
										        LOG(DEBUG) << "Device just partitioned; silently formatting";
										        vol->setSilent(true);
										        vol->create();			
										        vol->format("auto");
										        vol->destroy();
										        vol->setSilent(false);
										    }

										    mVolumes.push_back(vol);
										    vol->setDiskId(getId());
										    vol->create();
										}

		
								
					  				
					  
						createPrivateVolume	     // ext4

		  case NetlinkEvent::Action::kChange:      //kChange 流程,格式化过程
		  {
		        LOG(DEBUG) << "Disk at " << major << ":" << minor << " changed";
		                disk->readMetadata();
		                disk->readPartitions();
		  }





----------


// 2. creat volume     (PublicVolume.cpp  VolumeBase.cpp)

  PublicVolume::create()
	VolumeBase::create() 
		PublicVolume::doCreate();
	      notifyEvent(ResponseCode::VolumeCreated,  StringPrintf("%d \"%s\" \"%s\"", mType, mDiskId.c_str(), mPartGuid.c_str()));     **// notify  VolumeCreated event to mountservice**
          


----------


// 3. process VOLUME_CREATED  650 handler from vold  (mountservice.java)
MountServiceHandler.onEvent
	MountServiceHandler.onEventLocked
		            case VoldResponseCode.VOLUME_CREATED: 			// reciver  VOLUME_CREATED  650 handler from vold
					                onVolumeCreatedLocked(vol);
								                mHandler.obtainMessage(H_VOLUME_MOUNT, vol).sendToTarget();    // send message (H_VOLUME_MOUNT) to  mountservice


----------


//4. handle H_VOLUME_MOUNT   message     (mountservice.java)
MountServiceHandler.handleMessage
	case H_VOLUME_MOUNT: 
		 mConnector.execute("volume", "mount", vol.id, vol.mountFlags,  vol.mountUserId);
                          


----------


//5 .native do mount  (VolumeBase.cpp  PublicVolume.cpp    vfat.cpp )

 VolumeBase::mount() 
{
    if ((mState != State::kUnmounted) && (mState != State::kUnmountable)) {
        LOG(WARNING) << getId() << " mount requires state unmounted or unmountable";
        return -EBUSY;
    }

    setState(State::kChecking);  -> 	    notifyEvent(ResponseCode::VolumeStateChanged, StringPrintf("%d", mState));   	// set state      VolumeStateChanged = 651   kChecking
	

    status_t res = doMount();			

/*-----------------------------------------------------------*/
		PublicVolume::doMount()																			       // PublicVolume.cpp
				exfat::Mount(mDevPath, mRawPath, false, false, false,AID_MEDIA_RW, AID_MEDIA_RW, 0007);		// vfat.cpp
                
/*------------------------------------------------------------*/
	
    if (res == OK) 
        setState(State::kMounted);			// set state  notifyEvent   kMounted      
     else 
        setState(State::kUnmountable);		// set state  anotifyEvent  kUnmountable
}






						


1.格式化过程


1.mountservic下发格式化命令-擦除所有的分区 (Disk::partitionPublic)
vold    : /system/bin/sgdisk
vold    :     --zap-all
vold    :     /dev/block/vold/disk:179,64


2.分区表已经被删除需要重新分区
sgdisk  : GPT data structures destroyed! You may now partition the disk using fdisk or
sgdisk  : other utilities.


3. vold收到kernel的 disk changed uevent消息   VolumeManager::handleBlockEvent 处理 NetlinkEvent::Action::kChange 消息,接下来走格式化的一些流程
mmcblk1 : p1
vold    : Disk at 179:64 changed


4.读取分区信息,获取sdcard类型以便创建publicvolume/privateVolume  (Disk::readPartitions)
vold    : /system/bin/sgdisk
vold    :     --android-dump
vold    :     /dev/block/vold/disk:179,64
vold    :     /dev/block/vold/disk:179,64


Line 11852: 01-07 08:47:54.323   358   364 I sgdisk  : 
	Line 11853: 01-07 08:47:54.323   358   364 I sgdisk  : ***************************************************************
	Line 11854: 01-07 08:47:54.323   358   364 I sgdisk  : Found invalid GPT and valid MBR; converting MBR to GPT format
	Line 11855: 01-07 08:47:54.323   358   364 I sgdisk  : in memory. 
	Line 11856: 01-07 08:47:54.323   358   364 I sgdisk  : ***************************************************************
	Line 11857: 01-07 08:47:54.323   358   364 I sgdisk  : 
	Line 11858: 01-07 08:47:54.323   358   364 I sgdisk  : 
	Line 11859: 01-07 08:47:54.323   358   364 I sgdisk  : Warning! Secondary partition table overlaps the last partition by
	Line 11860: 01-07 08:47:54.323   358   364 I sgdisk  : 33 blocks!
	Line 11861: 01-07 08:47:54.323   358   364 I sgdisk  : You will need to delete this partition or resize it in another utility.
	Line 11868: 01-07 08:47:55.393     0     0 I mmcblk1 : p1
	Line 11869: 01-07 08:47:55.393   358   364 I sgdisk  : GPT data structures destroyed! You may now partition the disk using fdisk or
	Line 11870: 01-07 08:47:55.393   358   364 I sgdisk  : other utilities.
	Line 11875: 01-07 08:47:55.447  1224  1390 D VoldConnector: RCV <- {200 37 Command succeeded}
	Line 11876: 01-07 08:47:55.448  1224  2186 E VoldConnector: NDC Command {37 volume partition disk:179,64 public} took too long (2243ms)
	Line 11877: 01-07 08:47:55.451     0     0 I mmcblk1 : p1
	Line 11878: 01-07 08:47:55.453   358   362 D vold    : Disk at 179:64 changed
	Line 11878: 01-07 08:47:55.453   358   362 D vold    : Disk at 179:64 changed
	Line 11879: 01-07 08:47:55.454  1224  1390 D VoldConnector: RCV <- {641 disk:179,64 15854469120}
	Line 11880: 01-07 08:47:55.455   358   362 V vold    : /system/bin/sgdisk
	Line 11880: 01-07 08:47:55.455   358   362 V vold    : /system/bin/sgdisk
	Line 11881: 01-07 08:47:55.455   358   362 V vold    :     --android-dump
	Line 11882: 01-07 08:47:55.455   358   362 V vold    :     /dev/block/vold/disk:179,64
	Line 11882: 01-07 08:47:55.455   358   362 V vold    :     /dev/block/vold/disk:179,64
	Line 11883: 01-07 08:47:55.455  1224  1390 D VoldConnector: RCV <- {642 disk:179,64 }
	Line 11884: 01-07 08:47:55.456  1224  1390 D VoldConnector: RCV <- {644 disk:179,64 /sys//devices/soc/7864900.sdhci/mmc_host/mmc1/mmc1:0001/block/mmcblk1}
	Line 11884: 01-07 08:47:55.456  1224  1390 D VoldConnector: RCV <- {644 disk:179,64 /sys//devices/soc/7864900.sdhci/mmc_host/mmc1/mmc1:0001/block/mmcblk1}
	Line 11892: 01-07 08:47:55.505   358   362 V vold    : DISK mbr
	Line 11893: 01-07 08:47:55.505   358   362 V vold    : 
	Line 11894: 01-07 08:47:55.505   358   362 V vold    : PART 1 c
	Line 11895: 01-07 08:47:55.505   358   362 V vold    : 
	Line 11896: 01-07 08:47:55.510   358   362 D vold    : Device just partitioned; silently formatting
	Line 11897: 01-07 08:47:55.511   358   362 E vold    : zch=================readMetadata start
	Line 11897: 01-07 08:47:55.511   358   362 E vold    : zch=================readMetadata start
	Line 11898: 01-07 08:47:55.511   358   362 V vold    : /system/bin/blkid
	Line 11899: 01-07 08:47:55.511   358   362 V vold    :     -c
	Line 11900: 01-07 08:47:55.511   358   362 V vold    :     /dev/null
	Line 11901: 01-07 08:47:55.511   358   362 V vold    :     -s
	Line 11902: 01-07 08:47:55.511   358   362 V vold    :     TYPE
	Line 11903: 01-07 08:47:55.511   358   362 V vold    :     -s
	Line 11904: 01-07 08:47:55.511   358   362 V vold    :     UUID
	Line 11905: 01-07 08:47:55.511   358   362 V vold    :     -s
	Line 11906: 01-07 08:47:55.511   358   362 V vold    :     LABEL
	Line 11907: 01-07 08:47:55.511   358   362 V vold    :     /dev/block/vold/public:179,65
	Line 11907: 01-07 08:47:55.511   358   362 V vold    :     /dev/block/vold/public:179,65
	Line 11908: 01-07 08:47:55.594   358   362 V vold    : /dev/block/vold/public:179,65: UUID="F503-1002" TYPE="vfat" 
	Line 11908: 01-07 08:47:55.594   358   362 V vold    : /dev/block/vold/public:179,65: UUID="F503-1002" TYPE="vfat" 
	Line 11909: 01-07 08:47:55.594   358   362 V vold    : 
	Line 11910: 01-07 08:47:55.597   358   362 E vold    : zch=================readMetadata end
	Line 11910: 01-07 08:47:55.597   358   362 E vold    : zch=================readMetadata end
	Line 11911: 01-07 08:47:55.597   358   362 I vold    : About to discard 15853420544 on /dev/block/vold/public:179,65
	Line 11911: 01-07 08:47:55.597   358   362 I vold    : About to discard 15853420544 on /dev/block/vold/public:179,65
	Line 11938: 01-07 08:48:00.449  1224  2186 W MountService: Thread Binder:1224_D still waiting for partitionPublic...
	Line 11980: 01-07 08:48:05.449  1224  2186 W MountService: Thread Binder:1224_D still waiting for partitionPublic...
	Line 12010: 01-07 08:48:10.450  1224  2186 W MountService: Thread Binder:1224_D still waiting for partitionPublic...
	Line 12029: 01-07 08:48:15.451  1224  2186 W MountService: Thread Binder:1224_D still waiting for partitionPublic...
	Line 12060: 01-07 08:48:20.453  1224  2186 W MountService: Thread Binder:1224_D still waiting for partitionPublic...
	Line 12084: 01-07 08:48:25.455  1224  2186 W MountService: Thread Binder:1224_D still waiting for partitionPublic...
	Line 12108: 01-07 08:48:29.578   358   362 I vold    : Discard success on /dev/block/vold/public:179,65
	Line 12108: 01-07 08:48:29.578   358   362 I vold    : Discard success on /dev/block/vold/public:179,65
	Line 12109: 01-07 08:48:29.579   358   362 V vold    : /system/bin/blkid
	Line 12110: 01-07 08:48:29.579   358   362 V vold    :     -c
	Line 12111: 01-07 08:48:29.579   358   362 V vold    :     /dev/null
	Line 12112: 01-07 08:48:29.579   358   362 V vold    :     -s
	Line 12113: 01-07 08:48:29.579   358   362 V vold    :     TYPE
	Line 12114: 01-07 08:48:29.579   358   362 V vold    :     -s
	Line 12115: 01-07 08:48:29.579   358   362 V vold    :     UUID
	Line 12116: 01-07 08:48:29.579   358   362 V vold    :     -s
	Line 12117: 01-07 08:48:29.579   358   362 V vold    :     LABEL
	Line 12118: 01-07 08:48:29.579   358   362 V vold    :     /dev/block/vold/public:179,65
	Line 12118: 01-07 08:48:29.579   358   362 V vold    :     /dev/block/vold/public:179,65
	Line 12119: 01-07 08:48:29.655   358   362 E vold    : Failed to pclose /system/bin/blkid -c /dev/null -s TYPE -s UUID -s LABEL /dev/block/vold/public:179,65 : Success
	Line 12119: 01-07 08:48:29.655   358   362 E vold    : Failed to pclose /system/bin/blkid -c /dev/null -s TYPE -s UUID -s LABEL /dev/block/vold/public:179,65 : Success
	Line 12120: 01-07 08:48:29.655   358   362 E vold    : Failed to pclose errno : 0: Success
	Line 12121: 01-07 08:48:29.655   358   362 E vold    : PublicVolume doFormat mFsType = 
	Line 12122: 01-07 08:48:29.655   358   362 V vold    : /system/bin/newfs_msdos
	Line 12123: 01-07 08:48:29.655   358   362 V vold    :     -F
	Line 12124: 01-07 08:48:29.655   358   362 V vold    :     32
	Line 12125: 01-07 08:48:29.655   358   362 V vold    :     -O
	Line 12126: 01-07 08:48:29.655   358   362 V vold    :     android
	Line 12127: 01-07 08:48:29.655   358   362 V vold    :     -c
	Line 12128: 01-07 08:48:29.655   358   362 V vold    :     64
	Line 12129: 01-07 08:48:29.655   358   362 V vold    :     -A
	Line 12130: 01-07 08:48:29.655   358   362 V vold    :     /dev/block/vold/public:179,65
	Line 12130: 01-07 08:48:29.655   358   362 V vold    :     /dev/block/vold/public:179,65
	Line 12131: 01-07 08:48:29.700   358   362 I newfs_msdos: /system/bin/newfs_msdos: warning, /dev/block/vold/public:179,65 is not a character device
	Line 12133: 01-07 08:48:29.701   358   362 I newfs_msdos: /dev/block/vold/public:179,65: 30948480 sectors in 483570 FAT32 clusters (32768 bytes/cluster)
	Line 12137: 01-07 08:48:30.456  1224  2186 W MountService: Thread Binder:1224_D still waiting for partitionPublic...
	Line 12140: 01-07 08:48:31.211   358   362 I Vold    : Filesystem formatted OK
	Line 12141: 01-07 08:48:31.213  1224  1390 D VoldConnector: RCV <- {650 public:179,65 0 "disk:179,64" ""}
	Line 12142: 01-07 08:48:31.214  1224  1390 D VoldConnector: RCV <- {651 public:179,65 0}
	Line 12143: 01-07 08:48:31.214  1224  1389 D VoldConnector: SND -> {38 volume mount public:179,65 2 0}
	Line 12144: 01-07 08:48:31.214  1224  1390 D VoldConnector: RCV <- {643 disk:179,64}
	Line 12145: 01-07 08:48:31.215   358   362 D vold    : Disk at 179:64 changed
	Line 12145: 01-07 08:48:31.215   358   362 D vold    : Disk at 179:64 changed
	Line 12146: 01-07 08:48:31.216   358   362 V vold    : /system/bin/sgdisk
	Line 12146: 01-07 08:48:31.216   358   362 V vold    : /system/bin/sgdisk
	Line 12147: 01-07 08:48:31.216   358   362 V vold    :     --android-dump
	Line 12148: 01-07 08:48:31.216   358   362 V vold    :     /dev/block/vold/disk:179,64
	Line 12148: 01-07 08:48:31.216   358   362 V vold    :     /dev/block/vold/disk:179,64
	Line 12154: 01-07 08:48:31.216  1224  1390 D VoldConnector: RCV <- {641 disk:179,64 15854469120}
	Line 12155: 01-07 08:48:31.217  1224  1390 D VoldConnector: RCV <- {642 disk:179,64 }
	Line 12156: 01-07 08:48:31.217  1224  1390 D VoldConnector: RCV <- {644 disk:179,64 /sys//devices/soc/7864900.sdhci/mmc_host/mmc1/mmc1:0001/block/mmcblk1}
	Line 12156: 01-07 08:48:31.217  1224  1390 D VoldConnector: RCV <- {644 disk:179,64 /sys//devices/soc/7864900.sdhci/mmc_host/mmc1/mmc1:0001/block/mmcblk1}
	Line 12157: 01-07 08:48:31.218  1224  1390 D VoldConnector: RCV <- {651 public:179,65 7}
	Line 12158: 01-07 08:48:31.219  1224  1390 D VoldConnector: RCV <- {659 public:179,65}
	Line 12182: 01-07 08:48:31.276   358   362 V vold    : DISK mbr
	Line 12183: 01-07 08:48:31.276   358   362 V vold    : 
	Line 12184: 01-07 08:48:31.276   358   362 V vold    : PART 1 c
	Line 12185: 01-07 08:48:31.276   358   362 V vold    : 
	Line 12186: 01-07 08:48:31.278   358   364 V vold    : /system/bin/blkid
	Line 12187: 01-07 08:48:31.278   358   364 V vold    :     -c
	Line 12188: 01-07 08:48:31.278   358   364 V vold    :     /dev/null
	Line 12189: 01-07 08:48:31.278   358   364 V vold    :     -s
	Line 12190: 01-07 08:48:31.278   358   364 V vold    :     TYPE
	Line 12191: 01-07 08:48:31.278   358   364 V vold    :     -s
	Line 12192: 01-07 08:48:31.278   358   364 V vold    :     UUID
	Line 12193: 01-07 08:48:31.278  1224  1390 D VoldConnector: RCV <- {650 public:179,65 0 "disk:179,64" ""}
	Line 12194: 01-07 08:48:31.278   358   364 V vold    :     -s
	Line 12195: 01-07 08:48:31.278   358   364 V vold    :     LABEL
	Line 12196: 01-07 08:48:31.278   358   364 V vold    :     /dev/block/vold/public:179,65
	Line 12196: 01-07 08:48:31.278   358   364 V vold    :     /dev/block/vold/public:179,65
	Line 12197: 01-07 08:48:31.280  1224  1390 D VoldConnector: RCV <- {651 public:179,65 0}
	Line 12198: 01-07 08:48:31.281  1224  1390 D VoldConnector: RCV <- {643 disk:179,64}
	Line 12199: 01-07 08:48:31.281  1224  1390 D VoldConnector: RCV <- {651 public:179,65 1}
	Line 12215: 01-07 08:48:31.377   358   364 V vold    : /dev/block/vold/public:179,65: UUID="2007-1011" TYPE="vfat" 
	Line 12215: 01-07 08:48:31.377   358   364 V vold    : /dev/block/vold/public:179,65: UUID="2007-1011" TYPE="vfat" 
	Line 12216: 01-07 08:48:31.377   358   364 V vold    : 
	Line 12217: 01-07 08:48:31.393  1224  1390 D VoldConnector: RCV <- {652 public:179,65 vfat}
	Line 12218: 01-07 08:48:31.393   358   364 V vold    : /system/bin/fsck_msdos
	Line 12219: 01-07 08:48:31.393   358   364 V vold    :     -p
	Line 12220: 01-07 08:48:31.393   358   364 V vold    :     -f
	Line 12221: 01-07 08:48:31.393   358   364 V vold    :     /dev/block/vold/public:179,65
	Line 12221: 01-07 08:48:31.393   358   364 V vold    :     /dev/block/vold/public:179,65
	Line 12222: 01-07 08:48:31.393  1224  1390 D VoldConnector: RCV <- {653 public:179,65 2007-1011}
	Line 12223: 01-07 08:48:31.394  1224  1390 D VoldConnector: RCV <- {654 public:179,65 }
	Line 12226: 01-07 08:48:31.447   358   364 I fsck_msdos: ** /dev/block/vold/public:179,65
	Line 12250: 01-07 08:48:31.808   358   364 I Vold    : Filesystem check completed OK
	Line 12251: 01-07 08:48:31.808  1224  1390 D VoldConnector: RCV <- {656 public:179,65 /mnt/media_rw/2007-1011}
	Line 12252: 01-07 08:48:31.809  1224  1390 D VoldConnector: RCV <- {655 public:179,65 /storage/2007-1011}
	Line 12253: 01-07 08:48:31.838     0     0 D SELinux : initialized (dev mmcblk1p1, type vfat), uses genfs_contexts
	Line 12254: 01-07 08:48:31.898   358   364 V vold    : Waiting for FUSE to spin up...
	Line 12257: 01-07 08:48:31.948   358   364 V vold    : Waiting for FUSE to spin up...
	Line 12263: 01-07 08:48:32.000  1224  1390 D VoldConnector: RCV <- {651 public:179,65 2}
	Line 12264: 01-07 08:48:32.001  1224  1390 D VoldConnector: RCV <- {200 38 Command succeeded}
	Line 12265: 01-07 08:48:32.001  1224  1389 E VoldConnector: NDC Command {38 volume mount public:179,65 2 0} took too long (787ms)
	Line 12266: 01-07 08:48:32.016  1224  1389 D MountService: Volume public:179,65 broadcasting removed to UserHandle{0}
	Line 12267: 01-07 08:48:32.020  1224  1389 D VoldConnector: SND -> {39 volume mount public:179,65 2 0}
	Line 12273: 01-07 08:48:32.021   358   364 W vold    : public:179,65 flags change requires state unmounted or unmountable
	Line 12274: 01-07 08:48:32.022   358   364 W vold    : public:179,65 user change requires state unmounted or unmountable
	Line 12275: 01-07 08:48:32.022   358   364 W vold    : public:179,65 mount requires state unmounted or unmountable
	Line 12276: 01-07 08:48:32.022  1224  1390 D VoldConnector: RCV <- {400 39 Command failed}
	Line 12277: 01-07 08:48:32.024  1224  1389 D MountService: Volume public:179,65 broadcasting checking to UserHandle{0}
	Line 12278: 01-07 08:48:32.026  1224  1389 D MountService: Volume public:179,65 broadcasting mounted to UserHandle{0}







1.U盘插入拔出打印


1.1mountservice 完整流程



	 MountService: Volume public:8,1 broadcasting checking to UserHandle{0}  // 插入后检测挂载
	 MountService: Volume public:8,1 broadcasting mounted to UserHandle{0}
	 MountService: Volume public:8,1 broadcasting ejecting to UserHandle{0}  // 点击弹出umount
	 MountService: Volume public:8,1 broadcasting unmounted to UserHandle{0}
	 MountService: Volume public:8,1 broadcasting removed to UserHandle{0}	// 拔出U盘


	




1.2 kernelU盘插入拔出kernel打印


 usb 2-1: new SuperSpeed USB device number 2 using xhci_hcd       // 插上
 30375936 512-byte logical blocks: (15.5 GB/14.4 GiB)			  // 读取大小
 USB disconnect, device number									  // 拔出	

2.U盘插入拔出mount/umount代码流程

2.1监听subsystem为block 的uevent事件



	NetlinkHandler::onEvent
		VolumeManager::handleBlockEvent
			case add:
				Disk::create   // disk.cpp
					  disk::readMetadata();
					  disk::readPartitions();
					  notifyEvent(ResponseCode::DiskCreated, StringPrintf("%d", mFlags));
			case chager:
				  disk::readMetadata();
                  disk::readPartitions();
		  
			case remove:
				Disk::destroy()
					destroyAllVolumes();
					notifyEvent(ResponseCode::DiskDestroyed);
				


					

2.2vold发送广播


	
	Disk::notifyEvent
			 VolumeManager::Instance()->getBroadcaster()->sendBroadcast
						 


					

2.3 mountService接收来着vold的广播

	 
	MountService.onEvent
		MountService.onEventLocked
			case VoldResponseCode.VOLUME_STATE_CHANGED:  //每一次状态的改变都会调用这个分支
                    onVolumeStateChangedLocked(vol, oldState, newState);  // 状态改变做相应操作
					    mHandler.obtainMessage(H_VOLUME_BROADCAST, userVol).sendToTarget();  // mountService发广播给mountService

					
					    


3.mountService接收来着mountService的广播


MountServiceHandler.handleMessage  //接收广播

	case H_VOLUME_MOUNT: 		 // 挂载
		mConnector.execute("volume", "mount", vol.id, vol.mountFlags,vol.mountUserId);
	
	case H_VOLUME_BROADCAST:      // 发送广播给用户告知状态
		Slog.d(TAG, "Volume " + userVol.getId() + " broadcasting " + envState + " to "+ userVol.getOwner());
		mContext.sendBroadcastAsUser(intent, userVol.getOwner());   
						

4.vold sdcard识别挂载细节


4.1 工具的使用


// readMetadata  blkid工具读取元数据,区分sdcard类型
blkid -c /dev/null -s TYPE -s UUID -s LABEL  /dev/block/mmcblk1p1                                                                                                                                 
   /dev/block/mmcblk1p1: UUID="9034-1BF1" TYPE="vfat" 

// readPartitions   sgdisk读取分区信息
sgdisk  --android-dump /dev/block/mmcblk1p1


// partitionPublic 删除所有分区
/system/bin/sgdisk  --zap-all  /dev/block/vold/disk:179,64





4.2 内外置存储的volume


privateVolume     // 内置存储 ext4,mount到 /mnt/expand/xxx  

PublicVolume 	  // 外置存储 fat32 mount到 /mnt/media_rw/xxx
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值