Lines Matching refs:mydata
147 static int flush_dirty_fat_buffer(fsdata *mydata);
150 int flush_dirty_fat_buffer(fsdata *mydata) in flush_dirty_fat_buffer() argument
152 (void)(mydata); in flush_dirty_fat_buffer()
161 static __u32 get_fatent(fsdata *mydata, __u32 entry) in get_fatent() argument
167 if (CHECK_CLUST(entry, mydata->fatsize)) { in get_fatent()
172 switch (mydata->fatsize) { in get_fatent()
192 mydata->fatsize, entry, entry, offset, offset); in get_fatent()
195 if (bufnum != mydata->fatbufnum) { in get_fatent()
197 __u8 *bufptr = mydata->fatbuf; in get_fatent()
198 __u32 fatlength = mydata->fatlength; in get_fatent()
205 startblock += mydata->fat_sect; /* Offset from start of disk */ in get_fatent()
208 if (flush_dirty_fat_buffer(mydata) < 0) in get_fatent()
215 mydata->fatbufnum = bufnum; in get_fatent()
219 switch (mydata->fatsize) { in get_fatent()
221 ret = FAT2CPU32(((__u32 *) mydata->fatbuf)[offset]); in get_fatent()
224 ret = FAT2CPU16(((__u16 *) mydata->fatbuf)[offset]); in get_fatent()
229 ret = mydata->fatbuf[off8] + (mydata->fatbuf[off8 + 1] << 8); in get_fatent()
236 mydata->fatsize, ret, entry, offset); in get_fatent()
246 get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size) in get_cluster() argument
253 startsect = clust_to_sect(mydata, clustnum); in get_cluster()
255 startsect = mydata->rootdir_sect; in get_cluster()
261 ALLOC_CACHE_ALIGN_BUFFER(__u8, tmpbuf, mydata->sect_size); in get_cluster()
265 while (size >= mydata->sect_size) { in get_cluster()
272 memcpy(buffer, tmpbuf, mydata->sect_size); in get_cluster()
273 buffer += mydata->sect_size; in get_cluster()
274 size -= mydata->sect_size; in get_cluster()
277 idx = size / mydata->sect_size; in get_cluster()
284 idx *= mydata->sect_size; in get_cluster()
289 ALLOC_CACHE_ALIGN_BUFFER(__u8, tmpbuf, mydata->sect_size); in get_cluster()
311 static int get_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, in get_contents() argument
315 unsigned int bytesperclust = mydata->clust_size * mydata->sect_size; in get_contents()
337 curclust = get_fatent(mydata, curclust); in get_contents()
338 if (CHECK_CLUST(curclust, mydata->fatsize)) { in get_contents()
354 if (get_cluster(mydata, curclust, get_contents_vfatname_block, in get_contents()
367 curclust = get_fatent(mydata, curclust); in get_contents()
368 if (CHECK_CLUST(curclust, mydata->fatsize)) { in get_contents()
381 newclust = get_fatent(mydata, endclust); in get_contents()
384 if (CHECK_CLUST(newclust, mydata->fatsize)) { in get_contents()
395 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) { in get_contents()
402 if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) { in get_contents()
410 curclust = get_fatent(mydata, endclust); in get_contents()
411 if (CHECK_CLUST(curclust, mydata->fatsize)) { in get_contents()
547 static int get_fs_info(fsdata *mydata) in get_fs_info() argument
553 ret = read_bootsectandvi(&bs, &volinfo, &mydata->fatsize); in get_fs_info()
559 if (mydata->fatsize == 32) { in get_fs_info()
560 mydata->fatlength = bs.fat32_length; in get_fs_info()
562 mydata->fatlength = bs.fat_length; in get_fs_info()
565 mydata->fat_sect = bs.reserved; in get_fs_info()
567 mydata->rootdir_sect = mydata->fat_sect + mydata->fatlength * bs.fats; in get_fs_info()
569 mydata->sect_size = (bs.sector_size[1] << 8) + bs.sector_size[0]; in get_fs_info()
570 mydata->clust_size = bs.cluster_size; in get_fs_info()
571 if (mydata->sect_size != cur_part_info.blksz) { in get_fs_info()
573 mydata->sect_size, cur_part_info.blksz); in get_fs_info()
577 if (mydata->fatsize == 32) { in get_fs_info()
578 mydata->data_begin = mydata->rootdir_sect - in get_fs_info()
579 (mydata->clust_size * 2); in get_fs_info()
580 mydata->root_cluster = bs.root_cluster; in get_fs_info()
582 mydata->rootdir_size = ((bs.dir_entries[1] * (int)256 + in get_fs_info()
585 mydata->sect_size; in get_fs_info()
586 mydata->data_begin = mydata->rootdir_sect + in get_fs_info()
587 mydata->rootdir_size - in get_fs_info()
588 (mydata->clust_size * 2); in get_fs_info()
589 mydata->root_cluster = in get_fs_info()
590 sect_to_clust(mydata, mydata->rootdir_sect); in get_fs_info()
593 mydata->fatbufnum = -1; in get_fs_info()
594 mydata->fat_dirty = 0; in get_fs_info()
595 mydata->fatbuf = malloc_cache_aligned(FATBUFSIZE); in get_fs_info()
596 if (mydata->fatbuf == NULL) { in get_fs_info()
602 mydata->fatsize, mydata->fat_sect, mydata->fatlength); in get_fs_info()
605 mydata->root_cluster, in get_fs_info()
606 mydata->rootdir_sect, in get_fs_info()
607 mydata->rootdir_sect * mydata->sect_size, mydata->data_begin); in get_fs_info()
608 debug("Sector size: %d, cluster size: %d\n", mydata->sect_size, in get_fs_info()
609 mydata->clust_size); in get_fs_info()
695 fsdata *mydata = parent->fsdata; /* for silly macros */ in fat_itr_child() local
715 fsdata *mydata = itr->fsdata; /* for silly macros */ in next_cluster() local