Commit 90c1d0fe authored by Christoph Hellwig's avatar Christoph Hellwig

Move sysvfs incore data from include/linux/sysv_fs.h to fs/sysv/sysv.h.

parent 93f7c8dc
......@@ -19,9 +19,8 @@
* This file contains code for allocating/freeing blocks.
*/
#include <linux/fs.h>
#include <linux/sysv_fs.h>
#include <linux/locks.h>
#include "sysv.h"
/* We don't trust the value of
sb->sv_sbd2->s_tfree = *sb->sv_free_blocks
......
......@@ -13,9 +13,8 @@
* SystemV/Coherent directory handling functions
*/
#include <linux/fs.h>
#include <linux/sysv_fs.h>
#include <linux/pagemap.h>
#include "sysv.h"
static int sysv_readdir(struct file *, void *, filldir_t);
......
......@@ -13,8 +13,7 @@
* SystemV/Coherent regular file handling primitives
*/
#include <linux/fs.h>
#include <linux/sysv_fs.h>
#include "sysv.h"
/*
* We have mostly NULLs here: the current defaults are OK for
......
......@@ -20,12 +20,11 @@
*/
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/sysv_fs.h>
#include <linux/stddef.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/locks.h>
#include "sysv.h"
/* We don't trust the value of
sb->sv_sbd2->s_tinode = *sb->sv_sb_total_free_inodes
......
......@@ -21,14 +21,13 @@
* the superblock.
*/
#include <linux/fs.h>
#include <linux/sysv_fs.h>
#include <linux/locks.h>
#include <linux/smp_lock.h>
#include <linux/highuid.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <asm/byteorder.h>
#include "sysv.h"
/* This is only called on sync() and umount(), when s_dirt=1. */
static void sysv_write_super(struct super_block *sb)
......
......@@ -5,10 +5,9 @@
* AV, Sep--Dec 2000
*/
#include <linux/fs.h>
#include <linux/sysv_fs.h>
#include <linux/locks.h>
#include <linux/smp_lock.h>
#include "sysv.h"
enum {DIRECT = 10, DEPTH = 4}; /* Have triple indirect */
......
......@@ -12,10 +12,9 @@
* Copyright (C) 1997, 1998 Krzysztof G. Baranowski
*/
#include <linux/fs.h>
#include <linux/sysv_fs.h>
#include <linux/pagemap.h>
#include <linux/smp_lock.h>
#include "sysv.h"
static inline void inc_count(struct inode *inode)
{
......
......@@ -21,11 +21,9 @@
*/
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/sysv_fs.h>
#include <linux/init.h>
#include <linux/slab.h>
#include "sysv.h"
/*
* The following functions try to recognize specific filesystems.
......
......@@ -5,8 +5,7 @@
* Aug 2001, Christoph Hellwig (hch@infradead.org)
*/
#include <linux/fs.h>
#include <linux/sysv_fs.h>
#include "sysv.h"
static int sysv_readlink(struct dentry *dentry, char *buffer, int buflen)
{
......
#ifndef _SYSV_FS_SB
#define _SYSV_FS_SB
#ifndef _SYSV_H
#define _SYSV_H
#include <linux/fs.h>
#include <linux/sysv_fs.h>
/*
* SystemV/V7/Coherent super-block data in memory
*
* The SystemV/V7/Coherent superblock contains dynamic data (it gets modified
* while the system is running). This is in contrast to the Minix and Berkeley
* filesystems (where the superblock is never modified). This affects the
......@@ -51,6 +55,182 @@ struct sysv_sb_info {
u32 s_nzones; /* same as s_sbd->s_fsize */
u16 s_namelen; /* max length of dir entry */
};
/* The field s_toobig_block is currently unused. */
/*
* SystemV/V7/Coherent FS inode data in memory
*/
struct sysv_inode_info {
u32 i_data[13];
u32 i_dir_start_lookup;
struct inode vfs_inode;
};
static inline struct sysv_inode_info *SYSV_I(struct inode *inode)
{
return list_entry(inode, struct sysv_inode_info, vfs_inode);
}
static inline struct sysv_sb_info *SYSV_SB(struct super_block *sb)
{
return sb->u.generic_sbp;
}
/* identify the FS in memory */
enum {
FSTYPE_NONE = 0,
FSTYPE_XENIX,
FSTYPE_SYSV4,
FSTYPE_SYSV2,
FSTYPE_COH,
FSTYPE_V7,
FSTYPE_AFS,
FSTYPE_END,
};
#define SYSV_MAGIC_BASE 0x012FF7B3
#define XENIX_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_XENIX)
#define SYSV4_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_SYSV4)
#define SYSV2_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_SYSV2)
#define COH_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_COH)
/* Admissible values for i_nlink: 0.._LINK_MAX */
enum {
XENIX_LINK_MAX = 126, /* ?? */
SYSV_LINK_MAX = 126, /* 127? 251? */
V7_LINK_MAX = 126, /* ?? */
COH_LINK_MAX = 10000,
};
static inline void dirty_sb(struct super_block *sb)
{
struct sysv_sb_info *sbi = SYSV_SB(sb);
mark_buffer_dirty(sbi->s_bh1);
if (sbi->s_bh1 != sbi->s_bh2)
mark_buffer_dirty(sbi->s_bh2);
sb->s_dirt = 1;
}
/* ialloc.c */
extern struct sysv_inode *sysv_raw_inode(struct super_block *, unsigned,
struct buffer_head **);
extern struct inode * sysv_new_inode(const struct inode *, mode_t);
extern void sysv_free_inode(struct inode *);
extern unsigned long sysv_count_free_inodes(struct super_block *);
/* balloc.c */
extern u32 sysv_new_block(struct super_block *);
extern void sysv_free_block(struct super_block *, u32);
extern unsigned long sysv_count_free_blocks(struct super_block *);
/* itree.c */
extern void sysv_truncate(struct inode *);
/* inode.c */
extern void sysv_write_inode(struct inode *, int);
extern int sysv_sync_inode(struct inode *);
extern int sysv_sync_file(struct file *, struct dentry *, int);
extern void sysv_set_inode(struct inode *, dev_t);
/* dir.c */
extern struct sysv_dir_entry *sysv_find_entry(struct dentry *, struct page **);
extern int sysv_add_link(struct dentry *, struct inode *);
extern int sysv_delete_entry(struct sysv_dir_entry *, struct page *);
extern int sysv_make_empty(struct inode *, struct inode *);
extern int sysv_empty_dir(struct inode *);
extern void sysv_set_link(struct sysv_dir_entry *, struct page *,
struct inode *);
extern struct sysv_dir_entry *sysv_dotdot(struct inode *, struct page **);
extern ino_t sysv_inode_by_name(struct dentry *);
extern struct inode_operations sysv_file_inode_operations;
extern struct inode_operations sysv_dir_inode_operations;
extern struct inode_operations sysv_fast_symlink_inode_operations;
extern struct file_operations sysv_file_operations;
extern struct file_operations sysv_dir_operations;
extern struct address_space_operations sysv_aops;
extern struct super_operations sysv_sops;
extern struct dentry_operations sysv_dentry_operations;
enum {
BYTESEX_LE,
BYTESEX_PDP,
BYTESEX_BE,
};
static inline u32 PDP_swab(u32 x)
{
#ifdef __LITTLE_ENDIAN
return ((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16);
#else
#ifdef __BIG_ENDIAN
return ((x & 0xff00ff) << 8) | ((x & 0xff00ff00) >> 8);
#else
#error BYTESEX
#endif
#endif
}
static inline u32 fs32_to_cpu(struct sysv_sb_info *sbi, u32 n)
{
if (sbi->s_bytesex == BYTESEX_PDP)
return PDP_swab(n);
else if (sbi->s_bytesex == BYTESEX_LE)
return le32_to_cpu(n);
else
return be32_to_cpu(n);
}
static inline u32 cpu_to_fs32(struct sysv_sb_info *sbi, u32 n)
{
if (sbi->s_bytesex == BYTESEX_PDP)
return PDP_swab(n);
else if (sbi->s_bytesex == BYTESEX_LE)
return cpu_to_le32(n);
else
return cpu_to_be32(n);
}
static inline u32 fs32_add(struct sysv_sb_info *sbi, u32 *n, int d)
{
if (sbi->s_bytesex == BYTESEX_PDP)
return *n = PDP_swab(PDP_swab(*n)+d);
else if (sbi->s_bytesex == BYTESEX_LE)
return *n = cpu_to_le32(le32_to_cpu(*n)+d);
else
return *n = cpu_to_be32(be32_to_cpu(*n)+d);
}
static inline u16 fs16_to_cpu(struct sysv_sb_info *sbi, u16 n)
{
if (sbi->s_bytesex != BYTESEX_BE)
return le16_to_cpu(n);
else
return be16_to_cpu(n);
}
static inline u16 cpu_to_fs16(struct sysv_sb_info *sbi, u16 n)
{
if (sbi->s_bytesex != BYTESEX_BE)
return cpu_to_le16(n);
else
return cpu_to_be16(n);
}
static inline u16 fs16_add(struct sysv_sb_info *sbi, u16 *n, int d)
{
if (sbi->s_bytesex != BYTESEX_BE)
return *n = cpu_to_le16(le16_to_cpu(*n)+d);
else
return *n = cpu_to_be16(be16_to_cpu(*n)+d);
}
#endif /* _SYSV_H */
#ifndef _LINUX_SYSV_FS_H
#define _LINUX_SYSV_FS_H
/*
* The SystemV/Coherent filesystem constants/structures/macros
*/
/* This code assumes
- sizeof(short) = 2, sizeof(int) = 4, sizeof(long) = 4,
- alignof(short) = 2, alignof(long) = 4.
*/
#ifdef __GNUC__
#define __packed2__ __attribute__ ((packed, aligned(2)))
#if defined(__GNUC__)
# define __packed2__ __attribute__((packed, aligned(2)))
#else
#error I want gcc!
>> I want to scream! <<
#endif
#include <linux/stat.h> /* declares S_IFLNK etc. */
#include <linux/sched.h> /* declares wake_up() */
#include <linux/sysv_fs_sb.h>
#include <linux/sysv_fs_i.h>
static inline struct sysv_inode_info *SYSV_I(struct inode *inode)
{
return list_entry(inode, struct sysv_inode_info, vfs_inode);
}
static inline struct sysv_sb_info *SYSV_SB(struct super_block *sb)
{
return sb->u.generic_sbp;
}
/* Layout on disk */
/* ============== */
static inline u32 PDP_swab(u32 x)
{
#ifdef __LITTLE_ENDIAN
return ((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16);
#else
#ifdef __BIG_ENDIAN
return ((x & 0xff00ff) << 8) | ((x & 0xff00ff00) >> 8);
#else
#error BYTESEX
#endif
#endif
}
/* inode numbers are 16 bit */
typedef u16 sysv_ino_t;
/* Block numbers are 24 bit, sometimes stored in 32 bit.
On Coherent FS, they are always stored in PDP-11 manner: the least
significant 16 bits come last.
*/
significant 16 bits come last. */
typedef u32 sysv_zone_t;
/* Among the blocks ... */
/* Xenix FS, Coherent FS: block 0 is the boot block, block 1 the super-block.
SystemV FS: block 0 contains both the boot sector and the super-block. */
/* The first inode zone is sb->sv_firstinodezone (1 or 2). */
/* Among the inodes ... */
/* 0 is non-existent */
#define SYSV_BADBL_INO 1 /* inode of bad blocks file */
#define SYSV_ROOT_INO 2 /* inode of root directory */
......@@ -105,7 +53,8 @@ struct xenix_super_block {
};
/* SystemV FS comes in two variants:
/*
* SystemV FS comes in two variants:
* sysv2: System V Release 2 (e.g. Microport), structure elements aligned(2).
* sysv4: System V Release 4 (e.g. Consensys), structure elements aligned(4).
*/
......@@ -254,13 +203,6 @@ struct sysv_inode {
u32 i_ctime; /* time of creation */
};
/* Admissible values for i_nlink: 0.._LINK_MAX */
enum {
XENIX_LINK_MAX = 126, /* ?? */
SYSV_LINK_MAX = 126, /* 127? 251? */
V7_LINK_MAX = 126, /* ?? */
COH_LINK_MAX = 10000,
};
/* The number of inodes per block is
sb->sv_inodes_per_block = block_size / sizeof(struct sysv_inode) */
......@@ -269,9 +211,7 @@ enum {
/* SystemV/Coherent directory entry on disk */
#define SYSV_NAMELEN 14 /* max size of name in struct sysv_dir_entry */
struct sysv_dir_entry {
sysv_ino_t inode;
char name[SYSV_NAMELEN]; /* up to 14 characters, the rest are zeroes */
......@@ -279,139 +219,4 @@ struct sysv_dir_entry {
#define SYSV_DIRSIZE sizeof(struct sysv_dir_entry) /* size of every directory entry */
/* Operations */
/* ========== */
/* identify the FS in memory */
enum {
FSTYPE_NONE = 0,
FSTYPE_XENIX,
FSTYPE_SYSV4,
FSTYPE_SYSV2,
FSTYPE_COH,
FSTYPE_V7,
FSTYPE_AFS,
FSTYPE_END,
};
#define SYSV_MAGIC_BASE 0x012FF7B3
#define XENIX_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_XENIX)
#define SYSV4_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_SYSV4)
#define SYSV2_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_SYSV2)
#define COH_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_COH)
#ifdef __KERNEL__
enum {
BYTESEX_LE,
BYTESEX_PDP,
BYTESEX_BE,
};
/*
* Function prototypes
*/
extern struct inode * sysv_new_inode(const struct inode *, mode_t);
extern void sysv_free_inode(struct inode *);
extern unsigned long sysv_count_free_inodes(struct super_block *);
extern u32 sysv_new_block(struct super_block *);
extern void sysv_free_block(struct super_block *, u32);
extern unsigned long sysv_count_free_blocks(struct super_block *);
extern void sysv_truncate(struct inode *);
extern void sysv_write_inode(struct inode *, int);
extern int sysv_sync_inode(struct inode *);
extern int sysv_sync_file(struct file *, struct dentry *, int);
extern void sysv_set_inode(struct inode *, dev_t);
extern struct sysv_dir_entry *sysv_find_entry(struct dentry*, struct page**);
extern int sysv_add_link(struct dentry*, struct inode*);
extern int sysv_delete_entry(struct sysv_dir_entry*, struct page*);
extern int sysv_make_empty(struct inode*, struct inode*);
extern int sysv_empty_dir(struct inode*);
extern void sysv_set_link(struct sysv_dir_entry*, struct page*, struct inode*);
extern struct sysv_dir_entry *sysv_dotdot(struct inode*, struct page**);
extern ino_t sysv_inode_by_name(struct dentry*);
extern struct inode_operations sysv_file_inode_operations;
extern struct inode_operations sysv_dir_inode_operations;
extern struct inode_operations sysv_fast_symlink_inode_operations;
extern struct file_operations sysv_file_operations;
extern struct file_operations sysv_dir_operations;
extern struct address_space_operations sysv_aops;
extern struct super_operations sysv_sops;
extern struct dentry_operations sysv_dentry_operations;
extern struct sysv_inode *sysv_raw_inode(struct super_block *, unsigned, struct buffer_head **);
static inline void dirty_sb(struct super_block *sb)
{
struct sysv_sb_info *sbi = SYSV_SB(sb);
mark_buffer_dirty(sbi->s_bh1);
if (sbi->s_bh1 != sbi->s_bh2)
mark_buffer_dirty(sbi->s_bh2);
sb->s_dirt = 1;
}
static inline u32 fs32_to_cpu(struct sysv_sb_info *sbi, u32 n)
{
if (sbi->s_bytesex == BYTESEX_PDP)
return PDP_swab(n);
else if (sbi->s_bytesex == BYTESEX_LE)
return le32_to_cpu(n);
else
return be32_to_cpu(n);
}
static inline u32 cpu_to_fs32(struct sysv_sb_info *sbi, u32 n)
{
if (sbi->s_bytesex == BYTESEX_PDP)
return PDP_swab(n);
else if (sbi->s_bytesex == BYTESEX_LE)
return cpu_to_le32(n);
else
return cpu_to_be32(n);
}
static inline u32 fs32_add(struct sysv_sb_info *sbi, u32 *n, int d)
{
if (sbi->s_bytesex == BYTESEX_PDP)
return *n = PDP_swab(PDP_swab(*n)+d);
else if (sbi->s_bytesex == BYTESEX_LE)
return *n = cpu_to_le32(le32_to_cpu(*n)+d);
else
return *n = cpu_to_be32(be32_to_cpu(*n)+d);
}
static inline u16 fs16_to_cpu(struct sysv_sb_info *sbi, u16 n)
{
if (sbi->s_bytesex != BYTESEX_BE)
return le16_to_cpu(n);
else
return be16_to_cpu(n);
}
static inline u16 cpu_to_fs16(struct sysv_sb_info *sbi, u16 n)
{
if (sbi->s_bytesex != BYTESEX_BE)
return cpu_to_le16(n);
else
return cpu_to_be16(n);
}
static inline u16 fs16_add(struct sysv_sb_info *sbi, u16 *n, int d)
{
if (sbi->s_bytesex != BYTESEX_BE)
return *n = cpu_to_le16(le16_to_cpu(*n)+d);
else
return *n = cpu_to_be16(be16_to_cpu(*n)+d);
}
#endif /* __KERNEL__ */
#endif
#endif /* _LINUX_SYSV_FS_H */
#ifndef _SYSV_FS_I
#define _SYSV_FS_I
/*
* SystemV/V7/Coherent FS inode data in memory
*/
struct sysv_inode_info {
u32 i_data[10+1+1+1]; /* zone numbers: max. 10 data blocks,
* then 1 indirection block,
* then 1 double indirection block,
* then 1 triple indirection block.
*/
u32 i_dir_start_lookup;
struct inode vfs_inode;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment