linux/fs/exfat/dir.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2012-2013 Samsung Electronics Co., Ltd.
 */

#include <linux/slab.h>
#include <linux/compat.h>
#include <linux/bio.h>
#include <linux/buffer_head.h>

#include "exfat_raw.h"
#include "exfat_fs.h"

static int exfat_extract_uni_name(struct exfat_dentry *ep,
		unsigned short *uniname)
{}

static int exfat_get_uniname_from_ext_entry(struct super_block *sb,
		struct exfat_chain *p_dir, int entry, unsigned short *uniname)
{}

/* read a directory entry from the opened directory */
static int exfat_readdir(struct inode *inode, loff_t *cpos, struct exfat_dir_entry *dir_entry)
{}

static void exfat_init_namebuf(struct exfat_dentry_namebuf *nb)
{}

static int exfat_alloc_namebuf(struct exfat_dentry_namebuf *nb)
{}

static void exfat_free_namebuf(struct exfat_dentry_namebuf *nb)
{}

/*
 * Before calling dir_emit*(), sbi->s_lock should be released
 * because page fault can occur in dir_emit*().
 */
#define ITER_POS_FILLED_DOTS
static int exfat_iterate(struct file *file, struct dir_context *ctx)
{}

WRAP_DIR_ITER() // FIXME!
const struct file_operations exfat_dir_operations =;

int exfat_alloc_new_dir(struct inode *inode, struct exfat_chain *clu)
{}

int exfat_calc_num_entries(struct exfat_uni_name *p_uniname)
{}

unsigned int exfat_get_entry_type(struct exfat_dentry *ep)
{}

static void exfat_set_entry_type(struct exfat_dentry *ep, unsigned int type)
{}

static void exfat_init_stream_entry(struct exfat_dentry *ep,
		unsigned int start_clu, unsigned long long size)
{}

static void exfat_init_name_entry(struct exfat_dentry *ep,
		unsigned short *uniname)
{}

void exfat_init_dir_entry(struct exfat_entry_set_cache *es,
		unsigned int type, unsigned int start_clu,
		unsigned long long size, struct timespec64 *ts)
{}

static void exfat_free_benign_secondary_clusters(struct inode *inode,
		struct exfat_dentry *ep)
{}

void exfat_init_ext_entry(struct exfat_entry_set_cache *es, int num_entries,
		struct exfat_uni_name *p_uniname)
{}

void exfat_remove_entries(struct inode *inode, struct exfat_entry_set_cache *es,
		int order)
{}

void exfat_update_dir_chksum(struct exfat_entry_set_cache *es)
{}

int exfat_put_dentry_set(struct exfat_entry_set_cache *es, int sync)
{}

static int exfat_walk_fat_chain(struct super_block *sb,
		struct exfat_chain *p_dir, unsigned int byte_offset,
		unsigned int *clu)
{}

static int exfat_find_location(struct super_block *sb, struct exfat_chain *p_dir,
			       int entry, sector_t *sector, int *offset)
{}

#define EXFAT_MAX_RA_SIZE
static int exfat_dir_readahead(struct super_block *sb, sector_t sec)
{}

struct exfat_dentry *exfat_get_dentry(struct super_block *sb,
		struct exfat_chain *p_dir, int entry, struct buffer_head **bh)
{}

enum exfat_validate_dentry_mode {};

static bool exfat_validate_entry(unsigned int type,
		enum exfat_validate_dentry_mode *mode)
{}

struct exfat_dentry *exfat_get_dentry_cached(
	struct exfat_entry_set_cache *es, int num)
{}

/*
 * Returns a set of dentries.
 *
 * Note It provides a direct pointer to bh->data via exfat_get_dentry_cached().
 * User should call exfat_get_dentry_set() after setting 'modified' to apply
 * changes made in this entry set to the real device.
 *
 * in:
 *   sb+p_dir+entry: indicates a file/dir
 *   num_entries: specifies how many dentries should be included.
 *                It will be set to es->num_entries if it is not 0.
 *                If num_entries is 0, es->num_entries will be obtained
 *                from the first dentry.
 * out:
 *   es: pointer of entry set on success.
 * return:
 *   0 on success
 *   -error code on failure
 */
static int __exfat_get_dentry_set(struct exfat_entry_set_cache *es,
		struct super_block *sb, struct exfat_chain *p_dir, int entry,
		unsigned int num_entries)
{}

int exfat_get_dentry_set(struct exfat_entry_set_cache *es,
		struct super_block *sb, struct exfat_chain *p_dir,
		int entry, unsigned int num_entries)
{}

static int exfat_validate_empty_dentry_set(struct exfat_entry_set_cache *es)
{}

/*
 * Get an empty dentry set.
 *
 * in:
 *   sb+p_dir+entry: indicates the empty dentry location
 *   num_entries: specifies how many empty dentries should be included.
 * out:
 *   es: pointer of empty dentry set on success.
 * return:
 *   0  : on success
 *   >0 : the dentries are not empty, the return value is the number of
 *        dentries to be skipped for the next lookup.
 *   <0 : on failure
 */
int exfat_get_empty_dentry_set(struct exfat_entry_set_cache *es,
		struct super_block *sb, struct exfat_chain *p_dir,
		int entry, unsigned int num_entries)
{}

static inline void exfat_reset_empty_hint(struct exfat_hint_femp *hint_femp)
{}

static inline void exfat_set_empty_hint(struct exfat_inode_info *ei,
		struct exfat_hint_femp *candi_empty, struct exfat_chain *clu,
		int dentry, int num_entries, int entry_type)
{}

enum {};

/*
 * @ei:         inode info of parent directory
 * @p_dir:      directory structure of parent directory
 * @num_entries:entry size of p_uniname
 * @hint_opt:   If p_uniname is found, filled with optimized dir/entry
 *              for traversing cluster chain.
 * @return:
 *   >= 0:      file directory entry position where the name exists
 *   -ENOENT:   entry with the name does not exist
 *   -EIO:      I/O error
 */
int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei,
		struct exfat_chain *p_dir, struct exfat_uni_name *p_uniname,
		struct exfat_hint *hint_opt)
{}

int exfat_count_dir_entries(struct super_block *sb, struct exfat_chain *p_dir)
{}