|
From: Jan-Benedict G. <jb...@us...> - 2004-09-22 07:14:50
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14600 Modified Files: dir.c file.c inode.c super.c util.c Log Message: - Empty lines are empty. Really... Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/inode.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- inode.c 20 Sep 2004 20:27:17 -0000 1.7 +++ inode.c 22 Sep 2004 07:14:35 -0000 1.8 @@ -70,10 +70,10 @@ 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 @@ -83,7 +83,7 @@ if (( vp = strrchr(name, ods2p->semicolon)) != NULL) { *vp++ = 0; - + if (sscanf(vp, "%d", &vers) != 1) { *--vp = ods2p->semicolon; } else if (vers > 32767) { @@ -94,34 +94,34 @@ 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) { struct dirdef *dire = (struct 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; 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; - + 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) { @@ -219,28 +219,28 @@ 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.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. */ - + 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 = (struct ods2vari *) kmalloc(sizeof (struct ods2vari), GFP_KERNEL)) != NULL) { memset(ods2fhp->ods2vari, 0 , sizeof (struct ods2vari)); @@ -249,7 +249,7 @@ 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; FIXME bforget(bh); @@ -276,7 +276,7 @@ void ods2_clear_inode(struct inode *inode) { struct ods2fh *ods2fhp = (struct ods2fh *) inode->u.generic_ip; - + if (ods2fhp != NULL) { struct ods2map *map = ods2fhp->map; @@ -287,7 +287,7 @@ map = nxt; } ods2fhp->map = NULL; - + if (ods2fhp->ods2vari != NULL) { /* in case the file was of variable record type */ int idx; Index: util.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/util.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- util.c 22 Sep 2004 06:24:30 -0000 1.7 +++ util.c 22 Sep 2004 07:14:35 -0000 1.8 @@ -54,12 +54,12 @@ ino2fhlbn (struct super_block *sb, u32 ino) { 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 { 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); } @@ -121,7 +121,7 @@ mapinuse -= 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. Index: super.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/super.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- super.c 22 Sep 2004 07:10:35 -0000 1.11 +++ super.c 22 Sep 2004 07:14:35 -0000 1.12 @@ -77,7 +77,7 @@ struct ods2sb *ods2p = ODS2_SB (sb); struct inode *inode; struct buffer_head *bh; - + if ((inode = iget(sb, 2)) != NULL) { /* this is BITMAP.SYS */ struct ods2fh *ods2fhp = (struct ods2fh *) (inode->u.generic_ip); u32 lbn; @@ -90,7 +90,7 @@ 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 @@ -98,7 +98,7 @@ 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 @@ -349,9 +349,9 @@ 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. */ @@ -369,7 +369,7 @@ char format[13]; char volname[13]; char volowner[13]; - + /* * We need to fill in statfs structure * used when any user want to get Index: file.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/file.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- file.c 20 Sep 2004 21:15:47 -0000 1.7 +++ file.c 22 Sep 2004 07:14:35 -0000 1.8 @@ -202,22 +202,22 @@ struct ods2vari *ods2vari = ods2fhp->ods2vari; 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. @@ -231,11 +231,11 @@ 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)))); @@ -244,10 +244,10 @@ 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); } @@ -260,19 +260,19 @@ } } } 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) { @@ -284,7 +284,7 @@ ods2filep->curbyte = 0; } } - + if (buflen == 0) { return (buf - buforg); } } } @@ -332,7 +332,7 @@ struct ods2file *ods2filep = (struct ods2file *) filp->private_data; u32 vbn = 0; u16 cpylen; - + while (*loff < inode->i_size) { vbn = *loff >> 9; if (!(getfilebh(filp, vbn + 1))) { @@ -341,7 +341,7 @@ } 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; @@ -449,7 +449,7 @@ { struct inode *inode = filp->f_dentry->d_inode; loff_t offs; - + if (seek == 0) { /* SEEK_SET */ offs = MIN(loff, inode->i_size); } else { @@ -580,7 +580,7 @@ } while (1) { - + do { vbn = currec >> 9; if (!(getfilebh(filp, vbn + 1))) { @@ -609,7 +609,7 @@ 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); Index: dir.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/dir.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- dir.c 22 Sep 2004 07:10:35 -0000 1.8 +++ dir.c 22 Sep 2004 07:14:35 -0000 1.9 @@ -50,7 +50,7 @@ */ 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, @@ -63,7 +63,7 @@ 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. @@ -73,7 +73,7 @@ && (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 @@ -111,7 +111,7 @@ 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) @@ -155,23 +155,23 @@ 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; |