|
From: Jan-Benedict G. <jb...@us...> - 2004-09-23 02:06:36
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30952 Modified Files: inode.c Log Message: - No real work, only shifting code around. Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/inode.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- inode.c 22 Sep 2004 07:14:35 -0000 1.8 +++ inode.c 23 Sep 2004 02:06:27 -0000 1.9 @@ -81,10 +81,11 @@ stored together with each FID. */ - if (( vp = strrchr(name, ods2p->semicolon)) != NULL) { + vp = strrchr (name, ods2p->semicolon); + if (vp) { *vp++ = 0; - if (sscanf(vp, "%d", &vers) != 1) { + 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); @@ -92,28 +93,36 @@ } } - while ((lbn = vbn2lbn(sb, ods2fhp->map, vbn)) > 0 && - (bh = sb_bread(sb, GETBLKNO(sb, lbn))) != NULL && bh->b_data != NULL) { + 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)); + 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]; + if (dire->u1.s1.dir_b_namecount == strlen (name)) { + /* FIXME: Stack usage? */ + char dirname[dire->u1.s1.dir_b_namecount + 1]; - memcpy(dirname, &dire->u1.s1.dir_t_name, dire->u1.s1.dir_b_namecount); + 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++; } + 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; + if (strcmp (dirname, name) == 0) { + int curbyte = 0; while (curbyte < dire->u1.s1.dir_w_size) { u32 ino; @@ -128,7 +137,7 @@ d_add(dentry, inode); return NULL; } - printk("ODS2-fs error when iget for file %s\n", name); + printk (KERN_ERR "ODS2-fs error when iget for file %s\n", name); return ERR_PTR(-EACCES); } curbyte += 8; @@ -161,7 +170,7 @@ set bit mean granted access. */ -char unsigned vms2unixprot[] = { /* ODS2 prot */ +unsigned char 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 */ @@ -188,11 +197,13 @@ 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) { + 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); - if ((inode->u.generic_ip = kmalloc (sizeof (struct ods2fh), GFP_KERNEL)) != NULL) { + inode->u.generic_ip = kmalloc (sizeof (struct ods2fh), GFP_KERNEL); + if (inode->u.generic_ip) { struct ods2fh *ods2fhp; struct fi2def *fi2p; struct fatdef *fatp; @@ -204,9 +215,8 @@ fatp = (struct fatdef *) &(fh2p->fh2_w_recattr); if (verify_fh(fh2p, inode->i_ino)) { - - memcpy(&ods2fhp->fat, fatp, sizeof (struct fatdef)); - ods2fhp->map = getmap(sb, fh2p); + memcpy (&ods2fhp->fat, fatp, sizeof (struct fatdef)); + ods2fhp->map = getmap (sb, fh2p); if (fh2p->u4.s1.fch_v_directory) { inode->i_mode = S_IFDIR; @@ -217,20 +227,20 @@ 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_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); + 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. - */ - + * 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 */ @@ -238,43 +248,44 @@ 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; } + 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 ((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)); sema_init(&(ods2fhp->ods2vari->sem), 1); } else { - printk("ODS2-fs kmalloc failed for vari data\n"); + printk(KERN_ERR "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); + 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); return; } - printk("ODS2-fs not a valid file header\n"); + printk (KERN_ERR "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); + bforget (bh); + printk (KERN_ERR "ODS2-fs kmalloc failed for extension inode\n"); + kfree (inode->u.generic_ip); } } - printk("ODS2-fs error reading inode\n"); - make_bad_inode(inode); + printk (KERN_ERR "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) { + * 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) { +void ods2_clear_inode (struct inode *inode) { struct ods2fh *ods2fhp = (struct ods2fh *) inode->u.generic_ip; if (ods2fhp != NULL) { @@ -282,8 +293,7 @@ while (map != NULL) { struct ods2map *nxt = map->nxt; - - kfree(map); + kfree (map); map = nxt; } ods2fhp->map = NULL; @@ -301,22 +311,21 @@ ods2varp = nxt; } } - kfree(ods2fhp->ods2vari); + kfree (ods2fhp->ods2vari); ods2fhp->ods2vari = NULL; } - kfree(inode->u.generic_ip); + 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); + * 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); } |