|
From: Jan-Benedict G. <jb...@us...> - 2004-09-19 19:51:26
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20987 Modified Files: CHANGES Makefile dir.c file.c inode.c ods2.h super.c util.c Log Message: - This one actually compiles! - Don't use it. Even I haven't used it for *anything*, not even a simple testdrive. - If you use it, please send patches :-) - I'm especially looking for a replacement for get_hardsect_size(), which is a 2.4.x function I've found no equivalent for in 2.6.x. For now, there's a hardcoded replacement in utils.c. Index: CHANGES =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/CHANGES,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CHANGES 19 Sep 2004 09:47:49 -0000 1.1 +++ CHANGES 19 Sep 2004 19:51:15 -0000 1.2 @@ -1,3 +1,10 @@ +Changes from version 0.9.3 to 0.9.4a +==================================== + - Quick'n'dirty port from 2.4.x to 2.6.x + - Does compile cleanly, but contains known errors and for + sure won't work. This is a pure development release! + - Porting work done by Jan-Benedict Glaw <jb...@lu...> + Changes from version 0.9.2 to version 0.9.3 =========================================== - Added code to handle hard sector size of 1024 and 2048 bytes. @@ -19,8 +26,7 @@ - Updated all structures to use u8, u16 and u32 so it will work on 64 bits architectures such as Alpha. - Changes from version 0.9.0 to version 0.9.1 =========================================== - This is a special version for kernel 2.2.X - - Changed all long unsigned in structures to u32. \ No newline at end of file + - Changed all long unsigned in structures to u32. Index: util.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/util.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- util.c 19 Sep 2004 16:37:06 -0000 1.2 +++ util.c 19 Sep 2004 19:51:15 -0000 1.3 @@ -20,6 +20,7 @@ #include <linux/slab.h> #include <linux/init.h> #include <linux/blkdev.h> +#include <linux/buffer_head.h> #include <asm/uaccess.h> #include "ods2.h" @@ -55,8 +56,10 @@ } -u32 ino2fhlbn(struct super_block *sb, u32 ino) { - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; +u32 +ino2fhlbn (struct super_block *sb, u32 ino) +{ + ODS2SB *ods2p = ODS2_SB (sb); if (ino < 17) { /* the first 16 file headers are located at known locations in INDEXF.SYS */ return le16_to_cpu(ods2p->hm2.hm2_w_ibmapsize) + le32_to_cpu(ods2p->hm2.hm2_l_ibmaplbn) + ino - 1; @@ -201,36 +204,44 @@ } -int save_raw(ARGBLK *argblk) { - struct super_block *sb = (void *)argblk->arg; - ODS2SB *ods2p = (void *)sb->u.generic_sbp; +int +save_raw (ARGBLK *argblk) +{ + struct super_block *sb = (struct super_block *) argblk->arg; + ODS2SB *ods2p = ODS2_SB (sb); ods2p->flags.v_raw = 1; return 1; } -int save_lowercase(ARGBLK *argblk) { - struct super_block *sb = (void *)argblk->arg; - ODS2SB *ods2p = (void *)sb->u.generic_sbp; +int +save_lowercase (ARGBLK *argblk) +{ + struct super_block *sb = (struct super_block *) argblk->arg; + ODS2SB *ods2p = ODS2_SB (sb); ods2p->flags.v_lowercase = 1; return 1; } -int save_dollar(ARGBLK *argblk) { - struct super_block *sb = (void *)argblk->arg; - ODS2SB *ods2p = (void *)sb->u.generic_sbp; +int +save_dollar (ARGBLK *argblk) +{ + struct super_block *sb = (struct super_block *) argblk->arg; + ODS2SB *ods2p = ODS2_SB (sb); ods2p->dollar = argblk->token[0]; return 1; } -int save_semicolon(ARGBLK *argblk) { - struct super_block *sb = (void *)argblk->arg; - ODS2SB *ods2p = (void *)sb->u.generic_sbp; +int +save_semicolon (ARGBLK *argblk) +{ + struct super_block *sb = (struct super_block *) argblk->arg; + ODS2SB *ods2p = ODS2_SB (sb); ods2p->semicolon = argblk->token[0]; return 1; @@ -238,8 +249,8 @@ int save_version(ARGBLK *argblk) { - struct super_block *sb = (void *)argblk->arg; - ODS2SB *ods2p = (void *)sb->u.generic_sbp; + struct super_block *sb = (struct super_block *) argblk->arg; + ODS2SB *ods2p = ODS2_SB (sb); ods2p->flags.v_version = argblk->mask; return 1; @@ -308,13 +319,31 @@ return tparse(&argblk, tpa1); } + /* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: + * Ok, I give up :-) for some reason unknown to me the addition of 2 seconds + * is needed to get the correct time. + * It works for a file created 1-jan-1971 and for a file created 1-jan-2038 + * as well as for files created 1992 and 2003. */ +time_t +vms2unix_sec (u16 *vms_timestamp) +{ + printk (KERN_ERR "%s probably isn't yet correct, because it uses 2.4.x style i_[mca]time!\n", __FUNCTION__); + return ((u64)div64((le64_to_cpu(*(u64 *)&(vms_timestamp)) - 0x007c953d63a19980L) >> 7, 78125) + 2); +} + +long +vms2unix_nsec (u16 *vms_timestamp) +{ + printk (KERN_ERR "%s isn't yet correct!\n", __FUNCTION__); + return 0; +} + +int +get_hardsect_size (int xx) +{ + printk (KERN_ERR "%s: Not implemented!\n", __FUNCTION__); + return 512; +} + Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 19 Sep 2004 09:54:58 -0000 1.1 +++ Makefile 19 Sep 2004 19:51:15 -0000 1.2 @@ -6,3 +6,7 @@ ods2-objs := super.o inode.o file.o dir.o util.o tparse.o +# Intentionally misspelled, only for local compile testing +lcean: + -rm -f *.o *.lst .*.o.cmd + Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/inode.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- inode.c 19 Sep 2004 16:37:06 -0000 1.2 +++ inode.c 19 Sep 2004 19:51:15 -0000 1.3 @@ -20,58 +20,59 @@ #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> +#include <linux/buffer_head.h> #include <linux/blkdev.h> #include <asm/uaccess.h> #include "ods2.h" struct file_operations ods2_dir_operations = { - read: NULL, - readdir: ods2_readdir, - open: ods2_open_release, - release: ods2_open_release, - ioctl: NULL, - fsync: NULL, + .readdir = ods2_readdir, + .open = ods2_open_release, + .release = ods2_open_release, + //.read = NULL, + //.ioctl = NULL, + //.fsync = NULL, }; - struct file_operations ods2_file_operations = { - read: ods2_read, - readdir: NULL, - llseek: ods2_llseek, - open: ods2_open_release, - release: ods2_open_release, - ioctl: ods2_file_ioctl, - fsync: NULL, + .read ods2_read, + .llseek = ods2_llseek, + .open = ods2_open_release, + .release = ods2_open_release, + .ioctl = ods2_file_ioctl, + //.readdir = NULL, + //.fsync = NULL, }; struct inode_operations ods2_dir_inode_operations = { - create: NULL, - lookup: ods2_lookup, - link: NULL, - unlink: NULL, - symlink: NULL, - mkdir: NULL, - rmdir: NULL, - mknod: NULL, - rename: NULL, + .lookup = ods2_lookup, + //.create = NULL, + //.link = NULL, + //.unlink = NULL, + //.symlink = NULL, + //.mkdir = NULL, + //.rmdir = NULL, + //.mknod = NULL, + //.rename = NULL, }; -struct dentry *ods2_lookup(struct inode *dir, struct dentry *dentry) +struct dentry * +ods2_lookup (struct inode *dir, struct dentry *dentry, struct nameidata *nd) { - struct super_block *sb = dir->i_sb; - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; - struct buffer_head *bh = NULL; - char *vp; - u16 *rec; - ODS2FH *ods2fhp = (ODS2FH *)dir->u.generic_ip; - u32 vbn = 1; - u32 lbn; - int vers = 0; - char name[dentry->d_name.len + 1]; + struct super_block *sb = dir->i_sb; + ODS2SB *ods2p = ODS2_SB (sb); + struct buffer_head *bh; + char *vp; + u16 *rec; + ODS2FH *ods2fhp = (ODS2FH *) dir->u.generic_ip; + u32 vbn = 1; + u32 lbn; + int vers = 0; + char name[dentry->d_name.len + 1]; memcpy(name, dentry->d_name.name, dentry->d_name.len); name[dentry->d_name.len] = 0; @@ -182,11 +183,13 @@ 0 | 0 | 0 , /* */ }; -void ods2_read_inode(struct inode *inode) { - struct super_block *sb = inode->i_sb; - struct buffer_head *bh; - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; - u32 fhlbn; +void +ods2_read_inode (struct inode *inode) +{ + struct super_block *sb = inode->i_sb; + ODS2SB *ods2p = ODS2_SB (sb); + struct buffer_head *bh; + u32 fhlbn; if ((fhlbn = ino2fhlbn(sb, inode->i_ino)) > 0 && (bh = sb_bread(sb, GETBLKNO(sb, fhlbn))) != NULL && bh->b_data != NULL) { @@ -222,9 +225,12 @@ inode->i_uid = le16_to_cpu(fh2p->u5.s1.fh2_w_mem); inode->i_gid = le16_to_cpu(fh2p->u5.s1.fh2_w_grp); - inode->i_ctime = vms2unixtime(fi2p->fi2_q_credate); - inode->i_mtime = vms2unixtime(fi2p->fi2_q_revdate); - inode->i_atime = vms2unixtime(fi2p->fi2_q_revdate); + inode->i_ctime.tv_sec = vms2unix_sec(fi2p->fi2_q_credate); + inode->i_ctime.tv_nsec = vms2unix_nsec(fi2p->fi2_q_credate); + inode->i_mtime.tv_sec = vms2unix_sec(fi2p->fi2_q_revdate); + inode->i_mtime.tv_nsec = vms2unix_nsec(fi2p->fi2_q_revdate); + inode->i_atime.tv_sec = vms2unix_sec(fi2p->fi2_q_revdate); + inode->i_atime.tv_nsec = vms2unix_nsec(fi2p->fi2_q_revdate); /* Note that we don't use the system protection bits for ODS2. @@ -250,7 +256,7 @@ } ods2fhp->parent = (fh2p->u6.s1.fid_b_nmx << 16) | le16_to_cpu(fh2p->u6.s1.fid_w_num); - inode->i_version = ++event; + //inode->i_version = ++event; FIXME bforget(bh); return; } @@ -319,13 +325,3 @@ clear_inode(inode); } -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- super.c 19 Sep 2004 16:40:16 -0000 1.3 +++ super.c 19 Sep 2004 19:51:15 -0000 1.4 @@ -15,10 +15,11 @@ #include <linux/module.h> #include <linux/string.h> #include <linux/fs.h> +#include <linux/buffer_head.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/blkdev.h> -#include <asm/statfs.h> +#include <linux/statfs.h> #include <asm/uaccess.h> #include "ods2.h" @@ -30,12 +31,12 @@ */ static void ods2_put_super(struct super_block *sb) { - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; - + ODS2SB *ods2p = ODS2_SB (sb); + if (ods2p != NULL) { iput(ods2p->indexf); /* release INDEXF.SYS;1 */ kfree(ods2p->ibitmap); - kfree(sb->u.generic_sbp); + kfree(ods2p); } } @@ -45,24 +46,24 @@ the information we were gathering during the mount into the buffer. */ -int ods2_statfs(struct super_block *sb, struct statfs *buf) { - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; +int ods2_statfs(struct super_block *sb, struct kstatfs *buf) { + ODS2SB *ods2p = ODS2_SB (sb); - memcpy(buf, &ods2p->statfs, sizeof(struct statfs)); + memcpy(buf, &ods2p->kstatfs, sizeof(struct kstatfs)); return 0; } static struct super_operations ods2_sops = { - read_inode: ods2_read_inode, - write_inode: NULL, - put_inode: ods2_put_inode, - delete_inode: ods2_delete_inode, - clear_inode: ods2_clear_inode, - put_super: ods2_put_super, - write_super: NULL, - statfs: ods2_statfs, - remount_fs: NULL, + .read_inode = ods2_read_inode, + .put_inode = ods2_put_inode, + .delete_inode = ods2_delete_inode, + .clear_inode = ods2_clear_inode, + .put_super = ods2_put_super, + .statfs = ods2_statfs, + //write_inode: NULL, + //remount_fs: NULL, + //write_super: NULL, }; @@ -77,9 +78,9 @@ */ int ods2_read_bitmap(struct super_block *sb) { - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; - struct buffer_head *bh; - struct inode *inode; + ODS2SB *ods2p = ODS2_SB (sb); + struct inode *inode; + struct buffer_head *bh; if ((inode = iget(sb, 2)) != NULL) { /* this is BITMAP.SYS */ ODS2FH *ods2fhp = (ODS2FH *)(inode->u.generic_ip); @@ -121,9 +122,9 @@ vbn++; } bitset *= scb->scb_w_cluster; /* each bit represent 1 or more blocks (cluster factor) */ - ods2p->statfs.f_blocks = scb->scb_l_volsize; - ods2p->statfs.f_bfree = bitset; - ods2p->statfs.f_bavail = bitset; + ods2p->kstatfs.f_blocks = scb->scb_l_volsize; + ods2p->kstatfs.f_bfree = bitset; + ods2p->kstatfs.f_bavail = bitset; brelse(bh); iput(inode); return 1; /* everything went ok */ @@ -140,13 +141,14 @@ and copy data from the INDEXF.SYS file. At the same time the number of free file headers are counted. */ +int +ods2_read_ibitmap (struct super_block *sb) +{ + ODS2SB *ods2p = ODS2_SB (sb); + int idx; + struct buffer_head *bh; -int ods2_read_ibitmap(struct super_block *sb) { - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; - struct buffer_head *bh; - int idx; - - ods2p->statfs.f_ffree = 0; + ods2p->kstatfs.f_ffree = 0; if ((ods2p->ibitmap = kmalloc(ods2p->hm2.hm2_w_ibmapsize << 9, GFP_KERNEL)) != NULL) { memset(ods2p->ibitmap, 0, (ods2p->hm2.hm2_w_ibmapsize << 9)); for (idx = 0 ; idx < ods2p->hm2.hm2_w_ibmapsize ; idx++) { @@ -155,7 +157,9 @@ int cnt; memcpy((ods2p->ibitmap + (idx << 9)), GETBLKP(sb, ods2p->hm2.hm2_l_ibmaplbn + idx, bh->b_data), 512); - for (cnt = 0; cnt < 512; cnt++, bp++) { ods2p->statfs.f_ffree += (nibble2bits[(*bp & 0x0f) ^ 0xf] + nibble2bits[(*bp >> 4) ^ 0xf]); } + for (cnt = 0; cnt < 512; cnt++, bp++) { + ods2p->kstatfs.f_ffree += (nibble2bits[(*bp & 0x0f) ^ 0xf] + nibble2bits[(*bp >> 4) ^ 0xf]); + } bforget(bh); } } @@ -169,10 +173,11 @@ This is the routine that is invoked when an ODS2 file system is mounted. */ - -static struct super_block * ods2_read_super(struct super_block *sb, void *data, int silent) { - struct buffer_head *bh; - ODS2SB *ods2p; +static int +ods2_fill_super(struct super_block *sb, void *data, int silent) +{ + struct buffer_head *bh; + ODS2SB *ods2p; sb_set_blocksize(sb, get_hardsect_size(sb->s_dev)); if ((bh = sb_bread(sb, GETBLKNO(sb, 1))) != NULL && bh->b_data != NULL) { @@ -181,11 +186,11 @@ u16 chksum1 = 0; u16 chksum2 = 0; - if ((sb->u.generic_sbp = kmalloc(sizeof(ODS2SB), GFP_KERNEL)) == NULL) { + if ((ODS2_SB (sb) = kmalloc(sizeof(ODS2SB), GFP_KERNEL)) == NULL) { printk("ODS2-fs kmalloc failed for sb generic\n"); - return NULL; + return -ENOMEM; } - ods2p = (ODS2SB *)sb->u.generic_sbp; + ods2p = ODS2_SB (sb); memcpy(&ods2p->hm2, GETBLKP(sb, 1, bh->b_data), sizeof(HM2DEF)); brelse(bh); @@ -240,10 +245,10 @@ Some of the information is static and other is found in BITMAP.SYS. */ - ods2p->statfs.f_type = 0x3253444f; /* 2SDO */ - ods2p->statfs.f_bsize = 512; - ods2p->statfs.f_files = ods2p->hm2.hm2_l_maxfiles; - ods2p->statfs.f_namelen = 80; + ods2p->kstatfs.f_type = 0x3253444f; /* 2SDO */ + ods2p->kstatfs.f_bsize = 512; + ods2p->kstatfs.f_files = ods2p->hm2.hm2_l_maxfiles; + ods2p->kstatfs.f_namelen = 80; memcpy(format, ods2p->hm2.hm2_t_format, 12); format[12] = 0; @@ -252,17 +257,28 @@ memcpy(volowner, ods2p->hm2.hm2_t_ownername, 12); volowner[12] = 0; printk("ODS2-fs This is a valid ODS2 file system with format /%s/ and volume name /%s/ and owner /%s/\n", format, volname, volowner); - return sb; + return 0; } kfree(ods2p->ibitmap); } } - kfree(sb->u.generic_sbp); + kfree(ODS2_SB(sb)); } - return NULL; + return -EINVAL; } -static DECLARE_FSTYPE_DEV(ods2_fs_type, "ods2", ods2_read_super); +static struct super_block *ods2_read_super (struct file_system_type *fs_type, + int flags, const char *dev_name, void *data) { + return get_sb_bdev (fs_type, flags, dev_name, data, ods2_fill_super); +} + +static struct file_system_type ods2_fs_type = { + .owner = THIS_MODULE, + .name = "ods2", + .get_sb = ods2_read_super, + .kill_sb = kill_block_super, + .fs_flags = FS_REQUIRES_DEV, +}; static int __init init_ods2_fs(void) { @@ -274,22 +290,10 @@ unregister_filesystem(&ods2_fs_type); } -EXPORT_NO_SYMBOLS; - -module_init(init_ods2_fs); -module_exit(exit_ods2_fs); +module_init (init_ods2_fs); +module_exit (exit_ods2_fs); -MODULE_AUTHOR("Jonas Lindholm - <jl...@us...>"); -MODULE_DESCRIPTION("ODS2 Filesystem"); -MODULE_LICENSE("GPL"); +MODULE_AUTHOR ("Jonas Lindholm <jl...@us...>"); +MODULE_DESCRIPTION ("ODS-2 filesystem driver"); +MODULE_LICENSE ("GPL"); -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ Index: file.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/file.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- file.c 19 Sep 2004 16:37:06 -0000 1.2 +++ file.c 19 Sep 2004 19:51:15 -0000 1.3 @@ -23,6 +23,7 @@ #include <linux/slab.h> #include <linux/init.h> #include <linux/blkdev.h> +#include <linux/buffer_head.h> #include <asm/uaccess.h> #include "ods2.h" @@ -58,27 +59,32 @@ */ -int ods2_file_ioctl(struct inode *inode, struct file *filp, int unsigned cmd, long unsigned arg) { - struct super_block *sb = inode->i_sb; - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; - ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; - int error = -ENOTTY; - int onoff; +int +ods2_file_ioctl (struct inode *inode, struct file *filp, int unsigned cmd, + long unsigned arg) +{ + struct super_block *sb = inode->i_sb; + ODS2SB *ods2p = ODS2_SB (sb); + ODS2FILE *ods2filep = (ODS2FILE *) filp->private_data; + int error = -ENOTTY; + int onoff; switch (cmd) { - case ODS2_IOC_FISETRAW: - if ((error = get_user(onoff, (int *)arg)) == 0) { - ods2filep->u1.s1.v_raw = (onoff == 1); - } - break; - case ODS2_IOC_FIGETRAW: - onoff = ods2filep->u1.s1.v_raw; - error = put_user(onoff, (int *)arg); - break; - case ODS2_IOC_SBGETRAW: - onoff = ods2p->flags.v_raw; - error = put_user(onoff, (int *)arg); - break; + case ODS2_IOC_FISETRAW: + if ((error = get_user(onoff, (int *)arg)) == 0) { + ods2filep->u1.s1.v_raw = (onoff == 1); + } + break; + + case ODS2_IOC_FIGETRAW: + onoff = ods2filep->u1.s1.v_raw; + error = put_user(onoff, (int *)arg); + break; + + case ODS2_IOC_SBGETRAW: + onoff = ods2p->flags.v_raw; + error = put_user(onoff, (int *)arg); + break; } return error; } @@ -379,7 +385,7 @@ ssize_t ods2_read(struct file *filp, char *buf, size_t buflen, loff_t *loff) { struct inode *inode = filp->f_dentry->d_inode; struct super_block *sb = inode->i_sb; - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; + ODS2SB *ods2p = ODS2_SB (sb); ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); @@ -434,7 +440,9 @@ the end of file position. */ -loff_t ods2_llseek_stream(struct file *filp, loff_t loff, int seek) { +static loff_t +ods2_llseek_stream (struct file *filp, loff_t loff, int seek) +{ struct inode *inode = filp->f_dentry->d_inode; loff_t offs; @@ -452,7 +460,7 @@ } } filp->f_pos = offs; - filp->f_reada = 0; + //filp->f_reada = 0; FIXME filp->f_version++; return offs; } @@ -573,7 +581,7 @@ ods2filep->reclen = 65535; up(&(ods2vari->sem)); filp->f_pos = coffs; - filp->f_reada = 0; + //filp->f_reada = 0; FIXME filp->f_version++; return offs; } @@ -587,7 +595,7 @@ ods2filep->reclen = 65535; up(&(ods2vari->sem)); filp->f_pos = coffs; - filp->f_reada = 0; + //filp->f_reada = 0; FIXME filp->f_version++; return offs; } @@ -602,7 +610,7 @@ ods2filep->reclen = reclen; up(&(ods2vari->sem)); filp->f_pos = coffs; - filp->f_reada = 0; + //filp->f_reada = 0; FIXME filp->f_version++; return offs; } @@ -615,10 +623,12 @@ } -loff_t ods2_llseek(struct file *filp, loff_t loff, int seek) { +loff_t +ods2_llseek(struct file *filp, loff_t loff, int seek) +{ struct inode *inode = filp->f_dentry->d_inode; struct super_block *sb = inode->i_sb; - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; + ODS2SB *ods2p = ODS2_SB (sb); ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); @@ -664,13 +674,3 @@ return 0; } -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ Index: ods2.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/ods2.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ods2.h 19 Sep 2004 16:40:16 -0000 1.2 +++ ods2.h 19 Sep 2004 19:51:15 -0000 1.3 @@ -1,3 +1,6 @@ +#ifndef _ODS2_H +#define _ODS2_H + /* * linux/fs/ods2/ods2.h * @@ -11,7 +14,7 @@ * */ -#include <asm/statfs.h> +#include <linux/statfs.h> /* The followinf structures are defined in the book @@ -19,6 +22,12 @@ */ /* + * Access to the ods2 superblock from a VFS struct super_block. + */ +#define ODS2_SB(sb) (sb->s_fs_info) + + +/* This is the home block on a ODS2 disk. */ @@ -458,18 +467,18 @@ #define SB_M_LOWERCASE 16 typedef struct ods2sb { - HM2DEF hm2; - struct inode *indexf; /* INDEXF.SYS */ - u8 *ibitmap; /* index file header bitmap */ - struct statfs statfs; + HM2DEF hm2; + struct inode *indexf; /* INDEXF.SYS */ + u8 *ibitmap; /* index file header bitmap */ + struct kstatfs kstatfs; struct { - int v_version:3; /* what to do with file versions */ - int v_raw:1; /* force all files as stream */ - int v_lowercase:1; /* force all file names to lowercase */ - int v_res:27; /* reserved */ + int v_version:3; /* what to do with file versions */ + int v_raw:1; /* force all files as stream */ + int v_lowercase:1; /* force all file names to lowercase */ + int v_res:27; /* reserved */ } flags; - char dollar; /* character used for dollar */ - char semicolon; /* character used for semicolon */ + char dollar; /* character used for dollar */ + char semicolon; /* character used for semicolon */ } ODS2SB; /* @@ -494,15 +503,6 @@ #define MAX(a, b) (a > b ? a : b) /* - Ok, I give up :-) for some reason unknown to me the addition of 2 seconds - is needed to get the correct time. - It works for a file created 1-jan-1971 and for a file created 1-jan-2038 - as well as for files created 1992 and 2003. -*/ - -#define vms2unixtime(a) ((u64)div64((le64_to_cpu(*(u64 *)&(a)) - 0x007c953d63a19980L) >> 7, 78125) + 2); - -/* util.c */ @@ -518,7 +518,7 @@ inode.c */ -struct dentry *ods2_lookup(struct inode *dir, struct dentry *dentry); +struct dentry *ods2_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd); void ods2_read_inode(struct inode *inode); void ods2_put_inode(struct inode *inode); void ods2_clear_inode(struct inode *inode); @@ -539,14 +539,13 @@ loff_t ods2_llseek(struct file *filp, loff_t loff, int seek); int ods2_open_release(struct inode *inode, struct file *filp); - /* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: + * util.c */ +extern time_t vms2unix_sec (u16 *vms_timestamp); +extern long vms2unix_nsec (u16 *vms_timestamp); + +/* Hacks in util.c */ +extern int get_hardsect_size (int xx); + +#endif /* _ODS2_H */ Index: dir.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/dir.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- dir.c 19 Sep 2004 16:37:06 -0000 1.2 +++ dir.c 19 Sep 2004 19:51:15 -0000 1.3 @@ -21,21 +21,23 @@ #include <linux/slab.h> #include <linux/init.h> #include <linux/blkdev.h> +#include <linux/buffer_head.h> #include <asm/uaccess.h> #include "ods2.h" /* - This routine return one or more file names for a directory file. - For an ODS2 file structure each file name can have one or more - versions of a file, each file must be treated as a unique file. -*/ - -int ods2_readdir(struct file *filp, void *dirent, filldir_t filldir) { + * This routine return one or more file names for a directory file. + * For an ODS2 file structure each file name can have one or more + * versions of a file, each file must be treated as a unique file. + */ +int +ods2_readdir (struct file *filp, void *dirent, filldir_t filldir) +{ struct inode *inode = filp->f_dentry->d_inode; struct super_block *sb = inode->i_sb; struct buffer_head *bh = NULL; - ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; + ODS2SB *ods2p = ODS2_SB (sb); ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; loff_t pos = filp->f_pos; @@ -165,13 +167,3 @@ return 0; } -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ |