Commit ea747b67 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] hpfs: general cleanup

include files moved to fs/hpfs/, gratitious #include removed, stuff that
doesn't have to be global made static, misindented chunk of
hpfs_readdir() put in place, etc.
parent 9c96c8be
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* HPFS bitmap operations * HPFS bitmap operations
*/ */
#include <linux/buffer_head.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
/* /*
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* handling HPFS anode tree that contains file allocation info * handling HPFS anode tree that contains file allocation info
*/ */
#include <linux/buffer_head.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
/* Find a sector in allocation tree */ /* Find a sector in allocation tree */
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
* general buffer i/o * general buffer i/o
*/ */
#include <linux/buffer_head.h>
#include <linux/string.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
void hpfs_lock_creation(struct super_block *s) void hpfs_lock_creation(struct super_block *s)
......
...@@ -7,11 +7,8 @@ ...@@ -7,11 +7,8 @@
*/ */
#include "hpfs_fn.h" #include "hpfs_fn.h"
#include <linux/buffer_head.h>
#include <linux/time.h>
#include <linux/smp_lock.h>
int hpfs_dir_release(struct inode *inode, struct file *filp) static int hpfs_dir_release(struct inode *inode, struct file *filp)
{ {
lock_kernel(); lock_kernel();
hpfs_del_pos(inode, &filp->f_pos); hpfs_del_pos(inode, &filp->f_pos);
...@@ -22,7 +19,7 @@ int hpfs_dir_release(struct inode *inode, struct file *filp) ...@@ -22,7 +19,7 @@ int hpfs_dir_release(struct inode *inode, struct file *filp)
/* This is slow, but it's not used often */ /* This is slow, but it's not used often */
loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
{ {
loff_t new_off = off + (whence == 1 ? filp->f_pos : 0); loff_t new_off = off + (whence == 1 ? filp->f_pos : 0);
loff_t pos; loff_t pos;
...@@ -53,7 +50,7 @@ loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) ...@@ -53,7 +50,7 @@ loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
return -ESPIPE; return -ESPIPE;
} }
int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
{ {
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_dentry->d_inode;
struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
...@@ -140,32 +137,28 @@ int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -140,32 +137,28 @@ int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
hpfs_add_pos(inode, &filp->f_pos); hpfs_add_pos(inode, &filp->f_pos);
filp->f_version = inode->i_version; filp->f_version = inode->i_version;
} }
/*if (filp->f_version != inode->i_version) { old_pos = filp->f_pos;
ret = -ENOENT; if (!(de = map_pos_dirent(inode, &filp->f_pos, &qbh))) {
goto out; ret = -EIOERROR;
}*/ goto out;
old_pos = filp->f_pos; }
if (!(de = map_pos_dirent(inode, &filp->f_pos, &qbh))) { if (de->first || de->last) {
ret = -EIOERROR; if (hpfs_sb(inode->i_sb)->sb_chk) {
goto out; if (de->first && !de->last && (de->namelen != 2 || de ->name[0] != 1 || de->name[1] != 1)) hpfs_error(inode->i_sb, "hpfs_readdir: bad ^A^A entry; pos = %08x", old_pos);
} if (de->last && (de->namelen != 1 || de ->name[0] != 255)) hpfs_error(inode->i_sb, "hpfs_readdir: bad \\377 entry; pos = %08x", old_pos);
if (de->first || de->last) {
if (hpfs_sb(inode->i_sb)->sb_chk) {
if (de->first && !de->last && (de->namelen != 2 || de ->name[0] != 1 || de->name[1] != 1)) hpfs_error(inode->i_sb, "hpfs_readdir: bad ^A^A entry; pos = %08x", old_pos);
if (de->last && (de->namelen != 1 || de ->name[0] != 255)) hpfs_error(inode->i_sb, "hpfs_readdir: bad \\377 entry; pos = %08x", old_pos);
}
hpfs_brelse4(&qbh);
goto again;
}
tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3);
if (filldir(dirent, tempname, de->namelen, old_pos, de->fnode, DT_UNKNOWN) < 0) {
filp->f_pos = old_pos;
if (tempname != (char *)de->name) kfree(tempname);
hpfs_brelse4(&qbh);
goto out;
} }
hpfs_brelse4(&qbh);
goto again;
}
tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3);
if (filldir(dirent, tempname, de->namelen, old_pos, de->fnode, DT_UNKNOWN) < 0) {
filp->f_pos = old_pos;
if (tempname != (char *)de->name) kfree(tempname); if (tempname != (char *)de->name) kfree(tempname);
hpfs_brelse4(&qbh); hpfs_brelse4(&qbh);
goto out;
}
if (tempname != (char *)de->name) kfree(tempname);
hpfs_brelse4(&qbh);
} }
out: out:
unlock_kernel(); unlock_kernel();
...@@ -316,3 +309,12 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name ...@@ -316,3 +309,12 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
unlock_kernel(); unlock_kernel();
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
} }
struct file_operations hpfs_dir_ops =
{
.llseek = hpfs_dir_lseek,
.read = generic_read_dir,
.readdir = hpfs_readdir,
.release = hpfs_dir_release,
.fsync = hpfs_file_fsync,
};
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* handling directory dnode tree - adding, deleteing & searching for dirents * handling directory dnode tree - adding, deleteing & searching for dirents
*/ */
#include <linux/buffer_head.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
static loff_t get_pos(struct dnode *d, struct hpfs_dirent *fde) static loff_t get_pos(struct dnode *d, struct hpfs_dirent *fde)
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
* handling extended attributes * handling extended attributes
*/ */
#include <linux/buffer_head.h>
#include <linux/string.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
/* Remove external extended attributes. ano specifies whether a is a /* Remove external extended attributes. ano specifies whether a is a
......
...@@ -6,16 +6,11 @@ ...@@ -6,16 +6,11 @@
* file VFS functions * file VFS functions
*/ */
#include <linux/buffer_head.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/smp_lock.h>
#include <linux/pagemap.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
#define BLOCKS(size) (((size) + 511) >> 9) #define BLOCKS(size) (((size) + 511) >> 9)
int hpfs_file_release(struct inode *inode, struct file *file) static int hpfs_file_release(struct inode *inode, struct file *file)
{ {
lock_kernel(); lock_kernel();
hpfs_write_if_changed(inode); hpfs_write_if_changed(inode);
...@@ -34,7 +29,7 @@ int hpfs_file_fsync(struct file *file, struct dentry *dentry, int datasync) ...@@ -34,7 +29,7 @@ int hpfs_file_fsync(struct file *file, struct dentry *dentry, int datasync)
* so we must ignore such errors. * so we must ignore such errors.
*/ */
secno hpfs_bmap(struct inode *inode, unsigned file_secno) static secno hpfs_bmap(struct inode *inode, unsigned file_secno)
{ {
struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
unsigned n, disk_secno; unsigned n, disk_secno;
...@@ -50,7 +45,7 @@ secno hpfs_bmap(struct inode *inode, unsigned file_secno) ...@@ -50,7 +45,7 @@ secno hpfs_bmap(struct inode *inode, unsigned file_secno)
return disk_secno; return disk_secno;
} }
void hpfs_truncate(struct inode *i) static void hpfs_truncate(struct inode *i)
{ {
if (IS_IMMUTABLE(i)) return /*-EPERM*/; if (IS_IMMUTABLE(i)) return /*-EPERM*/;
lock_kernel(); lock_kernel();
...@@ -63,7 +58,7 @@ void hpfs_truncate(struct inode *i) ...@@ -63,7 +58,7 @@ void hpfs_truncate(struct inode *i)
unlock_kernel(); unlock_kernel();
} }
int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
{ {
secno s; secno s;
s = hpfs_bmap(inode, iblock); s = hpfs_bmap(inode, iblock);
...@@ -113,7 +108,7 @@ struct address_space_operations hpfs_aops = { ...@@ -113,7 +108,7 @@ struct address_space_operations hpfs_aops = {
.bmap = _hpfs_bmap .bmap = _hpfs_bmap
}; };
ssize_t hpfs_file_write(struct file *file, const char __user *buf, static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
ssize_t retval; ssize_t retval;
...@@ -127,3 +122,19 @@ ssize_t hpfs_file_write(struct file *file, const char __user *buf, ...@@ -127,3 +122,19 @@ ssize_t hpfs_file_write(struct file *file, const char __user *buf,
return retval; return retval;
} }
struct file_operations hpfs_file_ops =
{
.llseek = generic_file_llseek,
.read = generic_file_read,
.write = hpfs_file_write,
.mmap = generic_file_mmap,
.release = hpfs_file_release,
.fsync = hpfs_file_fsync,
.sendfile = generic_file_sendfile,
};
struct inode_operations hpfs_file_iops =
{
.truncate = hpfs_truncate,
.setattr = hpfs_notify_change,
};
...@@ -9,28 +9,14 @@ ...@@ -9,28 +9,14 @@
//#define DBG //#define DBG
//#define DEBUG_LOCKS //#define DEBUG_LOCKS
#include <linux/pagemap.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/fs.h>
#include <linux/hpfs_fs.h> #include <linux/hpfs_fs.h>
#include <linux/hpfs_fs_i.h>
#include <linux/hpfs_fs_sb.h>
#include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/time.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <stdarg.h>
#include "hpfs.h" #include "hpfs.h"
#define memcpy_tofs memcpy
#define memcpy_fromfs memcpy
#define EIOERROR EIO #define EIOERROR EIO
#define EFSERROR EPERM #define EFSERROR EPERM
#define EMEMERROR ENOMEM #define EMEMERROR ENOMEM
...@@ -56,7 +42,56 @@ ...@@ -56,7 +42,56 @@
#define PRINTK(x) #define PRINTK(x)
#endif #endif
typedef void nonconst; /* What this is for ? */ struct hpfs_inode_info {
loff_t mmu_private;
ino_t i_parent_dir; /* (directories) gives fnode of parent dir */
unsigned i_dno; /* (directories) root dnode */
unsigned i_dpos; /* (directories) temp for readdir */
unsigned i_dsubdno; /* (directories) temp for readdir */
unsigned i_file_sec; /* (files) minimalist cache of alloc info */
unsigned i_disk_sec; /* (files) minimalist cache of alloc info */
unsigned i_n_secs; /* (files) minimalist cache of alloc info */
unsigned i_ea_size; /* size of extended attributes */
unsigned i_conv : 2; /* (files) crlf->newline hackery */
unsigned i_ea_mode : 1; /* file's permission is stored in ea */
unsigned i_ea_uid : 1; /* file's uid is stored in ea */
unsigned i_ea_gid : 1; /* file's gid is stored in ea */
unsigned i_dirty : 1;
struct semaphore i_sem;
struct semaphore i_parent;
loff_t **i_rddir_off;
struct inode vfs_inode;
};
struct hpfs_sb_info {
ino_t sb_root; /* inode number of root dir */
unsigned sb_fs_size; /* file system size, sectors */
unsigned sb_bitmaps; /* sector number of bitmap list */
unsigned sb_dirband_start; /* directory band start sector */
unsigned sb_dirband_size; /* directory band size, dnodes */
unsigned sb_dmap; /* sector number of dnode bit map */
unsigned sb_n_free; /* free blocks for statfs, or -1 */
unsigned sb_n_free_dnodes; /* free dnodes for statfs, or -1 */
uid_t sb_uid; /* uid from mount options */
gid_t sb_gid; /* gid from mount options */
umode_t sb_mode; /* mode from mount options */
unsigned sb_conv : 2; /* crlf->newline hackery */
unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */
unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */
unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */
unsigned sb_lowercase : 1; /* downcase filenames hackery */
unsigned sb_was_error : 1; /* there was an error, set dirty flag */
unsigned sb_chkdsk : 2; /* chkdsk: 0-no, 1-on errs, 2-allways */
unsigned char *sb_cp_table; /* code page tables: */
/* 128 bytes uppercasing table & */
/* 128 bytes lowercasing table */
unsigned *sb_bmp_dir; /* main bitmap directory */
unsigned sb_c_bitmap; /* current bitmap */
struct semaphore hpfs_creation_de; /* when creating dirents, nobody else
can alloc blocks */
/*unsigned sb_mounting : 1;*/
int sb_timeshift;
};
/* /*
* conv= options * conv= options
...@@ -162,8 +197,6 @@ static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n) ...@@ -162,8 +197,6 @@ static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n)
return 0; return 0;
} }
struct statfs;
/* alloc.c */ /* alloc.c */
int hpfs_chk_sectors(struct super_block *, secno, int, char *); int hpfs_chk_sectors(struct super_block *, secno, int, char *);
...@@ -205,10 +238,8 @@ void hpfs_set_dentry_operations(struct dentry *); ...@@ -205,10 +238,8 @@ void hpfs_set_dentry_operations(struct dentry *);
/* dir.c */ /* dir.c */
int hpfs_dir_release(struct inode *, struct file *);
loff_t hpfs_dir_lseek(struct file *, loff_t, int);
int hpfs_readdir(struct file *, void *, filldir_t);
struct dentry *hpfs_lookup(struct inode *, struct dentry *, struct nameidata *); struct dentry *hpfs_lookup(struct inode *, struct dentry *, struct nameidata *);
extern struct file_operations hpfs_dir_ops;
/* dnode.c */ /* dnode.c */
...@@ -235,13 +266,10 @@ void hpfs_set_ea(struct inode *, struct fnode *, char *, char *, int); ...@@ -235,13 +266,10 @@ void hpfs_set_ea(struct inode *, struct fnode *, char *, char *, int);
/* file.c */ /* file.c */
int hpfs_file_release(struct inode *, struct file *);
int hpfs_open(struct inode *, struct file *);
int hpfs_file_fsync(struct file *, struct dentry *, int); int hpfs_file_fsync(struct file *, struct dentry *, int);
secno hpfs_bmap(struct inode *, unsigned); extern struct file_operations hpfs_file_ops;
void hpfs_truncate(struct inode *); extern struct inode_operations hpfs_file_iops;
int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create); extern struct address_space_operations hpfs_aops;
ssize_t hpfs_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos);
/* inode.c */ /* inode.c */
...@@ -277,14 +305,8 @@ void hpfs_decide_conv(struct inode *, unsigned char *, unsigned); ...@@ -277,14 +305,8 @@ void hpfs_decide_conv(struct inode *, unsigned char *, unsigned);
/* namei.c */ /* namei.c */
int hpfs_mkdir(struct inode *, struct dentry *, int); extern struct inode_operations hpfs_dir_iops;
int hpfs_create(struct inode *, struct dentry *, int, struct nameidata *); extern struct address_space_operations hpfs_symlink_aops;
int hpfs_mknod(struct inode *, struct dentry *, int, dev_t);
int hpfs_symlink(struct inode *, struct dentry *, const char *);
int hpfs_unlink(struct inode *, struct dentry *);
int hpfs_rmdir(struct inode *, struct dentry *);
int hpfs_symlink_readpage(struct file *, struct page *);
int hpfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
static inline struct hpfs_inode_info *hpfs_i(struct inode *inode) static inline struct hpfs_inode_info *hpfs_i(struct inode *inode)
{ {
...@@ -300,12 +322,7 @@ static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb) ...@@ -300,12 +322,7 @@ static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb)
void hpfs_error(struct super_block *, char *, ...); void hpfs_error(struct super_block *, char *, ...);
int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *); int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *);
int hpfs_remount_fs(struct super_block *, int *, char *);
void hpfs_put_super(struct super_block *);
unsigned hpfs_count_one_bitmap(struct super_block *, secno); unsigned hpfs_count_one_bitmap(struct super_block *, secno);
int hpfs_statfs(struct super_block *, struct kstatfs *);
extern struct address_space_operations hpfs_aops;
/* /*
* local time (HPFS) to GMT (Unix) * local time (HPFS) to GMT (Unix)
...@@ -322,4 +339,3 @@ static inline time_t gmt_to_local(struct super_block *s, time_t t) ...@@ -322,4 +339,3 @@ static inline time_t gmt_to_local(struct super_block *s, time_t t)
extern struct timezone sys_tz; extern struct timezone sys_tz;
return t - sys_tz.tz_minuteswest * 60 - hpfs_sb(s)->sb_timeshift; return t - sys_tz.tz_minuteswest * 60 - hpfs_sb(s)->sb_timeshift;
} }
...@@ -6,57 +6,8 @@ ...@@ -6,57 +6,8 @@
* inode VFS functions * inode VFS functions
*/ */
#include <linux/fs.h>
#include <linux/time.h>
#include <linux/smp_lock.h>
#include <linux/buffer_head.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
static struct file_operations hpfs_file_ops =
{
.llseek = generic_file_llseek,
.read = generic_file_read,
.write = hpfs_file_write,
.mmap = generic_file_mmap,
.open = hpfs_open,
.release = hpfs_file_release,
.fsync = hpfs_file_fsync,
.sendfile = generic_file_sendfile,
};
static struct inode_operations hpfs_file_iops =
{
.truncate = hpfs_truncate,
.setattr = hpfs_notify_change,
};
static struct file_operations hpfs_dir_ops =
{
.llseek = hpfs_dir_lseek,
.read = generic_read_dir,
.readdir = hpfs_readdir,
.open = hpfs_open,
.release = hpfs_dir_release,
.fsync = hpfs_file_fsync,
};
static struct inode_operations hpfs_dir_iops =
{
.create = hpfs_create,
.lookup = hpfs_lookup,
.unlink = hpfs_unlink,
.symlink = hpfs_symlink,
.mkdir = hpfs_mkdir,
.rmdir = hpfs_rmdir,
.mknod = hpfs_mknod,
.rename = hpfs_rename,
.setattr = hpfs_notify_change,
};
struct address_space_operations hpfs_symlink_aops = {
.readpage = hpfs_symlink_readpage
};
void hpfs_init_inode(struct inode *i) void hpfs_init_inode(struct inode *i)
{ {
struct super_block *sb = i->i_sb; struct super_block *sb = i->i_sb;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* mapping structures to memory with some minimal checks * mapping structures to memory with some minimal checks
*/ */
#include <linux/buffer_head.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
unsigned *hpfs_map_dnode_bitmap(struct super_block *s, struct quad_buffer_head *qbh) unsigned *hpfs_map_dnode_bitmap(struct super_block *s, struct quad_buffer_head *qbh)
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* operations with filenames * operations with filenames
*/ */
#include <linux/string.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
char *text_postfix[]={ char *text_postfix[]={
......
...@@ -6,12 +6,9 @@ ...@@ -6,12 +6,9 @@
* adding & removing files & directories * adding & removing files & directories
*/ */
#include <linux/pagemap.h>
#include <linux/string.h>
#include <linux/buffer_head.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{ {
const char *name = dentry->d_name.name; const char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
...@@ -121,7 +118,7 @@ int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -121,7 +118,7 @@ int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
return err; return err;
} }
int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd)
{ {
const char *name = dentry->d_name.name; const char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
...@@ -211,7 +208,7 @@ int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struct namei ...@@ -211,7 +208,7 @@ int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struct namei
return err; return err;
} }
int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
{ {
const char *name = dentry->d_name.name; const char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
...@@ -289,9 +286,7 @@ int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -289,9 +286,7 @@ int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
return err; return err;
} }
extern struct address_space_operations hpfs_symlink_aops; static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *symlink)
int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *symlink)
{ {
const char *name = dentry->d_name.name; const char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
...@@ -371,7 +366,7 @@ int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *symlink) ...@@ -371,7 +366,7 @@ int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *symlink)
return err; return err;
} }
int hpfs_unlink(struct inode *dir, struct dentry *dentry) static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
{ {
const char *name = dentry->d_name.name; const char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
...@@ -453,7 +448,7 @@ int hpfs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -453,7 +448,7 @@ int hpfs_unlink(struct inode *dir, struct dentry *dentry)
return err; return err;
} }
int hpfs_rmdir(struct inode *dir, struct dentry *dentry) static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
{ {
const char *name = dentry->d_name.name; const char *name = dentry->d_name.name;
unsigned len = dentry->d_name.len; unsigned len = dentry->d_name.len;
...@@ -513,7 +508,7 @@ int hpfs_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -513,7 +508,7 @@ int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
return err; return err;
} }
int hpfs_symlink_readpage(struct file *file, struct page *page) static int hpfs_symlink_readpage(struct file *file, struct page *page)
{ {
char *link = kmap(page); char *link = kmap(page);
struct inode *i = page->mapping->host; struct inode *i = page->mapping->host;
...@@ -542,8 +537,12 @@ int hpfs_symlink_readpage(struct file *file, struct page *page) ...@@ -542,8 +537,12 @@ int hpfs_symlink_readpage(struct file *file, struct page *page)
unlock_page(page); unlock_page(page);
return err; return err;
} }
struct address_space_operations hpfs_symlink_aops = {
.readpage = hpfs_symlink_readpage
};
int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry) struct inode *new_dir, struct dentry *new_dentry)
{ {
char *old_name = (char *)old_dentry->d_name.name; char *old_name = (char *)old_dentry->d_name.name;
...@@ -659,3 +658,16 @@ int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -659,3 +658,16 @@ int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
unlock_kernel(); unlock_kernel();
return err; return err;
} }
struct inode_operations hpfs_dir_iops =
{
.create = hpfs_create,
.lookup = hpfs_lookup,
.unlink = hpfs_unlink,
.symlink = hpfs_symlink,
.mkdir = hpfs_mkdir,
.rmdir = hpfs_rmdir,
.mknod = hpfs_mknod,
.rename = hpfs_rename,
.setattr = hpfs_notify_change,
};
...@@ -6,13 +6,11 @@ ...@@ -6,13 +6,11 @@
* mounting, unmounting, error handling * mounting, unmounting, error handling
*/ */
#include <linux/buffer_head.h>
#include <linux/string.h>
#include "hpfs_fn.h" #include "hpfs_fn.h"
#include <linux/module.h> #include <linux/module.h>
#include <linux/parser.h> #include <linux/parser.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/vfs.h> #include <linux/statfs.h>
/* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */ /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */
...@@ -101,7 +99,7 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2, ...@@ -101,7 +99,7 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2,
return 0; return 0;
} }
void hpfs_put_super(struct super_block *s) static void hpfs_put_super(struct super_block *s)
{ {
struct hpfs_sb_info *sbi = hpfs_sb(s); struct hpfs_sb_info *sbi = hpfs_sb(s);
if (sbi->sb_cp_table) kfree(sbi->sb_cp_table); if (sbi->sb_cp_table) kfree(sbi->sb_cp_table);
...@@ -137,7 +135,7 @@ static unsigned count_bitmaps(struct super_block *s) ...@@ -137,7 +135,7 @@ static unsigned count_bitmaps(struct super_block *s)
return count; return count;
} }
int hpfs_statfs(struct super_block *s, struct kstatfs *buf) static int hpfs_statfs(struct super_block *s, struct kstatfs *buf)
{ {
struct hpfs_sb_info *sbi = hpfs_sb(s); struct hpfs_sb_info *sbi = hpfs_sb(s);
lock_kernel(); lock_kernel();
...@@ -206,18 +204,6 @@ static void destroy_inodecache(void) ...@@ -206,18 +204,6 @@ static void destroy_inodecache(void)
printk(KERN_INFO "hpfs_inode_cache: not all structures were freed\n"); printk(KERN_INFO "hpfs_inode_cache: not all structures were freed\n");
} }
/* Super operations */
static struct super_operations hpfs_sops =
{
.alloc_inode = hpfs_alloc_inode,
.destroy_inode = hpfs_destroy_inode,
.delete_inode = hpfs_delete_inode,
.put_super = hpfs_put_super,
.statfs = hpfs_statfs,
.remount_fs = hpfs_remount_fs,
};
/* /*
* A tiny parser for option strings, stolen from dosfs. * A tiny parser for option strings, stolen from dosfs.
* Stolen again from read-only hpfs. * Stolen again from read-only hpfs.
...@@ -397,7 +383,7 @@ HPFS filesystem options:\n\ ...@@ -397,7 +383,7 @@ HPFS filesystem options:\n\
\n"); \n");
} }
int hpfs_remount_fs(struct super_block *s, int *flags, char *data) static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
{ {
uid_t uid; uid_t uid;
gid_t gid; gid_t gid;
...@@ -441,6 +427,18 @@ int hpfs_remount_fs(struct super_block *s, int *flags, char *data) ...@@ -441,6 +427,18 @@ int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
return 0; return 0;
} }
/* Super operations */
static struct super_operations hpfs_sops =
{
.alloc_inode = hpfs_alloc_inode,
.destroy_inode = hpfs_destroy_inode,
.delete_inode = hpfs_delete_inode,
.put_super = hpfs_put_super,
.statfs = hpfs_statfs,
.remount_fs = hpfs_remount_fs,
};
static int hpfs_fill_super(struct super_block *s, void *options, int silent) static int hpfs_fill_super(struct super_block *s, void *options, int silent)
{ {
struct buffer_head *bh0, *bh1, *bh2; struct buffer_head *bh0, *bh1, *bh2;
......
#ifndef _HPFS_FS_I
#define _HPFS_FS_I
struct hpfs_inode_info {
loff_t mmu_private;
ino_t i_parent_dir; /* (directories) gives fnode of parent dir */
unsigned i_dno; /* (directories) root dnode */
unsigned i_dpos; /* (directories) temp for readdir */
unsigned i_dsubdno; /* (directories) temp for readdir */
unsigned i_file_sec; /* (files) minimalist cache of alloc info */
unsigned i_disk_sec; /* (files) minimalist cache of alloc info */
unsigned i_n_secs; /* (files) minimalist cache of alloc info */
unsigned i_ea_size; /* size of extended attributes */
unsigned i_conv : 2; /* (files) crlf->newline hackery */
unsigned i_ea_mode : 1; /* file's permission is stored in ea */
unsigned i_ea_uid : 1; /* file's uid is stored in ea */
unsigned i_ea_gid : 1; /* file's gid is stored in ea */
unsigned i_dirty : 1;
struct semaphore i_sem;
struct semaphore i_parent;
loff_t **i_rddir_off;
struct inode vfs_inode;
};
#endif
#ifndef _HPFS_FS_SB
#define _HPFS_FS_SB
struct hpfs_sb_info {
ino_t sb_root; /* inode number of root dir */
unsigned sb_fs_size; /* file system size, sectors */
unsigned sb_bitmaps; /* sector number of bitmap list */
unsigned sb_dirband_start; /* directory band start sector */
unsigned sb_dirband_size; /* directory band size, dnodes */
unsigned sb_dmap; /* sector number of dnode bit map */
unsigned sb_n_free; /* free blocks for statfs, or -1 */
unsigned sb_n_free_dnodes; /* free dnodes for statfs, or -1 */
uid_t sb_uid; /* uid from mount options */
gid_t sb_gid; /* gid from mount options */
umode_t sb_mode; /* mode from mount options */
unsigned sb_conv : 2; /* crlf->newline hackery */
unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */
unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */
unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */
unsigned sb_lowercase : 1; /* downcase filenames hackery */
unsigned sb_was_error : 1; /* there was an error, set dirty flag */
unsigned sb_chkdsk : 2; /* chkdsk: 0-no, 1-on errs, 2-allways */
unsigned char *sb_cp_table; /* code page tables: */
/* 128 bytes uppercasing table & */
/* 128 bytes lowercasing table */
unsigned *sb_bmp_dir; /* main bitmap directory */
unsigned sb_c_bitmap; /* current bitmap */
struct semaphore hpfs_creation_de; /* when creating dirents, nobody else
can alloc blocks */
/*unsigned sb_mounting : 1;*/
int sb_timeshift;
};
#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