aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/dir.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2005-11-07 06:16:07 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-07 08:18:56 -0500
commit182ec4eee397543101a6db8906ed88727d3f7e53 (patch)
tree0f6dd2c52697123702bdf0c3a7143537f947b060 /fs/jffs2/dir.c
parent97894cda5773e59bd13e87b72077751099419a9f (diff)
[JFFS2] Clean up trailing white spaces
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/dir.c')
-rw-r--r--fs/jffs2/dir.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 19bea0f95ac1..a7bf9cb2567f 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: dir.c,v 1.89 2005/09/07 08:34:54 havasi Exp $ 10 * $Id: dir.c,v 1.90 2005/11/07 11:14:39 gleixner Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -64,7 +64,7 @@ struct inode_operations jffs2_dir_inode_operations =
64 64
65 65
66/* We keep the dirent list sorted in increasing order of name hash, 66/* We keep the dirent list sorted in increasing order of name hash,
67 and we use the same hash function as the dentries. Makes this 67 and we use the same hash function as the dentries. Makes this
68 nice and simple 68 nice and simple
69*/ 69*/
70static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, 70static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
@@ -85,7 +85,7 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
85 85
86 /* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */ 86 /* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */
87 for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= target->d_name.hash; fd_list = fd_list->next) { 87 for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= target->d_name.hash; fd_list = fd_list->next) {
88 if (fd_list->nhash == target->d_name.hash && 88 if (fd_list->nhash == target->d_name.hash &&
89 (!fd || fd_list->version > fd->version) && 89 (!fd || fd_list->version > fd->version) &&
90 strlen(fd_list->name) == target->d_name.len && 90 strlen(fd_list->name) == target->d_name.len &&
91 !strncmp(fd_list->name, target->d_name.name, target->d_name.len)) { 91 !strncmp(fd_list->name, target->d_name.name, target->d_name.len)) {
@@ -147,7 +147,7 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir)
147 curofs++; 147 curofs++;
148 /* First loop: curofs = 2; offset = 2 */ 148 /* First loop: curofs = 2; offset = 2 */
149 if (curofs < offset) { 149 if (curofs < offset) {
150 D2(printk(KERN_DEBUG "Skipping dirent: \"%s\", ino #%u, type %d, because curofs %ld < offset %ld\n", 150 D2(printk(KERN_DEBUG "Skipping dirent: \"%s\", ino #%u, type %d, because curofs %ld < offset %ld\n",
151 fd->name, fd->ino, fd->type, curofs, offset)); 151 fd->name, fd->ino, fd->type, curofs, offset));
152 continue; 152 continue;
153 } 153 }
@@ -182,7 +182,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode,
182 ri = jffs2_alloc_raw_inode(); 182 ri = jffs2_alloc_raw_inode();
183 if (!ri) 183 if (!ri)
184 return -ENOMEM; 184 return -ENOMEM;
185 185
186 c = JFFS2_SB_INFO(dir_i->i_sb); 186 c = JFFS2_SB_INFO(dir_i->i_sb);
187 187
188 D1(printk(KERN_DEBUG "jffs2_create()\n")); 188 D1(printk(KERN_DEBUG "jffs2_create()\n"));
@@ -203,7 +203,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode,
203 f = JFFS2_INODE_INFO(inode); 203 f = JFFS2_INODE_INFO(inode);
204 dir_f = JFFS2_INODE_INFO(dir_i); 204 dir_f = JFFS2_INODE_INFO(dir_i);
205 205
206 ret = jffs2_do_create(c, dir_f, f, ri, 206 ret = jffs2_do_create(c, dir_f, f, ri,
207 dentry->d_name.name, dentry->d_name.len); 207 dentry->d_name.name, dentry->d_name.len);
208 208
209 if (ret) { 209 if (ret) {
@@ -234,7 +234,7 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
234 int ret; 234 int ret;
235 uint32_t now = get_seconds(); 235 uint32_t now = get_seconds();
236 236
237 ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, 237 ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name,
238 dentry->d_name.len, dead_f, now); 238 dentry->d_name.len, dead_f, now);
239 if (dead_f->inocache) 239 if (dead_f->inocache)
240 dentry->d_inode->i_nlink = dead_f->inocache->nlink; 240 dentry->d_inode->i_nlink = dead_f->inocache->nlink;
@@ -303,11 +303,11 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
303 303
304 if (!ri) 304 if (!ri)
305 return -ENOMEM; 305 return -ENOMEM;
306 306
307 c = JFFS2_SB_INFO(dir_i->i_sb); 307 c = JFFS2_SB_INFO(dir_i->i_sb);
308 308
309 /* Try to reserve enough space for both node and dirent. 309 /* Try to reserve enough space for both node and dirent.
310 * Just the node will do for now, though 310 * Just the node will do for now, though
311 */ 311 */
312 namelen = dentry->d_name.len; 312 namelen = dentry->d_name.len;
313 ret = jffs2_reserve_space(c, sizeof(*ri) + targetlen, &phys_ofs, &alloclen, 313 ret = jffs2_reserve_space(c, sizeof(*ri) + targetlen, &phys_ofs, &alloclen,
@@ -338,7 +338,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
338 ri->compr = JFFS2_COMPR_NONE; 338 ri->compr = JFFS2_COMPR_NONE;
339 ri->data_crc = cpu_to_je32(crc32(0, target, targetlen)); 339 ri->data_crc = cpu_to_je32(crc32(0, target, targetlen));
340 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); 340 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
341 341
342 fn = jffs2_write_dnode(c, f, ri, target, targetlen, phys_ofs, ALLOC_NORMAL); 342 fn = jffs2_write_dnode(c, f, ri, target, targetlen, phys_ofs, ALLOC_NORMAL);
343 343
344 jffs2_free_raw_inode(ri); 344 jffs2_free_raw_inode(ri);
@@ -364,7 +364,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
364 memcpy(f->target, target, targetlen + 1); 364 memcpy(f->target, target, targetlen + 1);
365 D1(printk(KERN_DEBUG "jffs2_symlink: symlink's target '%s' cached\n", (char *)f->target)); 365 D1(printk(KERN_DEBUG "jffs2_symlink: symlink's target '%s' cached\n", (char *)f->target));
366 366
367 /* No data here. Only a metadata node, which will be 367 /* No data here. Only a metadata node, which will be
368 obsoleted by the first data write 368 obsoleted by the first data write
369 */ 369 */
370 f->metadata = fn; 370 f->metadata = fn;
@@ -407,7 +407,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
407 fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL); 407 fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL);
408 408
409 if (IS_ERR(fd)) { 409 if (IS_ERR(fd)) {
410 /* dirent failed to write. Delete the inode normally 410 /* dirent failed to write. Delete the inode normally
411 as if it were the final unlink() */ 411 as if it were the final unlink() */
412 jffs2_complete_reservation(c); 412 jffs2_complete_reservation(c);
413 jffs2_free_raw_dirent(rd); 413 jffs2_free_raw_dirent(rd);
@@ -450,11 +450,11 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
450 ri = jffs2_alloc_raw_inode(); 450 ri = jffs2_alloc_raw_inode();
451 if (!ri) 451 if (!ri)
452 return -ENOMEM; 452 return -ENOMEM;
453 453
454 c = JFFS2_SB_INFO(dir_i->i_sb); 454 c = JFFS2_SB_INFO(dir_i->i_sb);
455 455
456 /* Try to reserve enough space for both node and dirent. 456 /* Try to reserve enough space for both node and dirent.
457 * Just the node will do for now, though 457 * Just the node will do for now, though
458 */ 458 */
459 namelen = dentry->d_name.len; 459 namelen = dentry->d_name.len;
460 ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL, 460 ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL,
@@ -482,7 +482,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
482 482
483 ri->data_crc = cpu_to_je32(0); 483 ri->data_crc = cpu_to_je32(0);
484 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); 484 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
485 485
486 fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL); 486 fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
487 487
488 jffs2_free_raw_inode(ri); 488 jffs2_free_raw_inode(ri);
@@ -494,7 +494,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
494 jffs2_clear_inode(inode); 494 jffs2_clear_inode(inode);
495 return PTR_ERR(fn); 495 return PTR_ERR(fn);
496 } 496 }
497 /* No data here. Only a metadata node, which will be 497 /* No data here. Only a metadata node, which will be
498 obsoleted by the first data write 498 obsoleted by the first data write
499 */ 499 */
500 f->metadata = fn; 500 f->metadata = fn;
@@ -508,7 +508,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
508 jffs2_clear_inode(inode); 508 jffs2_clear_inode(inode);
509 return ret; 509 return ret;
510 } 510 }
511 511
512 rd = jffs2_alloc_raw_dirent(); 512 rd = jffs2_alloc_raw_dirent();
513 if (!rd) { 513 if (!rd) {
514 /* Argh. Now we treat it like a normal delete */ 514 /* Argh. Now we treat it like a normal delete */
@@ -535,9 +535,9 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
535 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen)); 535 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
536 536
537 fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL); 537 fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL);
538 538
539 if (IS_ERR(fd)) { 539 if (IS_ERR(fd)) {
540 /* dirent failed to write. Delete the inode normally 540 /* dirent failed to write. Delete the inode normally
541 as if it were the final unlink() */ 541 as if it were the final unlink() */
542 jffs2_complete_reservation(c); 542 jffs2_complete_reservation(c);
543 jffs2_free_raw_dirent(rd); 543 jffs2_free_raw_dirent(rd);
@@ -599,16 +599,16 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
599 ri = jffs2_alloc_raw_inode(); 599 ri = jffs2_alloc_raw_inode();
600 if (!ri) 600 if (!ri)
601 return -ENOMEM; 601 return -ENOMEM;
602 602
603 c = JFFS2_SB_INFO(dir_i->i_sb); 603 c = JFFS2_SB_INFO(dir_i->i_sb);
604 604
605 if (S_ISBLK(mode) || S_ISCHR(mode)) { 605 if (S_ISBLK(mode) || S_ISCHR(mode)) {
606 dev = cpu_to_je16(old_encode_dev(rdev)); 606 dev = cpu_to_je16(old_encode_dev(rdev));
607 devlen = sizeof(dev); 607 devlen = sizeof(dev);
608 } 608 }
609 609
610 /* Try to reserve enough space for both node and dirent. 610 /* Try to reserve enough space for both node and dirent.
611 * Just the node will do for now, though 611 * Just the node will do for now, though
612 */ 612 */
613 namelen = dentry->d_name.len; 613 namelen = dentry->d_name.len;
614 ret = jffs2_reserve_space(c, sizeof(*ri) + devlen, &phys_ofs, &alloclen, 614 ret = jffs2_reserve_space(c, sizeof(*ri) + devlen, &phys_ofs, &alloclen,
@@ -638,7 +638,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
638 ri->compr = JFFS2_COMPR_NONE; 638 ri->compr = JFFS2_COMPR_NONE;
639 ri->data_crc = cpu_to_je32(crc32(0, &dev, devlen)); 639 ri->data_crc = cpu_to_je32(crc32(0, &dev, devlen));
640 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); 640 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
641 641
642 fn = jffs2_write_dnode(c, f, ri, (char *)&dev, devlen, phys_ofs, ALLOC_NORMAL); 642 fn = jffs2_write_dnode(c, f, ri, (char *)&dev, devlen, phys_ofs, ALLOC_NORMAL);
643 643
644 jffs2_free_raw_inode(ri); 644 jffs2_free_raw_inode(ri);
@@ -650,7 +650,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
650 jffs2_clear_inode(inode); 650 jffs2_clear_inode(inode);
651 return PTR_ERR(fn); 651 return PTR_ERR(fn);
652 } 652 }
653 /* No data here. Only a metadata node, which will be 653 /* No data here. Only a metadata node, which will be
654 obsoleted by the first data write 654 obsoleted by the first data write
655 */ 655 */
656 f->metadata = fn; 656 f->metadata = fn;
@@ -694,9 +694,9 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
694 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen)); 694 rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
695 695
696 fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL); 696 fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL);
697 697
698 if (IS_ERR(fd)) { 698 if (IS_ERR(fd)) {
699 /* dirent failed to write. Delete the inode normally 699 /* dirent failed to write. Delete the inode normally
700 as if it were the final unlink() */ 700 as if it were the final unlink() */
701 jffs2_complete_reservation(c); 701 jffs2_complete_reservation(c);
702 jffs2_free_raw_dirent(rd); 702 jffs2_free_raw_dirent(rd);
@@ -730,7 +730,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
730 uint8_t type; 730 uint8_t type;
731 uint32_t now; 731 uint32_t now;
732 732
733 /* The VFS will check for us and prevent trying to rename a 733 /* The VFS will check for us and prevent trying to rename a
734 * file over a directory and vice versa, but if it's a directory, 734 * file over a directory and vice versa, but if it's a directory,
735 * the VFS can't check whether the victim is empty. The filesystem 735 * the VFS can't check whether the victim is empty. The filesystem
736 * needs to do that for itself. 736 * needs to do that for itself.
@@ -752,18 +752,18 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
752 } 752 }
753 753
754 /* XXX: We probably ought to alloc enough space for 754 /* XXX: We probably ought to alloc enough space for
755 both nodes at the same time. Writing the new link, 755 both nodes at the same time. Writing the new link,
756 then getting -ENOSPC, is quite bad :) 756 then getting -ENOSPC, is quite bad :)
757 */ 757 */
758 758
759 /* Make a hard link */ 759 /* Make a hard link */
760 760
761 /* XXX: This is ugly */ 761 /* XXX: This is ugly */
762 type = (old_dentry->d_inode->i_mode & S_IFMT) >> 12; 762 type = (old_dentry->d_inode->i_mode & S_IFMT) >> 12;
763 if (!type) type = DT_REG; 763 if (!type) type = DT_REG;
764 764
765 now = get_seconds(); 765 now = get_seconds();
766 ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i), 766 ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i),
767 old_dentry->d_inode->i_ino, type, 767 old_dentry->d_inode->i_ino, type,
768 new_dentry->d_name.name, new_dentry->d_name.len, now); 768 new_dentry->d_name.name, new_dentry->d_name.len, now);
769 769
@@ -782,13 +782,13 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
782 } 782 }
783 } 783 }
784 784
785 /* If it was a directory we moved, and there was no victim, 785 /* If it was a directory we moved, and there was no victim,
786 increase i_nlink on its new parent */ 786 increase i_nlink on its new parent */
787 if (S_ISDIR(old_dentry->d_inode->i_mode) && !victim_f) 787 if (S_ISDIR(old_dentry->d_inode->i_mode) && !victim_f)
788 new_dir_i->i_nlink++; 788 new_dir_i->i_nlink++;
789 789
790 /* Unlink the original */ 790 /* Unlink the original */
791 ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), 791 ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i),
792 old_dentry->d_name.name, old_dentry->d_name.len, NULL, now); 792 old_dentry->d_name.name, old_dentry->d_name.len, NULL, now);
793 793
794 /* We don't touch inode->i_nlink */ 794 /* We don't touch inode->i_nlink */