You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(11) |
Jun
(66) |
Jul
(16) |
Aug
(2) |
Sep
(7) |
Oct
(17) |
Nov
(1) |
Dec
(220) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(154) |
Feb
(167) |
Mar
(159) |
Apr
(172) |
May
(35) |
Jun
(58) |
Jul
(97) |
Aug
(285) |
Sep
(139) |
Oct
(252) |
Nov
(8) |
Dec
(3) |
| 2004 |
Jan
(13) |
Feb
(159) |
Mar
(136) |
Apr
(33) |
May
(50) |
Jun
(42) |
Jul
(140) |
Aug
(42) |
Sep
(199) |
Oct
(31) |
Nov
(55) |
Dec
|
| 2005 |
Jan
|
Feb
(12) |
Mar
(214) |
Apr
(119) |
May
(21) |
Jun
(2) |
Jul
(127) |
Aug
(10) |
Sep
(3) |
Oct
(24) |
Nov
(1) |
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(45) |
May
(13) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
(26) |
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(35) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-22 06:27:30
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5730 Modified Files: ods2.h Log Message: - Nuke remaining bits of former option-parsing functions. Index: ods2.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/ods2.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ods2.h 20 Sep 2004 21:15:47 -0000 1.7 +++ ods2.h 22 Sep 2004 06:27:17 -0000 1.8 @@ -496,7 +496,6 @@ extern struct ods2map *getmap(struct super_block *sb, struct fh2def *fh2p); extern struct buffer_head *getfilebh(struct file *filp, u32 vbn); extern int verify_fh(struct fh2def *fh2p, u32 ino); -extern int parse_options(struct super_block *sb, char *options); /* * inode.c |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-22 06:26:00
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5545 Modified Files: CHANGES TODO Log Message: - Update text files. Index: CHANGES =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/CHANGES,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CHANGES 20 Sep 2004 06:05:29 -0000 1.4 +++ CHANGES 22 Sep 2004 06:25:50 -0000 1.5 @@ -1,3 +1,7 @@ +Changes from version 0.9.4c to 0.9.4d +===================================== + - Use Linux-2.6.x style option parsing infrastructure. + Changes from version 0.9.4b to 0.9.4c ===================================== - Removal for the argument parsing typedefs. Index: TODO =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/TODO,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TODO 20 Sep 2004 20:25:37 -0000 1.1 +++ TODO 22 Sep 2004 06:25:50 -0000 1.2 @@ -1,4 +1,3 @@ -- Rewrite option parsing code to use the 2.6.x kernel's parsing functions - Check sector loading code (FS blocks vs. hard sectors) - Put pointer/array arithmetic into function-like looking macros - Add write support :-) |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-22 06:24:41
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5296 Modified Files: Makefile super.c util.c Removed Files: tparse.c tparse.h Log Message: - Use Linux-2.6.x style option parsing infrastructure. Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 19 Sep 2004 19:51:15 -0000 1.2 +++ Makefile 22 Sep 2004 06:24:30 -0000 1.3 @@ -4,7 +4,7 @@ obj-$(CONFIG_ODS2_FS) += ods2.o -ods2-objs := super.o inode.o file.o dir.o util.o tparse.o +ods2-objs := super.o inode.o file.o dir.o util.o # Intentionally misspelled, only for local compile testing lcean: Index: util.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/util.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- util.c 20 Sep 2004 20:27:17 -0000 1.6 +++ util.c 22 Sep 2004 06:24:30 -0000 1.7 @@ -18,10 +18,7 @@ #include <linux/init.h> #include <linux/blkdev.h> #include <linux/buffer_head.h> - #include "ods2.h" -#include "tparse.h" - u64 div64 (u64 a, u32 b0) { @@ -203,120 +200,6 @@ return 0; } -int -save_raw (struct argblk *argblk) -{ - struct super_block *sb = (struct super_block *) argblk->arg; - struct ods2sb *ods2p = ODS2_SB (sb); - - ods2p->flags.v_raw = 1; - return 1; -} - - -int -save_lowercase (struct argblk *argblk) -{ - struct super_block *sb = (struct super_block *) argblk->arg; - struct ods2sb *ods2p = ODS2_SB (sb); - - ods2p->flags.v_lowercase = 1; - return 1; -} - - -int -save_dollar (struct argblk *argblk) -{ - struct super_block *sb = (struct super_block *) argblk->arg; - struct ods2sb *ods2p = ODS2_SB (sb); - - ods2p->dollar = argblk->token[0]; - return 1; -} - - -int -save_semicolon (struct argblk *argblk) -{ - struct super_block *sb = (struct super_block *) argblk->arg; - struct ods2sb *ods2p = ODS2_SB (sb); - - ods2p->semicolon = argblk->token[0]; - return 1; -} - - -int -save_version (struct argblk *argblk) -{ - struct super_block *sb = (struct super_block *) argblk->arg; - struct ods2sb *ods2p = ODS2_SB (sb); - - ods2p->flags.v_version = argblk->mask; - return 1; -} - - -struct tparse tpa1[]; -struct tparse tpa10[]; -struct tparse tpa11[]; -struct tparse tpa20[]; -struct tparse tpa21[]; -struct tparse tpa30[]; -struct tparse tpa31[]; - -struct tparse tpa1[] = { - { "dollar", tpa10, NULL, 0, NULL, 0 }, - { "version", tpa20, NULL, 0, NULL, 0 }, - { "semicolon", tpa30, NULL, 0, NULL, 0 }, - { "lowercase", tpa1, save_lowercase, 0, NULL, 0 }, - { "raw", tpa1, save_raw, 0, NULL, 0 }, - { TPA_EOS, TPA_EXIT, NULL, 0, NULL, 0 }, - TPA_END, -}; - -struct tparse tpa10[] = { - { "=", tpa11, NULL, 0, NULL, 0 }, - TPA_END, -}; - -struct tparse tpa11[] = { - { TPA_ANY, tpa1, save_dollar, 0, NULL, 0 }, - TPA_END, -}; - -struct tparse tpa20[] = { - { "=", tpa21, NULL, 0, NULL, 0 }, - TPA_END, -}; - -struct tparse tpa21[] = { - { "all", tpa1, save_version, SB_M_VERSALL, NULL, 0 }, - { "highest", tpa1, save_version, SB_M_VERSHIGH, NULL, 0 }, - { "none", tpa1, save_version, SB_M_VERSNONE, NULL, 0 }, - TPA_END, -}; - -struct tparse tpa30[] = { - { "=", tpa31, NULL, 0, NULL, 0 }, - TPA_END, -}; - -struct tparse tpa31[] = { - { TPA_ANY, tpa1, save_semicolon, 0, NULL, 0 }, - TPA_END, -}; - - -int -parse_options (struct super_block *sb, char *options) { - struct argblk argblk; - - argblk.str = options; - argblk.arg = (unsigned long) sb; - return tparse (&argblk, tpa1); -} /* * Ok, I give up :-) for some reason unknown to me the addition of 2 seconds --- tparse.c DELETED --- Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- super.c 20 Sep 2004 20:47:53 -0000 1.9 +++ super.c 22 Sep 2004 06:24:30 -0000 1.10 @@ -20,6 +20,7 @@ #include <linux/init.h> #include <linux/blkdev.h> #include <linux/statfs.h> +#include <linux/parser.h> #include "ods2.h" @@ -168,15 +169,119 @@ return 0; } + +/* + * Parse options that can be supplied (mount -o xxxxxxx) + */ +enum { + Opt_ods2_dollar, + Opt_ods2_semicolon, + Opt_ods2_version_all, + Opt_ods2_version_highest, + Opt_ods2_version_none, + Opt_ods2_lowercase, + Opt_ods2_raw, + Opt_ods2_err, +}; +static match_table_t ods2_tokens = { + { .token = Opt_ods2_dollar, .pattern = "dollar=%s", }, + { .token = Opt_ods2_semicolon, .pattern = "semicolon=%s", }, + { .token = Opt_ods2_version_all, .pattern = "version=all", }, + { .token = Opt_ods2_version_highest, .pattern = "version=highest", }, + { .token = Opt_ods2_version_none, .pattern = "version=none", }, + { .token = Opt_ods2_lowercase, .pattern = "lowercase", }, + { .token = Opt_ods2_raw, .pattern = "raw", }, + { .token = Opt_ods2_err, .pattern = NULL, }, +}; + +static int +ods2_set_defaults_and_user_options (struct super_block *sb, char *options) +{ + struct ods2sb *ods2sb = ODS2_SB (sb); + substring_t args[MAX_OPT_ARGS]; + int token; + char *p; + char *string_opt; + + /* + * Set default values first, ... + */ + ods2sb->flags.v_raw = 0; + ods2sb->flags.v_lowercase = 0; + ods2sb->flags.v_version = SB_M_VERSALL; + ods2sb->dollar = '_'; + ods2sb->semicolon = '.'; + + /* + * ...then try to parse user-supplied options + */ + if (!options) + return 0; + + while ((p = strsep(&options, ",")) != NULL) { + if (!*p) + continue; + + token = match_token (p, ods2_tokens, args); + switch (token) { + case Opt_ods2_dollar: + string_opt = match_strdup (&args[0]); + if (!string_opt) + return -ENOMEM; + ods2sb->dollar = string_opt[0]; + kfree (string_opt); + break; + + case Opt_ods2_semicolon: + string_opt = match_strdup (&args[0]); + if (!string_opt) + return -ENOMEM; + ods2sb->semicolon = string_opt[0]; + kfree (string_opt); + break; + + case Opt_ods2_version_all: + ods2sb->flags.v_version = SB_M_VERSALL; + break; + + case Opt_ods2_version_highest: + ods2sb->flags.v_version = SB_M_VERSHIGH; + break; + + case Opt_ods2_version_none: + ods2sb->flags.v_version = SB_M_VERSNONE; + break; + + case Opt_ods2_lowercase: + ods2sb->flags.v_lowercase = 1; + break; + + case Opt_ods2_raw: + ods2sb->flags.v_raw = 1; + break; + + case Opt_ods2_err: + default: + printk (KERN_ERR "Unrecognized ODS-2 option or " + "missing value \"%s\"\n", p); + return -EINVAL; + } + } + + return 0; +} + + /* * This is the routine that is invoked when an ODS2 file system * is mounted. */ static int -ods2_fill_super(struct super_block *sb, void *data, int silent) +ods2_fill_super (struct super_block *sb, void *data, int silent) { struct buffer_head *bh; struct ods2sb *ods2p; + int ret; /* This should be something like (from ext2): * @@ -220,7 +325,13 @@ ods2p = ODS2_SB (sb); memcpy(&ods2p->hm2, GETBLKP(sb, 1, bh->b_data), sizeof (struct hm2def)); brelse(bh); - + + ret = ods2_set_defaults_and_user_options (sb, data); + if (ret) { + kfree (ODS2_SB (sb)); + return ret; + } + for (p = (u16 *)&(ods2p->hm2) ; p < (u16 *)&(ods2p->hm2.hm2_w_checksum1) ; chksum1 += *p++); for (p = (u16 *)&(ods2p->hm2) ; p < (u16 *)&(ods2p->hm2.hm2_w_checksum2) ; chksum2 += *p++); @@ -239,17 +350,6 @@ ods2p->hm2.hm2_w_resfiles >= 5 && chksum1 == ods2p->hm2.hm2_w_checksum1 && chksum2 == ods2p->hm2.hm2_w_checksum2) { - /* - * Set default values first, then parse - * user-supplied option string - */ - ods2p->flags.v_raw = 0; - ods2p->flags.v_lowercase = 0; - ods2p->flags.v_version = SB_M_VERSALL; - ods2p->dollar = '_'; - ods2p->semicolon = '.'; - if (data) - parse_options(sb, data); sb->s_op = &ods2_sops; --- tparse.h DELETED --- |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 21:15:56
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6108 Modified Files: dir.c file.c ods2.h tparse.c Log Message: - Remove trailing blanks. Index: tparse.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/tparse.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- tparse.c 20 Sep 2004 06:05:29 -0000 1.3 +++ tparse.c 20 Sep 2004 21:15:47 -0000 1.4 @@ -22,7 +22,7 @@ { int idx; int found; - + while (1) { char *str = argblk->str; @@ -71,7 +71,7 @@ if (((void **)tpa[idx].type)[0] == (void *)244) { struct tparse *tmptpa = ((struct tparse **)tpa[idx].type)[1]; struct argblk tmpargblk; - + tmpargblk.options = argblk->options; tmpargblk.arg = argblk->arg; tmpargblk.str = str; Index: file.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/file.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- file.c 20 Sep 2004 20:27:17 -0000 1.6 +++ file.c 20 Sep 2004 21:15:47 -0000 1.7 @@ -52,7 +52,7 @@ IMPLICIT: - None. + None. */ @@ -296,12 +296,12 @@ For a non-RMS machine that doesn't know anything about records these three formats are the same. For RMS the different between these formats is the following: - + STREAM: Records are delimited by FF, VT, LF, or CRLF. STREAMLF: Records are delimited by LF. STREAMCR: Records are delimited by CR. - - Note that we can not use generic read routines even if we treat the data as just a + + Note that we can not use generic read routines even if we treat the data as just a stream of bytes because the way we need to translate from VBN to LBN. INPUT: @@ -628,7 +628,7 @@ } } - + loff_t ods2_llseek(struct file *filp, loff_t loff, int seek) { Index: ods2.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/ods2.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ods2.h 20 Sep 2004 21:13:38 -0000 1.6 +++ ods2.h 20 Sep 2004 21:15:47 -0000 1.7 @@ -391,7 +391,7 @@ * This is the index for one or more ODS2VAR structures. By doing index as * much as possible it is easy to calculate what structure to use by just * doing some shifts and bit masking. - * Note that this structure and its sub structures are protected by a + * Note that this structure and its sub structures are protected by a * semaphore because more than one process at the same time can use the inode * structure to read the file contents. * The number of bytes for this structure is 128 * 4 + 12 (or 16) => 528. Index: dir.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/dir.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- dir.c 20 Sep 2004 20:27:16 -0000 1.6 +++ dir.c 20 Sep 2004 21:15:47 -0000 1.7 @@ -118,7 +118,7 @@ * will be detected later on when the user try to walk down into * the false directory. */ - if (filldir(dirent, dirnamev, strlen(dirnamev), filp->f_pos, ino, + if (filldir(dirent, dirnamev, strlen(dirnamev), filp->f_pos, ino, (strstr(dirnamev, (ods2p->flags.v_lowercase ? ".dir." : ".DIR")) == NULL ? DT_REG : DT_DIR))) { /* We come here when filldir is unable to handle more entries. |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 21:13:49
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5603 Modified Files: ods2.h Log Message: - Remove spaces. Index: ods2.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/ods2.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ods2.h 20 Sep 2004 05:51:29 -0000 1.5 +++ ods2.h 20 Sep 2004 21:13:38 -0000 1.6 @@ -31,58 +31,58 @@ * This is the home block on a ODS2 disk. */ struct hm2def { - u32 hm2_l_homelbn; - u32 hm2_l_alhomelbn; - u32 hm2_l_altidxlbn; + u32 hm2_l_homelbn; + u32 hm2_l_alhomelbn; + u32 hm2_l_altidxlbn; union { - u16 hm2_w_struclev; + u16 hm2_w_struclev; struct { - u8 hm2_b_structlevv; - u8 hm2_b_structlevl; - } s1; - } u1; - u16 hm2_w_cluster; - u16 hm2_w_homevbn; - u16 hm2_w_alhomevbn; - u16 hm2_w_altidxvbn; - u16 hm2_w_ibmapvbn; - u32 hm2_l_ibmaplbn; - u32 hm2_l_maxfiles; - u16 hm2_w_ibmapsize; - u16 hm2_w_resfiles; - u16 hm2_w_devtype; - u16 hm2_w_rvn; - u16 hm2_w_setcount; - u16 hm2_w_volchar; + u8 hm2_b_structlevv; + u8 hm2_b_structlevl; + } s1; + } u1; + u16 hm2_w_cluster; + u16 hm2_w_homevbn; + u16 hm2_w_alhomevbn; + u16 hm2_w_altidxvbn; + u16 hm2_w_ibmapvbn; + u32 hm2_l_ibmaplbn; + u32 hm2_l_maxfiles; + u16 hm2_w_ibmapsize; + u16 hm2_w_resfiles; + u16 hm2_w_devtype; + u16 hm2_w_rvn; + u16 hm2_w_setcount; + u16 hm2_w_volchar; union { - u32 hm2_l_owner; + u32 hm2_l_owner; struct { - u16 hm2_w_mem; - u16 hm2_w_grp; - } s1; - } u2; - u32 hm2_l_res1; - u16 hm2_w_protect; - u16 hm2_w_fileprot; - u16 hm2_w_res2; - u16 hm2_w_checksum1; - u32 hm2_q_credate[2]; - u8 hm2_b_window; - u8 hm2_b_lru_lim; - u16 hm2_w_extend; - u32 hm2_q_retainmin[2]; - u32 hm2_q_retainmax[2]; - u32 hm2_q_revdate[2]; - u8 hm2_r_min_class[20]; - u8 hm2_r_max_class[20]; - u8 hm2_b_res3[320]; - u32 hm2_l_serialnum; - char hm2_t_structname[12]; - char hm2_t_volname[12]; - char hm2_t_ownername[12]; - char hm2_t_format[12]; - u16 hm2_w_res4; - u16 hm2_w_checksum2; + u16 hm2_w_mem; + u16 hm2_w_grp; + } s1; + } u2; + u32 hm2_l_res1; + u16 hm2_w_protect; + u16 hm2_w_fileprot; + u16 hm2_w_res2; + u16 hm2_w_checksum1; + u32 hm2_q_credate[2]; + u8 hm2_b_window; + u8 hm2_b_lru_lim; + u16 hm2_w_extend; + u32 hm2_q_retainmin[2]; + u32 hm2_q_retainmax[2]; + u32 hm2_q_revdate[2]; + u8 hm2_r_min_class[20]; + u8 hm2_r_max_class[20]; + u8 hm2_b_res3[320]; + u32 hm2_l_serialnum; + char hm2_t_structname[12]; + char hm2_t_volname[12]; + char hm2_t_ownername[12]; + char hm2_t_format[12]; + u16 hm2_w_res4; + u16 hm2_w_checksum2; }; /* @@ -91,47 +91,47 @@ */ struct scbdef { union { - u16 scb_w_struclev; + u16 scb_w_struclev; struct { - u8 scb_b_structlevv; - u8 scb_b_structlevl; - } s1; - } u1; - u16 scb_w_cluster; - u32 scb_l_volsize; - u32 scb_l_blksize; - u32 scb_l_sectors; - u32 scb_l_tracks; - u32 scb_l_cylinders; + u8 scb_b_structlevv; + u8 scb_b_structlevl; + } s1; + } u1; + u16 scb_w_cluster; + u32 scb_l_volsize; + u32 scb_l_blksize; + u32 scb_l_sectors; + u32 scb_l_tracks; + u32 scb_l_cylinders; union { - u32 scb_l_status; + u32 scb_l_status; struct { - u32 scb_v_mapdirty:1; - u32 scb_v_mapalloc:1; - u32 scb_v_filalloc:1; - u32 scb_v_quodirty:1; - u32 scb_v_hdrwrite:1; - u32 scb_v_corrupt:1; - } s1; - } u2; + u32 scb_v_mapdirty:1; + u32 scb_v_mapalloc:1; + u32 scb_v_filalloc:1; + u32 scb_v_quodirty:1; + u32 scb_v_hdrwrite:1; + u32 scb_v_corrupt:1; + } s1; + } u2; union { - u32 scb_l_status2; + u32 scb_l_status2; struct { - u32 scb_v_mapdirty:1; - u32 scb_v_mapalloc:1; - u32 scb_v_filalloc:1; - u32 scb_v_quodirty:1; - u32 scb_v_hdrwrite:1; - u32 scb_v_corrupt:1; - } s1; - } u3; - u16 scb_w_writecnt; - char scb_t_volockname[12]; - u16 scb_q_mounttime[4]; - u16 scb_w_backrev; - u64 scb_q_genernum; - u8 scb_b_reserved[446]; - u16 scb_w_checksum; + u32 scb_v_mapdirty:1; + u32 scb_v_mapalloc:1; + u32 scb_v_filalloc:1; + u32 scb_v_quodirty:1; + u32 scb_v_hdrwrite:1; + u32 scb_v_corrupt:1; + } s1; + } u3; + u16 scb_w_writecnt; + char scb_t_volockname[12]; + u16 scb_q_mounttime[4]; + u16 scb_w_backrev; + u64 scb_q_genernum; + u8 scb_b_reserved[446]; + u16 scb_w_checksum; }; /* @@ -139,13 +139,13 @@ * fives different tomes as well as the file name. */ struct fi2def { - char fi2_t_filename[20]; - u16 fi2_w_revision; - u16 fi2_q_credate[4]; - u16 fi2_q_revdate[4]; - u16 fi2_q_expdate[4]; - u16 fi2_q_bakdate[4]; - char fi_2_filenameext[66]; + char fi2_t_filename[20]; + u16 fi2_w_revision; + u16 fi2_q_credate[4]; + u16 fi2_q_revdate[4]; + u16 fi2_q_expdate[4]; + u16 fi2_q_bakdate[4]; + char fi_2_filenameext[66]; }; /* @@ -153,86 +153,86 @@ * It is located in file INDEXF.SYS. */ struct fh2def { - u8 fh2_b_idoffset; - u8 fh2_b_mpoffset; - u8 fh2_b_acoffset; - u8 fh2_b_rsoffset; - u16 fh2_w_seg_num; + u8 fh2_b_idoffset; + u8 fh2_b_mpoffset; + u8 fh2_b_acoffset; + u8 fh2_b_rsoffset; + u16 fh2_w_seg_num; union { - u16 fh2_w_struclev; + u16 fh2_w_struclev; struct { - u8 fh2_b_structlevv; - u8 fh2_b_structlevl; - } s1; - } u1; + u8 fh2_b_structlevv; + u8 fh2_b_structlevl; + } s1; + } u1; union { - u16 fh2_w_fid[3]; + u16 fh2_w_fid[3]; struct { - u16 fh2_w_fid_num; - u16 fh2_w_fid_seq; - u8 fh2_b_fid_rvn; - u8 fh2_b_fid_nmx; - } s1; - } u2; + u16 fh2_w_fid_num; + u16 fh2_w_fid_seq; + u8 fh2_b_fid_rvn; + u8 fh2_b_fid_nmx; + } s1; + } u2; union { - u16 fh2_w_ext_fid[3]; + u16 fh2_w_ext_fid[3]; struct { - u16 fid_w_ex_fidnum; - u16 fid_w_ex_fidseq; - u8 fid_b_ex_fidrvn; - u8 fid_b_ex_fidnmx; - } s1; - } u3; - u32 fh2_w_recattr[8]; + u16 fid_w_ex_fidnum; + u16 fid_w_ex_fidseq; + u8 fid_b_ex_fidrvn; + u8 fid_b_ex_fidnmx; + } s1; + } u3; + u32 fh2_w_recattr[8]; union { struct filechar { - u32 fch_v_wascontig:1; - u32 fch_v_nobackup:1; - u32 fch_v_writeback:1; - u32 fch_v_readcheck:1; - u32 fch_v_writecheck:1; - u32 fch_v_contigb:1; - u32 fch_v_locked:1; - u32 fch_v_contig:1; - u32 fch_v_res1:3; - u32 fch_v_badacl:1; - u32 fch_v_spool:1; - u32 fch_v_directory:1; - u32 fch_v_badblock:1; - u32 fch_v_markdel:1; - u32 fch_v_nocharge:1; - u32 fch_v_erase:1; - } s1; - u32 fh2_l_filechar; - } u4; - u16 fh2_w_res1; - u8 fh2_b_map_inuse; - u8 fh2_b_acc_mode; + u32 fch_v_wascontig:1; + u32 fch_v_nobackup:1; + u32 fch_v_writeback:1; + u32 fch_v_readcheck:1; + u32 fch_v_writecheck:1; + u32 fch_v_contigb:1; + u32 fch_v_locked:1; + u32 fch_v_contig:1; + u32 fch_v_res1:3; + u32 fch_v_badacl:1; + u32 fch_v_spool:1; + u32 fch_v_directory:1; + u32 fch_v_badblock:1; + u32 fch_v_markdel:1; + u32 fch_v_nocharge:1; + u32 fch_v_erase:1; + } s1; + u32 fh2_l_filechar; + } u4; + u16 fh2_w_res1; + u8 fh2_b_map_inuse; + u8 fh2_b_acc_mode; union { - u32 fh2_l_fileowner; + u32 fh2_l_fileowner; struct { - u16 fh2_w_mem; - u16 fh2_w_grp; - } s1; - } u5; - u16 fh2_w_fileprot; + u16 fh2_w_mem; + u16 fh2_w_grp; + } s1; + } u5; + u16 fh2_w_fileprot; union { - u16 fh2_w_backlink[3]; + u16 fh2_w_backlink[3]; struct { - u16 fid_w_num; - u16 fid_w_seq; - u8 fid_b_rvn; - u8 fid_b_nmx; - } s1; - } u6; - u8 fh2_b_journal; - u8 fh2_b_ru_active; - u16 fh2_w_res2; - u32 fh2_l_highwater; - u8 fh2_b_res3[8]; - u8 fh2_r_class_prot[20]; - u8 fh2_b_res4[402]; - u16 fh2_w_checksum; + u16 fid_w_num; + u16 fid_w_seq; + u8 fid_b_rvn; + u8 fid_b_nmx; + } s1; + } u6; + u8 fh2_b_journal; + u8 fh2_b_ru_active; + u16 fh2_w_res2; + u32 fh2_l_highwater; + u8 fh2_b_res3[8]; + u8 fh2_r_class_prot[20]; + u8 fh2_b_res4[402]; + u16 fh2_w_checksum; }; /* @@ -240,57 +240,57 @@ * It is part of the file header. * It defines RMS attributes for any file. */ -#define FAT_C_UNDEFINED 0 -#define FAT_C_FIXED 1 -#define FAT_C_VARIABLE 2 -#define FAT_C_VFC 3 -#define FAT_C_STREAM 4 -#define FAT_C_STREAMLF 5 -#define FAT_C_STREAMCR 6 +#define FAT_C_UNDEFINED 0 +#define FAT_C_FIXED 1 +#define FAT_C_VARIABLE 2 +#define FAT_C_VFC 3 +#define FAT_C_STREAM 4 +#define FAT_C_STREAMLF 5 +#define FAT_C_STREAMCR 6 -#define FAT_C_SEQUANTIAL 0 -#define FAT_C_RELATIVE 1 -#define FAT_C_INDEXED 2 -#define FAT_C_DIRECT 3 +#define FAT_C_SEQUANTIAL 0 +#define FAT_C_RELATIVE 1 +#define FAT_C_INDEXED 2 +#define FAT_C_DIRECT 3 -#define FAT_M_FORTRANCC 0x01 -#define FAT_M_IMPLIEDCC 0x02 -#define FAT_M_PRINTCC 0x04 -#define FAT_M_NOSPAN 0x08 -#define FAT_M_MSBRCW 0x10 +#define FAT_M_FORTRANCC 0x01 +#define FAT_M_IMPLIEDCC 0x02 +#define FAT_M_PRINTCC 0x04 +#define FAT_M_NOSPAN 0x08 +#define FAT_M_MSBRCW 0x10 struct fatdef { union { - u8 fat_b_rtype; + u8 fat_b_rtype; struct { - u8 fat_v_rtype:4; - u8 fat_v_fileorg:4; - } s0; - } u0; - u8 fat_b_rattrib; - u8 fat_w_rsize; + u8 fat_v_rtype:4; + u8 fat_v_fileorg:4; + } s0; + } u0; + u8 fat_b_rattrib; + u8 fat_w_rsize; union { - u32 fat_l_hiblk; + u32 fat_l_hiblk; struct { - u16 fat_w_hiblkh; - u16 fat_w_hiblkl; - } s1; - } u1; + u16 fat_w_hiblkh; + u16 fat_w_hiblkl; + } s1; + } u1; union { - u32 fat_l_efblk; + u32 fat_l_efblk; struct { - u16 fat_w_efblkh; - u16 fat_w_efblkl; - } s1; + u16 fat_w_efblkh; + u16 fat_w_efblkl; + } s1; } u2; - u16 fat_w_ffbyte; - u8 fat_b_bktsize; - u8 fat_b_vfcsize; - u16 fat_w_maxrec; - u16 fat_w_defext; - u8 fat_b_res1[6]; - u16 fat_w_notused; - u16 fat_w_versions; + u16 fat_w_ffbyte; + u8 fat_b_bktsize; + u8 fat_b_vfcsize; + u16 fat_w_maxrec; + u16 fat_w_defext; + u8 fat_b_res1[6]; + u16 fat_w_notused; + u16 fat_w_versions; }; /* @@ -301,21 +301,21 @@ struct fm2def { union { struct { - u8 fm2_b_count1; - u8 fm2_v_highlbn:6; - u8 fm2_v_format:2; - u16 fm2_w_lowlbn; - } fm1; + u8 fm2_b_count1; + u8 fm2_v_highlbn:6; + u8 fm2_v_format:2; + u16 fm2_w_lowlbn; + } fm1; struct { - u16 fm2_v_count2:14; - u16 fm2_v_format:2; - u16 fm2_l_lbn2[2]; - } fm2; + u16 fm2_v_count2:14; + u16 fm2_v_format:2; + u16 fm2_l_lbn2[2]; + } fm2; struct { - u16 fm2_v_count2:14; - u16 fm2_v_format:2; - u16 fm2_w_lowcount; - u32 fm2_l_lbn3; + u16 fm2_v_count2:14; + u16 fm2_v_format:2; + u16 fm2_w_lowcount; + u32 fm2_l_lbn3; } fm3; } u1; }; @@ -328,33 +328,33 @@ struct dirdef { union { struct { - u16 dir_w_size; - s16 dir_w_verlimit; + u16 dir_w_size; + s16 dir_w_verlimit; union { - u8 dir_b_flags; + u8 dir_b_flags; struct { - u8 dir_v_type:3; - u8 dir_v_res1:3; - u8 dir_v_nextrec:1; - u8 dir_v_prevrec:1; - } s4; - } u4; - u8 dir_b_namecount; - char dir_t_name; - } s1; + u8 dir_v_type:3; + u8 dir_v_res1:3; + u8 dir_v_nextrec:1; + u8 dir_v_prevrec:1; + } s4; + } u4; + u8 dir_b_namecount; + char dir_t_name; + } s1; struct { - u16 dir_w_version; + u16 dir_w_version; union { - u16 dir_w_fid[3]; + u16 dir_w_fid[3]; struct { - u16 fid_w_num; - u16 fid_w_seq; - u8 fid_b_rvn; - u8 fid_b_nmx; - } s3; - } u2; - } s2; - } u1; + u16 fid_w_num; + u16 fid_w_seq; + u8 fid_b_rvn; + u8 fid_b_nmx; + } s3; + } u2; + } s2; + } u1; }; /* @@ -362,11 +362,11 @@ * and definitions. */ struct ods2map { - struct ods2map *nxt; + struct ods2map *nxt; struct { - u32 cnt; - u32 lbn; - } s1[16]; + u32 cnt; + u32 lbn; + } s1[16]; }; /* @@ -378,11 +378,11 @@ * below has 128 pointers. */ struct ods2var { - struct ods2var *nxt; /* next block if needed */ + struct ods2var *nxt; /* next block if needed */ struct { - u64 recoffs; /* offset to start of record */ - loff_t loff; /* virtual offset to start of record */ - } s1[16]; + u64 recoffs; /* offset to start of record */ + loff_t loff; /* virtual offset to start of record */ + } s1[16]; }; /* @@ -425,8 +425,8 @@ u32 v_raw:1; /* this file handler must return data in raw mode */ u32 v_res1:31; - } s1; - } u1; + } s1; + } u1; }; /* @@ -471,8 +471,9 @@ * 1024 or 2048 bytes. * I.e. the RRD47 CDROM drive on my Alpha server 1200 report a sector * size of 2048 even for an ODS2 CD. + * + * FIXME: These macros need deuglification. */ - #define GETBLKNO(a, b) ((b) >> (a->s_blocksize_bits - 9)) #define GETBLKP(a, b, c) ((void *)&(((char *)(c))[((b) & ((a)->s_blocksize_bits == 9 ? 0 : ((a)->s_blocksize_bits == 10 ? 1 : 3))) << 9])) |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 20:48:03
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32475 Modified Files: super.c Log Message: - A small ton of comment formatting. - Little code adjusting. Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- super.c 20 Sep 2004 20:27:17 -0000 1.8 +++ super.c 20 Sep 2004 20:47:53 -0000 1.9 @@ -169,9 +169,9 @@ } /* - This is the routine that is invoked when an ODS2 file system - is mounted. -*/ + * This is the routine that is invoked when an ODS2 file system + * is mounted. + */ static int ods2_fill_super(struct super_block *sb, void *data, int silent) { @@ -211,10 +211,12 @@ u16 chksum1 = 0; u16 chksum2 = 0; - if ((ODS2_SB (sb) = kmalloc(sizeof(struct ods2sb), GFP_KERNEL)) == NULL) { + ODS2_SB (sb) = kmalloc (sizeof (struct ods2sb), GFP_KERNEL); + if (!ODS2_SB (sb)) { printk("ODS2-fs kmalloc failed for sb generic\n"); return -ENOMEM; } + ods2p = ODS2_SB (sb); memcpy(&ods2p->hm2, GETBLKP(sb, 1, bh->b_data), sizeof (struct hm2def)); brelse(bh); @@ -237,12 +239,18 @@ ods2p->hm2.hm2_w_resfiles >= 5 && chksum1 == ods2p->hm2.hm2_w_checksum1 && chksum2 == ods2p->hm2.hm2_w_checksum2) { + /* + * Set default values first, then parse + * user-supplied option string + */ ods2p->flags.v_raw = 0; ods2p->flags.v_lowercase = 0; ods2p->flags.v_version = SB_M_VERSALL; ods2p->dollar = '_'; ods2p->semicolon = '.'; - if (data != NULL) { parse_options(sb, data); } + if (data) + parse_options(sb, data); + sb->s_op = &ods2_sops; @@ -251,40 +259,43 @@ sb->s_root = d_alloc_root(iget(sb, 4)); /* this is 000000.DIR;1 */ /* - We need to be able to read the index file header bitmap. - */ - + * We need to be able to read the index file header bitmap. + */ if (ods2_read_ibitmap(sb)) { - /* - We need to be able to read BITMAP.SYS as it contains the bitmap for allocated blocks. - Without this file we need to rebuild it by reading ALL file mapping pointers for ALL - files and create the file. That will be in a later release... - */ - + * We need to be able to read BITMAP.SYS as + * it contains the bitmap for allocated + * blocks. Without this file we need to + * rebuild it by reading ALL file mapping + * pointers for ALL files and create the + * file. That will be in a later release so + * it's a FIXME. + */ if (ods2_read_bitmap(sb)) { - char format[13]; - char volname[13]; - char volowner[13]; + char format[13]; + char volname[13]; + char volowner[13]; /* - We need to fill in statfs structure used when any user want to get information about - the mounted ODS2 file system. - Some of the information is static and other is found in BITMAP.SYS. - */ - + * We need to fill in statfs structure + * used when any user want to get + * information about the mounted ODS2 + * file system. Some of the information + * is static and other is found in + * BITMAP.SYS. + */ 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; memcpy(volname, ods2p->hm2.hm2_t_volname, 12); volname[12] = 0; 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); + printk(KERN_NOTICE "ODS2-fs This is a valid ODS2 file system with format /%s/ and volume name /%s/ and owner /%s/\n", format, volname, volowner); return 0; } kfree(ods2p->ibitmap); @@ -295,8 +306,9 @@ return -EINVAL; } -static struct super_block *ods2_read_super (struct file_system_type *fs_type, - int flags, const char *dev_name, void *data) { +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); } @@ -308,14 +320,16 @@ .fs_flags = FS_REQUIRES_DEV, }; -static int __init init_ods2_fs(void) +static int __init +init_ods2_fs (void) { - return register_filesystem(&ods2_fs_type); + return register_filesystem (&ods2_fs_type); } -static void __exit exit_ods2_fs(void) +static void __exit +exit_ods2_fs (void) { - unregister_filesystem(&ods2_fs_type); + unregister_filesystem (&ods2_fs_type); } module_init (init_ods2_fs); |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 20:27:29
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27962 Modified Files: dir.c file.c inode.c super.c util.c Log Message: - No need to include <asm/uaccess.h> in a filesystem driver. Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/inode.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- inode.c 20 Sep 2004 06:10:46 -0000 1.6 +++ inode.c 20 Sep 2004 20:27:17 -0000 1.7 @@ -20,7 +20,6 @@ #include <linux/init.h> #include <linux/buffer_head.h> #include <linux/blkdev.h> -#include <asm/uaccess.h> #include "ods2.h" Index: util.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/util.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- util.c 20 Sep 2004 06:05:29 -0000 1.5 +++ util.c 20 Sep 2004 20:27:17 -0000 1.6 @@ -12,16 +12,12 @@ */ #include <linux/config.h> -/* -#include <linux/module.h> -*/ #include <linux/string.h> #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/blkdev.h> #include <linux/buffer_head.h> -#include <asm/uaccess.h> #include "ods2.h" #include "tparse.h" @@ -38,7 +34,6 @@ return res; } - u32 vbn2lbn (struct super_block *sb, struct ods2map *map, u32 vbn) { Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- super.c 20 Sep 2004 07:01:15 -0000 1.7 +++ super.c 20 Sep 2004 20:27:17 -0000 1.8 @@ -20,7 +20,6 @@ #include <linux/init.h> #include <linux/blkdev.h> #include <linux/statfs.h> -#include <asm/uaccess.h> #include "ods2.h" Index: file.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/file.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- file.c 20 Sep 2004 05:51:29 -0000 1.5 +++ file.c 20 Sep 2004 20:27:17 -0000 1.6 @@ -22,7 +22,6 @@ #include <linux/init.h> #include <linux/blkdev.h> #include <linux/buffer_head.h> -#include <asm/uaccess.h> #include "ods2.h" Index: dir.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/dir.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- dir.c 20 Sep 2004 05:51:29 -0000 1.5 +++ dir.c 20 Sep 2004 20:27:16 -0000 1.6 @@ -20,7 +20,6 @@ #include <linux/init.h> #include <linux/blkdev.h> #include <linux/buffer_head.h> -#include <asm/uaccess.h> #include "ods2.h" |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 20:25:46
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27634 Added Files: TODO Log Message: - TODO. --- NEW FILE: TODO --- - Rewrite option parsing code to use the 2.6.x kernel's parsing functions - Check sector loading code (FS blocks vs. hard sectors) - Put pointer/array arithmetic into function-like looking macros - Add write support :-) |
|
From: Berczi G. <gab...@us...> - 2004-09-20 10:23:50
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24921 Modified Files: defconfig Log Message: enable KA48 by default Index: defconfig =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/defconfig,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- defconfig 15 Sep 2004 21:59:53 -0000 1.18 +++ defconfig 20 Sep 2004 10:23:36 -0000 1.19 @@ -25,7 +25,7 @@ CONFIG_CPU_KA42=y CONFIG_CPU_KA43=y CONFIG_CPU_KA46=y -# CONFIG_CPU_KA48 is not set +CONFIG_CPU_KA48=y # CONFIG_CPU_KA55 is not set # CONFIG_CPU_VXT is not set |
|
From: Kenn H. <ke...@us...> - 2004-09-20 08:53:27
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8308 Modified Files: cpu_ka48.c Log Message: According to Gabucino, LANCE on VLC is on VSBUS interrupt line 1, not 5 Index: cpu_ka48.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/cpu_ka48.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- cpu_ka48.c 19 Sep 2004 17:25:35 -0000 1.5 +++ cpu_ka48.c 20 Sep 2004 08:53:18 -0000 1.6 @@ -144,7 +144,7 @@ retval = platform_device_register(&ka48_vsbus_device); if (!retval) { - vsbus_add_fixed_device(&ka48_vsbus_device.dev, "lance", 0x200e0000, 5); + vsbus_add_fixed_device(&ka48_vsbus_device.dev, "lance", 0x200e0000, 1); } return retval; |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 07:01:31
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18977 Modified Files: super.c Log Message: - Add comment about sector/block size handling - Reformat lengthy if (...) expression. Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- super.c 20 Sep 2004 05:51:29 -0000 1.6 +++ super.c 20 Sep 2004 07:01:15 -0000 1.7 @@ -179,12 +179,38 @@ struct buffer_head *bh; struct ods2sb *ods2p; + /* This should be something like (from ext2): + * + * int blocksize; + * blocksize = sb_min_blocksize(sb, BLOCK_SIZE); + * // See what the current blocksize for the device is, and + * // use that as the blocksize. Otherwise (or if the blocksize + * // is smaller than the default) use the default. + * // This is important for devices that have a hardware + * // sectorsize that is larger than the default. + * blocksize = sb_min_blocksize(sb, BLOCK_SIZE); + * if (!blocksize) { + * printk ("EXT2-fs: unable to set blocksize\n"); + * goto failed_sbi; + * } + * + * // If the superblock doesn't start on a hardware sector boundary, + * // calculate the offset. + * if (blocksize != BLOCK_SIZE) { + * logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize; + * offset = (sb_block*BLOCK_SIZE) % blocksize; + * } else { + * logic_sb_block = sb_block; + * } + * + * if (!(bh = sb_bread(sb, logic_sb_block))) { + * ... + */ sb_set_blocksize(sb, get_hardsect_size(sb->s_dev)); if ((bh = sb_bread(sb, GETBLKNO(sb, 1))) != NULL && bh->b_data != NULL) { - - u16 *p; - u16 chksum1 = 0; - u16 chksum2 = 0; + u16 *p; + u16 chksum1 = 0; + u16 chksum2 = 0; if ((ODS2_SB (sb) = kmalloc(sizeof(struct ods2sb), GFP_KERNEL)) == NULL) { printk("ODS2-fs kmalloc failed for sb generic\n"); @@ -198,17 +224,20 @@ for (p = (u16 *)&(ods2p->hm2) ; p < (u16 *)&(ods2p->hm2.hm2_w_checksum2) ; chksum2 += *p++); /* - This is the way to check for a valid home block. - */ - - if (ods2p->hm2.hm2_l_homelbn != 0 && ods2p->hm2.hm2_l_alhomelbn != 0 && - ods2p->hm2.hm2_l_altidxlbn != 0 && ods2p->hm2.hm2_w_cluster != 0 && - ods2p->hm2.u1.s1.hm2_b_structlevl == 2 && ods2p->hm2.u1.s1.hm2_b_structlevv >= 1 && - ods2p->hm2.hm2_w_homevbn != 0 && ods2p->hm2.hm2_l_ibmaplbn != 0 && - ods2p->hm2.hm2_l_maxfiles > ods2p->hm2.hm2_w_resfiles && ods2p->hm2.hm2_w_resfiles >= 5 && - chksum1 == ods2p->hm2.hm2_w_checksum1 && chksum2 == ods2p->hm2.hm2_w_checksum2) { - - + * This is the way to check for a valid home block. + */ + if (ods2p->hm2.hm2_l_homelbn != 0 && + ods2p->hm2.hm2_l_alhomelbn != 0 && + ods2p->hm2.hm2_l_altidxlbn != 0 && + ods2p->hm2.hm2_w_cluster != 0 && + ods2p->hm2.u1.s1.hm2_b_structlevl == 2 && + ods2p->hm2.u1.s1.hm2_b_structlevv >= 1 && + ods2p->hm2.hm2_w_homevbn != 0 && + ods2p->hm2.hm2_l_ibmaplbn != 0 && + ods2p->hm2.hm2_l_maxfiles > ods2p->hm2.hm2_w_resfiles && + ods2p->hm2.hm2_w_resfiles >= 5 && + chksum1 == ods2p->hm2.hm2_w_checksum1 && + chksum2 == ods2p->hm2.hm2_w_checksum2) { ods2p->flags.v_raw = 0; ods2p->flags.v_lowercase = 0; ods2p->flags.v_version = SB_M_VERSALL; |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 06:10:56
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10297 Modified Files: inode.c Log Message: - Fix missing '='. I've yet to learn how/why gcc accepted that at all... Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/inode.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- inode.c 20 Sep 2004 05:51:29 -0000 1.5 +++ inode.c 20 Sep 2004 06:10:46 -0000 1.6 @@ -34,7 +34,7 @@ }; struct file_operations ods2_file_operations = { - .read ods2_read, + .read = ods2_read, .llseek = ods2_llseek, .open = ods2_open_release, .release = ods2_open_release, |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 06:05:42
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9433 Modified Files: CHANGES tparse.c tparse.h util.c Log Message: - Detypedefication for argument parsing functions (these need to be rewritten using the 2.6.x option parsing routines anyway...). Index: CHANGES =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/CHANGES,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- CHANGES 20 Sep 2004 05:39:06 -0000 1.3 +++ CHANGES 20 Sep 2004 06:05:29 -0000 1.4 @@ -1,3 +1,7 @@ +Changes from version 0.9.4b to 0.9.4c +===================================== + - Removal for the argument parsing typedefs. + Changes from version 0.9.4a to 0.9.4b ===================================== - Removal of all typedefs. The source now properly uses Index: util.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/util.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- util.c 20 Sep 2004 05:39:07 -0000 1.4 +++ util.c 20 Sep 2004 06:05:29 -0000 1.5 @@ -231,7 +231,7 @@ int -save_dollar (ARGBLK *argblk) +save_dollar (struct argblk *argblk) { struct super_block *sb = (struct super_block *) argblk->arg; struct ods2sb *ods2p = ODS2_SB (sb); @@ -242,7 +242,7 @@ int -save_semicolon (ARGBLK *argblk) +save_semicolon (struct argblk *argblk) { struct super_block *sb = (struct super_block *) argblk->arg; struct ods2sb *ods2p = ODS2_SB (sb); @@ -252,7 +252,9 @@ } -int save_version(ARGBLK *argblk) { +int +save_version (struct argblk *argblk) +{ struct super_block *sb = (struct super_block *) argblk->arg; struct ods2sb *ods2p = ODS2_SB (sb); @@ -261,74 +263,73 @@ } -TPARSE tpa1[]; -TPARSE tpa10[]; -TPARSE tpa11[]; -TPARSE tpa20[]; -TPARSE tpa21[]; -TPARSE tpa30[]; -TPARSE tpa31[]; - +struct tparse tpa1[]; +struct tparse tpa10[]; +struct tparse tpa11[]; +struct tparse tpa20[]; +struct tparse tpa21[]; +struct tparse tpa30[]; +struct tparse tpa31[]; -TPARSE tpa1[] = { - { "dollar", tpa10, NULL, 0, NULL, 0 }, - { "version", tpa20, NULL, 0, NULL, 0 }, - { "semicolon", tpa30, NULL, 0, NULL, 0 }, - { "lowercase", tpa1, save_lowercase, 0, NULL, 0 }, - { "raw", tpa1, save_raw, 0, NULL, 0 }, - { TPA_EOS, TPA_EXIT, NULL, 0, NULL, 0 }, - TPA_END +struct tparse tpa1[] = { + { "dollar", tpa10, NULL, 0, NULL, 0 }, + { "version", tpa20, NULL, 0, NULL, 0 }, + { "semicolon", tpa30, NULL, 0, NULL, 0 }, + { "lowercase", tpa1, save_lowercase, 0, NULL, 0 }, + { "raw", tpa1, save_raw, 0, NULL, 0 }, + { TPA_EOS, TPA_EXIT, NULL, 0, NULL, 0 }, + TPA_END, }; - - -TPARSE tpa10[] = { - { "=", tpa11, NULL, 0, NULL, 0 }, - TPA_END +struct tparse tpa10[] = { + { "=", tpa11, NULL, 0, NULL, 0 }, + TPA_END, }; -TPARSE tpa11[] = { - { TPA_ANY, tpa1, save_dollar, 0, NULL, 0 }, - TPA_END +struct tparse tpa11[] = { + { TPA_ANY, tpa1, save_dollar, 0, NULL, 0 }, + TPA_END, }; -TPARSE tpa20[] = { - { "=", tpa21, NULL, 0, NULL, 0 }, - TPA_END +struct tparse tpa20[] = { + { "=", tpa21, NULL, 0, NULL, 0 }, + TPA_END, }; -TPARSE tpa21[] = { - { "all", tpa1, save_version, SB_M_VERSALL, NULL, 0 }, - { "highest", tpa1, save_version, SB_M_VERSHIGH, NULL, 0 }, - { "none", tpa1, save_version, SB_M_VERSNONE, NULL, 0 }, - TPA_END +struct tparse tpa21[] = { + { "all", tpa1, save_version, SB_M_VERSALL, NULL, 0 }, + { "highest", tpa1, save_version, SB_M_VERSHIGH, NULL, 0 }, + { "none", tpa1, save_version, SB_M_VERSNONE, NULL, 0 }, + TPA_END, }; -TPARSE tpa30[] = { - { "=", tpa31, NULL, 0, NULL, 0 }, - TPA_END +struct tparse tpa30[] = { + { "=", tpa31, NULL, 0, NULL, 0 }, + TPA_END, }; -TPARSE tpa31[] = { - { TPA_ANY, tpa1, save_semicolon, 0, NULL, 0 }, - TPA_END +struct tparse tpa31[] = { + { TPA_ANY, tpa1, save_semicolon, 0, NULL, 0 }, + TPA_END, }; -int parse_options(struct super_block *sb, char *options) { - ARGBLK argblk; +int +parse_options (struct super_block *sb, char *options) { + struct argblk argblk; argblk.str = options; - argblk.arg = (long unsigned)sb; - return tparse(&argblk, tpa1); + argblk.arg = (unsigned long) sb; + return tparse (&argblk, tpa1); } - /* * 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. + * + * FIXME: Needs 2.4.x i_[cma]time -> 2.6.x i_[cma]time porting!!! */ time_t vms2unix_sec (u16 *vms_timestamp) @@ -347,7 +348,7 @@ int get_hardsect_size (int xx) { - printk (KERN_ERR "%s: Not implemented!\n", __FUNCTION__); + printk (KERN_ERR "%s: Not implemented, returning 512!\n", __FUNCTION__); return 512; } Index: tparse.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/tparse.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tparse.c 20 Sep 2004 05:51:29 -0000 1.2 +++ tparse.c 20 Sep 2004 06:05:29 -0000 1.3 @@ -17,9 +17,11 @@ #include "tparse.h" -int tparse(ARGBLK *argblk, TPARSE *tpa) { - int idx; - int found; +int +tparse (struct argblk *argblk, struct tparse *tpa) +{ + int idx; + int found; while (1) { char *str = argblk->str; @@ -67,8 +69,8 @@ default: { if (((void **)tpa[idx].type)[0] == (void *)244) { - TPARSE *tmptpa = ((TPARSE **)tpa[idx].type)[1]; - ARGBLK tmpargblk; + struct tparse *tmptpa = ((struct tparse **)tpa[idx].type)[1]; + struct argblk tmpargblk; tmpargblk.options = argblk->options; tmpargblk.arg = argblk->arg; Index: tparse.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/tparse.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tparse.h 20 Sep 2004 05:52:49 -0000 1.2 +++ tparse.h 20 Sep 2004 06:05:29 -0000 1.3 @@ -18,37 +18,36 @@ #define TPA_END {NULL, NULL, NULL, 0, NULL, 0} /* - The following definition must match the size of void * -*/ - -#define lu (long unsigned) + * FIXME: * The following definition must match the size of "void *" + * + * FIXME "lu" is used like a function: lu(something) + */ +#define lu (unsigned long) /* - The string *str is pointing to must be writable - or tparse will fail. -*/ - -typedef struct argblk { - long unsigned options; - char *str; - char *token; - long unsigned number; - long unsigned param; - long unsigned arg; - long unsigned mask; - long unsigned *mskadr; -} ARGBLK; - + * The string *str is pointing to must be writable + * or tparse will fail. + */ +struct argblk { + unsigned long options; + char *str; + char *token; + unsigned long number; + unsigned long param; + unsigned long arg; + unsigned long mask; + unsigned long *mskadr; +}; -typedef struct tparse { - char *type; - struct tparse *label; - int (*action)(ARGBLK *); - unsigned long mask; - unsigned long *mskadr; - unsigned long param; -} TPARSE; +struct tparse { + char *type; + struct tparse *label; + int (*action)(struct argblk *); + unsigned long mask; + unsigned long *mskadr; + unsigned long param; +}; -int tparse(ARGBLK *argblk, TPARSE *tpa); +extern int tparse (struct argblk *argblk, struct tparse *tpa); #endif /* _TPARSE_H */ |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 05:53:05
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6989 Modified Files: tparse.h Log Message: - Add header file guards. Index: tparse.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/tparse.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tparse.h 19 Sep 2004 09:47:49 -0000 1.1 +++ tparse.h 20 Sep 2004 05:52:49 -0000 1.2 @@ -1,3 +1,6 @@ +#ifndef _TPARSE_H +#define _TPARSE_H + #define TPA_EXIT (void *)1 #define TPA_FAIL (void *)0 @@ -47,3 +50,5 @@ } TPARSE; int tparse(ARGBLK *argblk, TPARSE *tpa); + +#endif /* _TPARSE_H */ |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 05:51:38
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6596 Modified Files: dir.c file.c inode.c ods2.h super.c tparse.c Log Message: - Remove the non-working download URL for a copy of the GPL license. - Add a working URL instead :-) Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- super.c 20 Sep 2004 05:39:07 -0000 1.5 +++ super.c 20 Sep 2004 05:51:29 -0000 1.6 @@ -4,7 +4,7 @@ * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: - * ftp://prep.ai.mit.edu/pub/gnu/GPL + * http://www.gnu.org/licenses/gpl.txt * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> Index: tparse.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/tparse.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tparse.c 19 Sep 2004 09:47:49 -0000 1.1 +++ tparse.c 20 Sep 2004 05:51:29 -0000 1.2 @@ -4,7 +4,7 @@ * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: - * ftp://prep.ai.mit.edu/pub/gnu/GPL + * http://www.gnu.org/licenses/gpl.txt * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/inode.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- inode.c 20 Sep 2004 05:39:07 -0000 1.4 +++ inode.c 20 Sep 2004 05:51:29 -0000 1.5 @@ -4,7 +4,7 @@ * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: - * ftp://prep.ai.mit.edu/pub/gnu/GPL + * http://www.gnu.org/licenses/gpl.txt * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> @@ -12,9 +12,7 @@ */ #include <linux/config.h> -/* #include <linux/module.h> -*/ #include <linux/string.h> #include <linux/ctype.h> #include <linux/fs.h> Index: file.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/file.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- file.c 20 Sep 2004 05:39:07 -0000 1.4 +++ file.c 20 Sep 2004 05:51:29 -0000 1.5 @@ -4,7 +4,7 @@ * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: - * ftp://prep.ai.mit.edu/pub/gnu/GPL + * http://www.gnu.org/licenses/gpl.txt * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> @@ -15,9 +15,7 @@ */ #include <linux/config.h> -/* #include <linux/module.h> -*/ #include <linux/string.h> #include <linux/fs.h> #include <linux/slab.h> Index: ods2.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/ods2.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ods2.h 20 Sep 2004 05:39:07 -0000 1.4 +++ ods2.h 20 Sep 2004 05:51:29 -0000 1.5 @@ -7,7 +7,7 @@ * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: - * ftp://prep.ai.mit.edu/pub/gnu/GPL + * http://www.gnu.org/licenses/gpl.txt * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> @@ -17,9 +17,9 @@ #include <linux/statfs.h> /* - The followinf structures are defined in the book - "VMS File System Internals" -*/ + * The following structures are defined in the book + * "VMS File System Internals" + */ /* * Access to the ods2 superblock from a VFS struct super_block. Index: dir.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/dir.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- dir.c 20 Sep 2004 05:39:07 -0000 1.4 +++ dir.c 20 Sep 2004 05:51:29 -0000 1.5 @@ -4,7 +4,7 @@ * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: - * ftp://prep.ai.mit.edu/pub/gnu/GPL + * http://www.gnu.org/licenses/gpl.txt * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> @@ -12,9 +12,7 @@ */ #include <linux/config.h> -/* #include <linux/module.h> -*/ #include <linux/string.h> #include <linux/ctype.h> #include <linux/fs.h> |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-20 05:39:19
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4263 Modified Files: CHANGES dir.c file.c inode.c ods2.h super.c util.c Log Message: - Typedef -> struct "downgrade". Index: util.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/util.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- util.c 19 Sep 2004 19:51:15 -0000 1.3 +++ util.c 20 Sep 2004 05:39:07 -0000 1.4 @@ -27,10 +27,11 @@ #include "tparse.h" -u64 div64(u64 a, u32 b0) { +u64 +div64 (u64 a, u32 b0) { u32 a1, a2; - u32 long res; - + u32 long res; /* FIXME: What?! */ + a1 = ((u32 *)&a)[0]; a2 = ((u32 *)&a)[1]; res = a1/b0 + (u64)a2 * (u64)(0xffffffff/b0) + a2 / b0 + (a2 * (0xffffffff % b0)) / b0; @@ -38,10 +39,12 @@ } -u32 vbn2lbn(struct super_block *sb, ODS2MAP *map, u32 vbn) { - int idx = 0; - u32 curvbn = 1; /* VBN is 1 based - not 0 */ - +u32 +vbn2lbn (struct super_block *sb, struct ods2map *map, u32 vbn) +{ + int idx = 0; + u32 curvbn = 1; /* VBN is 1 based - not 0 */ + while (map && map->s1[idx].cnt > 0 && curvbn < vbn && curvbn + map->s1[idx].cnt <= vbn) { curvbn += map->s1[idx].cnt; if (++idx > 15) { @@ -55,61 +58,64 @@ return 0; } - u32 ino2fhlbn (struct super_block *sb, u32 ino) { - ODS2SB *ods2p = ODS2_SB (sb); + struct 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; } else { - ODS2FH *ods2fhp = (ODS2FH *)ods2p->indexf->u.generic_ip; + struct ods2fh *ods2fhp = (struct ods2fh *) ods2p->indexf->u.generic_ip; return vbn2lbn(sb, ods2fhp->map, le16_to_cpu(ods2p->hm2.hm2_w_cluster) * 4 + le16_to_cpu(ods2p->hm2.hm2_w_ibmapsize) + ino); } + return 0; } /* - This function retreives all file mapping pointers and create a linked list so - VBN's can be translated to LBN's. - Note that this routine read ALL mapping pointers thus creating a catedral window - for the file. Should there be extension headers they are all read directly not - using iget to fetch them. -*/ - -ODS2MAP *getmap(struct super_block *sb, FH2DEF *fh2p) { - FM2DEF *fm2p = (FM2DEF *)((short unsigned *)fh2p + fh2p->fh2_b_mpoffset); - ODS2MAP *map = kmalloc(sizeof(ODS2MAP), GFP_KERNEL); - ODS2MAP *mapfst = map; - struct buffer_head *bh = NULL; - int idx = 0; - u8 mapinuse = 0; + * This function retreives all file mapping pointers and create a linked list so + * VBN's can be translated to LBN's. + * Note that this routine read ALL mapping pointers thus creating a catedral window + * for the file. Should there be extension headers they are all read directly not + * using iget to fetch them. + */ +struct ods2map * +getmap (struct super_block *sb, struct fh2def *fh2p) { + struct fm2def *fm2p = (struct fm2def *) ((short unsigned *)fh2p + fh2p->fh2_b_mpoffset); + struct ods2map *map; + struct ods2map *mapfst; + struct buffer_head *bh = NULL; + int idx = 0; + u8 mapinuse = 0; - if (map == NULL) { + mapfst = map = kmalloc (sizeof (struct ods2map), GFP_KERNEL); + if (!map) { printk("ODS2-fs kmalloc failed for getmap (1)\n"); return NULL; } - memset(map, 0, sizeof(ODS2MAP)); + memset (map, 0, sizeof (struct ods2map)); + do { mapinuse = fh2p->fh2_b_map_inuse; - while (fm2p < (FM2DEF *)((short unsigned *)fh2p + fh2p->fh2_b_acoffset) && mapinuse > 0) { - u32 cnt = 0; - u32 lbn = 0; - u16 size = 0; - + while (fm2p < (struct fm2def *)((short unsigned *)fh2p + fh2p->fh2_b_acoffset) && mapinuse > 0) { + u32 cnt = 0; + u32 lbn = 0; + u16 size = 0; + switch (fm2p->u1.fm1.fm2_v_format) { - case 0: size = 1; break; - case 1: cnt = fm2p->u1.fm1.fm2_b_count1; lbn = (fm2p->u1.fm1.fm2_v_highlbn << 16) | fm2p->u1.fm1.fm2_w_lowlbn; size = 2; break; - case 2: cnt = fm2p->u1.fm2.fm2_v_count2; lbn = (le16_to_cpu(fm2p->u1.fm2.fm2_l_lbn2[1]) << 16) | le16_to_cpu(fm2p->u1.fm2.fm2_l_lbn2[0]); size = 3; break; - case 3: cnt = (fm2p->u1.fm3.fm2_v_count2 << 16) | le16_to_cpu(fm2p->u1.fm3.fm2_w_lowcount); lbn = le32_to_cpu(fm2p->u1.fm3.fm2_l_lbn3); size = 4; break; + case 0: size = 1; break; + case 1: cnt = fm2p->u1.fm1.fm2_b_count1; lbn = (fm2p->u1.fm1.fm2_v_highlbn << 16) | fm2p->u1.fm1.fm2_w_lowlbn; size = 2; break; + case 2: cnt = fm2p->u1.fm2.fm2_v_count2; lbn = (le16_to_cpu(fm2p->u1.fm2.fm2_l_lbn2[1]) << 16) | le16_to_cpu(fm2p->u1.fm2.fm2_l_lbn2[0]); size = 3; break; + case 3: cnt = (fm2p->u1.fm3.fm2_v_count2 << 16) | le16_to_cpu(fm2p->u1.fm3.fm2_w_lowcount); lbn = le32_to_cpu(fm2p->u1.fm3.fm2_l_lbn3); size = 4; break; } if (fm2p->u1.fm1.fm2_v_format > 0) { if (idx > 15) { - if ((map->nxt = kmalloc(sizeof(ODS2MAP), GFP_KERNEL)) != NULL) { + map->nxt = kmalloc (sizeof (struct ods2map), GFP_KERNEL); + if (map->nxt) { map = map->nxt; - memset(map, 0, sizeof(ODS2MAP)); + memset (map, 0, sizeof (struct ods2map)); idx = 0; } else { printk("ODS2-fs kmalloc failed for getmap (2)\n"); @@ -121,27 +127,26 @@ idx++; } mapinuse -= size; - fm2p = (FM2DEF *)((short unsigned *)(fm2p) + size); + fm2p = (struct fm2def *) ((short unsigned *) (fm2p) + size); } /* - If there is an extension header we need to read all of them because - they could have additional mapping information. - - Note that we can not use iget to fetch the extension header because - it is not a valid inode for an ODS2 file. Only primary file header - can be used as an inode. - */ - + * If there is an extension header we need to read all of them because + * they could have additional mapping information. + * + * Note that we can not use iget to fetch the extension header because + * it is not a valid inode for an ODS2 file. Only primary file header + * can be used as an inode. + */ if (fh2p->u3.s1.fid_w_ex_fidnum != 0) { - u32 lbn; - + u32 lbn; + if ((lbn = ino2fhlbn(sb, le16_to_cpu(fh2p->u3.s1.fid_w_ex_fidnum) | (fh2p->u3.s1.fid_b_ex_fidnmx << 16))) != 0) { fh2p = NULL; brelse(bh); - if ((bh = sb_bread(sb, GETBLKNO(sb, lbn))) != NULL && bh->b_data != NULL) { - fh2p = (FH2DEF *)(GETBLKP(sb, lbn, bh->b_data)); - fm2p = (FM2DEF *)((short unsigned *)fh2p + fh2p->fh2_b_mpoffset); + if ((bh = sb_bread(sb, GETBLKNO (sb, lbn))) != NULL && bh->b_data != NULL) { + fh2p = (struct fh2def *) (GETBLKP(sb, lbn, bh->b_data)); + fm2p = (struct fm2def *) ((short unsigned *) fh2p + fh2p->fh2_b_mpoffset); } } } else { @@ -154,14 +159,13 @@ struct buffer_head *getfilebh(struct file *filp, u32 vbn) { - struct inode *inode = filp->f_dentry->d_inode; - struct super_block *sb = inode->i_sb; - ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; - ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; - + struct inode *inode = filp->f_dentry->d_inode; + struct super_block *sb = inode->i_sb; + struct ods2fh *ods2fhp = (struct ods2fh *) inode->u.generic_ip; + struct ods2file *ods2filep = (struct ods2file *) filp->private_data; if ((vbn - 1) * 512 < inode->i_size) { - u32 lbn; + u32 lbn; if ((lbn = vbn2lbn(sb, ods2fhp->map, vbn)) > 0) { @@ -183,10 +187,11 @@ return NULL; } - -int verify_fh(FH2DEF *fh2p, u32 ino) { - u16 *p = (short unsigned *)fh2p; - u16 chksum = 0; +int +verify_fh (struct fh2def *fh2p, u32 ino) +{ + u16 *p = (short unsigned *) fh2p; + u16 chksum = 0; for (; p < (short unsigned *)&(fh2p->fh2_w_checksum) ; chksum += le16_to_cpu(*p++)); if (fh2p->fh2_b_idoffset <= fh2p->fh2_b_mpoffset && @@ -203,12 +208,11 @@ return 0; } - int -save_raw (ARGBLK *argblk) +save_raw (struct argblk *argblk) { struct super_block *sb = (struct super_block *) argblk->arg; - ODS2SB *ods2p = ODS2_SB (sb); + struct ods2sb *ods2p = ODS2_SB (sb); ods2p->flags.v_raw = 1; return 1; @@ -216,10 +220,10 @@ int -save_lowercase (ARGBLK *argblk) +save_lowercase (struct argblk *argblk) { struct super_block *sb = (struct super_block *) argblk->arg; - ODS2SB *ods2p = ODS2_SB (sb); + struct ods2sb *ods2p = ODS2_SB (sb); ods2p->flags.v_lowercase = 1; return 1; @@ -230,7 +234,7 @@ save_dollar (ARGBLK *argblk) { struct super_block *sb = (struct super_block *) argblk->arg; - ODS2SB *ods2p = ODS2_SB (sb); + struct ods2sb *ods2p = ODS2_SB (sb); ods2p->dollar = argblk->token[0]; return 1; @@ -241,7 +245,7 @@ save_semicolon (ARGBLK *argblk) { struct super_block *sb = (struct super_block *) argblk->arg; - ODS2SB *ods2p = ODS2_SB (sb); + struct ods2sb *ods2p = ODS2_SB (sb); ods2p->semicolon = argblk->token[0]; return 1; @@ -250,7 +254,7 @@ int save_version(ARGBLK *argblk) { struct super_block *sb = (struct super_block *) argblk->arg; - ODS2SB *ods2p = ODS2_SB (sb); + struct ods2sb *ods2p = ODS2_SB (sb); ods2p->flags.v_version = argblk->mask; return 1; Index: CHANGES =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/CHANGES,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CHANGES 19 Sep 2004 19:51:15 -0000 1.2 +++ CHANGES 20 Sep 2004 05:39:06 -0000 1.3 @@ -1,3 +1,9 @@ +Changes from version 0.9.4a to 0.9.4b +===================================== + - Removal of all typedefs. The source now properly uses + struct xxx instead of XXX + - Still compiles, but not tested even with one filesystem image. + Changes from version 0.9.3 to 0.9.4a ==================================== - Quick'n'dirty port from 2.4.x to 2.6.x Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/inode.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- inode.c 19 Sep 2004 19:51:15 -0000 1.3 +++ inode.c 20 Sep 2004 05:39:07 -0000 1.4 @@ -64,11 +64,11 @@ ods2_lookup (struct inode *dir, struct dentry *dentry, struct nameidata *nd) { struct super_block *sb = dir->i_sb; - ODS2SB *ods2p = ODS2_SB (sb); + struct ods2sb *ods2p = ODS2_SB (sb); struct buffer_head *bh; char *vp; u16 *rec; - ODS2FH *ods2fhp = (ODS2FH *) dir->u.generic_ip; + struct ods2fh *ods2fhp = (struct ods2fh *) dir->u.generic_ip; u32 vbn = 1; u32 lbn; int vers = 0; @@ -101,7 +101,7 @@ rec = (u16 *)(GETBLKP(sb, lbn, bh->b_data)); while (*rec != 65535 && *rec != 0) { - DIRDEF *dire = (DIRDEF *)rec; + struct dirdef *dire = (struct dirdef *) rec; if (dire->u1.s1.dir_b_namecount == strlen(name)) { char dirname[dire->u1.s1.dir_b_namecount + 1]; @@ -119,11 +119,11 @@ int curbyte = 0; while (curbyte < dire->u1.s1.dir_w_size) { - u32 ino; - DIRDEF *dirv = (DIRDEF *)((char *)dire + ((dire->u1.s1.dir_b_namecount + 1) & ~1) + 6 + curbyte); + u32 ino; + struct dirdef *dirv = (struct dirdef *) ((char *)dire + ((dire->u1.s1.dir_b_namecount + 1) & ~1) + 6 + curbyte); if (dirv->u1.s2.dir_w_version == vers || vers == 0) { - struct inode *inode; + struct inode *inode; ino = (dirv->u1.s2.u2.s3.fid_b_nmx << 16) | le16_to_cpu(dirv->u1.s2.u2.s3.fid_w_num); brelse(bh); @@ -187,30 +187,28 @@ ods2_read_inode (struct inode *inode) { struct super_block *sb = inode->i_sb; - ODS2SB *ods2p = ODS2_SB (sb); + struct 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) { + struct fh2def *fh2p = (struct fh2def *) GETBLKP(sb, fhlbn, bh->b_data); - FH2DEF *fh2p = (FH2DEF *)(GETBLKP(sb, fhlbn, bh->b_data)); - - if ((inode->u.generic_ip = kmalloc(sizeof(ODS2FH), GFP_KERNEL)) != NULL) { - - ODS2FH *ods2fhp; - FI2DEF *fi2p; - FATDEF *fatp; + if ((inode->u.generic_ip = kmalloc (sizeof (struct ods2fh), GFP_KERNEL)) != NULL) { + struct ods2fh *ods2fhp; + struct fi2def *fi2p; + struct fatdef *fatp; - ods2fhp = (ODS2FH *)inode->u.generic_ip; + ods2fhp = (struct ods2fh *) inode->u.generic_ip; ods2fhp->map = NULL; ods2fhp->ods2vari = NULL; - fi2p = (FI2DEF *)((short unsigned *)fh2p + fh2p->fh2_b_idoffset); - fatp = (FATDEF *)&(fh2p->fh2_w_recattr); + fi2p = (struct fi2def *) ((short unsigned *)fh2p + fh2p->fh2_b_idoffset); + fatp = (struct fatdef *) &(fh2p->fh2_w_recattr); if (verify_fh(fh2p, inode->i_ino)) { - memcpy(&ods2fhp->fat, fatp, sizeof(FATDEF)); + memcpy(&ods2fhp->fat, fatp, sizeof (struct fatdef)); ods2fhp->map = getmap(sb, fh2p); if (fh2p->u4.s1.fch_v_directory) { @@ -247,8 +245,8 @@ inode->i_size += le16_to_cpu(fatp->fat_w_ffbyte); if ((fatp->u0.s0.fat_v_rtype == FAT_C_VFC || fatp->u0.s0.fat_v_rtype == FAT_C_VARIABLE) && !ods2p->flags.v_raw) { - if ((ods2fhp->ods2vari = (ODS2VARI *)kmalloc(sizeof(ODS2VARI), GFP_KERNEL)) != NULL) { - memset(ods2fhp->ods2vari, 0 , sizeof(ODS2VARI)); + if ((ods2fhp->ods2vari = (struct ods2vari *) kmalloc(sizeof (struct ods2vari), GFP_KERNEL)) != NULL) { + memset(ods2fhp->ods2vari, 0 , sizeof (struct ods2vari)); sema_init(&(ods2fhp->ods2vari->sem), 1); } else { printk("ODS2-fs kmalloc failed for vari data\n"); @@ -280,28 +278,28 @@ void ods2_clear_inode(struct inode *inode) { - ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; + struct ods2fh *ods2fhp = (struct ods2fh *) inode->u.generic_ip; if (ods2fhp != NULL) { - ODS2MAP *map = ods2fhp->map; - + struct ods2map *map = ods2fhp->map; + while (map != NULL) { - ODS2MAP *nxt = map->nxt; - + struct ods2map *nxt = map->nxt; + kfree(map); map = nxt; } ods2fhp->map = NULL; if (ods2fhp->ods2vari != NULL) { /* in case the file was of variable record type */ - int idx; - + int idx; + for (idx = 0; idx < 128; idx++) { - ODS2VAR *ods2varp = ods2fhp->ods2vari->ods2varp[idx]; - + struct ods2var *ods2varp = ods2fhp->ods2vari->ods2varp[idx]; + while (ods2varp != NULL) { - ODS2VAR *nxt = ods2varp->nxt; - + struct ods2var *nxt = ods2varp->nxt; + kfree(ods2varp); ods2varp = nxt; } Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- super.c 19 Sep 2004 19:51:15 -0000 1.4 +++ super.c 20 Sep 2004 05:39:07 -0000 1.5 @@ -31,7 +31,7 @@ */ static void ods2_put_super(struct super_block *sb) { - ODS2SB *ods2p = ODS2_SB (sb); + struct ods2sb *ods2p = ODS2_SB (sb); if (ods2p != NULL) { iput(ods2p->indexf); /* release INDEXF.SYS;1 */ @@ -47,7 +47,7 @@ */ int ods2_statfs(struct super_block *sb, struct kstatfs *buf) { - ODS2SB *ods2p = ODS2_SB (sb); + struct ods2sb *ods2p = ODS2_SB (sb); memcpy(buf, &ods2p->kstatfs, sizeof(struct kstatfs)); return 0; @@ -78,20 +78,20 @@ */ int ods2_read_bitmap(struct super_block *sb) { - ODS2SB *ods2p = ODS2_SB (sb); + struct 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); - u32 lbn; + struct ods2fh *ods2fhp = (struct ods2fh *) (inode->u.generic_ip); + u32 lbn; if ((lbn = vbn2lbn(sb, ods2fhp->map, 1)) > 0 && (bh = sb_bread(sb, GETBLKNO(sb, lbn))) != NULL && bh->b_data != NULL) { - struct scbdef *scb = (SCBDEF *)(GETBLKP(sb, lbn, bh->b_data)); - short unsigned *p; - short unsigned chksum = 0; + struct scbdef *scb = (struct scbdef *) GETBLKP(sb, lbn, bh->b_data); + short unsigned *p; + short unsigned chksum = 0; for (p = (short unsigned *)scb ; p < (short unsigned *)&(scb->scb_w_checksum) ; chksum += *p++); @@ -99,9 +99,9 @@ scb->scb_w_cluster == ods2p->hm2.hm2_w_cluster && scb->scb_w_checksum == chksum) { - struct buffer_head *bh2; - u32 vbn = 1; - u32 bitset = 0; + struct buffer_head *bh2; + u32 vbn = 1; + u32 bitset = 0; /* We need to loop through all bytes that make up the bitmap. @@ -144,7 +144,7 @@ int ods2_read_ibitmap (struct super_block *sb) { - ODS2SB *ods2p = ODS2_SB (sb); + struct ods2sb *ods2p = ODS2_SB (sb); int idx; struct buffer_head *bh; @@ -177,7 +177,7 @@ ods2_fill_super(struct super_block *sb, void *data, int silent) { struct buffer_head *bh; - ODS2SB *ods2p; + struct 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) { @@ -186,12 +186,12 @@ u16 chksum1 = 0; u16 chksum2 = 0; - if ((ODS2_SB (sb) = kmalloc(sizeof(ODS2SB), GFP_KERNEL)) == NULL) { + if ((ODS2_SB (sb) = kmalloc(sizeof(struct ods2sb), GFP_KERNEL)) == NULL) { printk("ODS2-fs kmalloc failed for sb generic\n"); return -ENOMEM; } ods2p = ODS2_SB (sb); - memcpy(&ods2p->hm2, GETBLKP(sb, 1, bh->b_data), sizeof(HM2DEF)); + memcpy(&ods2p->hm2, GETBLKP(sb, 1, bh->b_data), sizeof (struct hm2def)); brelse(bh); for (p = (u16 *)&(ods2p->hm2) ; p < (u16 *)&(ods2p->hm2.hm2_w_checksum1) ; chksum1 += *p++); Index: file.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/file.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- file.c 19 Sep 2004 19:51:15 -0000 1.3 +++ file.c 20 Sep 2004 05:39:07 -0000 1.4 @@ -64,8 +64,8 @@ long unsigned arg) { struct super_block *sb = inode->i_sb; - ODS2SB *ods2p = ODS2_SB (sb); - ODS2FILE *ods2filep = (ODS2FILE *) filp->private_data; + struct ods2sb *ods2p = ODS2_SB (sb); + struct ods2file *ods2filep = (struct ods2file *) filp->private_data; int error = -ENOTTY; int onoff; @@ -117,16 +117,19 @@ */ -int update_virtual_file_pos(loff_t loff, ODS2VARI *ods2vari, u64 currec) { - ODS2VAR *ods2varp = NULL; - int idxvar = IDXVAR(loff); - int idxvari = IDXVARI(loff); - int idxblock = IDXBLOCK(loff); - - if (ods2vari->ods2varp[idxvari] == NULL) { - if ((ods2vari->ods2varp[idxvari] = (ODS2VAR *)kmalloc(sizeof(ODS2VAR), GFP_KERNEL)) != NULL) { - memset(ods2vari->ods2varp[idxvari], 0, sizeof(ODS2VAR)); - } else { +int +update_virtual_file_pos (loff_t loff, struct ods2vari *ods2vari, u64 currec) +{ + struct ods2var *ods2varp; + int idxvar = IDXVAR (loff); + int idxvari = IDXVARI (loff); + int idxblock = IDXBLOCK (loff); + + if (!ods2vari->ods2varp[idxvari]) { + ods2vari->ods2varp[idxvari] = kmalloc (sizeof (struct ods2var), GFP_KERNEL); + if (ods2vari->ods2varp[idxvari]) + memset(ods2vari->ods2varp[idxvari], 0, sizeof (struct ods2var)); + else { printk("ODS2-fs kmalloc failed for new varp (1)\n"); return 0; } @@ -134,16 +137,17 @@ ods2varp = ods2vari->ods2varp[idxvari]; for (; idxblock > 0; idxblock--) { if (ods2varp->nxt == NULL) { - if ((ods2varp->nxt = (ODS2VAR *)kmalloc(sizeof(ODS2VAR), GFP_KERNEL)) != NULL) { - memset(ods2varp->nxt, 0, sizeof(ODS2VAR)); - } else { + ods2varp->nxt = kmalloc (sizeof (struct ods2var), GFP_KERNEL); + if (ods2varp->nxt) + memset(ods2varp->nxt, 0, sizeof (struct ods2var)); + else { printk("ODS2-fs kmalloc failed for new varp (2)\n"); return 0; } } ods2varp = ods2varp->nxt; } - if (ods2varp != NULL && ods2varp->s1[idxvar].loff == 0) { + if (ods2varp && ods2varp->s1[idxvar].loff == 0) { ods2varp->s1[idxvar].recoffs = currec; ods2varp->s1[idxvar].loff = loff; ods2vari->highidx = loff; @@ -190,15 +194,17 @@ */ -ssize_t ods2_read_variable(struct file *filp, char *buf, size_t buflen, loff_t *loff) { - struct inode *inode = filp->f_dentry->d_inode; - char *buforg = buf; - ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; - ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; - ODS2VARI *ods2vari = ods2fhp->ods2vari; - FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); - u32 vbn = 0; - u16 cpylen; +ssize_t +ods2_read_variable(struct file *filp, char *buf, size_t buflen, loff_t *loff) +{ + struct inode *inode = filp->f_dentry->d_inode; + char *buforg = buf; + struct ods2fh *ods2fhp = (struct ods2fh *) inode->u.generic_ip; + struct ods2file *ods2filep = (struct ods2file *) filp->private_data; + struct fatdef *fatp = (struct fatdef *) &(ods2fhp->fat); + struct ods2vari *ods2vari = ods2fhp->ods2vari; + u32 vbn = 0; + u16 cpylen; if (*loff == 0) { @@ -321,12 +327,14 @@ None. */ -ssize_t ods2_read_stream(struct file *filp, char *buf, size_t buflen, loff_t *loff) { - struct inode *inode = filp->f_dentry->d_inode; - char *buforg = buf; - ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; - u32 vbn = 0; - u16 cpylen; +ssize_t +ods2_read_stream(struct file *filp, char *buf, size_t buflen, loff_t *loff) +{ + struct inode *inode = filp->f_dentry->d_inode; + char *buforg = buf; + struct ods2file *ods2filep = (struct ods2file *) filp->private_data; + u32 vbn = 0; + u16 cpylen; while (*loff < inode->i_size) { vbn = *loff >> 9; @@ -383,13 +391,12 @@ */ 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 = ODS2_SB (sb); - ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; - ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; - FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); - + struct inode *inode = filp->f_dentry->d_inode; + struct super_block *sb = inode->i_sb; + struct ods2sb *ods2p = ODS2_SB (sb); + struct ods2fh *ods2fhp = (struct ods2fh *) inode->u.generic_ip; + struct ods2file *ods2filep = (struct ods2file *) filp->private_data; + struct fatdef *fatp = (struct fatdef *) &(ods2fhp->fat); if (ods2p->flags.v_raw || ods2filep->u1.s1.v_raw) { return ods2_read_stream(filp, buf, buflen, loff); @@ -516,19 +523,21 @@ */ -loff_t ods2_llseek_variable(struct file *filp, loff_t loff, int seek) { - struct inode *inode = filp->f_dentry->d_inode; - ODS2VAR *ods2varp = NULL; - ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; - ODS2VARI *ods2vari = ods2fhp->ods2vari; - ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; - FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); - int idxblock = 0; - loff_t offs = 0; - loff_t coffs = 0; - loff_t currec = 0; - u32 vbn = 0; - u16 reclen = 0; +loff_t +ods2_llseek_variable(struct file *filp, loff_t loff, int seek) +{ + struct inode *inode = filp->f_dentry->d_inode; + struct ods2var *ods2varp = NULL; + struct ods2fh *ods2fhp = (struct ods2fh *) inode->u.generic_ip; + struct ods2vari *ods2vari = ods2fhp->ods2vari; + struct ods2file *ods2filep = (struct ods2file *) filp->private_data; + struct fatdef *fatp = (struct fatdef *) &(ods2fhp->fat); + int idxblock = 0; + loff_t offs = 0; + loff_t coffs = 0; + loff_t currec = 0; + u32 vbn = 0; + u16 reclen = 0; offs = loff; if (seek == 0) { /* SEEK_SET */ @@ -626,12 +635,12 @@ 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 = ODS2_SB (sb); - ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; - ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; - FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); + struct inode *inode = filp->f_dentry->d_inode; + struct super_block *sb = inode->i_sb; + struct ods2sb *ods2p = ODS2_SB (sb); + struct ods2fh *ods2fhp = (struct ods2fh *) inode->u.generic_ip; + struct ods2file *ods2filep = (struct ods2file *) filp->private_data; + struct fatdef *fatp = (struct fatdef *) &(ods2fhp->fat); if (ods2p->flags.v_raw || ods2filep->u1.s1.v_raw) { return ods2_llseek_stream(filp, loff, seek); @@ -656,16 +665,17 @@ int ods2_open_release(struct inode *inode, struct file *filp) { if (filp->private_data == NULL) { - if ((filp->private_data = kmalloc(sizeof(ODS2FILE), GFP_KERNEL)) != NULL) { - memset(filp->private_data, 0, sizeof(ODS2FILE)); - } else { + filp->private_data = kmalloc (sizeof (struct ods2file), GFP_KERNEL); + if (filp->private_data) + memset (filp->private_data, 0, sizeof (struct ods2file)); + else { printk("ODS2-fs kmalloc failed for open_release\n"); return 0; } } else { - ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; - - if (ods2filep != NULL) { + struct ods2file *ods2filep = (struct ods2file *) filp->private_data; + + if (ods2filep) { brelse(ods2filep->bhp); kfree(filp->private_data); } Index: ods2.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/ods2.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ods2.h 19 Sep 2004 19:51:15 -0000 1.3 +++ ods2.h 20 Sep 2004 05:39:07 -0000 1.4 @@ -28,10 +28,9 @@ /* - This is the home block on a ODS2 disk. -*/ - -typedef struct hm2def { + * This is the home block on a ODS2 disk. + */ +struct hm2def { u32 hm2_l_homelbn; u32 hm2_l_alhomelbn; u32 hm2_l_altidxlbn; @@ -84,14 +83,13 @@ char hm2_t_format[12]; u16 hm2_w_res4; u16 hm2_w_checksum2; -} HM2DEF; +}; /* - This is the Storage Control Block. - It is the first block in file BITMAP.SYS. -*/ - -typedef struct scbdef { + * This is the Storage Control Block. + * It is the first block in file BITMAP.SYS. + */ +struct scbdef { union { u16 scb_w_struclev; struct { @@ -134,14 +132,13 @@ u64 scb_q_genernum; u8 scb_b_reserved[446]; u16 scb_w_checksum; -} SCBDEF; +}; /* - This structure is part of the file header block and - fives different tomes as well as the file name. -*/ - -typedef struct fi2def { + * This structure is part of the file header block and + * fives different tomes as well as the file name. + */ +struct fi2def { char fi2_t_filename[20]; u16 fi2_w_revision; u16 fi2_q_credate[4]; @@ -149,14 +146,13 @@ u16 fi2_q_expdate[4]; u16 fi2_q_bakdate[4]; char fi_2_filenameext[66]; -} FI2DEF; +}; /* - This is the file header for any ODS2 file. - It is located in file INDEXF.SYS. -*/ - -typedef struct fh2def { + * This is the file header for any ODS2 file. + * It is located in file INDEXF.SYS. + */ +struct fh2def { u8 fh2_b_idoffset; u8 fh2_b_mpoffset; u8 fh2_b_acoffset; @@ -237,14 +233,13 @@ u8 fh2_r_class_prot[20]; u8 fh2_b_res4[402]; u16 fh2_w_checksum; -} FH2DEF; +}; /* - This is the file attribute structure. - It is part of the file header. - It defines RMS attributes for any file. -*/ - + * This is the file attribute structure. + * It is part of the file header. + * It defines RMS attributes for any file. + */ #define FAT_C_UNDEFINED 0 #define FAT_C_FIXED 1 #define FAT_C_VARIABLE 2 @@ -264,7 +259,7 @@ #define FAT_M_NOSPAN 0x08 #define FAT_M_MSBRCW 0x10 -typedef struct fatdef { +struct fatdef { union { u8 fat_b_rtype; struct { @@ -296,15 +291,14 @@ u8 fat_b_res1[6]; u16 fat_w_notused; u16 fat_w_versions; -} FATDEF; +}; /* - This is the structure used for mapping virtual block - number, VBN, to logical block numbers, LBN. - One or more of this structure is part of the file header. -*/ - -typedef struct fm2def { + * This is the structure used for mapping virtual block + * number, VBN, to logical block numbers, LBN. + * One or more of this structure is part of the file header. + */ +struct fm2def { union { struct { u8 fm2_b_count1; @@ -324,16 +318,14 @@ u32 fm2_l_lbn3; } fm3; } u1; -} FM2DEF; +}; /* - This structure define a directory entry in a directory file. -*/ - + * This structure define a directory entry in a directory file. + */ #define DIR_C_FID 0 #define DIR_C_LINKNAME 1 - -typedef struct dirdef { +struct dirdef { union { struct { u16 dir_w_size; @@ -363,111 +355,104 @@ } u2; } s2; } u1; -} DIRDEF; - +}; /* - From here we have our own ODS2 specific structures - and definitions. -*/ - -typedef struct ods2map { + * From here we have our own ODS2 specific structures + * and definitions. + */ +struct ods2map { struct ods2map *nxt; struct { u32 cnt; u32 lbn; } s1[16]; -} ODS2MAP; +}; /* - Each block map 64Kbyte * 16 loff's. - The number of bytes for this structure is 4 + 16 * 16 => 260. - For a 1GB file we need a total of 1024 blocks. If each block is - 260 bytes the total amount of bytes is 1024 * 260 => 266240 bytes - The linked list will contain no more than 8 blocks as the structure - below has 128 pointers. -*/ - -typedef struct ods2var { + * Each block map 64Kbyte * 16 loff's. + * The number of bytes for this structure is 4 + 16 * 16 => 260. + * For a 1GB file we need a total of 1024 blocks. If each block is + * 260 bytes the total amount of bytes is 1024 * 260 => 266240 bytes + * The linked list will contain no more than 8 blocks as the structure + * below has 128 pointers. + */ +struct ods2var { struct ods2var *nxt; /* next block if needed */ struct { u64 recoffs; /* offset to start of record */ loff_t loff; /* virtual offset to start of record */ } s1[16]; -} ODS2VAR; +}; /* - Each file that is of variable record type has the following structure - attached to it. - This is the index for one or more ODS2VAR structures. By doing index as - much as possible it is easy to calculate what structure to use by just - doing some shifts and bit masking. - Note that this structure and its sub structures are protected by a - semaphore because more than one process at the same time can use the inode - structure to read the file contents. - The number of bytes for this structure is 128 * 4 + 12 (or 16) => 528. - The overhead for small files are big but 528 bytes allocated using kmalloc - should not be to much. -*/ - -#define IDXVAR(a) ((a >> 16) & 0x0f) -#define IDXVARI(a) ((a >> 20) & 0x7f) -#define IDXBLOCK(a) (a >> 27) - -typedef struct ods2vari { - ODS2VAR *ods2varp[128]; /* pointers to ods2var blocks */ - struct semaphore sem; /* This is the semaphore used to protect this structure */ - loff_t highidx; /* highest index so far... */ -} ODS2VARI; + * Each file that is of variable record type has the following structure + * attached to it. + * This is the index for one or more ODS2VAR structures. By doing index as + * much as possible it is easy to calculate what structure to use by just + * doing some shifts and bit masking. + * Note that this structure and its sub structures are protected by a + * semaphore because more than one process at the same time can use the inode + * structure to read the file contents. + * The number of bytes for this structure is 128 * 4 + 12 (or 16) => 528. + * The overhead for small files are big but 528 bytes allocated using kmalloc + * should not be to much. + */ +#define IDXVAR(a) (((a) >> 16) & 0x0f) +#define IDXVARI(a) (((a) >> 20) & 0x7f) +#define IDXBLOCK(a) ((a) >> 27) +struct ods2vari { + struct ods2var *ods2varp[128]; /* pointers to ods2var blocks */ + struct semaphore sem; /* This is the semaphore used + to protect this structure */ + loff_t highidx; /* highest index so far... */ +}; /* - Each open file has the following structure attached to it. - It add the extra variables needed to handle directories and - RMS data. -*/ - -typedef struct ods2file { - struct buffer_head *bhp; - u8 *data; /* pointer to data portion in buffer */ - u64 currec; /* byte offset to current record --- from start of file */ - u16 curbyte; /* byte offset into current record */ - u16 reclen; /* length of current record */ + * Each open file has the following structure attached to it. + * It add the extra variables needed to handle directories and + * RMS data. + */ +struct ods2file { + struct buffer_head *bhp; + u8 *data; /* pointer to data portion in buffer */ + u64 currec; /* byte offset to current record --- from start of file */ + u16 curbyte; /* byte offset into current record */ + u16 reclen; /* length of current record */ union { - u32 flags; + u32 flags; struct { - u32 v_raw:1; /* this file handler must return data in raw mode */ - u32 v_res1:31; + u32 v_raw:1; /* this file handler must + return data in raw mode */ + u32 v_res1:31; } s1; } u1; -} ODS2FILE; +}; /* - Each inode has the following structure attached to it. - It keep the file attributes and mapping information in memory. -*/ - -typedef struct ods2fh { - ODS2MAP *map; /* mapping information from VBN to LBN */ - ODS2VARI *ods2vari; /* only used for variable record files */ - FATDEF fat; /* file attributes */ - u32 parent; /* ino of parent directory */ -} ODS2FH; + * Each inode has the following structure attached to it. + * It keep the file attributes and mapping information in memory. + */ +struct ods2fh { + struct ods2map *map; /* mapping information from VBN to LBN */ + struct ods2vari *ods2vari; /* only used for variable record files */ + struct fatdef fat; /* file attributes */ + u32 parent; /* ino of parent directory */ +}; /* - The super block for an ODS2 disk has the following - structure attached. - It keep the home block and the inode for INDEXF.SYS;1 - in memory. -*/ - -#define SB_M_VERSALL 0 -#define SB_M_VERSHIGH 1 -#define SB_M_VERSNONE 2 -#define SB_M_RAW 8 -#define SB_M_LOWERCASE 16 - -typedef struct ods2sb { - HM2DEF hm2; + * The super block for an ODS2 disk has the following + * structure attached. + * It keep the home block and the inode for INDEXF.SYS;1 + * in memory. + */ +#define SB_M_VERSALL 0 +#define SB_M_VERSHIGH 1 +#define SB_M_VERSNONE 2 +#define SB_M_RAW 8 +#define SB_M_LOWERCASE 16 +struct ods2sb { + struct hm2def hm2; struct inode *indexf; /* INDEXF.SYS */ u8 *ibitmap; /* index file header bitmap */ struct kstatfs kstatfs; @@ -479,65 +464,60 @@ } flags; char dollar; /* character used for dollar */ char semicolon; /* character used for semicolon */ -} ODS2SB; +}; /* - These two macros are used to support media with a sector size of - 1024 or 2048 bytes. - I.e. the RRD47 CDROM drive on my Alpha server 1200 report a sector - size of 2048 even for an ODS2 CD. -*/ + * These two macros are used to support media with a sector size of + * 1024 or 2048 bytes. + * I.e. the RRD47 CDROM drive on my Alpha server 1200 report a sector + * size of 2048 even for an ODS2 CD. + */ -#define GETBLKNO(a, b) ((b) >> (a->s_blocksize_bits - 9)) -#define GETBLKP(a, b, c) (void *)&(((char *)c)[((b) & (a->s_blocksize_bits == 9 ? 0 : (a->s_blocksize_bits == 10 ? 1 : 3))) << 9]) +#define GETBLKNO(a, b) ((b) >> (a->s_blocksize_bits - 9)) +#define GETBLKP(a, b, c) ((void *)&(((char *)(c))[((b) & ((a)->s_blocksize_bits == 9 ? 0 : ((a)->s_blocksize_bits == 10 ? 1 : 3))) << 9])) /* - This is our private ioctl operations for a file pointer. -*/ - -#define ODS2_IOC_FISETRAW _IOW('f', 0x0d0, long) /* enable/disable raw file mode */ -#define ODS2_IOC_FIGETRAW _IOR('g', 0x0d0, long) /* get raw file mode */ -#define ODS2_IOC_SBGETRAW _IOR('g', 0x0d1, long) /* get raw mode for super block */ + * This is our private ioctl operations for a file pointer. + */ +#define ODS2_IOC_FISETRAW _IOW('f', 0x0d0, long) /* enable/disable raw file mode */ +#define ODS2_IOC_FIGETRAW _IOR('g', 0x0d0, long) /* get raw file mode */ +#define ODS2_IOC_SBGETRAW _IOR('g', 0x0d1, long) /* get raw mode for super block */ -#define MIN(a, b) (a < b ? a : b) -#define MAX(a, b) (a > b ? a : b) +#define MIN(a, b) ((a) < (b)? (a): (b)) /* FIXME - deprecated! */ +#define MAX(a, b) ((a) > (b)? (a): (b)) /* FIXME - deprecated! */ /* - util.c -*/ - -u64 div64(u64 a, u32 b0); -u32 vbn2lbn(struct super_block *sb, ODS2MAP *map, u32 vbn); -u32 ino2fhlbn(struct super_block *sb, u32 ino); -ODS2MAP *getmap(struct super_block *sb, FH2DEF *fh2p); -struct buffer_head *getfilebh(struct file *filp, u32 vbn); -int verify_fh(FH2DEF *fh2p, u32 ino); -int parse_options(struct super_block *sb, char *options); + * util.c + */ +extern u64 div64(u64 a, u32 b0); +extern u32 vbn2lbn(struct super_block *sb, struct ods2map *map, u32 vbn); +extern u32 ino2fhlbn(struct super_block *sb, u32 ino); +extern struct ods2map *getmap(struct super_block *sb, struct fh2def *fh2p); +extern struct buffer_head *getfilebh(struct file *filp, u32 vbn); +extern int verify_fh(struct fh2def *fh2p, u32 ino); +extern int parse_options(struct super_block *sb, char *options); /* - inode.c -*/ - -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); -void ods2_delete_inode(struct inode *inode); + * inode.c + */ +extern struct dentry *ods2_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd); +extern void ods2_read_inode(struct inode *inode); +extern void ods2_put_inode(struct inode *inode); +extern void ods2_clear_inode(struct inode *inode); +extern void ods2_delete_inode(struct inode *inode); /* - dir.c -*/ - -int ods2_readdir(struct file *filp, void *dirent, filldir_t filldir); + * dir.c + */ +extern int ods2_readdir(struct file *filp, void *dirent, filldir_t filldir); /* - file.c -*/ - -int ods2_file_ioctl(struct inode *inode, struct file *filp, int unsigned cmd, long unsigned arg); -ssize_t ods2_read(struct file *filp, char *buf, size_t buflen, loff_t *loff); -loff_t ods2_llseek(struct file *filp, loff_t loff, int seek); -int ods2_open_release(struct inode *inode, struct file *filp); + * file.c + */ +extern int ods2_file_ioctl(struct inode *inode, struct file *filp, int unsigned cmd, long unsigned arg); +extern ssize_t ods2_read(struct file *filp, char *buf, size_t buflen, loff_t *loff); +extern loff_t ods2_llseek(struct file *filp, loff_t loff, int seek); +extern int ods2_open_release(struct inode *inode, struct file *filp); /* * util.c @@ -545,7 +525,7 @@ extern time_t vms2unix_sec (u16 *vms_timestamp); extern long vms2unix_nsec (u16 *vms_timestamp); -/* Hacks in util.c */ +/* FIXME: 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.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- dir.c 19 Sep 2004 19:51:15 -0000 1.3 +++ dir.c 20 Sep 2004 05:39:07 -0000 1.4 @@ -34,24 +34,24 @@ 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 = ODS2_SB (sb); - ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; - ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; - loff_t pos = filp->f_pos; - u32 vbn = (ods2filep->currec >> 9); /* get current VBN-1 to use */ - u32 lbn; - char cdirname[256]; + struct inode *inode = filp->f_dentry->d_inode; + struct super_block *sb = inode->i_sb; + struct buffer_head *bh = NULL; + struct ods2sb *ods2p = ODS2_SB (sb); + struct ods2fh *ods2fhp = (struct ods2fh *) inode->u.generic_ip; + struct ods2file *ods2filep = (struct ods2file *) filp->private_data; + loff_t pos = filp->f_pos; + u32 vbn = (ods2filep->currec >> 9); /* get current VBN-1 to use */ + u32 lbn; + char cdirname[256]; /* FIXME: large stack useage!!! */ - memset(cdirname, ' ', sizeof(cdirname)); + memset (cdirname, ' ', sizeof (cdirname)); /* - When there are no more files to return the file position in file - is set to -1. - */ - - if (pos == -1) return 0; + * When there are no more files to return the file position in file + * is set to -1. + */ + if (pos == -1) + return 0; /* When we get called the first time for a directory file the file @@ -87,14 +87,14 @@ */ while (*recp != 65535 && *recp <= 512 && ods2filep->currec < inode->i_size) { - DIRDEF *dire = (DIRDEF *)recp; - char dirname[dire->u1.s1.dir_b_namecount + 1]; - + struct dirdef *dire = (struct dirdef *) recp; + char dirname[dire->u1.s1.dir_b_namecount + 1]; /* FIXME: Check stack useage */ + memcpy(dirname, &dire->u1.s1.dir_t_name, dire->u1.s1.dir_b_namecount); dirname[dire->u1.s1.dir_b_namecount] = 0; if (ods2p->dollar != '$' || ods2p->flags.v_lowercase) { - char *p = dirname; - char cnt = dire->u1.s1.dir_b_namecount; + char *p = dirname; + char cnt = dire->u1.s1.dir_b_namecount; while (*p && cnt-- > 0) { if (*p == '$') { *p = ods2p->dollar; } if (ods2p->flags.v_lowercase) { *p = tolower(*p); } p++; } } @@ -104,25 +104,23 @@ while (ods2filep->curbyte < dire->u1.s1.dir_w_size && !(ods2p->flags.v_version != SB_M_VERSALL && strlen(dirname) == strlen(cdirname) && strncmp(dirname, cdirname, strlen(dirname)) == 0)) { - DIRDEF *dirv = (DIRDEF *)((char *)dire + ods2filep->curbyte); - u32 ino = (dirv->u1.s2.u2.s3.fid_b_nmx << 16) | le16_to_cpu(dirv->u1.s2.u2.s3.fid_w_num); - char dirnamev[dire->u1.s1.dir_b_namecount + 1 + 5 + 1]; - + struct dirdef *dirv = (struct dirdef *) ((char *)dire + ods2filep->curbyte); + u32 ino = (dirv->u1.s2.u2.s3.fid_b_nmx << 16) | le16_to_cpu(dirv->u1.s2.u2.s3.fid_w_num); + char dirnamev[dire->u1.s1.dir_b_namecount + 1 + 5 + 1]; /* FIXME: Check stack useage! */ + if (ino != 4) { /* we must ignore 000000.DIR as it is the same as . */ - if (ods2p->flags.v_version == SB_M_VERSNONE) { + if (ods2p->flags.v_version == SB_M_VERSNONE) sprintf(dirnamev, "%s", dirname); - } else { + else sprintf(dirnamev, "%s%c%d", dirname, ods2p->semicolon, dirv->u1.s2.dir_w_version); - } /* - We don't really know if the file is a directory by just checking - the file extension but it is the best we can do. - Should the file have extension .DIR but be a regular file the mistake - will be detected later on when the user try to walk down into - the false directory. - */ - + * We don't really know if the file is a directory by just checking + * the file extension but it is the best we can do. + * Should the file have extension .DIR but be a regular file the mistake + * will be detected later on when the user try to walk down into + * the false directory. + */ if (filldir(dirent, dirnamev, strlen(dirnamev), filp->f_pos, ino, (strstr(dirnamev, (ods2p->flags.v_lowercase ? ".dir." : ".DIR")) == NULL ? DT_REG : DT_DIR))) { /* |
|
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: - */ |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-19 19:32:07
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16979 Removed Files: Makefile.i386 Log Message: - Remove the original Makefile, which is a specific one to build the ODS-2 driver outside the kernel tree for a ia32 class machine. --- Makefile.i386 DELETED --- |
|
From: Berczi G. <gab...@us...> - 2004-09-19 17:25:43
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23113/arch/vax/kernel Modified Files: cpu_ka48.c Log Message: sync with Kenn's latest change ("Move all the current VSBUS code into drivers/vax/bus/vsbus.") Index: cpu_ka48.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/cpu_ka48.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- cpu_ka48.c 11 May 2004 19:47:46 -0000 1.4 +++ cpu_ka48.c 19 Sep 2004 17:25:35 -0000 1.5 @@ -18,7 +18,6 @@ #include <asm/mtpr.h> #include <asm/mv.h> #include <asm/vaxcpu.h> -#include <asm/vsa.h> #include <asm/ka48.h> #include <asm/clock.h> /* For clock_init routines */ #include <asm/bus/vsbus.h> @@ -114,9 +113,6 @@ static void ka48_init_devices(void) { printk("ka48: init_devices\n"); -#ifdef CONFIG_VSBUS - vsbus_setup(); -#endif /* CONFIG_VSBUS */ /* Initialise the DMA area */ ka48_dma_init(); |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-19 16:40:25
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13748 Modified Files: ods2.h super.c Log Message: - struct statfs is in <asm/statfs.h>. Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- super.c 19 Sep 2004 16:37:06 -0000 1.2 +++ super.c 19 Sep 2004 16:40:16 -0000 1.3 @@ -18,6 +18,7 @@ #include <linux/slab.h> #include <linux/init.h> #include <linux/blkdev.h> +#include <asm/statfs.h> #include <asm/uaccess.h> #include "ods2.h" Index: ods2.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/ods2.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ods2.h 19 Sep 2004 09:47:49 -0000 1.1 +++ ods2.h 19 Sep 2004 16:40:16 -0000 1.2 @@ -11,6 +11,8 @@ * */ +#include <asm/statfs.h> + /* The followinf structures are defined in the book "VMS File System Internals" |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-19 16:37:15
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12998 Modified Files: dir.c file.c inode.c super.c util.c Log Message: - <linux/locks.h> is no longer. It's most important functions (superblock locking and unlocking) is now part of <linux/fs.h>. Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/inode.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- inode.c 19 Sep 2004 09:47:49 -0000 1.1 +++ inode.c 19 Sep 2004 16:37:06 -0000 1.2 @@ -20,7 +20,6 @@ #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> -#include <linux/locks.h> #include <linux/blkdev.h> #include <asm/uaccess.h> Index: util.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/util.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- util.c 19 Sep 2004 09:47:49 -0000 1.1 +++ util.c 19 Sep 2004 16:37:06 -0000 1.2 @@ -19,7 +19,6 @@ #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> -#include <linux/locks.h> #include <linux/blkdev.h> #include <asm/uaccess.h> Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- super.c 19 Sep 2004 09:47:49 -0000 1.1 +++ super.c 19 Sep 2004 16:37:06 -0000 1.2 @@ -17,7 +17,6 @@ #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> -#include <linux/locks.h> #include <linux/blkdev.h> #include <asm/uaccess.h> Index: file.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/file.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- file.c 19 Sep 2004 09:47:49 -0000 1.1 +++ file.c 19 Sep 2004 16:37:06 -0000 1.2 @@ -22,7 +22,6 @@ #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> -#include <linux/locks.h> #include <linux/blkdev.h> #include <asm/uaccess.h> Index: dir.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/dir.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dir.c 19 Sep 2004 09:47:49 -0000 1.1 +++ dir.c 19 Sep 2004 16:37:06 -0000 1.2 @@ -20,7 +20,6 @@ #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> -#include <linux/locks.h> #include <linux/blkdev.h> #include <asm/uaccess.h> |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-19 09:55:08
|
Update of /cvsroot/linux-vax/kernel-2.5/fs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21724 Modified Files: Makefile Kconfig Log Message: - Integrate ODS-2 into the build environment. Of course, it won't compile right now because it's 2.4.x source code... Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/Makefile,v retrieving revision 1.1.1.34 retrieving revision 1.2 diff -u -d -r1.1.1.34 -r1.2 --- Makefile 28 Jul 2004 22:27:25 -0000 1.1.1.34 +++ Makefile 19 Sep 2004 09:54:58 -0000 1.2 @@ -91,3 +91,4 @@ obj-$(CONFIG_XFS_FS) += xfs/ obj-$(CONFIG_AFS_FS) += afs/ obj-$(CONFIG_BEFS_FS) += befs/ +obj-$(CONFIG_ODS2_FS) += ods2/ Index: Kconfig =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/Kconfig,v retrieving revision 1.1.1.23 retrieving revision 1.2 diff -u -d -r1.1.1.23 -r1.2 --- Kconfig 2 Sep 2004 18:41:42 -0000 1.1.1.23 +++ Kconfig 19 Sep 2004 09:54:58 -0000 1.2 @@ -1368,6 +1368,14 @@ Say Y here if you want to try writing to UFS partitions. This is experimental, so you should back up your UFS partitions beforehand. +config ODS2_FS + tristate "VMS ODS-2 filesystem support (read-only)" + depends on EXPERIMENTAL + default n + help + Say Y if you want to read ODS-2 filesystems, which are normally used + by the VMS operating system. + endmenu menu "Network File Systems" |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-19 09:55:08
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21724/ods2 Added Files: Makefile Log Message: - Integrate ODS-2 into the build environment. Of course, it won't compile right now because it's 2.4.x source code... --- NEW FILE: Makefile --- # # Makefile for the Linux ods2 filesystem implementation. # obj-$(CONFIG_ODS2_FS) += ods2.o ods2-objs := super.o inode.o file.o dir.o util.o tparse.o |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-19 09:48:01
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20217 Added Files: CHANGES Makefile.i386 README dir.c file.c inode.c ods2.h super.c tparse.c tparse.h util.c Log Message: - Initial import of latest ods2 sources (version 0.9.3). This won't compile right now, don't try to build it until you want to hack it! --- NEW FILE: super.c --- /* * linux/fs/ods2/super.c * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: * ftp://prep.ai.mit.edu/pub/gnu/GPL * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> * */ #include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/locks.h> #include <linux/blkdev.h> #include <asm/uaccess.h> #include "ods2.h" /* This routine is executed when the ODS2 file system is unmounted. The only thing we need to do is to release file INDEXF.SYS;1 and deallocate memory used for index file header bitmap. */ static void ods2_put_super(struct super_block *sb) { ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; if (ods2p != NULL) { iput(ods2p->indexf); /* release INDEXF.SYS;1 */ kfree(ods2p->ibitmap); kfree(sb->u.generic_sbp); } } /* This routine is executed when the user want to get information about the ODS2 file system. As we are read only we can just copy 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; memcpy(buf, &ods2p->statfs, sizeof(struct statfs)); 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, }; /* This array is used to get the number of bits set for a nibble value. */ static char unsigned nibble2bits[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; /* This routine open and read the BITMAP.SYS;1 file. */ int ods2_read_bitmap(struct super_block *sb) { ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; struct buffer_head *bh; struct inode *inode; if ((inode = iget(sb, 2)) != NULL) { /* this is BITMAP.SYS */ ODS2FH *ods2fhp = (ODS2FH *)(inode->u.generic_ip); u32 lbn; if ((lbn = vbn2lbn(sb, ods2fhp->map, 1)) > 0 && (bh = sb_bread(sb, GETBLKNO(sb, lbn))) != NULL && bh->b_data != NULL) { struct scbdef *scb = (SCBDEF *)(GETBLKP(sb, lbn, bh->b_data)); short unsigned *p; short unsigned chksum = 0; for (p = (short unsigned *)scb ; p < (short unsigned *)&(scb->scb_w_checksum) ; chksum += *p++); if (scb->u1.s1.scb_b_structlevl == 2 && scb->u1.s1.scb_b_structlevv >= 1 && scb->scb_w_cluster == ods2p->hm2.hm2_w_cluster && scb->scb_w_checksum == chksum) { struct buffer_head *bh2; u32 vbn = 1; u32 bitset = 0; /* We need to loop through all bytes that make up the bitmap. The fastest way to count the number of bits set in the byte is to have a nibble table that has the number of bits for the values of 0 to 15. By adding the number of bits for the low and high nibble we can get the total amount of bits set. */ while (vbn * 512 < inode->i_size && (lbn = vbn2lbn(sb, ods2fhp->map, vbn + 1)) > 0 && (bh2 = sb_bread(sb, GETBLKNO(sb, lbn))) != NULL && bh->b_data != NULL) { u8 *bp = (char unsigned *)(GETBLKP(sb, lbn, bh2->b_data)); int cnt; for (cnt = 0; cnt < 512; cnt++, bp++) { bitset += (nibble2bits[*bp & 0x0f] + nibble2bits[*bp >> 4]); } brelse(bh2); 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; brelse(bh); iput(inode); return 1; /* everything went ok */ } brelse(bh); /* invalid data in VBN 1 */ } iput(inode); /* could not read VBN 1 */ } return 0; /* unable to get inode 2 OR some other problem */ } /* This routine allocate memory for the index file header bitmap 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 = (ODS2SB *)sb->u.generic_sbp; struct buffer_head *bh; int idx; ods2p->statfs.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++) { if ((bh = sb_bread(sb, GETBLKNO(sb, ods2p->hm2.hm2_l_ibmaplbn + idx))) != NULL && bh->b_data != NULL) { u8 *bp = (GETBLKP(sb, ods2p->hm2.hm2_l_ibmaplbn + idx, bh->b_data)); 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]); } bforget(bh); } } return 1; } printk("ODS2-fs error when allocating memory for index file header bitmap\n"); return 0; } /* 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; sb_set_blocksize(sb, get_hardsect_size(sb->s_dev)); if ((bh = sb_bread(sb, GETBLKNO(sb, 1))) != NULL && bh->b_data != NULL) { u16 *p; u16 chksum1 = 0; u16 chksum2 = 0; if ((sb->u.generic_sbp = kmalloc(sizeof(ODS2SB), GFP_KERNEL)) == NULL) { printk("ODS2-fs kmalloc failed for sb generic\n"); return NULL; } ods2p = (ODS2SB *)sb->u.generic_sbp; memcpy(&ods2p->hm2, GETBLKP(sb, 1, bh->b_data), sizeof(HM2DEF)); brelse(bh); for (p = (u16 *)&(ods2p->hm2) ; p < (u16 *)&(ods2p->hm2.hm2_w_checksum1) ; chksum1 += *p++); for (p = (u16 *)&(ods2p->hm2) ; p < (u16 *)&(ods2p->hm2.hm2_w_checksum2) ; chksum2 += *p++); /* This is the way to check for a valid home block. */ if (ods2p->hm2.hm2_l_homelbn != 0 && ods2p->hm2.hm2_l_alhomelbn != 0 && ods2p->hm2.hm2_l_altidxlbn != 0 && ods2p->hm2.hm2_w_cluster != 0 && ods2p->hm2.u1.s1.hm2_b_structlevl == 2 && ods2p->hm2.u1.s1.hm2_b_structlevv >= 1 && ods2p->hm2.hm2_w_homevbn != 0 && ods2p->hm2.hm2_l_ibmaplbn != 0 && ods2p->hm2.hm2_l_maxfiles > ods2p->hm2.hm2_w_resfiles && ods2p->hm2.hm2_w_resfiles >= 5 && chksum1 == ods2p->hm2.hm2_w_checksum1 && chksum2 == ods2p->hm2.hm2_w_checksum2) { ods2p->flags.v_raw = 0; ods2p->flags.v_lowercase = 0; ods2p->flags.v_version = SB_M_VERSALL; ods2p->dollar = '_'; ods2p->semicolon = '.'; if (data != NULL) { parse_options(sb, data); } sb->s_op = &ods2_sops; ods2p->indexf = iget(sb, 1); /* read INDEXF.SYS. */ sb->s_root = d_alloc_root(iget(sb, 4)); /* this is 000000.DIR;1 */ /* We need to be able to read the index file header bitmap. */ if (ods2_read_ibitmap(sb)) { /* We need to be able to read BITMAP.SYS as it contains the bitmap for allocated blocks. Without this file we need to rebuild it by reading ALL file mapping pointers for ALL files and create the file. That will be in a later release... */ if (ods2_read_bitmap(sb)) { char format[13]; char volname[13]; char volowner[13]; /* We need to fill in statfs structure used when any user want to get information about the mounted ODS2 file system. 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; memcpy(format, ods2p->hm2.hm2_t_format, 12); format[12] = 0; memcpy(volname, ods2p->hm2.hm2_t_volname, 12); volname[12] = 0; 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; } kfree(ods2p->ibitmap); } } kfree(sb->u.generic_sbp); } return NULL; } static DECLARE_FSTYPE_DEV(ods2_fs_type, "ods2", ods2_read_super); static int __init init_ods2_fs(void) { return register_filesystem(&ods2_fs_type); } static void __exit exit_ods2_fs(void) { unregister_filesystem(&ods2_fs_type); } EXPORT_NO_SYMBOLS; module_init(init_ods2_fs); module_exit(exit_ods2_fs); MODULE_AUTHOR("Jonas Lindholm - <jl...@us...>"); MODULE_DESCRIPTION("ODS2 Filesystem"); 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: */ --- NEW FILE: inode.c --- /* * linux/fs/ods2/inode.c * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: * ftp://prep.ai.mit.edu/pub/gnu/GPL * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> * */ #include <linux/config.h> /* #include <linux/module.h> */ #include <linux/string.h> #include <linux/ctype.h> #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/locks.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, }; 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, }; 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, }; struct dentry *ods2_lookup(struct inode *dir, struct dentry *dentry) { 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]; memcpy(name, dentry->d_name.name, dentry->d_name.len); name[dentry->d_name.len] = 0; /* We need to extract any version number and terminate the file name with file type at the ; character because in the directory file only the file name and type is stored as text without the ; character. The version number for the file is stored together with each FID. */ if (( vp = strrchr(name, ods2p->semicolon)) != NULL) { *vp++ = 0; if (sscanf(vp, "%d", &vers) != 1) { *--vp = ods2p->semicolon; } else if (vers > 32767) { printk("ODS2-fs error with version number for %s (%s)\n", name, vp); return ERR_PTR(-EBADF); } } while ((lbn = vbn2lbn(sb, ods2fhp->map, vbn)) > 0 && (bh = sb_bread(sb, GETBLKNO(sb, lbn))) != NULL && bh->b_data != NULL) { rec = (u16 *)(GETBLKP(sb, lbn, bh->b_data)); while (*rec != 65535 && *rec != 0) { DIRDEF *dire = (DIRDEF *)rec; if (dire->u1.s1.dir_b_namecount == strlen(name)) { char dirname[dire->u1.s1.dir_b_namecount + 1]; memcpy(dirname, &dire->u1.s1.dir_t_name, dire->u1.s1.dir_b_namecount); dirname[dire->u1.s1.dir_b_namecount] = 0; if (ods2p->dollar != '$' || ods2p->flags.v_lowercase) { char *p = dirname; char cnt = dire->u1.s1.dir_b_namecount; while (*p && cnt-- > 0) { if (*p == '$') { *p = ods2p->dollar; } if (ods2p->flags.v_lowercase) { *p = tolower(*p); } p++; } } if (strcmp(dirname, name) == 0) { int curbyte = 0; while (curbyte < dire->u1.s1.dir_w_size) { u32 ino; DIRDEF *dirv = (DIRDEF *)((char *)dire + ((dire->u1.s1.dir_b_namecount + 1) & ~1) + 6 + curbyte); if (dirv->u1.s2.dir_w_version == vers || vers == 0) { struct inode *inode; ino = (dirv->u1.s2.u2.s3.fid_b_nmx << 16) | le16_to_cpu(dirv->u1.s2.u2.s3.fid_w_num); brelse(bh); if ((inode = iget(dir->i_sb, ino)) != NULL) { d_add(dentry, inode); return NULL; } printk("ODS2-fs error when iget for file %s\n", name); return ERR_PTR(-EACCES); } curbyte += 8; } } } rec = (u16 *)((char *)rec + le16_to_cpu(dire->u1.s1.dir_w_size) + 2); } brelse(bh); vbn++; } d_add(dentry, NULL); return NULL; } /* The array is used to map ODS2 protection bits to Unix protection bits. There are two problems when doing the mapping. The first one is that ODS2 have four types of classes, system, owner, group and world. As you know Unix has only three, owner, group and other. We solve that by mapping owner to owner, group to group and world to other. The system class is ignored. The other problem is that ODS2 have four different protection bits, read, write, execute and delete. The read, write and execute can be mapped directly to Unix bits but the delete bit must be mapped to something else. As write access give the user delete access on Unix we map the delete bit to write access. Please note that on an ODS2 disk a set bit mean deny access where on Unix a set bit mean granted access. */ char unsigned vms2unixprot[] = { /* ODS2 prot */ S_IROTH | S_IWOTH | S_IXOTH , /* D E W R */ 0 | S_IWOTH | S_IXOTH , /* D E W */ S_IROTH | S_IWOTH | S_IXOTH , /* D E R */ 0 | S_IWOTH | S_IXOTH , /* D E */ S_IROTH | S_IWOTH | 0 , /* D W R */ 0 | S_IWOTH | 0 , /* D W */ S_IROTH | S_IWOTH | 0 , /* D R */ 0 | S_IWOTH | 0 , /* D */ S_IROTH | S_IWOTH | S_IXOTH , /* E W R */ 0 | S_IWOTH | S_IXOTH , /* E W */ S_IROTH | 0 | S_IXOTH , /* E R */ 0 | 0 | S_IXOTH , /* E */ S_IROTH | S_IWOTH | 0 , /* W R */ 0 | S_IWOTH | 0 , /* W */ S_IROTH | 0 | 0 , /* R */ 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; if ((fhlbn = ino2fhlbn(sb, inode->i_ino)) > 0 && (bh = sb_bread(sb, GETBLKNO(sb, fhlbn))) != NULL && bh->b_data != NULL) { FH2DEF *fh2p = (FH2DEF *)(GETBLKP(sb, fhlbn, bh->b_data)); if ((inode->u.generic_ip = kmalloc(sizeof(ODS2FH), GFP_KERNEL)) != NULL) { ODS2FH *ods2fhp; FI2DEF *fi2p; FATDEF *fatp; ods2fhp = (ODS2FH *)inode->u.generic_ip; ods2fhp->map = NULL; ods2fhp->ods2vari = NULL; fi2p = (FI2DEF *)((short unsigned *)fh2p + fh2p->fh2_b_idoffset); fatp = (FATDEF *)&(fh2p->fh2_w_recattr); if (verify_fh(fh2p, inode->i_ino)) { memcpy(&ods2fhp->fat, fatp, sizeof(FATDEF)); ods2fhp->map = getmap(sb, fh2p); if (fh2p->u4.s1.fch_v_directory) { inode->i_mode = S_IFDIR; inode->i_op = &ods2_dir_inode_operations; inode->i_fop = &ods2_dir_operations; } else { inode->i_mode = S_IFREG; inode->i_fop = &ods2_file_operations; } 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); /* Note that we don't use the system protection bits for ODS2. */ inode->i_mode |= vms2unixprot[(le16_to_cpu(fh2p->fh2_w_fileprot) >> 4) & 0x0f] << 6; /* owner */ inode->i_mode |= vms2unixprot[(le16_to_cpu(fh2p->fh2_w_fileprot) >> 8) & 0x0f] << 3; /* group */ inode->i_mode |= vms2unixprot[(le16_to_cpu(fh2p->fh2_w_fileprot) >> 12) & 0x0f]; /* world => other */ inode->i_blksize = 512; inode->i_blocks = ((le16_to_cpu(fatp->u1.s1.fat_w_hiblkh) << 16) | le16_to_cpu(fatp->u1.s1.fat_w_hiblkl)); inode->i_size = ((le16_to_cpu(fatp->u2.s1.fat_w_efblkh) << 16) | le16_to_cpu(fatp->u2.s1.fat_w_efblkl)) << 9; if (inode->i_size > 0) { inode->i_size -= 512; } inode->i_size += le16_to_cpu(fatp->fat_w_ffbyte); if ((fatp->u0.s0.fat_v_rtype == FAT_C_VFC || fatp->u0.s0.fat_v_rtype == FAT_C_VARIABLE) && !ods2p->flags.v_raw) { if ((ods2fhp->ods2vari = (ODS2VARI *)kmalloc(sizeof(ODS2VARI), GFP_KERNEL)) != NULL) { memset(ods2fhp->ods2vari, 0 , sizeof(ODS2VARI)); sema_init(&(ods2fhp->ods2vari->sem), 1); } else { printk("ODS2-fs kmalloc failed for vari data\n"); } } ods2fhp->parent = (fh2p->u6.s1.fid_b_nmx << 16) | le16_to_cpu(fh2p->u6.s1.fid_w_num); inode->i_version = ++event; bforget(bh); return; } printk("ODS2-fs not a valid file header\n"); } else { bforget(bh); printk("ODS2-fs kmalloc failed for extension inode\n"); kfree(inode->u.generic_ip); } } printk("ODS2-fs error reading inode\n"); make_bad_inode(inode); } /* For a read only file system there is nothing to do for put_inode. */ void ods2_put_inode(struct inode *inode) { } void ods2_clear_inode(struct inode *inode) { ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; if (ods2fhp != NULL) { ODS2MAP *map = ods2fhp->map; while (map != NULL) { ODS2MAP *nxt = map->nxt; kfree(map); map = nxt; } ods2fhp->map = NULL; if (ods2fhp->ods2vari != NULL) { /* in case the file was of variable record type */ int idx; for (idx = 0; idx < 128; idx++) { ODS2VAR *ods2varp = ods2fhp->ods2vari->ods2varp[idx]; while (ods2varp != NULL) { ODS2VAR *nxt = ods2varp->nxt; kfree(ods2varp); ods2varp = nxt; } } kfree(ods2fhp->ods2vari); ods2fhp->ods2vari = NULL; } kfree(inode->u.generic_ip); inode->u.generic_ip = NULL; } } /* This routine doesn't need to be defined for a read only filesystem but we do it for fun so remember to call clear_inode otherwise you will run out of memory... */ void ods2_delete_inode(struct inode *inode) { 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: */ --- NEW FILE: dir.c --- /* * linux/fs/ods2/dir.c * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: * ftp://prep.ai.mit.edu/pub/gnu/GPL * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> * */ #include <linux/config.h> /* #include <linux/module.h> */ #include <linux/string.h> #include <linux/ctype.h> #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/locks.h> #include <linux/blkdev.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) { 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; ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; loff_t pos = filp->f_pos; u32 vbn = (ods2filep->currec >> 9); /* get current VBN-1 to use */ u32 lbn; char cdirname[256]; memset(cdirname, ' ', sizeof(cdirname)); /* When there are no more files to return the file position in file is set to -1. */ if (pos == -1) return 0; /* When we get called the first time for a directory file the file position is set to 0. We must then return two fake entries, . for the current directory and .. for the parent directory. */ if (pos == 0) { filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR); filldir(dirent, "..", 2, 1, ods2fhp->parent, DT_DIR); ods2filep->currec = 0; ods2filep->curbyte = 0; vbn = 0; } /* As long we can translate the virtual block number, VBN, to a logical block number, LBN, and read the block we continue to loop. */ while (vbn * 512 < inode->i_size && (lbn = vbn2lbn(sb, ods2fhp->map, vbn + 1)) > 0 && (bh = sb_bread(sb, GETBLKNO(sb, lbn))) != NULL && bh->b_data != NULL) { u16 *recp = (short unsigned *)((char *)(GETBLKP(sb, lbn, bh->b_data)) + (ods2filep->currec & 511)); /* For a ODS2 directory each block contains 1 to 62 directory entries. Note that a directory entry can not span between two or more blocks. We should be able to use the routine to read variable block size but because directory file is so specific we do our own block decoding here. When there are no more directory entries in the current block the record length -1 is inserted as the last record. */ while (*recp != 65535 && *recp <= 512 && ods2filep->currec < inode->i_size) { DIRDEF *dire = (DIRDEF *)recp; char dirname[dire->u1.s1.dir_b_namecount + 1]; memcpy(dirname, &dire->u1.s1.dir_t_name, dire->u1.s1.dir_b_namecount); dirname[dire->u1.s1.dir_b_namecount] = 0; if (ods2p->dollar != '$' || ods2p->flags.v_lowercase) { char *p = dirname; char cnt = dire->u1.s1.dir_b_namecount; while (*p && cnt-- > 0) { if (*p == '$') { *p = ods2p->dollar; } if (ods2p->flags.v_lowercase) { *p = tolower(*p); } p++; } } if (ods2filep->curbyte == 0) { ods2filep->curbyte = ((dire->u1.s1.dir_b_namecount + 1) & ~1) + 6; } filp->f_pos = ods2filep->currec + ods2filep->curbyte; while (ods2filep->curbyte < dire->u1.s1.dir_w_size && !(ods2p->flags.v_version != SB_M_VERSALL && strlen(dirname) == strlen(cdirname) && strncmp(dirname, cdirname, strlen(dirname)) == 0)) { DIRDEF *dirv = (DIRDEF *)((char *)dire + ods2filep->curbyte); u32 ino = (dirv->u1.s2.u2.s3.fid_b_nmx << 16) | le16_to_cpu(dirv->u1.s2.u2.s3.fid_w_num); char dirnamev[dire->u1.s1.dir_b_namecount + 1 + 5 + 1]; if (ino != 4) { /* we must ignore 000000.DIR as it is the same as . */ if (ods2p->flags.v_version == SB_M_VERSNONE) { sprintf(dirnamev, "%s", dirname); } else { sprintf(dirnamev, "%s%c%d", dirname, ods2p->semicolon, dirv->u1.s2.dir_w_version); } /* We don't really know if the file is a directory by just checking the file extension but it is the best we can do. Should the file have extension .DIR but be a regular file the mistake will be detected later on when the user try to walk down into the false directory. */ if (filldir(dirent, dirnamev, strlen(dirnamev), filp->f_pos, ino, (strstr(dirnamev, (ods2p->flags.v_lowercase ? ".dir." : ".DIR")) == NULL ? DT_REG : DT_DIR))) { /* We come here when filldir is unable to handle more entries. */ brelse(bh); return 0; } if (ods2p->flags.v_version != SB_M_VERSALL) { strcpy(cdirname, dirname); } } if (ods2p->flags.v_version == SB_M_VERSALL) { ods2filep->curbyte += 8; filp->f_pos += 8; } else { ods2filep->curbyte = le16_to_cpu(dire->u1.s1.dir_w_size); filp->f_pos += dire->u1.s1.dir_w_size; } } /* When we come here there are no more versions for the file name. We then reset our current byte offset and set current record offset to the next directory entry. */ ods2filep->curbyte = 0; ods2filep->currec += le16_to_cpu(dire->u1.s1.dir_w_size) + 2; recp = (u16 *)((char *)recp + le16_to_cpu(dire->u1.s1.dir_w_size) + 2); } /* When we come here there are no more directory entries in the current block and we just release the buffer and increase the VBN counter. */ brelse(bh); vbn++; ods2filep->currec = vbn * 512; } filp->f_pos = -1; /* this mark that we have no more files to return */ 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: */ --- NEW FILE: file.c --- /* * linux/fs/ods2/file.c * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: * ftp://prep.ai.mit.edu/pub/gnu/GPL * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> * * Changes: 0.9.2 - A lot of bug fixes for keeping track of * virtual position for variable record files. * */ #include <linux/config.h> /* #include <linux/module.h> */ #include <linux/string.h> #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/locks.h> #include <linux/blkdev.h> #include <asm/uaccess.h> #include "ods2.h" /* FUNCTION: This routine take care of ioctl command for an open file. It is possible to put a file into raw mode independing if raw mode was selected or not during the file system mount. This is used by the rms library. INPUT: *inode pointer to inode structure for the open file. *filp pointer to file structure for the open file. cmd ODS2 specific command. arg argument for the command. OUTPUT: 0 if everything went ok. -ENOTTY for invalid cmmand. Other negativ values for different errors. IMPLICIT: None. */ 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; 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; } return error; } /* FUNCTION: This routine update the memory structure used to keep track of the virtual position in a variable record file. INPUT: loff virtual position. *ods2vari pointer to memory structure used to keep tracj of position. currec current record position in file. This is the offset in bytes from the start of the file. OUTPUT: 1 if the update was successful. 0 if something went wrong such as memory allocaion. IMPLICIT: The only requirement is that a linked list of varp structures are at least the number of entries allocated by macro IDXBLOCK. */ int update_virtual_file_pos(loff_t loff, ODS2VARI *ods2vari, u64 currec) { ODS2VAR *ods2varp = NULL; int idxvar = IDXVAR(loff); int idxvari = IDXVARI(loff); int idxblock = IDXBLOCK(loff); if (ods2vari->ods2varp[idxvari] == NULL) { if ((ods2vari->ods2varp[idxvari] = (ODS2VAR *)kmalloc(sizeof(ODS2VAR), GFP_KERNEL)) != NULL) { memset(ods2vari->ods2varp[idxvari], 0, sizeof(ODS2VAR)); } else { printk("ODS2-fs kmalloc failed for new varp (1)\n"); return 0; } } ods2varp = ods2vari->ods2varp[idxvari]; for (; idxblock > 0; idxblock--) { if (ods2varp->nxt == NULL) { if ((ods2varp->nxt = (ODS2VAR *)kmalloc(sizeof(ODS2VAR), GFP_KERNEL)) != NULL) { memset(ods2varp->nxt, 0, sizeof(ODS2VAR)); } else { printk("ODS2-fs kmalloc failed for new varp (2)\n"); return 0; } } ods2varp = ods2varp->nxt; } if (ods2varp != NULL && ods2varp->s1[idxvar].loff == 0) { ods2varp->s1[idxvar].recoffs = currec; ods2varp->s1[idxvar].loff = loff; ods2vari->highidx = loff; } return 1; } /* FUNCTION: This routine take care of reading of variable record files. This routine will add a LF after each record if one of the following record attributes are set: FAT_M_FORTRANCC, FAT_M_IMPLIEDCC, FAT_M_PRINTCC. Note that a correct handling of all record structures should be able to handle form feed and insertion of more than one LF after each record. All this extra functionality must be handled outside of this driver. It will also handle the FAT_M_NOSPAN. This attributes indicates that no record must span between blocks. In each block a record with length 65535 (-1) is inserted to indicate that there are no more records in the current block. INPUT: *filp pointer to the file. *buf buffer where to return data. buflen size of buf area. *loff virtual position in file where to read from. OUTPUT: The number of bytes read. 0 if no bytes was read. IMPLICIT: The ODS2 specific part of the file header must have a ODS2VARI structure attached to it. */ ssize_t ods2_read_variable(struct file *filp, char *buf, size_t buflen, loff_t *loff) { struct inode *inode = filp->f_dentry->d_inode; char *buforg = buf; ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; ODS2VARI *ods2vari = ods2fhp->ods2vari; FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); u32 vbn = 0; u16 cpylen; if (*loff == 0) { ods2filep->currec = 0; ods2filep->curbyte = 0; ods2filep->reclen = 0; } if (ods2filep->reclen == 65535) { brelse(ods2filep->bhp); ods2filep->bhp = NULL; return 0; } while (1) { /* We need to loop until the calculated value of currec offset plus currect byte offset from currec give the same VBN as the last one we fetched. There is one case when we will loop. That case is when a record start is at the last two bytes of the block. In that case the length will be fetched from current block but all data will start on next block. */ do { vbn = (ods2filep->currec + ods2filep->curbyte) >> 9; if (!(getfilebh(filp, vbn + 1))) { ods2filep->reclen = 65535; return (buf - buforg); } /* If curbyte is zero we will start on a new record. */ if (ods2filep->curbyte == 0) { ods2filep->reclen = le16_to_cpu(*((u16 *)((char *)ods2filep->data + (ods2filep->currec & 511)))); if ((*loff >> 16) != 0) { down(&(ods2vari->sem)); update_virtual_file_pos(*loff, ods2vari, ods2filep->currec); up(&(ods2vari->sem)); } if ((ods2filep->reclen == 65535 && !(fatp->fat_b_rattrib & FAT_M_NOSPAN)) || (ods2filep->currec >= inode->i_size)) { /* end of records */ ods2filep->reclen = 65535; return (buf - buforg); } if (ods2filep->reclen == 65535 && (fatp->fat_b_rattrib & FAT_M_NOSPAN)) { ods2filep->currec = (vbn + 1) * 512; /* could be a new record at next block */ } else { ods2filep->curbyte = 2; ods2filep->curbyte += (fatp->u0.s0.fat_v_rtype == FAT_C_VFC ? fatp->fat_b_vfcsize : 0); } } } while (((ods2filep->currec + ods2filep->curbyte) >> 9) != vbn); cpylen = MIN(MIN((ods2filep->reclen - ods2filep->curbyte + 2), buflen), (512 - ((ods2filep->currec + ods2filep->curbyte) & 511))); if (cpylen > 0) { u8 *recp = (u8 *)((char *)ods2filep->data + ((ods2filep->currec + ods2filep->curbyte) & 511)); memcpy(buf, recp, cpylen); *loff += cpylen; /* loff will always be a virtual offset for a variable record file */ buf += cpylen; buflen -= cpylen; ods2filep->curbyte += cpylen; } if (ods2filep->curbyte - 2 == ods2filep->reclen) { if (buflen > 0) { if (fatp->fat_b_rattrib & FAT_M_FORTRANCC || fatp->fat_b_rattrib & FAT_M_IMPLIEDCC || fatp->fat_b_rattrib & FAT_M_PRINTCC) { buflen--; *buf++ = '\n'; *loff += 1; } ods2filep->currec = ((ods2filep->currec + ods2filep->reclen + 1) & ~1) + 2; /* each record is always even aligned */ ods2filep->curbyte = 0; } } if (buflen == 0) { return (buf - buforg); } } } /* FUNCTION: This routine is invoked when the file type is one of STREAM, STREAMLF or STREAMCR. For a non-RMS machine that doesn't know anything about records these three formats are the same. For RMS the different between these formats is the following: STREAM: Records are delimited by FF, VT, LF, or CRLF. STREAMLF: Records are delimited by LF. STREAMCR: Records are delimited by CR. Note that we can not use generic read routines even if we treat the data as just a stream of bytes because the way we need to translate from VBN to LBN. INPUT: *filp pointer to the file. *buf buffer where to return data. buflen size of buf area. *loff virtual position in file where to read from. OUTPUT: The number of bytes read. 0 if no bytes was read. IMPLICIT: None. */ ssize_t ods2_read_stream(struct file *filp, char *buf, size_t buflen, loff_t *loff) { struct inode *inode = filp->f_dentry->d_inode; char *buforg = buf; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; u32 vbn = 0; u16 cpylen; while (*loff < inode->i_size) { vbn = *loff >> 9; if (!(getfilebh(filp, vbn + 1))) { *loff = inode->i_size; return (buf - buforg); } if ((cpylen = MIN(MIN(inode->i_size - *loff, buflen), 512 - (*loff & 511))) > 0) { u8 *recp = (u8 *)((char *)ods2filep->data + (*loff & 511)); memcpy(buf, recp, cpylen); *loff += cpylen; buf += cpylen; buflen -= cpylen; if (buflen == 0) { return (buf - buforg); } } } brelse(ods2filep->bhp); ods2filep->bhp = NULL; return (buf - buforg); } /* FUNCTION: This routine is called when a read request is done for any file. The routine will invoke one of two functions. One function is for files of STREAM types. The other routine is for VARIABLE record files. File of type RELATIVE or INDEXED are not supported by this module. Should the file system be mounted by option raw or if the file has been set to raw mode the routine to hamdle STREAM format is invoked for ALL file types including RELATIVE and INDEXED files. *filp pointer to the file. *buf buffer where to return data. buflen size of buf area. *loff virtual position in file where to read from. OUTPUT: The number of bytes read. 0 if no bytes was read. IMPLICIT: None. */ 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; ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); if (ods2p->flags.v_raw || ods2filep->u1.s1.v_raw) { return ods2_read_stream(filp, buf, buflen, loff); } else { switch (fatp->u0.s0.fat_v_fileorg) { case FAT_C_SEQUANTIAL: { switch (fatp->u0.s0.fat_v_rtype) { case FAT_C_VFC: case FAT_C_VARIABLE: return ods2_read_variable(filp, buf, buflen, loff); case FAT_C_FIXED: case FAT_C_STREAMLF: case FAT_C_STREAMCR: case FAT_C_STREAM: return ods2_read_stream(filp, buf, buflen, loff); default: return 0; } } default: return 0; } } } /* FUNCTION: This routine return a valid file offset for STREAM files. Note that the current ODS2 driver does not support an offset that is larger then file size. INPUT: *filp pointer to the file. loff virtual position in file where to read from. seek how loff should be calculated for the file. 0 = absolute position. 1 = offset from current file position. 2 = offset from end of file. OUTPUT: The new position in the file is returned. IMPLICIT: This routine will not allow the current position to be beyond the end of file position. */ loff_t ods2_llseek_stream(struct file *filp, loff_t loff, int seek) { struct inode *inode = filp->f_dentry->d_inode; loff_t offs; if (seek == 0) { /* SEEK_SET */ offs = MIN(loff, inode->i_size); } else { if (seek == 1) { /* SEEK_CUR */ if (loff > 0) { offs = MIN(filp->f_pos + loff, inode->i_size); } else { offs = MAX(filp->f_pos + loff, 0); } } else { offs = MIN(inode->i_size + loff, inode->i_size); } } filp->f_pos = offs; filp->f_reada = 0; filp->f_version++; return offs; } /* FUNCTION: This routine return a valid file offset for VARIABLE files. Note that the current ODS2 driver does not support an offset that is larger then file size. This routine will take care of the fact that Linux doesn't know anything about records in a file so all routines and utilities believe the file offset is the exact position in the file. For a variable record file each record consists not only of data but also of the record length (2 bytes). An additional fix part of the record can contain meta data for the record such as print control information. All this make it complicated to calculate the record offset into the file from a given offset. To avoid to be forced to read from the start of the file to find the correct position for a given offset checkpoints are stored together with the inode for each 64K blocks of data. By using these checkpoints this routine can calculate the record position for a given offset by starting reading records from the closest checkpoint. If the requested position is within a part of the file already read no more than 128 blocks of data must be read to find the position. On the other hand if no reading has been done for the requested position before we could ending up to read all records for the remaining of the file but that is no other good solution to the problem. INPUT: *filp pointer to the file. loff virtual position in file where to read from. seek how loff should be calculated for the file. 0 = absolute position. 1 = offset from current file position. 2 = offset from end of file. OUTPUT: The new position in the file is returned. IMPLICIT: This routine will not allow the current position to be beyond the end of file position. */ loff_t ods2_llseek_variable(struct file *filp, loff_t loff, int seek) { struct inode *inode = filp->f_dentry->d_inode; ODS2VAR *ods2varp = NULL; ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; ODS2VARI *ods2vari = ods2fhp->ods2vari; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); int idxblock = 0; loff_t offs = 0; loff_t coffs = 0; loff_t currec = 0; u32 vbn = 0; u16 reclen = 0; offs = loff; if (seek == 0) { /* SEEK_SET */ offs = MIN(offs, inode->i_size); } else { if (seek == 1) { /* SEEK_CUR */ if (offs > 0) { offs = MIN(filp->f_pos + offs, inode->i_size); } else { offs = MAX(filp->f_pos + offs, 0); } } else { offs = MIN(inode->i_size + offs, inode->i_size); } } /* offs - the absolute virtual offset into the file we want to find. coffs - offset counter. */ down(&(ods2vari->sem)); if (offs > 65535) { coffs = offs; if ((coffs >> 16) > (ods2vari->highidx >> 16)) { coffs = ods2vari->highidx; } coffs += 65536; do { coffs -= 65536; idxblock = IDXBLOCK(coffs); ods2varp = ods2vari->ods2varp[IDXVARI(coffs)]; for (; idxblock > 0; idxblock--) { ods2varp = ods2varp->nxt; } } while (coffs > 65535 && ods2varp->s1[IDXVAR(coffs)].loff > offs); if (coffs > 65535) { currec = ods2varp->s1[IDXVAR(coffs)].recoffs; coffs = ods2varp->s1[IDXVAR(coffs)].loff; } else { coffs = 0; } } while (1) { do { vbn = currec >> 9; if (!(getfilebh(filp, vbn + 1))) { ods2filep->reclen = 65535; up(&(ods2vari->sem)); filp->f_pos = coffs; filp->f_reada = 0; filp->f_version++; return offs; } reclen = le16_to_cpu(*((u16 *)((char *)ods2filep->data + (currec & 511)))); if ((coffs >> 16) != 0) { update_virtual_file_pos(coffs, ods2vari, currec); } if ((reclen == 65535 && !(fatp->fat_b_rattrib & FAT_M_NOSPAN)) || currec > inode->i_size) { /* end of records */ ods2filep->reclen = 65535; up(&(ods2vari->sem)); filp->f_pos = coffs; filp->f_reada = 0; filp->f_version++; return offs; } if (reclen == 65535 && (fatp->fat_b_rattrib & FAT_M_NOSPAN)) { currec = (vbn + 1) * 512; /* next block... */ } } while (reclen == 65535); if (coffs <= offs && (coffs + reclen - (fatp->u0.s0.fat_v_rtype == FAT_C_VFC ? fatp->fat_b_vfcsize : 0)) >= offs) { /* we have found our location */ ods2filep->currec = currec; ods2filep->curbyte = (offs - coffs) + 2 + (fatp->u0.s0.fat_v_rtype == FAT_C_VFC ? fatp->fat_b_vfcsize : 0); ods2filep->reclen = reclen; up(&(ods2vari->sem)); filp->f_pos = coffs; filp->f_reada = 0; filp->f_version++; return offs; } coffs += (reclen - (fatp->u0.s0.fat_v_rtype == FAT_C_VFC ? fatp->fat_b_vfcsize : 0)); if (fatp->fat_b_rattrib & FAT_M_FORTRANCC || fatp->fat_b_rattrib & FAT_M_IMPLIEDCC || fatp->fat_b_rattrib & FAT_M_PRINTCC) { coffs++; /* need to add one byte for LF */ } currec = ((currec + reclen + 1) & ~1) + 2; /* all records are even aligned */ } } 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; ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; FATDEF *fatp = (FATDEF *)&(ods2fhp->fat); if (ods2p->flags.v_raw || ods2filep->u1.s1.v_raw) { return ods2_llseek_stream(filp, loff, seek); } else { switch (fatp->u0.s0.fat_v_fileorg) { case FAT_C_SEQUANTIAL: { switch (fatp->u0.s0.fat_v_rtype) { case FAT_C_VFC: case FAT_C_VARIABLE: return ods2_llseek_variable(filp, loff, seek); case FAT_C_FIXED: case FAT_C_STREAMLF: case FAT_C_STREAMCR: case FAT_C_STREAM: return ods2_llseek_stream(filp, loff, seek); default: return loff; } } default: return loff; } } } int ods2_open_release(struct inode *inode, struct file *filp) { if (filp->private_data == NULL) { if ((filp->private_data = kmalloc(sizeof(ODS2FILE), GFP_KERNEL)) != NULL) { memset(filp->private_data, 0, sizeof(ODS2FILE)); } else { printk("ODS2-fs kmalloc failed for open_release\n"); return 0; } } else { ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; if (ods2filep != NULL) { brelse(ods2filep->bhp); kfree(filp->private_data); } filp->private_data = NULL; } 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: */ --- NEW FILE: util.c --- /* * linux/fs/ods2/util.c * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: * ftp://prep.ai.mit.edu/pub/gnu/GPL * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> * */ #include <linux/config.h> /* #include <linux/module.h> */ #include <linux/string.h> #include <linux/fs.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/locks.h> #include <linux/blkdev.h> #include <asm/uaccess.h> #include "ods2.h" #include "tparse.h" u64 div64(u64 a, u32 b0) { u32 a1, a2; u32 long res; a1 = ((u32 *)&a)[0]; a2 = ((u32 *)&a)[1]; res = a1/b0 + (u64)a2 * (u64)(0xffffffff/b0) + a2 / b0 + (a2 * (0xffffffff % b0)) / b0; return res; } u32 vbn2lbn(struct super_block *sb, ODS2MAP *map, u32 vbn) { int idx = 0; u32 curvbn = 1; /* VBN is 1 based - not 0 */ while (map && map->s1[idx].cnt > 0 && curvbn < vbn && curvbn + map->s1[idx].cnt <= vbn) { curvbn += map->s1[idx].cnt; if (++idx > 15) { map = map->nxt; idx = 0; } } if (map && map->s1[idx].cnt > 0) { return map->s1[idx].lbn + (vbn - curvbn); } return 0; } u32 ino2fhlbn(struct super_block *sb, u32 ino) { ODS2SB *ods2p = (ODS2SB *)sb->u.generic_sbp; 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; } else { ODS2FH *ods2fhp = (ODS2FH *)ods2p->indexf->u.generic_ip; return vbn2lbn(sb, ods2fhp->map, le16_to_cpu(ods2p->hm2.hm2_w_cluster) * 4 + le16_to_cpu(ods2p->hm2.hm2_w_ibmapsize) + ino); } return 0; } /* This function retreives all file mapping pointers and create a linked list so VBN's can be translated to LBN's. Note that this routine read ALL mapping pointers thus creating a catedral window for the file. Should there be extension headers they are all read directly not using iget to fetch them. */ ODS2MAP *getmap(struct super_block *sb, FH2DEF *fh2p) { FM2DEF *fm2p = (FM2DEF *)((short unsigned *)fh2p + fh2p->fh2_b_mpoffset); ODS2MAP *map = kmalloc(sizeof(ODS2MAP), GFP_KERNEL); ODS2MAP *mapfst = map; struct buffer_head *bh = NULL; int idx = 0; u8 mapinuse = 0; if (map == NULL) { printk("ODS2-fs kmalloc failed for getmap (1)\n"); return NULL; } memset(map, 0, sizeof(ODS2MAP)); do { mapinuse = fh2p->fh2_b_map_inuse; while (fm2p < (FM2DEF *)((short unsigned *)fh2p + fh2p->fh2_b_acoffset) && mapinuse > 0) { u32 cnt = 0; u32 lbn = 0; u16 size = 0; switch (fm2p->u1.fm1.fm2_v_format) { case 0: size = 1; break; case 1: cnt = fm2p->u1.fm1.fm2_b_count1; lbn = (fm2p->u1.fm1.fm2_v_highlbn << 16) | fm2p->u1.fm1.fm2_w_lowlbn; size = 2; break; case 2: cnt = fm2p->u1.fm2.fm2_v_count2; lbn = (le16_to_cpu(fm2p->u1.fm2.fm2_l_lbn2[1]) << 16) | le16_to_cpu(fm2p->u1.fm2.fm2_l_lbn2[0]); size = 3; break; case 3: cnt = (fm2p->u1.fm3.fm2_v_count2 << 16) | le16_to_cpu(fm2p->u1.fm3.fm2_w_lowcount); lbn = le32_to_cpu(fm2p->u1.fm3.fm2_l_lbn3); size = 4; break; } if (fm2p->u1.fm1.fm2_v_format > 0) { if (idx > 15) { if ((map->nxt = kmalloc(sizeof(ODS2MAP), GFP_KERNEL)) != NULL) { map = map->nxt; memset(map, 0, sizeof(ODS2MAP)); idx = 0; } else { printk("ODS2-fs kmalloc failed for getmap (2)\n"); return map; } } map->s1[idx].cnt = cnt + 1; /* the count is always N + 1 mapped blocks */ map->s1[idx].lbn = lbn; idx++; } mapinuse -= size; fm2p = (FM2DEF *)((short unsigned *)(fm2p) + size); } /* If there is an extension header we need to read all of them because they could have additional mapping information. Note that we can not use iget to fetch the extension header because it is not a valid inode for an ODS2 file. Only primary file header can be used as an inode. */ if (fh2p->u3.s1.fid_w_ex_fidnum != 0) { u32 lbn; if ((lbn = ino2fhlbn(sb, le16_to_cpu(fh2p->u3.s1.fid_w_ex_fidnum) | (fh2p->u3.s1.fid_b_ex_fidnmx << 16))) != 0) { fh2p = NULL; brelse(bh); if ((bh = sb_bread(sb, GETBLKNO(sb, lbn))) != NULL && bh->b_data != NULL) { fh2p = (FH2DEF *)(GETBLKP(sb, lbn, bh->b_data)); fm2p = (FM2DEF *)((short unsigned *)fh2p + fh2p->fh2_b_mpoffset); } } } else { fh2p = NULL; } } while (fh2p != NULL); brelse(bh); return mapfst; } struct buffer_head *getfilebh(struct file *filp, u32 vbn) { struct inode *inode = filp->f_dentry->d_inode; struct super_block *sb = inode->i_sb; ODS2FH *ods2fhp = (ODS2FH *)inode->u.generic_ip; ODS2FILE *ods2filep = (ODS2FILE *)filp->private_data; if ((vbn - 1) * 512 < inode->i_size) { u32 lbn; if ((lbn = vbn2lbn(sb, ods2fhp->map, vbn)) > 0) { if (ods2filep->bhp == NULL || GETBLKNO(sb, lbn) != ods2filep->bhp->b_blocknr) { brelse(ods2filep->bhp); ods2filep->bhp = NULL; if ((ods2filep->bhp = sb_bread(sb, GETBLKNO(sb, lbn))) != NULL) { if (ods2filep->bhp->b_data != NULL) { ods2filep->data = GETBLKP(sb, lbn, ods2filep->bhp->b_data); return ods2filep->bhp; } } } else { ods2filep->data = GETBLKP(sb, lbn, ods2filep->bhp->b_data); return ods2filep->bhp; } } } return NULL; } int verify_fh(FH2DEF *fh2p, u32 ino) { u16 *p = (short unsigned *)fh2p; u16 chksum = 0; for (; p < (short unsigned *)&(fh2p->fh2_w_checksum) ; chksum += le16_to_cpu(*p++)); if (fh2p->fh2_b_idoffset <= fh2p->fh2_b_mpoffset && fh2p->fh2_b_mpoffset <= fh2p->fh2_b_acoffset && fh2p->fh2_b_acoffset <= fh2p->fh2_b_rsoffset && fh2p->u1.s1.fh2_b_structlevl == 2 && fh2p->u1.s1.fh2_b_structlevv >= 1 && fh2p->u2.s1.fh2_w_fid_num != 0 && ((fh2p->u2.s1.fh2_b_fid_nmx << 16) | le16_to_cpu(fh2p->u2.s1.fh2_w_fid_num)) == ino && fh2p->fh2_b_map_inuse <= (fh2p->fh2_b_acoffset - fh2p->fh2_b_mpoffset) && le16_to_cpu(fh2p->fh2_w_checksum) == chksum) { return 1; /* it is a valid file header */ } return 0; } int save_raw(ARGBLK *argblk) { struct super_block *sb = (void *)argblk->arg; ODS2SB *ods2p = (void *)sb->u.generic_sbp; 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; 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; 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; ods2p->semicolon = argblk->token[0]; return 1; } int save_version(ARGBLK *argblk) { struct super_block *sb = (void *)argblk->arg; ODS2SB *ods2p = (void *)sb->u.generic_sbp; ods2p->flags.v_version = argblk->mask; return 1; } TPARSE tpa1[]; TPARSE tpa10[]; TPARSE tpa11[]; TPARSE tpa20[]; TPARSE tpa21[]; TPARSE tpa30[]; TPARSE tpa31[]; TPARSE tpa1[] = { { "dollar", tpa10, NULL, 0, NULL, 0 }, { "version", tpa20, NULL, 0, NULL, 0 }, { "semicolon", tpa30, NULL, 0, NULL, 0 }, { "lowercase", tpa1, save_lowercase, 0, NULL, 0 }, { "raw", tpa1, save_raw, 0, NULL, 0 }, { TPA_EOS, TPA_EXIT, NULL, 0, NULL, 0 }, TPA_END }; TPARSE tpa10[] = { { "=", tpa11, NULL, 0, NULL, 0 }, TPA_END }; TPARSE tpa11[] = { { TPA_ANY, tpa1, save_dollar, 0, NULL, 0 }, TPA_END }; TPARSE tpa20[] = { { "=", tpa21, NULL, 0, NULL, 0 }, TPA_END }; TPARSE tpa21[] = { { "all", tpa1, save_version, SB_M_VERSALL, NULL, 0 }, { "highest", tpa1, save_version, SB_M_VERSHIGH, NULL, 0 }, { "none", tpa1, save_version, SB_M_VERSNONE, NULL, 0 }, TPA_END }; TPARSE tpa30[] = { { "=", tpa31, NULL, 0, NULL, 0 }, TPA_END }; TPARSE tpa31[] = { { TPA_ANY, tpa1, save_semicolon, 0, NULL, 0 }, TPA_END }; int parse_options(struct super_block *sb, char *options) { ARGBLK argblk; argblk.str = options; argblk.arg = (long unsigned)sb; 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: */ --- NEW FILE: tparse.c --- /* * linux/fs/ods2/file.c * * COPYRIGHT * This file is distributed under the terms of the GNU General Public * License (GPL). Copies of the GPL can be obtained from: * ftp://prep.ai.mit.edu/pub/gnu/GPL * Each contributing author retains all rights to their own work. * * Written 2003 by Jonas Lindholm <jl...@us...> * */ #include <linux/string.h> #include <linux/ctype.h> #include "tparse.h" int tparse(ARGBLK *argblk, TPARSE *tpa) { int idx; int found; while (1) { char *str = argblk->str; while (*str && (*str == ' ' || *str == '\t')) { str++; }; found = 0; idx = -1; argblk->number = 0; argblk->str = str; argblk->token = str; do { str = argblk->str; idx++; switch ((long unsigned)tpa[idx].type) { case lu(TPA_ANY): { if (*str) { str++; found = 1; } break; } case lu(TPA_ALPHA): { if (*str && ((*str >= 'A' && *str <= 'Z') || (*str >= 'a' && *str <= 'z'))) { str++; found = 1; } break; } case lu(TPA_DIGIT): { if (*str && (*str >= '0' && *str <= '9')) { argblk->number = *str++ - '0'; found = 1; } break; } case lu(TPA_HEX): { while (*str && ((*str >= '0' && *str <= '9') || (tolower(*str) >= 'a' && tolower(*str) <= 'f'))) { argblk->number = (argblk->number * 16) + (*str <= '9' ? *str - '0' : tolower(*str) - 'a' + 10); str++; } found = 1; break; } case lu(TPA_OCTAL): { while (*str && (*str >= '0' && *str <= '7')) { argblk->number = argblk->number * 8 + (*str++ - '0'); } found = 1; break; } case lu(TPA_DECIMAL): { while (*str && (*str >= '0' && *str <= '9')) { argblk->number = argblk->number * 10 + (*str++ - '0'); } found = 1; break; } case lu(TPA_STRING): { while (*str && ((*str >= '0' && *str <= '9') || (*str >= 'A' && *str <= 'Z') || (*str >= 'a' && *str <= 'z'))) { str++; } found = 1; break; } case lu(TPA_SYMBOL): { while (*str && ((*str >= '0' && *str <= '9') || (*str >= 'A' && *str <= 'Z') || (*str >= 'a' && *str <= 'z') || *str == '_' || *str == '$')) { str++; } found = 1; break; } case lu(TPA_EOS): { found = !*str; break; } case lu(TPA_LAMBDA): { found = 1; } case 0: /* no more entries in table */ break; default: { if (((void **)tpa[idx].type)[0] == (void *)244) { TPARSE *tmptpa = ((TPARSE **)tpa[idx].type)[1]; ARGBLK tmpargblk; tmpargblk.options = argblk->options; tmpargblk.arg = argblk->arg; tmpargblk.str = str; tmpargblk.token = NULL; tmpargblk.number = 0; tmpargblk.param = tpa[idx].param; if ((found = tparse(&tmpargblk, tmptpa))) { str = tmpargblk.str; } break; } else { if (strlen(tpa[idx].type) == 1) { if (*str++ == *tpa[idx].type) { found = 1; } } else { while (*str && ((*str >= '0' && *str <= '9') || (*str >= 'A' && *str <= 'Z') || (*str >= 'a' && *str <= 'z') || *str == '_' || *str == '$')) { str++; } if (strlen(tpa[idx].type) == (str - argblk->token) && strncmp(argblk->token, tpa[idx].type, (str - argblk->token)) == 0) { found = 1; } } } } } if (found) { if (tpa[idx].action != NULL) { char tmp = *str; *str = 0; argblk->param = tpa[idx].param; argblk->mask = tpa[idx].mask; argblk->mskadr = tpa[idx].mskadr; found = tpa[idx].action(argblk); *str = tmp; } argblk->str = str; argblk->token = str; } } while (!found && tpa[idx].type != NULL); if (found) { if (tpa[idx].mskadr != NULL) { *tpa[idx].mskadr |= tpa[idx].mask; } if ((void *)tpa[idx].label == (void *)0) { return 0; } if ((void *)tpa[idx].label == (void *)1) { return 1; } tpa = tpa[idx].label; } else { return 0; } } } --- NEW FILE: README --- Overview ======== The ODS2 driver for Linux version 0.9.2 support read of ODS2 formated file systems such as SCSI disks, CDROM's, container disks that have been formatted using OpenVMS. Currently only stream and variable record files are supported. Limitations and workarounds =========================== The nature of variable record files make it hard for utilities like less to find the correct end. The less utility assume that the file size is the true end of the last byte of data in the file but for a variable record file the file size also include bytes not to be displayed. The major problem is that if you use less and then hit the End key less will try to go beyond the end of the virtual position. A simple way around this is to use cat on the file and pipe that to less. By this method you will go to end of file when you hit the End key for less. Utilities like less use llseek to find its positions in the file. Without any workaround less would ending up in the wrong position in the file. To solve the problem the ODS2 driver keep track of the virtual position in the file (the position less knows about) and create checkpoints every 64K position. By these checkpoints function llseek can find its position by searching from the closest position instead reading all records from start. License ======= The ODS2 source code is released under GNU General Public License (GPL). Author ====== The ODS2 driver is written by me, Jonas Lindholm, and I was doing it for fun and to get deeper knowledge of file systems on Linux. It is also a challange to get it to work and it seems that people are looking for a ODS filoe system module for Linux. Later versions will support write as well. --- NEW FILE: CHANGES --- Changes from version 0.9.2 to version 0.9.3 =========================================== - Added code to handle hard sector size of 1024 and 2048 bytes. - Fix bug when checking RMS file type and record type. - Files of type FIXED will now be treated as STREAM files. Changes from version 0.9.1 to version 0.9.2 =========================================== - Added check of hard sector size before trying to mount. Current version of this driver only support 512 byte sectors. - Fix bug in ods2_llseek_variable. The fixed record size was not removed from variable coffs giving wrong offsets. Another bug was that the VFC value was not taken into account when testing if the location was found. Yet another bug was the check for the end of file for variable record files. - Updated all definitions of vbn and lbn to use u32. - Updated all definitions of currec to u64. - 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. --- NEW FILE: Makefile.i386 --- TARGET = ods2.o OBJECTS = super.o inode.o file.o dir.o util.o tparse.o INCLUDE = ods2.h tparse.h DEBUG = -g OPTIMIZE= CFLAGS = -D__KERNEL__ -I/usr/src/linux-2.4.20/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.20/include/linux/modversions.h -nostdinc -iwithprefix include $(TARGET):... [truncated message content] |
|
From: Jan-Benedict G. <jb...@us...> - 2004-09-19 09:45:53
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19950/ods2 Log Message: Directory /cvsroot/linux-vax/kernel-2.5/fs/ods2 added to the repository |