linux/fs/fat/inode.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  linux/fs/fat/inode.c
 *
 *  Written 1992,1993 by Werner Almesberger
 *  VFAT extensions by Gordon Chaffee, merged with msdos fs by Henrik Storner
 *  Rewritten for the constant inumbers support by Al Viro
 *
 *  Fixes:
 *
 *	Max Cohan: Fixed invalid FSINFO offset when info_sector is 0
 */

#include <linux/module.h>
#include <linux/pagemap.h>
#include <linux/mpage.h>
#include <linux/vfs.h>
#include <linux/seq_file.h>
#include <linux/uio.h>
#include <linux/blkdev.h>
#include <linux/backing-dev.h>
#include <asm/unaligned.h>
#include <linux/random.h>
#include <linux/iversion.h>
#include "fat.h"

#ifndef CONFIG_FAT_DEFAULT_IOCHARSET
/* if user don't select VFAT, this is undefined. */
#define CONFIG_FAT_DEFAULT_IOCHARSET
#endif

#define KB_IN_SECTORS

/* DOS dates from 1980/1/1 through 2107/12/31 */
#define FAT_DATE_MIN
#define FAT_DATE_MAX
#define FAT_TIME_MAX

/*
 * A deserialized copy of the on-disk structure laid out in struct
 * fat_boot_sector.
 */
struct fat_bios_param_block {};

static int fat_default_codepage =;
static char fat_default_iocharset[] =;

static struct fat_floppy_defaults {} floppy_defaults[] =;

int fat_add_cluster(struct inode *inode)
{}

static inline int __fat_get_block(struct inode *inode, sector_t iblock,
				  unsigned long *max_blocks,
				  struct buffer_head *bh_result, int create)
{}

static int fat_get_block(struct inode *inode, sector_t iblock,
			 struct buffer_head *bh_result, int create)
{}

static int fat_writepages(struct address_space *mapping,
			  struct writeback_control *wbc)
{}

static int fat_read_folio(struct file *file, struct folio *folio)
{}

static void fat_readahead(struct readahead_control *rac)
{}

static void fat_write_failed(struct address_space *mapping, loff_t to)
{}

static int fat_write_begin(struct file *file, struct address_space *mapping,
			loff_t pos, unsigned len,
			struct page **pagep, void **fsdata)
{}

static int fat_write_end(struct file *file, struct address_space *mapping,
			loff_t pos, unsigned len, unsigned copied,
			struct page *pagep, void *fsdata)
{}

static ssize_t fat_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
{}

static int fat_get_block_bmap(struct inode *inode, sector_t iblock,
		struct buffer_head *bh_result, int create)
{}

static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
{}

/*
 * fat_block_truncate_page() zeroes out a mapping from file offset `from'
 * up to the end of the block which corresponds to `from'.
 * This is required during truncate to physically zeroout the tail end
 * of that block so it doesn't yield old data if the file is later grown.
 * Also, avoid causing failure from fsx for cases of "data past EOF"
 */
int fat_block_truncate_page(struct inode *inode, loff_t from)
{}

static const struct address_space_operations fat_aops =;

/*
 * New FAT inode stuff. We do the following:
 *	a) i_ino is constant and has nothing with on-disk location.
 *	b) FAT manages its own cache of directory entries.
 *	c) *This* cache is indexed by on-disk location.
 *	d) inode has an associated directory entry, all right, but
 *		it may be unhashed.
 *	e) currently entries are stored within struct inode. That should
 *		change.
 *	f) we deal with races in the following way:
 *		1. readdir() and lookup() do FAT-dir-cache lookup.
 *		2. rename() unhashes the F-d-c entry and rehashes it in
 *			a new place.
 *		3. unlink() and rmdir() unhash F-d-c entry.
 *		4. fat_write_inode() checks whether the thing is unhashed.
 *			If it is we silently return. If it isn't we do bread(),
 *			check if the location is still valid and retry if it
 *			isn't. Otherwise we do changes.
 *		5. Spinlock is used to protect hash/unhash/location check/lookup
 *		6. fat_evict_inode() unhashes the F-d-c entry.
 *		7. lookup() and readdir() do igrab() if they find a F-d-c entry
 *			and consider negative result as cache miss.
 */

static void fat_hash_init(struct super_block *sb)
{}

static inline unsigned long fat_hash(loff_t i_pos)
{}

static void dir_hash_init(struct super_block *sb)
{}

void fat_attach(struct inode *inode, loff_t i_pos)
{}
EXPORT_SYMBOL_GPL();

void fat_detach(struct inode *inode)
{}
EXPORT_SYMBOL_GPL();

struct inode *fat_iget(struct super_block *sb, loff_t i_pos)
{}

