aboutsummaryrefslogtreecommitdiffstats
path: root/fs/qnx4/inode.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /fs/qnx4/inode.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'fs/qnx4/inode.c')
-rw-r--r--fs/qnx4/inode.c51
1 files changed, 16 insertions, 35 deletions
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index d2cd1798d8c4..277575ddc05c 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -64,25 +64,7 @@ static struct buffer_head *qnx4_getblk(struct inode *inode, int nr,
64 result = sb_getblk(inode->i_sb, nr); 64 result = sb_getblk(inode->i_sb, nr);
65 return result; 65 return result;
66 } 66 }
67 if (!create) { 67 return NULL;
68 return NULL;
69 }
70#if 0
71 tmp = qnx4_new_block(inode->i_sb);
72 if (!tmp) {
73 return NULL;
74 }
75 result = sb_getblk(inode->i_sb, tmp);
76 if (tst) {
77 qnx4_free_block(inode->i_sb, tmp);
78 brelse(result);
79 goto repeat;
80 }
81 tst = tmp;
82#endif
83 inode->i_ctime = CURRENT_TIME_SEC;
84 mark_inode_dirty(inode);
85 return result;
86} 68}
87 69
88struct buffer_head *qnx4_bread(struct inode *inode, int block, int create) 70struct buffer_head *qnx4_bread(struct inode *inode, int block, int create)
@@ -107,14 +89,12 @@ static int qnx4_get_block( struct inode *inode, sector_t iblock, struct buffer_h
107{ 89{
108 unsigned long phys; 90 unsigned long phys;
109 91
110 QNX4DEBUG(("qnx4: qnx4_get_block inode=[%ld] iblock=[%ld]\n",inode->i_ino,iblock)); 92 QNX4DEBUG((KERN_INFO "qnx4: qnx4_get_block inode=[%ld] iblock=[%ld]\n",inode->i_ino,iblock));
111 93
112 phys = qnx4_block_map( inode, iblock ); 94 phys = qnx4_block_map( inode, iblock );
113 if ( phys ) { 95 if ( phys ) {
114 // logical block is before EOF 96 // logical block is before EOF
115 map_bh(bh, inode->i_sb, phys); 97 map_bh(bh, inode->i_sb, phys);
116 } else if ( create ) {
117 // to be done.
118 } 98 }
119 return 0; 99 return 0;
120} 100}
@@ -142,12 +122,12 @@ unsigned long qnx4_block_map( struct inode *inode, long iblock )
142 // read next xtnt block. 122 // read next xtnt block.
143 bh = sb_bread(inode->i_sb, i_xblk - 1); 123 bh = sb_bread(inode->i_sb, i_xblk - 1);
144 if ( !bh ) { 124 if ( !bh ) {
145 QNX4DEBUG(("qnx4: I/O error reading xtnt block [%ld])\n", i_xblk - 1)); 125 QNX4DEBUG((KERN_ERR "qnx4: I/O error reading xtnt block [%ld])\n", i_xblk - 1));
146 return -EIO; 126 return -EIO;
147 } 127 }
148 xblk = (struct qnx4_xblk*)bh->b_data; 128 xblk = (struct qnx4_xblk*)bh->b_data;
149 if ( memcmp( xblk->xblk_signature, "IamXblk", 7 ) ) { 129 if ( memcmp( xblk->xblk_signature, "IamXblk", 7 ) ) {
150 QNX4DEBUG(("qnx4: block at %ld is not a valid xtnt\n", qnx4_inode->i_xblk)); 130 QNX4DEBUG((KERN_ERR "qnx4: block at %ld is not a valid xtnt\n", qnx4_inode->i_xblk));
151 return -EIO; 131 return -EIO;
152 } 132 }
153 } 133 }
@@ -168,7 +148,7 @@ unsigned long qnx4_block_map( struct inode *inode, long iblock )
168 brelse( bh ); 148 brelse( bh );
169 } 149 }
170 150
171 QNX4DEBUG(("qnx4: mapping block %ld of inode %ld = %ld\n",iblock,inode->i_ino,block)); 151 QNX4DEBUG((KERN_INFO "qnx4: mapping block %ld of inode %ld = %ld\n",iblock,inode->i_ino,block));
172 return block; 152 return block;
173} 153}
174 154
@@ -209,7 +189,7 @@ static const char *qnx4_checkroot(struct super_block *sb)
209 if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/') { 189 if (*(qnx4_sb(sb)->sb->RootDir.di_fname) != '/') {
210 return "no qnx4 filesystem (no root dir)."; 190 return "no qnx4 filesystem (no root dir).";
211 } else { 191 } else {
212 QNX4DEBUG(("QNX4 filesystem found on dev %s.\n", sb->s_id)); 192 QNX4DEBUG((KERN_NOTICE "QNX4 filesystem found on dev %s.\n", sb->s_id));
213 rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1; 193 rd = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_blk) - 1;
214 rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size); 194 rl = le32_to_cpu(qnx4_sb(sb)->sb->RootDir.di_first_xtnt.xtnt_size);
215 for (j = 0; j < rl; j++) { 195 for (j = 0; j < rl; j++) {
@@ -220,8 +200,9 @@ static const char *qnx4_checkroot(struct super_block *sb)
220 for (i = 0; i < QNX4_INODES_PER_BLOCK; i++) { 200 for (i = 0; i < QNX4_INODES_PER_BLOCK; i++) {
221 rootdir = (struct qnx4_inode_entry *) (bh->b_data + i * QNX4_DIR_ENTRY_SIZE); 201 rootdir = (struct qnx4_inode_entry *) (bh->b_data + i * QNX4_DIR_ENTRY_SIZE);
222 if (rootdir->di_fname != NULL) { 202 if (rootdir->di_fname != NULL) {
223 QNX4DEBUG(("Rootdir entry found : [%s]\n", rootdir->di_fname)); 203 QNX4DEBUG((KERN_INFO "rootdir entry found : [%s]\n", rootdir->di_fname));
224 if (!strncmp(rootdir->di_fname, QNX4_BMNAME, sizeof QNX4_BMNAME)) { 204 if (!strcmp(rootdir->di_fname,
205 QNX4_BMNAME)) {
225 found = 1; 206 found = 1;
226 qnx4_sb(sb)->BitMap = kmalloc( sizeof( struct qnx4_inode_entry ), GFP_KERNEL ); 207 qnx4_sb(sb)->BitMap = kmalloc( sizeof( struct qnx4_inode_entry ), GFP_KERNEL );
227 if (!qnx4_sb(sb)->BitMap) { 208 if (!qnx4_sb(sb)->BitMap) {
@@ -265,12 +246,12 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
265 if we don't belong here... */ 246 if we don't belong here... */
266 bh = sb_bread(s, 1); 247 bh = sb_bread(s, 1);
267 if (!bh) { 248 if (!bh) {
268 printk("qnx4: unable to read the superblock\n"); 249 printk(KERN_ERR "qnx4: unable to read the superblock\n");
269 goto outnobh; 250 goto outnobh;
270 } 251 }
271 if ( le32_to_cpup((__le32*) bh->b_data) != QNX4_SUPER_MAGIC ) { 252 if ( le32_to_cpup((__le32*) bh->b_data) != QNX4_SUPER_MAGIC ) {
272 if (!silent) 253 if (!silent)
273 printk("qnx4: wrong fsid in superblock.\n"); 254 printk(KERN_ERR "qnx4: wrong fsid in superblock.\n");
274 goto out; 255 goto out;
275 } 256 }
276 s->s_op = &qnx4_sops; 257 s->s_op = &qnx4_sops;
@@ -284,14 +265,14 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
284 errmsg = qnx4_checkroot(s); 265 errmsg = qnx4_checkroot(s);
285 if (errmsg != NULL) { 266 if (errmsg != NULL) {
286 if (!silent) 267 if (!silent)
287 printk("qnx4: %s\n", errmsg); 268 printk(KERN_ERR "qnx4: %s\n", errmsg);
288 goto out; 269 goto out;
289 } 270 }
290 271
291 /* does root not have inode number QNX4_ROOT_INO ?? */ 272 /* does root not have inode number QNX4_ROOT_INO ?? */
292 root = qnx4_iget(s, QNX4_ROOT_INO * QNX4_INODES_PER_BLOCK); 273 root = qnx4_iget(s, QNX4_ROOT_INO * QNX4_INODES_PER_BLOCK);
293 if (IS_ERR(root)) { 274 if (IS_ERR(root)) {
294 printk("qnx4: get inode failed\n"); 275 printk(KERN_ERR "qnx4: get inode failed\n");
295 ret = PTR_ERR(root); 276 ret = PTR_ERR(root);
296 goto out; 277 goto out;
297 } 278 }
@@ -374,7 +355,7 @@ struct inode *qnx4_iget(struct super_block *sb, unsigned long ino)
374 qnx4_inode = qnx4_raw_inode(inode); 355 qnx4_inode = qnx4_raw_inode(inode);
375 inode->i_mode = 0; 356 inode->i_mode = 0;
376 357
377 QNX4DEBUG(("Reading inode : [%d]\n", ino)); 358 QNX4DEBUG((KERN_INFO "reading inode : [%d]\n", ino));
378 if (!ino) { 359 if (!ino) {
379 printk(KERN_ERR "qnx4: bad inode number on dev %s: %lu is " 360 printk(KERN_ERR "qnx4: bad inode number on dev %s: %lu is "
380 "out of range\n", 361 "out of range\n",
@@ -385,7 +366,7 @@ struct inode *qnx4_iget(struct super_block *sb, unsigned long ino)
385 block = ino / QNX4_INODES_PER_BLOCK; 366 block = ino / QNX4_INODES_PER_BLOCK;
386 367
387 if (!(bh = sb_bread(sb, block))) { 368 if (!(bh = sb_bread(sb, block))) {
388 printk("qnx4: major problem: unable to read inode from dev " 369 printk(KERN_ERR "qnx4: major problem: unable to read inode from dev "
389 "%s\n", sb->s_id); 370 "%s\n", sb->s_id);
390 iget_failed(inode); 371 iget_failed(inode);
391 return ERR_PTR(-EIO); 372 return ERR_PTR(-EIO);
@@ -499,7 +480,7 @@ static int __init init_qnx4_fs(void)
499 return err; 480 return err;
500 } 481 }
501 482
502 printk("QNX4 filesystem 0.2.3 registered.\n"); 483 printk(KERN_INFO "QNX4 filesystem 0.2.3 registered.\n");
503 return 0; 484 return 0;
504} 485}
505 486