linux/fs/zonefs/zonefs.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Simple zone file system for zoned block devices.
 *
 * Copyright (C) 2019 Western Digital Corporation or its affiliates.
 */
#ifndef __ZONEFS_H__
#define __ZONEFS_H__

#include <linux/fs.h>
#include <linux/magic.h>
#include <linux/uuid.h>
#include <linux/mutex.h>
#include <linux/rwsem.h>
#include <linux/kobject.h>

/*
 * Maximum length of file names: this only needs to be large enough to fit
 * the zone group directory names and a decimal zone number for file names.
 * 16 characters is plenty.
 */
#define ZONEFS_NAME_MAX

/*
 * Zone types: ZONEFS_ZTYPE_SEQ is used for all sequential zone types
 * defined in linux/blkzoned.h, that is, BLK_ZONE_TYPE_SEQWRITE_REQ and
 * BLK_ZONE_TYPE_SEQWRITE_PREF.
 */
enum zonefs_ztype {};

static inline enum zonefs_ztype zonefs_zone_type(struct blk_zone *zone)
{}

#define ZONEFS_ZONE_INIT_MODE
#define ZONEFS_ZONE_OPEN
#define ZONEFS_ZONE_ACTIVE
#define ZONEFS_ZONE_OFFLINE
#define ZONEFS_ZONE_READONLY
#define ZONEFS_ZONE_CNV

/*
 * In-memory per-file inode zone data.
 */
struct zonefs_zone {};

/*
 * In memory zone group information: all zones of a group are exposed
 * as files, one file per zone.
 */
struct zonefs_zone_group {};

/*
 * In-memory inode data.
 */
struct zonefs_inode_info {};

static inline struct zonefs_inode_info *ZONEFS_I(struct inode *inode)
{}

static inline bool zonefs_zone_is_cnv(struct zonefs_zone *z)
{}

static inline bool zonefs_zone_is_seq(struct zonefs_zone *z)
{}

static inline struct zonefs_zone *zonefs_inode_zone(struct inode *inode)
{}

static inline bool zonefs_inode_is_cnv(struct inode *inode)
{}

static inline bool zonefs_inode_is_seq(struct inode *inode)
{}

/*
 * On-disk super block (block 0).
 */
#define ZONEFS_LABEL_LEN
#define ZONEFS_UUID_SIZE
#define ZONEFS_SUPER_SIZE

struct zonefs_super {} __packed;

/*
 * Feature flags: specified in the s_features field of the on-disk super
 * block struct zonefs_super and in-memory in the s_feartures field of
 * struct zonefs_sb_info.
 */
enum zonefs_features {};

#define ZONEFS_F_DEFINED_FEATURES

/*
 * Mount options for zone write pointer error handling.
 */
#define ZONEFS_MNTOPT_ERRORS_RO
#define ZONEFS_MNTOPT_ERRORS_ZRO
#define ZONEFS_MNTOPT_ERRORS_ZOL
#define ZONEFS_MNTOPT_ERRORS_REPAIR
#define ZONEFS_MNTOPT_ERRORS_MASK
#define ZONEFS_MNTOPT_EXPLICIT_OPEN

/*
 * In-memory Super block information.
 */
struct zonefs_sb_info {};

static inline struct zonefs_sb_info *ZONEFS_SB(struct super_block *sb)
{}

#define zonefs_info(sb, format, args...)
#define zonefs_err(sb, format, args...)
#define zonefs_warn(sb, format, args...)

/* In super.c */
void zonefs_inode_account_active(struct inode *inode);
int zonefs_inode_zone_mgmt(struct inode *inode, enum req_op op);
void zonefs_i_size_write(struct inode *inode, loff_t isize);
void zonefs_update_stats(struct inode *inode, loff_t new_isize);
void __zonefs_io_error(struct inode *inode, bool write);

static inline void zonefs_io_error(struct inode *inode, bool write)
{}

/* In super.c */
extern const struct inode_operations zonefs_dir_inode_operations;
extern const struct file_operations zonefs_dir_operations;

/* In file.c */
extern const struct address_space_operations zonefs_file_aops;
extern const struct file_operations zonefs_file_operations;
int zonefs_file_truncate(struct inode *inode, loff_t isize);

/* In sysfs.c */
int zonefs_sysfs_register(struct super_block *sb);
void zonefs_sysfs_unregister(struct super_block *sb);
int zonefs_sysfs_init(void);
void zonefs_sysfs_exit(void);

#endif