static int is_exec(unsigned char *extension)
{}

static int fat_calc_dir_size(struct inode *inode)
{}

static int fat_validate_dir(struct inode *dir)
{}

/* doesn't deal with root inode */
int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
{}

static inline void fat_lock_build_inode(struct msdos_sb_info *sbi)
{}

static inline void fat_unlock_build_inode(struct msdos_sb_info *sbi)
{}

struct inode *fat_build_inode(struct super_block *sb,
			struct msdos_dir_entry *de, loff_t i_pos)
{}

EXPORT_SYMBOL_GPL();

static int __fat_write_inode(struct inode *inode, int wait);

static void fat_free_eofblocks(struct inode *inode)
{}

static void fat_evict_inode(struct inode *inode)
{}

static void fat_set_state(struct super_block *sb,
			unsigned int set, unsigned int force)
{}

static void fat_reset_iocharset(struct fat_mount_options *opts)
{}

static void delayed_free(struct rcu_head *p)
{}

static void fat_put_super(struct super_block *sb)
{}

static struct kmem_cache *fat_inode_cachep;

static struct inode *fat_alloc_inode(struct super_block *sb)
{}

static void fat_free_inode(struct inode *inode)
{}

static void init_once(void *foo)
{}

static int __init fat_init_inodecache(void)
{}

static void __exit fat_destroy_inodecache(void)
{}

int fat_reconfigure(struct fs_context *fc)
{}
EXPORT_SYMBOL_GPL();

static int fat_statfs(struct dentry *dentry, struct kstatfs *buf)
{}

static int __fat_write_inode(struct inode *inode, int wait)
{}

static int fat_write_inode(struct inode *inode, struct writeback_control *wbc)
{}

int fat_sync_inode(struct inode *inode)
{}

EXPORT_SYMBOL_GPL();

static int fat_show_options(struct seq_file *m, struct dentry *root);
static const struct super_operations fat_sops =;

static int fat_show_options(struct seq_file *m, struct dentry *root)
{}

enum {};

static const struct constant_table fat_param_check[] =;

static const struct constant_table fat_param_tz[] =;

static const struct constant_table fat_param_errors[] =;


static const struct constant_table fat_param_nfs[] =;

/*
 * These are all obsolete but we still reject invalid options.
 * The corresponding values are therefore meaningless.
 */
static const struct constant_table fat_param_conv[] =;

/* Core options. See below for vfat and msdos extras */
const struct fs_parameter_spec fat_param_spec[] =;
EXPORT_SYMBOL_GPL();

static const struct fs_parameter_spec msdos_param_spec[] =;

static const struct constant_table fat_param_shortname[] =;

static const struct fs_parameter_spec vfat_param_spec[] =;

int fat_parse_param(struct fs_context *fc, struct fs_parameter *param,
			   bool is_vfat)
{}
EXPORT_SYMBOL_GPL();

static int fat_read_root(struct inode *inode)
{}

static unsigned long calc_fat_clusters(struct super_block *sb)
{}

static bool fat_bpb_is_zero(struct fat_boot_sector *b)
{}

static int fat_read_bpb(struct super_block *sb, struct fat_boot_sector *b,
	int silent, struct fat_bios_param_block *bpb)
{}

static int fat_read_static_bpb(struct super_block *sb,
	struct fat_boot_sector *b, int silent,
	struct fat_bios_param_block *bpb)
{}

/*
 * Read the super block of an MS-DOS FS.
 */
int fat_fill_super(struct super_block *sb, struct fs_context *fc,
		   void (*setup)(struct super_block *))
{}

EXPORT_SYMBOL_GPL();

/*
 * helper function for fat_flush_inodes.  This writes both the inode
 * and the file data blocks, waiting for in flight data blocks before
 * the start of the call.  It does not wait for any io started
 * during the call
 */
static int writeback_inode(struct inode *inode)
{}

/*
 * write data and metadata corresponding to i1 and i2.  The io is
 * started but we do not wait for any of it to finish.
 *
 * filemap_flush is used for the block device, so if there is a dirty
 * page for a block already in flight, we will not wait and start the
 * io over again
 */
int fat_flush_inodes(struct super_block *sb, struct inode *i1, struct inode *i2)
{}
EXPORT_SYMBOL_GPL();

int fat_init_fs_context(struct fs_context *fc, bool is_vfat)
{}
EXPORT_SYMBOL_GPL();

void fat_free_fc(struct fs_context *fc)
{}
EXPORT_SYMBOL_GPL();

static int __init init_fat_fs(void)
{}

static void __exit exit_fat_fs(void)
{}

module_init()
module_exit()

MODULE_DESCRIPTION();
MODULE_LICENSE();