Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * dir.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * PURPOSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Directory handling routines for the OSTA-UDF(tm) filesystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * COPYRIGHT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *	This file is distributed under the terms of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *	License (GPL). Copies of the GPL can be obtained from:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *		ftp://prep.ai.mit.edu/pub/gnu/GPL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *	Each contributing author retains all rights to their own work.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *  (C) 1998-2004 Ben Fennema
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * HISTORY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *  10/05/98 dgb  Split directory operations into its own file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *                Implemented directory reads via do_udf_readdir
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *  10/06/98      Made directory operations work!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *  11/17/98      Rewrote directory to support ICBTAG_FLAG_AD_LONG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *  11/25/98 blf  Rewrote directory handling (readdir+lookup) to support reading
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *                across blocks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *  12/12/98      Split out the lookup code to namei.c. bulk of directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *                code now in directory.c:udf_fileident_read.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include "udfdecl.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <linux/bio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <linux/iversion.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include "udf_i.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include "udf_sb.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) static int udf_readdir(struct file *file, struct dir_context *ctx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	struct inode *dir = file_inode(file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	struct udf_inode_info *iinfo = UDF_I(dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	struct udf_fileident_bh fibh = { .sbh = NULL, .ebh = NULL};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	struct fileIdentDesc *fi = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	struct fileIdentDesc cfi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	udf_pblk_t block, iblock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	loff_t nf_pos, emit_pos = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	int flen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	unsigned char *fname = NULL, *copy_name = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	unsigned char *nameptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	uint16_t liu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	uint8_t lfi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	loff_t size = udf_ext0_offset(dir) + dir->i_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	struct buffer_head *tmp, *bha[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	struct kernel_lb_addr eloc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	uint32_t elen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	sector_t offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	int i, num, ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	struct extent_position epos = { NULL, 0, {0, 0} };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	struct super_block *sb = dir->i_sb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	bool pos_valid = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	if (ctx->pos == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		if (!dir_emit_dot(file, ctx))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 			return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		ctx->pos = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	nf_pos = (ctx->pos - 1) << 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	if (nf_pos >= size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	 * Something changed since last readdir (either lseek was called or dir
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	 * changed)?  We need to verify the position correctly points at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	 * beginning of some dir entry so that the directory parsing code does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	 * not get confused. Since UDF does not have any reliable way of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	 * identifying beginning of dir entry (names are under user control),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	 * we need to scan the directory from the beginning.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	if (!inode_eq_iversion(dir, file->f_version)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		emit_pos = nf_pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		nf_pos = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		pos_valid = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	fname = kmalloc(UDF_NAME_LEN, GFP_NOFS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	if (!fname) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	if (nf_pos == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		nf_pos = udf_ext0_offset(dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	fibh.soffset = fibh.eoffset = nf_pos & (sb->s_blocksize - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		if (inode_bmap(dir, nf_pos >> sb->s_blocksize_bits,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		    &epos, &eloc, &elen, &offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		    != (EXT_RECORDED_ALLOCATED >> 30)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 			ret = -ENOENT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		block = udf_get_lb_pblock(sb, &eloc, offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		if ((++offset << sb->s_blocksize_bits) < elen) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 			if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 				epos.offset -= sizeof(struct short_ad);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			else if (iinfo->i_alloc_type ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 					ICBTAG_FLAG_AD_LONG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 				epos.offset -= sizeof(struct long_ad);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 			offset = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		if (!(fibh.sbh = fibh.ebh = udf_tread(sb, block))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			ret = -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		if (!(offset & ((16 >> (sb->s_blocksize_bits - 9)) - 1))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 			i = 16 >> (sb->s_blocksize_bits - 9);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			if (i + offset > (elen >> sb->s_blocksize_bits))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 				i = (elen >> sb->s_blocksize_bits) - offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			for (num = 0; i > 0; i--) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 				block = udf_get_lb_pblock(sb, &eloc, offset + i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 				tmp = udf_tgetblk(sb, block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 				if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 					bha[num++] = tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 				else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 					brelse(tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 			if (num) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 				ll_rw_block(REQ_OP_READ, REQ_RAHEAD, num, bha);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 				for (i = 0; i < num; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 					brelse(bha[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	while (nf_pos < size) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		struct kernel_lb_addr tloc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		loff_t cur_pos = nf_pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		/* Update file position only if we got past the current one */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		if (nf_pos >= emit_pos) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 			ctx->pos = (nf_pos >> 2) + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 			pos_valid = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 					&elen, &offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		if (!fi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		/* Still not at offset where user asked us to read from? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		if (cur_pos < emit_pos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		liu = le16_to_cpu(cfi.lengthOfImpUse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		lfi = cfi.lengthFileIdent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		if (fibh.sbh == fibh.ebh) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 			nameptr = fi->fileIdent + liu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 			int poffset;	/* Unpaded ending offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 			poffset = fibh.soffset + sizeof(struct fileIdentDesc) + liu + lfi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 			if (poffset >= lfi) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 				nameptr = (char *)(fibh.ebh->b_data + poffset - lfi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 			} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 				if (!copy_name) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 					copy_name = kmalloc(UDF_NAME_LEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 							    GFP_NOFS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 					if (!copy_name) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 						ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 						goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 					}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 				nameptr = copy_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 				memcpy(nameptr, fi->fileIdent + liu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 				       lfi - poffset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 				memcpy(nameptr + lfi - poffset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 				       fibh.ebh->b_data, poffset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		if ((cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 			if (!UDF_QUERY_FLAG(sb, UDF_FLAG_UNDELETE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 				continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		if ((cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			if (!UDF_QUERY_FLAG(sb, UDF_FLAG_UNHIDE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 				continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		if (cfi.fileCharacteristics & FID_FILE_CHAR_PARENT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 			if (!dir_emit_dotdot(file, ctx))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 				goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		if (flen < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		tloc = lelb_to_cpu(cfi.icb.extLocation);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		iblock = udf_get_lb_pblock(sb, &tloc, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		if (!dir_emit(ctx, fname, flen, iblock, DT_UNKNOWN))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	} /* end while */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	ctx->pos = (nf_pos >> 2) + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	pos_valid = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	if (pos_valid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		file->f_version = inode_query_iversion(dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	if (fibh.sbh != fibh.ebh)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		brelse(fibh.ebh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	brelse(fibh.sbh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	brelse(epos.bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	kfree(fname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	kfree(copy_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) /* readdir and lookup functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) const struct file_operations udf_dir_operations = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	.llseek			= generic_file_llseek,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	.read			= generic_read_dir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	.iterate_shared		= udf_readdir,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	.unlocked_ioctl		= udf_ioctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	.fsync			= generic_file_fsync,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) };