aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ncpfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ncpfs')
-rw-r--r--fs/ncpfs/dir.c8
-rw-r--r--fs/ncpfs/file.c4
-rw-r--r--fs/ncpfs/inode.c52
-rw-r--r--fs/ncpfs/ioctl.c8
-rw-r--r--fs/ncpfs/mmap.c4
-rw-r--r--fs/ncpfs/sock.c20
6 files changed, 54 insertions, 42 deletions
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 458b3b785194..73747772c3bb 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -402,7 +402,7 @@ static time_t ncp_obtain_mtime(struct dentry *dentry)
402 402
403static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir) 403static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
404{ 404{
405 struct dentry *dentry = filp->f_dentry; 405 struct dentry *dentry = filp->f_path.dentry;
406 struct inode *inode = dentry->d_inode; 406 struct inode *inode = dentry->d_inode;
407 struct page *page = NULL; 407 struct page *page = NULL;
408 struct ncp_server *server = NCP_SERVER(inode); 408 struct ncp_server *server = NCP_SERVER(inode);
@@ -554,7 +554,7 @@ static int
554ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir, 554ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
555 struct ncp_cache_control *ctrl, struct ncp_entry_info *entry) 555 struct ncp_cache_control *ctrl, struct ncp_entry_info *entry)
556{ 556{
557 struct dentry *newdent, *dentry = filp->f_dentry; 557 struct dentry *newdent, *dentry = filp->f_path.dentry;
558 struct inode *newino, *inode = dentry->d_inode; 558 struct inode *newino, *inode = dentry->d_inode;
559 struct ncp_cache_control ctl = *ctrl; 559 struct ncp_cache_control ctl = *ctrl;
560 struct qstr qname; 560 struct qstr qname;
@@ -649,7 +649,7 @@ static void
649ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir, 649ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir,
650 struct ncp_cache_control *ctl) 650 struct ncp_cache_control *ctl)
651{ 651{
652 struct dentry *dentry = filp->f_dentry; 652 struct dentry *dentry = filp->f_path.dentry;
653 struct inode *inode = dentry->d_inode; 653 struct inode *inode = dentry->d_inode;
654 struct ncp_server *server = NCP_SERVER(inode); 654 struct ncp_server *server = NCP_SERVER(inode);
655 struct ncp_volume_info info; 655 struct ncp_volume_info info;
@@ -685,7 +685,7 @@ static void
685ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir, 685ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir,
686 struct ncp_cache_control *ctl) 686 struct ncp_cache_control *ctl)
687{ 687{
688 struct dentry *dentry = filp->f_dentry; 688 struct dentry *dentry = filp->f_path.dentry;
689 struct inode *dir = dentry->d_inode; 689 struct inode *dir = dentry->d_inode;
690 struct ncp_server *server = NCP_SERVER(dir); 690 struct ncp_server *server = NCP_SERVER(dir);
691 struct nw_search_sequence seq; 691 struct nw_search_sequence seq;
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index df37524b85db..b91fea03b1c3 100644
--- a/fs/ncpfs/file.c
+++ b/fs/ncpfs/file.c
@@ -101,7 +101,7 @@ out:
101static ssize_t 101static ssize_t
102ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 102ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
103{ 103{
104 struct dentry *dentry = file->f_dentry; 104 struct dentry *dentry = file->f_path.dentry;
105 struct inode *inode = dentry->d_inode; 105 struct inode *inode = dentry->d_inode;
106 size_t already_read = 0; 106 size_t already_read = 0;
107 off_t pos; 107 off_t pos;
@@ -182,7 +182,7 @@ outrel:
182static ssize_t 182static ssize_t
183ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) 183ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
184{ 184{
185 struct dentry *dentry = file->f_dentry; 185 struct dentry *dentry = file->f_path.dentry;
186 struct inode *inode = dentry->d_inode; 186 struct inode *inode = dentry->d_inode;
187 size_t already_written = 0; 187 size_t already_written = 0;
188 off_t pos; 188 off_t pos;
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 42e3bef270c9..67a90bf795d5 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -40,12 +40,12 @@ static void ncp_delete_inode(struct inode *);
40static void ncp_put_super(struct super_block *); 40static void ncp_put_super(struct super_block *);
41static int ncp_statfs(struct dentry *, struct kstatfs *); 41static int ncp_statfs(struct dentry *, struct kstatfs *);
42 42
43static kmem_cache_t * ncp_inode_cachep; 43static struct kmem_cache * ncp_inode_cachep;
44 44
45static struct inode *ncp_alloc_inode(struct super_block *sb) 45static struct inode *ncp_alloc_inode(struct super_block *sb)
46{ 46{
47 struct ncp_inode_info *ei; 47 struct ncp_inode_info *ei;
48 ei = (struct ncp_inode_info *)kmem_cache_alloc(ncp_inode_cachep, SLAB_KERNEL); 48 ei = (struct ncp_inode_info *)kmem_cache_alloc(ncp_inode_cachep, GFP_KERNEL);
49 if (!ei) 49 if (!ei)
50 return NULL; 50 return NULL;
51 return &ei->vfs_inode; 51 return &ei->vfs_inode;
@@ -56,7 +56,7 @@ static void ncp_destroy_inode(struct inode *inode)
56 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode)); 56 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode));
57} 57}
58 58
59static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) 59static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
60{ 60{
61 struct ncp_inode_info *ei = (struct ncp_inode_info *) foo; 61 struct ncp_inode_info *ei = (struct ncp_inode_info *) foo;
62 62
@@ -327,11 +327,12 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
327 char *optarg; 327 char *optarg;
328 unsigned long optint; 328 unsigned long optint;
329 int version = 0; 329 int version = 0;
330 int ret;
330 331
331 data->flags = 0; 332 data->flags = 0;
332 data->int_flags = 0; 333 data->int_flags = 0;
333 data->mounted_uid = 0; 334 data->mounted_uid = 0;
334 data->wdog_pid = -1; 335 data->wdog_pid = NULL;
335 data->ncp_fd = ~0; 336 data->ncp_fd = ~0;
336 data->time_out = 10; 337 data->time_out = 10;
337 data->retry_count = 20; 338 data->retry_count = 20;
@@ -343,8 +344,9 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
343 data->mounted_vol[0] = 0; 344 data->mounted_vol[0] = 0;
344 345
345 while ((optval = ncp_getopt("ncpfs", &options, ncp_opts, NULL, &optarg, &optint)) != 0) { 346 while ((optval = ncp_getopt("ncpfs", &options, ncp_opts, NULL, &optarg, &optint)) != 0) {
346 if (optval < 0) 347 ret = optval;
347 return optval; 348 if (ret < 0)
349 goto err;
348 switch (optval) { 350 switch (optval) {
349 case 'u': 351 case 'u':
350 data->uid = optint; 352 data->uid = optint;
@@ -371,7 +373,7 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
371 data->flags = optint; 373 data->flags = optint;
372 break; 374 break;
373 case 'w': 375 case 'w':
374 data->wdog_pid = optint; 376 data->wdog_pid = find_get_pid(optint);
375 break; 377 break;
376 case 'n': 378 case 'n':
377 data->ncp_fd = optint; 379 data->ncp_fd = optint;
@@ -380,18 +382,21 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
380 data->info_fd = optint; 382 data->info_fd = optint;
381 break; 383 break;
382 case 'v': 384 case 'v':
383 if (optint < NCP_MOUNT_VERSION_V4) { 385 ret = -ECHRNG;
384 return -ECHRNG; 386 if (optint < NCP_MOUNT_VERSION_V4)
385 } 387 goto err;
386 if (optint > NCP_MOUNT_VERSION_V5) { 388 if (optint > NCP_MOUNT_VERSION_V5)
387 return -ECHRNG; 389 goto err;
388 }
389 version = optint; 390 version = optint;
390 break; 391 break;
391 392
392 } 393 }
393 } 394 }
394 return 0; 395 return 0;
396err:
397 put_pid(data->wdog_pid);
398 data->wdog_pid = NULL;
399 return ret;
395} 400}
396 401
397static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) 402static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
@@ -409,6 +414,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
409#endif 414#endif
410 struct ncp_entry_info finfo; 415 struct ncp_entry_info finfo;
411 416
417 data.wdog_pid = NULL;
412 server = kzalloc(sizeof(struct ncp_server), GFP_KERNEL); 418 server = kzalloc(sizeof(struct ncp_server), GFP_KERNEL);
413 if (!server) 419 if (!server)
414 return -ENOMEM; 420 return -ENOMEM;
@@ -425,7 +431,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
425 data.flags = md->flags; 431 data.flags = md->flags;
426 data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE; 432 data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE;
427 data.mounted_uid = md->mounted_uid; 433 data.mounted_uid = md->mounted_uid;
428 data.wdog_pid = md->wdog_pid; 434 data.wdog_pid = find_get_pid(md->wdog_pid);
429 data.ncp_fd = md->ncp_fd; 435 data.ncp_fd = md->ncp_fd;
430 data.time_out = md->time_out; 436 data.time_out = md->time_out;
431 data.retry_count = md->retry_count; 437 data.retry_count = md->retry_count;
@@ -445,7 +451,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
445 data.flags = md->flags; 451 data.flags = md->flags;
446 data.int_flags = 0; 452 data.int_flags = 0;
447 data.mounted_uid = md->mounted_uid; 453 data.mounted_uid = md->mounted_uid;
448 data.wdog_pid = md->wdog_pid; 454 data.wdog_pid = find_get_pid(md->wdog_pid);
449 data.ncp_fd = md->ncp_fd; 455 data.ncp_fd = md->ncp_fd;
450 data.time_out = md->time_out; 456 data.time_out = md->time_out;
451 data.retry_count = md->retry_count; 457 data.retry_count = md->retry_count;
@@ -471,7 +477,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
471 if (!ncp_filp) 477 if (!ncp_filp)
472 goto out; 478 goto out;
473 error = -ENOTSOCK; 479 error = -ENOTSOCK;
474 sock_inode = ncp_filp->f_dentry->d_inode; 480 sock_inode = ncp_filp->f_path.dentry->d_inode;
475 if (!S_ISSOCK(sock_inode->i_mode)) 481 if (!S_ISSOCK(sock_inode->i_mode))
476 goto out_fput; 482 goto out_fput;
477 sock = SOCKET_I(sock_inode); 483 sock = SOCKET_I(sock_inode);
@@ -504,7 +510,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
504 if (!server->info_filp) 510 if (!server->info_filp)
505 goto out_fput; 511 goto out_fput;
506 error = -ENOTSOCK; 512 error = -ENOTSOCK;
507 sock_inode = server->info_filp->f_dentry->d_inode; 513 sock_inode = server->info_filp->f_path.dentry->d_inode;
508 if (!S_ISSOCK(sock_inode->i_mode)) 514 if (!S_ISSOCK(sock_inode->i_mode))
509 goto out_fput2; 515 goto out_fput2;
510 info_sock = SOCKET_I(sock_inode); 516 info_sock = SOCKET_I(sock_inode);
@@ -577,12 +583,12 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
577 server->rcv.ptr = (unsigned char*)&server->rcv.buf; 583 server->rcv.ptr = (unsigned char*)&server->rcv.buf;
578 server->rcv.len = 10; 584 server->rcv.len = 10;
579 server->rcv.state = 0; 585 server->rcv.state = 0;
580 INIT_WORK(&server->rcv.tq, ncp_tcp_rcv_proc, server); 586 INIT_WORK(&server->rcv.tq, ncp_tcp_rcv_proc);
581 INIT_WORK(&server->tx.tq, ncp_tcp_tx_proc, server); 587 INIT_WORK(&server->tx.tq, ncp_tcp_tx_proc);
582 sock->sk->sk_write_space = ncp_tcp_write_space; 588 sock->sk->sk_write_space = ncp_tcp_write_space;
583 } else { 589 } else {
584 INIT_WORK(&server->rcv.tq, ncpdgram_rcv_proc, server); 590 INIT_WORK(&server->rcv.tq, ncpdgram_rcv_proc);
585 INIT_WORK(&server->timeout_tq, ncpdgram_timeout_proc, server); 591 INIT_WORK(&server->timeout_tq, ncpdgram_timeout_proc);
586 server->timeout_tm.data = (unsigned long)server; 592 server->timeout_tm.data = (unsigned long)server;
587 server->timeout_tm.function = ncpdgram_timeout_call; 593 server->timeout_tm.function = ncpdgram_timeout_call;
588 } 594 }
@@ -679,6 +685,7 @@ out_fput:
679 */ 685 */
680 fput(ncp_filp); 686 fput(ncp_filp);
681out: 687out:
688 put_pid(data.wdog_pid);
682 sb->s_fs_info = NULL; 689 sb->s_fs_info = NULL;
683 kfree(server); 690 kfree(server);
684 return error; 691 return error;
@@ -711,7 +718,8 @@ static void ncp_put_super(struct super_block *sb)
711 if (server->info_filp) 718 if (server->info_filp)
712 fput(server->info_filp); 719 fput(server->info_filp);
713 fput(server->ncp_filp); 720 fput(server->ncp_filp);
714 kill_proc(server->m.wdog_pid, SIGTERM, 1); 721 kill_pid(server->m.wdog_pid, SIGTERM, 1);
722 put_pid(server->m.wdog_pid);
715 723
716 kfree(server->priv.data); 724 kfree(server->priv.data);
717 kfree(server->auth.object_name); 725 kfree(server->auth.object_name);
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 589d1eac55c1..8843a83d4ef0 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -35,7 +35,7 @@ static int
35ncp_get_fs_info(struct ncp_server * server, struct file *file, 35ncp_get_fs_info(struct ncp_server * server, struct file *file,
36 struct ncp_fs_info __user *arg) 36 struct ncp_fs_info __user *arg)
37{ 37{
38 struct inode *inode = file->f_dentry->d_inode; 38 struct inode *inode = file->f_path.dentry->d_inode;
39 struct ncp_fs_info info; 39 struct ncp_fs_info info;
40 40
41 if ((file_permission(file, MAY_WRITE) != 0) 41 if ((file_permission(file, MAY_WRITE) != 0)
@@ -65,7 +65,7 @@ static int
65ncp_get_fs_info_v2(struct ncp_server * server, struct file *file, 65ncp_get_fs_info_v2(struct ncp_server * server, struct file *file,
66 struct ncp_fs_info_v2 __user * arg) 66 struct ncp_fs_info_v2 __user * arg)
67{ 67{
68 struct inode *inode = file->f_dentry->d_inode; 68 struct inode *inode = file->f_path.dentry->d_inode;
69 struct ncp_fs_info_v2 info2; 69 struct ncp_fs_info_v2 info2;
70 70
71 if ((file_permission(file, MAY_WRITE) != 0) 71 if ((file_permission(file, MAY_WRITE) != 0)
@@ -136,7 +136,7 @@ static int
136ncp_get_compat_fs_info_v2(struct ncp_server * server, struct file *file, 136ncp_get_compat_fs_info_v2(struct ncp_server * server, struct file *file,
137 struct compat_ncp_fs_info_v2 __user * arg) 137 struct compat_ncp_fs_info_v2 __user * arg)
138{ 138{
139 struct inode *inode = file->f_dentry->d_inode; 139 struct inode *inode = file->f_path.dentry->d_inode;
140 struct compat_ncp_fs_info_v2 info2; 140 struct compat_ncp_fs_info_v2 info2;
141 141
142 if ((file_permission(file, MAY_WRITE) != 0) 142 if ((file_permission(file, MAY_WRITE) != 0)
@@ -824,7 +824,7 @@ outrel:
824#ifdef CONFIG_COMPAT 824#ifdef CONFIG_COMPAT
825long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 825long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
826{ 826{
827 struct inode *inode = file->f_dentry->d_inode; 827 struct inode *inode = file->f_path.dentry->d_inode;
828 int ret; 828 int ret;
829 829
830 lock_kernel(); 830 lock_kernel();
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c
index e7d5a3097fe6..70a69115500f 100644
--- a/fs/ncpfs/mmap.c
+++ b/fs/ncpfs/mmap.c
@@ -29,7 +29,7 @@ static struct page* ncp_file_mmap_nopage(struct vm_area_struct *area,
29 unsigned long address, int *type) 29 unsigned long address, int *type)
30{ 30{
31 struct file *file = area->vm_file; 31 struct file *file = area->vm_file;
32 struct dentry *dentry = file->f_dentry; 32 struct dentry *dentry = file->f_path.dentry;
33 struct inode *inode = dentry->d_inode; 33 struct inode *inode = dentry->d_inode;
34 struct page* page; 34 struct page* page;
35 char *pg_addr; 35 char *pg_addr;
@@ -106,7 +106,7 @@ static struct vm_operations_struct ncp_file_mmap =
106/* This is used for a general mmap of a ncp file */ 106/* This is used for a general mmap of a ncp file */
107int ncp_mmap(struct file *file, struct vm_area_struct *vma) 107int ncp_mmap(struct file *file, struct vm_area_struct *vma)
108{ 108{
109 struct inode *inode = file->f_dentry->d_inode; 109 struct inode *inode = file->f_path.dentry->d_inode;
110 110
111 DPRINTK("ncp_mmap: called\n"); 111 DPRINTK("ncp_mmap: called\n");
112 112
diff --git a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c
index 11c2b252ebed..e496d8b65e92 100644
--- a/fs/ncpfs/sock.c
+++ b/fs/ncpfs/sock.c
@@ -350,9 +350,10 @@ static void info_server(struct ncp_server *server, unsigned int id, const void *
350 } 350 }
351} 351}
352 352
353void ncpdgram_rcv_proc(void *s) 353void ncpdgram_rcv_proc(struct work_struct *work)
354{ 354{
355 struct ncp_server *server = s; 355 struct ncp_server *server =
356 container_of(work, struct ncp_server, rcv.tq);
356 struct socket* sock; 357 struct socket* sock;
357 358
358 sock = server->ncp_sock; 359 sock = server->ncp_sock;
@@ -468,9 +469,10 @@ static void __ncpdgram_timeout_proc(struct ncp_server *server)
468 } 469 }
469} 470}
470 471
471void ncpdgram_timeout_proc(void *s) 472void ncpdgram_timeout_proc(struct work_struct *work)
472{ 473{
473 struct ncp_server *server = s; 474 struct ncp_server *server =
475 container_of(work, struct ncp_server, timeout_tq);
474 mutex_lock(&server->rcv.creq_mutex); 476 mutex_lock(&server->rcv.creq_mutex);
475 __ncpdgram_timeout_proc(server); 477 __ncpdgram_timeout_proc(server);
476 mutex_unlock(&server->rcv.creq_mutex); 478 mutex_unlock(&server->rcv.creq_mutex);
@@ -652,18 +654,20 @@ skipdata:;
652 } 654 }
653} 655}
654 656
655void ncp_tcp_rcv_proc(void *s) 657void ncp_tcp_rcv_proc(struct work_struct *work)
656{ 658{
657 struct ncp_server *server = s; 659 struct ncp_server *server =
660 container_of(work, struct ncp_server, rcv.tq);
658 661
659 mutex_lock(&server->rcv.creq_mutex); 662 mutex_lock(&server->rcv.creq_mutex);
660 __ncptcp_rcv_proc(server); 663 __ncptcp_rcv_proc(server);
661 mutex_unlock(&server->rcv.creq_mutex); 664 mutex_unlock(&server->rcv.creq_mutex);
662} 665}
663 666
664void ncp_tcp_tx_proc(void *s) 667void ncp_tcp_tx_proc(struct work_struct *work)
665{ 668{
666 struct ncp_server *server = s; 669 struct ncp_server *server =
670 container_of(work, struct ncp_server, tx.tq);
667 671
668 mutex_lock(&server->rcv.creq_mutex); 672 mutex_lock(&server->rcv.creq_mutex);
669 __ncptcp_try_send(server); 673 __ncptcp_try_send(server);