#include <linux/slab.h>
#include <linux/compat.h>
#include <linux/uaccess.h>
#include <linux/iversion.h>
#include "fat.h"
#define FAT_MAX_SHORT_SIZE …
#define FAT_MAX_UNI_CHARS …
#define FAT_MAX_UNI_SIZE …
static inline unsigned char fat_tolower(unsigned char c)
{ … }
static inline loff_t fat_make_i_pos(struct super_block *sb,
struct buffer_head *bh,
struct msdos_dir_entry *de)
{ … }
static inline void fat_dir_readahead(struct inode *dir, sector_t iblock,
sector_t phys)
{ … }
static int fat__get_entry(struct inode *dir, loff_t *pos,
struct buffer_head **bh, struct msdos_dir_entry **de)
{ … }
static inline int fat_get_entry(struct inode *dir, loff_t *pos,
struct buffer_head **bh,
struct msdos_dir_entry **de)
{ … }
static int uni16_to_x8(struct super_block *sb, unsigned char *ascii,
const wchar_t *uni, int len, struct nls_table *nls)
{ … }
static inline int fat_uni_to_x8(struct super_block *sb, const wchar_t *uni,
unsigned char *buf, int size)
{ … }
static inline int
fat_short2uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *uni)
{ … }
static inline int
fat_short2lower_uni(struct nls_table *t, unsigned char *c,
int clen, wchar_t *uni)
{ … }
static inline int
fat_shortname2uni(struct nls_table *nls, unsigned char *buf, int buf_size,
wchar_t *uni_buf, unsigned short opt, int lower)
{ … }
static inline int fat_name_match(struct msdos_sb_info *sbi,
const unsigned char *a, int a_len,
const unsigned char *b, int b_len)
{ … }
enum { … };
static int fat_parse_long(struct inode *dir, loff_t *pos,
struct buffer_head **bh, struct msdos_dir_entry **de,
wchar_t **unicode, unsigned char *nr_slots)
{ … }
static int fat_parse_short(struct super_block *sb,
const struct msdos_dir_entry *de,
unsigned char *name, int dot_hidden)
{ … }
int fat_search_long(struct inode *inode, const unsigned char *name,
int name_len, struct fat_slot_info *sinfo)
{ … }
EXPORT_SYMBOL_GPL(…);
struct fat_ioctl_filldir_callback { … };
static int __fat_readdir(struct inode *inode, struct file *file,
struct dir_context *ctx, int short_only,
struct fat_ioctl_filldir_callback *both)
{ … }
static int fat_readdir(struct file *file, struct dir_context *ctx)
{ … }
#define FAT_IOCTL_FILLDIR_FUNC(func, dirent_type) …
FAT_IOCTL_FILLDIR_FUNC(fat_ioctl_filldir, __fat_dirent)
static int fat_ioctl_readdir(struct inode *inode, struct file *file,
void __user *dirent, filldir_t filldir,
int short_only, int both)
{ … }
static long fat_dir_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{ … }
#ifdef CONFIG_COMPAT
#define VFAT_IOCTL_READDIR_BOTH32 …
#define VFAT_IOCTL_READDIR_SHORT32 …
FAT_IOCTL_FILLDIR_FUNC(fat_compat_ioctl_filldir, compat_dirent)
static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd,
unsigned long arg)
{ … }
#endif
const struct file_operations fat_dir_operations = …;
static int fat_get_short_entry(struct inode *dir, loff_t *pos,
struct buffer_head **bh,
struct msdos_dir_entry **de)
{ … }
int fat_get_dotdot_entry(struct inode *dir, struct buffer_head **bh,
struct msdos_dir_entry **de)
{ … }
EXPORT_SYMBOL_GPL(…);
int fat_dir_empty(struct inode *dir)
{ … }
EXPORT_SYMBOL_GPL(…);
int fat_subdirs(struct inode *dir)
{ … }
int fat_scan(struct inode *dir, const unsigned char *name,
struct fat_slot_info *sinfo)
{ … }
EXPORT_SYMBOL_GPL(…);
int fat_scan_logstart(struct inode *dir, int i_logstart,
struct fat_slot_info *sinfo)
{ … }
static int __fat_remove_entries(struct inode *dir, loff_t pos, int nr_slots)
{ … }
int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo)
{ … }
EXPORT_SYMBOL_GPL(…);
static int fat_zeroed_cluster(struct inode *dir, sector_t blknr, int nr_used,
struct buffer_head **bhs, int nr_bhs)
{ … }
int fat_alloc_new_dir(struct inode *dir, struct timespec64 *ts)
{ … }
EXPORT_SYMBOL_GPL(…);
static int fat_add_new_entries(struct inode *dir, void *slots, int nr_slots,
int *nr_cluster, struct msdos_dir_entry **de,
struct buffer_head **bh, loff_t *i_pos)
{ … }
int fat_add_entries(struct inode *dir, void *slots, int nr_slots,
struct fat_slot_info *sinfo)
{ … }
EXPORT_SYMBOL_GPL(…);