⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1011.udf.patch

📁 sm86xx内核源包括补丁( GPL )的
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+				EXT_NOT_RECORDED_NOT_ALLOCATED;+		} 	} } @@ -854,7 +884,6 @@ void udf_truncate(struct inode * inode) { 	int offset;-	struct buffer_head *bh; 	int err;  	if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||@@ -863,6 +892,7 @@ 	if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) 		return; +	lock_kernel(); 	if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) 	{ 		if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) +@@ -872,6 +902,7 @@ 			if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) 			{ 				inode->i_size = UDF_I_LENALLOC(inode);+				unlock_kernel(); 				return; 			} 			else@@ -879,16 +910,8 @@ 		} 		else 		{-			offset = (inode->i_size & (inode->i_sb->s_blocksize - 1)) +-				udf_file_entry_alloc_offset(inode);--			if ((bh = udf_tread(inode->i_sb,-				udf_get_lb_pblock(inode->i_sb, UDF_I_LOCATION(inode), 0))))-			{-				memset(bh->b_data + offset, 0x00, inode->i_sb->s_blocksize - offset);-				mark_buffer_dirty(bh);-				udf_release_data(bh);-			}+			offset = inode->i_size & (inode->i_sb->s_blocksize - 1);+			memset(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode) + offset, 0x00, inode->i_sb->s_blocksize - offset - udf_file_entry_alloc_offset(inode)); 			UDF_I_LENALLOC(inode) = inode->i_size; 		} 	}@@ -904,6 +927,7 @@ 		udf_sync_inode (inode); 	else 		mark_inode_dirty(inode);+	unlock_kernel(); }  /*@@ -927,6 +951,7 @@ void udf_read_inode(struct inode *inode) {+	UDF_I_DATA(inode) = NULL; 	memset(&UDF_I_LOCATION(inode), 0xFF, sizeof(lb_addr)); } @@ -941,7 +966,6 @@ 	 * Set defaults, but the inode is still incomplete! 	 * Note: get_new_inode() sets the following on a new inode: 	 *      i_sb = sb-	 *      i_dev = sb->s_dev; 	 *      i_no = ino 	 *      i_flags = sb->s_flags 	 *      i_state = 0@@ -1034,11 +1058,11 @@ 	struct extendedFileEntry *efe; 	time_t convtime; 	long convtime_usec;-	int offset, alen;+	int offset;  	inode->i_version = ++event;-	UDF_I_NEW_INODE(inode) = 0; + 	fe = (struct fileEntry *)bh->b_data; 	fe = (struct fileEntry *)bh->b_data; 	efe = (struct extendedFileEntry *)bh->b_data; @@ -1048,15 +1072,35 @@ 		UDF_I_STRAT4096(inode) = 1;  	UDF_I_ALLOCTYPE(inode) = le16_to_cpu(fe->icbTag.flags) & ICBTAG_FLAG_AD_MASK;+	UDF_I_UNIQUE(inode) = 0;+	UDF_I_LENEATTR(inode) = 0;+	UDF_I_LENEXTENTS(inode) = 0;+	UDF_I_LENALLOC(inode) = 0;+	UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;+	UDF_I_NEXT_ALLOC_GOAL(inode) = 0; 	if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_EFE)-		UDF_I_EXTENDED_FE(inode) = 1;+	{+		UDF_I_EFE(inode) = 1;+		UDF_I_USE(inode) = 0;+		UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL);+		memcpy(UDF_I_DATA(inode), bh->b_data + sizeof(struct extendedFileEntry), inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry));+	} 	else if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_FE)-		UDF_I_EXTENDED_FE(inode) = 0;+	{+		UDF_I_EFE(inode) = 0;+		UDF_I_USE(inode) = 0;+		UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL);+		memcpy(UDF_I_DATA(inode), bh->b_data + sizeof(struct fileEntry), inode->i_sb->s_blocksize - sizeof(struct fileEntry));+	} 	else if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_USE) 	{+		UDF_I_EFE(inode) = 0;+		UDF_I_USE(inode) = 1; 		UDF_I_LENALLOC(inode) = 			le32_to_cpu( 				((struct unallocSpaceEntry *)bh->b_data)->lengthAllocDescs);+		UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct unallocSpaceEntry), GFP_KERNEL);+		memcpy(UDF_I_DATA(inode), bh->b_data + sizeof(struct unallocSpaceEntry), inode->i_sb->s_blocksize - sizeof(struct unallocSpaceEntry)); 		return; 	} @@ -1079,7 +1123,7 @@ 	UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; 	UDF_I_NEXT_ALLOC_GOAL(inode) = 0; -	if (UDF_I_EXTENDED_FE(inode) == 0)+	if (UDF_I_EFE(inode) == 0) 	{ 		inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << 			(inode->i_sb->s_blocksize_bits - 9);@@ -1122,7 +1166,6 @@ 		UDF_I_LENEATTR(inode) = le32_to_cpu(fe->lengthExtendedAttr); 		UDF_I_LENALLOC(inode) = le32_to_cpu(fe->lengthAllocDescs); 		offset = sizeof(struct fileEntry) + UDF_I_LENEATTR(inode);-		alen = offset + UDF_I_LENALLOC(inode); 	} 	else 	{@@ -1179,7 +1222,6 @@ 		UDF_I_LENEATTR(inode) = le32_to_cpu(efe->lengthExtendedAttr); 		UDF_I_LENALLOC(inode) = le32_to_cpu(efe->lengthAllocDescs); 		offset = sizeof(struct extendedFileEntry) + UDF_I_LENEATTR(inode);-		alen = offset + UDF_I_LENALLOC(inode); 	}  	switch (fe->icbTag.fileType)@@ -1195,6 +1237,7 @@ 		case ICBTAG_FILE_TYPE_REALTIME: 		case ICBTAG_FILE_TYPE_REGULAR: 		case ICBTAG_FILE_TYPE_UNDEF:+		case ICBTAG_FILE_TYPE_VAT20: 		{ 			if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) 				inode->i_data.a_ops = &udf_adinicb_aops;@@ -1220,6 +1263,11 @@ 			init_special_inode(inode, inode->i_mode | S_IFIFO, 0); 			break; 		}+		case ICBTAG_FILE_TYPE_SOCKET:+		{+			init_special_inode(inode, inode->i_mode | S_IFSOCK, 0);+			break;+		} 		case ICBTAG_FILE_TYPE_SYMLINK: 		{ 			inode->i_data.a_ops = &udf_symlink_aops;@@ -1227,6 +1275,10 @@ 			inode->i_mode = S_IFLNK|S_IRWXUGO; 			break; 		}+		case ICBTAG_FILE_TYPE_MAIN:+		case ICBTAG_FILE_TYPE_MIRROR:+		case ICBTAG_FILE_TYPE_BITMAP:+			break; 		default: 		{ 			printk(KERN_ERR "udf: udf_fill_inode(ino %ld) failed unknown file type=%d\n",@@ -1237,18 +1289,16 @@ 	} 	if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) 	{-		struct buffer_head *tbh = NULL; 		struct deviceSpec *dsea = 			(struct deviceSpec *)-				udf_get_extendedattr(inode, 12, 1, &tbh);+				udf_get_extendedattr(inode, 12, 1);  		if (dsea) 		{-			init_special_inode(inode, inode->i_mode,-				((le32_to_cpu(dsea->majorDeviceIdent)) << 8) |-				(le32_to_cpu(dsea->minorDeviceIdent) & 0xFF));+			init_special_inode(inode, inode->i_mode, MKDEV(+				le32_to_cpu(dsea->majorDeviceIdent),+				le32_to_cpu(dsea->minorDeviceIdent))); 			/* Developer ID ??? */-			udf_release_data(tbh); 		} 		else 		{@@ -1325,19 +1375,11 @@ 		udf_debug("bread failure\n"); 		return -EIO; 	}++	memset(bh->b_data, 0x00, inode->i_sb->s_blocksize);+ 	fe = (struct fileEntry *)bh->b_data; 	efe = (struct extendedFileEntry *)bh->b_data;-	if (UDF_I_NEW_INODE(inode) == 1)-	{-		if (UDF_I_EXTENDED_FE(inode) == 0)-			memset(bh->b_data, 0x00, sizeof(struct fileEntry));-		else-			memset(bh->b_data, 0x00, sizeof(struct extendedFileEntry));-		memset(bh->b_data + udf_file_entry_alloc_offset(inode) +-			UDF_I_LENALLOC(inode), 0x0, inode->i_sb->s_blocksize --			udf_file_entry_alloc_offset(inode) - UDF_I_LENALLOC(inode));-		UDF_I_NEW_INODE(inode) = 0;-	}  	if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_USE) 	{@@ -1345,6 +1387,7 @@ 			(struct unallocSpaceEntry *)bh->b_data;  		use->lengthAllocDescs = cpu_to_le32(UDF_I_LENALLOC(inode));+		memcpy(bh->b_data + sizeof(struct unallocSpaceEntry), UDF_I_DATA(inode), inode->i_sb->s_blocksize - sizeof(struct unallocSpaceEntry)); 		crclen = sizeof(struct unallocSpaceEntry) + UDF_I_LENALLOC(inode) - 			sizeof(tag); 		use->descTag.tagLocation = cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum);@@ -1387,17 +1430,16 @@ 	if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) 	{ 		regid *eid;-		struct buffer_head *tbh = NULL; 		struct deviceSpec *dsea = 			(struct deviceSpec *)-				udf_get_extendedattr(inode, 12, 1, &tbh);	+				udf_get_extendedattr(inode, 12, 1);	  		if (!dsea) 		{ 			dsea = (struct deviceSpec *) 				udf_add_extendedattr(inode, 					sizeof(struct deviceSpec) +-					sizeof(regid), 12, 0x3, &tbh);+					sizeof(regid), 12, 0x3); 			dsea->attrType = 12; 			dsea->attrSubtype = 1; 			dsea->attrLength = sizeof(struct deviceSpec) +@@ -1411,12 +1453,11 @@ 		eid->identSuffix[1] = UDF_OS_ID_LINUX; 		dsea->majorDeviceIdent = kdev_t_to_nr(inode->i_rdev) >> 8; 		dsea->minorDeviceIdent = kdev_t_to_nr(inode->i_rdev) & 0xFF;-		mark_buffer_dirty_inode(tbh, inode);-		udf_release_data(tbh); 	} -	if (UDF_I_EXTENDED_FE(inode) == 0)+	if (UDF_I_EFE(inode) == 0) 	{+		memcpy(bh->b_data + sizeof(struct fileEntry), UDF_I_DATA(inode), inode->i_sb->s_blocksize - sizeof(struct fileEntry)); 		fe->logicalBlocksRecorded = cpu_to_le64( 			(inode->i_blocks + (1 << (inode->i_sb->s_blocksize_bits - 9)) - 1) >> 			(inode->i_sb->s_blocksize_bits - 9));@@ -1439,6 +1480,7 @@ 	} 	else 	{+		memcpy(bh->b_data + sizeof(struct extendedFileEntry), UDF_I_DATA(inode), inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry)); 		efe->objectSize = cpu_to_le64(inode->i_size); 		efe->logicalBlocksRecorded = cpu_to_le64( 			(inode->i_blocks + (1 << (inode->i_sb->s_blocksize_bits - 9)) - 1) >>@@ -1507,6 +1549,8 @@ 		fe->icbTag.fileType = ICBTAG_FILE_TYPE_CHAR; 	else if (S_ISFIFO(inode->i_mode)) 		fe->icbTag.fileType = ICBTAG_FILE_TYPE_FIFO;+	else if (S_ISSOCK(inode->i_mode))+		fe->icbTag.fileType = ICBTAG_FILE_TYPE_SOCKET;  	icbflags =	UDF_I_ALLOCTYPE(inode) | 			((inode->i_mode & S_ISUID) ? ICBTAG_FLAG_SETUID : 0) |@@ -1619,17 +1663,12 @@ 	long_ad *lad = NULL; 	struct allocExtDesc *aed; 	int8_t etype;+	uint8_t *ptr; -	if (!(*bh))-	{-		if (!(*bh = udf_tread(inode->i_sb,-			udf_get_lb_pblock(inode->i_sb, *bloc, 0))))-		{-			udf_debug("reading block %d failed!\n",-				udf_get_lb_pblock(inode->i_sb, *bloc, 0));-			return -1;-		}-	}+	if (!*bh)+		ptr = UDF_I_DATA(inode) + *extoffset - udf_file_entry_alloc_offset(inode) + UDF_I_LENEATTR(inode);+	else+		ptr = (*bh)->b_data + *extoffset;  	if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT) 		adsize = sizeof(short_ad);@@ -1645,7 +1684,7 @@ 		int err, loffset; 		lb_addr obloc = *bloc; -		if (!(bloc->logicalBlockNum = udf_new_block(inode->i_sb, inode,+		if (!(bloc->logicalBlockNum = udf_new_block(inode->i_sb, NULL, 			obloc.partitionReferenceNum, obloc.logicalBlockNum, &err))) 		{ 			return -1;@@ -1668,7 +1707,7 @@ 		{ 			loffset = *extoffset; 			aed->lengthAllocDescs = cpu_to_le32(adsize);-			sptr = (*bh)->b_data + *extoffset - adsize;+			sptr = ptr - adsize; 			dptr = nbh->b_data + sizeof(struct allocExtDesc); 			memcpy(dptr, sptr, adsize); 			*extoffset = sizeof(struct allocExtDesc) + adsize;@@ -1677,10 +1716,10 @@ 		{ 			loffset = *extoffset + adsize; 			aed->lengthAllocDescs = cpu_to_le32(0);-			sptr = (*bh)->b_data + *extoffset;+			sptr = ptr; 			*extoffset = sizeof(struct allocExtDesc); -			if (memcmp(&UDF_I_LOCATION(inode), &obloc, sizeof(lb_addr)))+			if (*bh) 			{ 				aed = (struct allocExtDesc *)(*bh)->b_data; 				aed->lengthAllocDescs =@@ -1720,18 +1759,23 @@ 				break; 			} 		}-		if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)-			udf_update_tag((*bh)->b_data, loffset);+		if (*bh)+		{+			if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)+				udf_update_tag((*bh)->b_data, loffset);+			else+				udf_update_tag((*bh)->b_data, sizeof(struct allocExtDesc));+			mark_buffer_dirty_inode(*bh, inode);+			udf_release_data(*bh);+		} 		else-			udf_update_tag((*bh)->b_data, sizeof(struct allocExtDesc));-		mark_buffer_dirty_inode(*bh, inode);-		udf_release_data(*bh);+			mark_inode_dirty(inode); 		*bh = nbh; 	}  	etype = udf_write_aext(inode, *bloc, extoffset, eloc, elen, *bh, inc); -	if (!memcmp(&UDF_I_LOCATION(inode), bloc, sizeof(lb_addr)))+	if (!*bh) 	{ 		UDF_I_LENALLOC(inode) += adsize; 		mark_inode_dirty(inode);@@ -1755,49 +1799,40 @@     lb_addr eloc, uint32_t elen, struct buffer_head *bh, int inc) { 	int adsize;-	short_ad *sad = NULL;-	long_ad *lad = NULL;+	uint8_t *ptr; -	if (!(bh))-	{-		if (!(bh = udf_tread(inode->i_sb,-			udf_get_lb_pblock(inode->i_sb, bloc, 0))))-		{-			udf_debug("reading block %d failed!\n",-				udf_get_lb_pblock(inode->i_sb, bloc, 0));-			return -1;-		}-	}+	if (!bh)+		ptr = UDF_I_DATA(inode) + *extoffset - udf_file_entry_alloc_offset(inode) + UDF_I_LENEATTR(inode); 	else+	{+		ptr = bh->b_data + *extoffset; 		atomic_inc(&bh->b_count);--	if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)-		adsize = sizeof(short_ad);-	else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)-		adsize = sizeof(long_ad);-	else-		return -1;+	}  	switch (UDF_I_ALLOCTYPE(inode)) 	{ 		case ICBTAG_FLAG_AD_SHORT: 		{-			sad = (short_ad *)((bh)->b_data + *extoffset);+			short_ad *sad = (short_ad *)ptr; 			sad->extLength = cpu_to_le32(elen); 			sad->extPosition = cpu_to_le32(eloc.logicalBlockNum);+			adsize = sizeof(short_ad); 			break; 		} 		case ICBTAG_FLAG_AD_LONG: 		{-			lad = (long_ad *)((bh)->b_data + *extoffset);+			long_ad *lad = (long_ad *)ptr; 			lad->extLength = cpu_to_le32(elen); 			lad->extLocation = cpu_to_lelb(eloc); 			memset(lad->impUse, 0x00, sizeof(lad->impUse));+			adsize = sizeof(long_ad); 			break; 		}+		default:+			return -1; 	} -	if (memcmp(&UDF_I_LOCATION(inode), &bloc, sizeof(lb_addr)))+	if (bh) 	{ 		if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201) 		{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -