4 * Copyright (C) 1995, 1996 by Volker Lendecke
5 * Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache
6 * Modified 1998, 1999 Wolfram Pienkoss for NLS
10 #include <linux/capability.h>
11 #include <linux/compat.h>
12 #include <linux/errno.h>
14 #include <linux/ioctl.h>
15 #include <linux/time.h>
17 #include <linux/mount.h>
18 #include <linux/slab.h>
19 #include <linux/highuid.h>
20 #include <linux/smp_lock.h>
21 #include <linux/vmalloc.h>
22 #include <linux/sched.h>
24 #include <linux/ncp_fs.h>
26 #include <asm/uaccess.h>
28 #include "ncplib_kernel.h"
30 /* maximum limit for ncp_objectname_ioctl */
31 #define NCP_OBJECT_NAME_MAX_LEN 4096
32 /* maximum limit for ncp_privatedata_ioctl */
33 #define NCP_PRIVATE_DATA_MAX_LEN 8192
34 /* maximum negotiable packet size */
35 #define NCP_PACKET_SIZE_INTERNAL 65536
38 ncp_get_fs_info(struct ncp_server
* server
, struct file
*file
,
39 struct ncp_fs_info __user
*arg
)
41 struct inode
*inode
= file
->f_path
.dentry
->d_inode
;
42 struct ncp_fs_info info
;
44 if (file_permission(file
, MAY_WRITE
) != 0
45 && current_uid() != server
->m
.mounted_uid
)
48 if (copy_from_user(&info
, arg
, sizeof(info
)))
51 if (info
.version
!= NCP_GET_FS_INFO_VERSION
) {
52 DPRINTK("info.version invalid: %d\n", info
.version
);
55 /* TODO: info.addr = server->m.serv_addr; */
56 SET_UID(info
.mounted_uid
, server
->m
.mounted_uid
);
57 info
.connection
= server
->connection
;
58 info
.buffer_size
= server
->buffer_size
;
59 info
.volume_number
= NCP_FINFO(inode
)->volNumber
;
60 info
.directory_id
= NCP_FINFO(inode
)->DosDirNum
;
62 if (copy_to_user(arg
, &info
, sizeof(info
)))
68 ncp_get_fs_info_v2(struct ncp_server
* server
, struct file
*file
,
69 struct ncp_fs_info_v2 __user
* arg
)
71 struct inode
*inode
= file
->f_path
.dentry
->d_inode
;
72 struct ncp_fs_info_v2 info2
;
74 if (file_permission(file
, MAY_WRITE
) != 0
75 && current_uid() != server
->m
.mounted_uid
)
78 if (copy_from_user(&info2
, arg
, sizeof(info2
)))
81 if (info2
.version
!= NCP_GET_FS_INFO_VERSION_V2
) {
82 DPRINTK("info.version invalid: %d\n", info2
.version
);
85 info2
.mounted_uid
= server
->m
.mounted_uid
;
86 info2
.connection
= server
->connection
;
87 info2
.buffer_size
= server
->buffer_size
;
88 info2
.volume_number
= NCP_FINFO(inode
)->volNumber
;
89 info2
.directory_id
= NCP_FINFO(inode
)->DosDirNum
;
90 info2
.dummy1
= info2
.dummy2
= info2
.dummy3
= 0;
92 if (copy_to_user(arg
, &info2
, sizeof(info2
)))
98 struct compat_ncp_objectname_ioctl
102 compat_caddr_t object_name
; /* a userspace data, in most cases user name */
105 struct compat_ncp_fs_info_v2
{
119 struct compat_ncp_ioctl_request
{
125 struct compat_ncp_privatedata_ioctl
128 compat_caddr_t data
; /* ~1000 for NDS */
131 #define NCP_IOC_GET_FS_INFO_V2_32 _IOWR('n', 4, struct compat_ncp_fs_info_v2)
132 #define NCP_IOC_NCPREQUEST_32 _IOR('n', 1, struct compat_ncp_ioctl_request)
133 #define NCP_IOC_GETOBJECTNAME_32 _IOWR('n', 9, struct compat_ncp_objectname_ioctl)
134 #define NCP_IOC_SETOBJECTNAME_32 _IOR('n', 9, struct compat_ncp_objectname_ioctl)
135 #define NCP_IOC_GETPRIVATEDATA_32 _IOWR('n', 10, struct compat_ncp_privatedata_ioctl)
136 #define NCP_IOC_SETPRIVATEDATA_32 _IOR('n', 10, struct compat_ncp_privatedata_ioctl)
139 ncp_get_compat_fs_info_v2(struct ncp_server
* server
, struct file
*file
,
140 struct compat_ncp_fs_info_v2 __user
* arg
)
142 struct inode
*inode
= file
->f_path
.dentry
->d_inode
;
143 struct compat_ncp_fs_info_v2 info2
;
145 if (file_permission(file
, MAY_WRITE
) != 0
146 && current_uid() != server
->m
.mounted_uid
)
149 if (copy_from_user(&info2
, arg
, sizeof(info2
)))
152 if (info2
.version
!= NCP_GET_FS_INFO_VERSION_V2
) {
153 DPRINTK("info.version invalid: %d\n", info2
.version
);
156 info2
.mounted_uid
= server
->m
.mounted_uid
;
157 info2
.connection
= server
->connection
;
158 info2
.buffer_size
= server
->buffer_size
;
159 info2
.volume_number
= NCP_FINFO(inode
)->volNumber
;
160 info2
.directory_id
= NCP_FINFO(inode
)->DosDirNum
;
161 info2
.dummy1
= info2
.dummy2
= info2
.dummy3
= 0;
163 if (copy_to_user(arg
, &info2
, sizeof(info2
)))
169 #define NCP_IOC_GETMOUNTUID16 _IOW('n', 2, u16)
170 #define NCP_IOC_GETMOUNTUID32 _IOW('n', 2, u32)
171 #define NCP_IOC_GETMOUNTUID64 _IOW('n', 2, u64)
173 #ifdef CONFIG_NCPFS_NLS
174 /* Here we are select the iocharset and the codepage for NLS.
175 * Thanks Petr Vandrovec for idea and many hints.
178 ncp_set_charsets(struct ncp_server
* server
, struct ncp_nls_ioctl __user
*arg
)
180 struct ncp_nls_ioctl user
;
181 struct nls_table
*codepage
;
182 struct nls_table
*iocharset
;
183 struct nls_table
*oldset_io
;
184 struct nls_table
*oldset_cp
;
186 if (!capable(CAP_SYS_ADMIN
))
188 if (server
->root_setuped
)
191 if (copy_from_user(&user
, arg
, sizeof(user
)))
195 user
.codepage
[NCP_IOCSNAME_LEN
] = 0;
196 if (!user
.codepage
[0] || !strcmp(user
.codepage
, "default"))
197 codepage
= load_nls_default();
199 codepage
= load_nls(user
.codepage
);
206 user
.iocharset
[NCP_IOCSNAME_LEN
] = 0;
207 if (!user
.iocharset
[0] || !strcmp(user
.iocharset
, "default")) {
208 iocharset
= load_nls_default();
209 NCP_CLR_FLAG(server
, NCP_FLAG_UTF8
);
210 } else if (!strcmp(user
.iocharset
, "utf8")) {
211 iocharset
= load_nls_default();
212 NCP_SET_FLAG(server
, NCP_FLAG_UTF8
);
214 iocharset
= load_nls(user
.iocharset
);
216 unload_nls(codepage
);
219 NCP_CLR_FLAG(server
, NCP_FLAG_UTF8
);
222 oldset_cp
= server
->nls_vol
;
223 server
->nls_vol
= codepage
;
224 oldset_io
= server
->nls_io
;
225 server
->nls_io
= iocharset
;
227 unload_nls(oldset_cp
);
228 unload_nls(oldset_io
);
234 ncp_get_charsets(struct ncp_server
* server
, struct ncp_nls_ioctl __user
*arg
)
236 struct ncp_nls_ioctl user
;
239 memset(&user
, 0, sizeof(user
));
240 if (server
->nls_vol
&& server
->nls_vol
->charset
) {
241 len
= strlen(server
->nls_vol
->charset
);
242 if (len
> NCP_IOCSNAME_LEN
)
243 len
= NCP_IOCSNAME_LEN
;
244 strncpy(user
.codepage
, server
->nls_vol
->charset
, len
);
245 user
.codepage
[len
] = 0;
248 if (NCP_IS_FLAG(server
, NCP_FLAG_UTF8
))
249 strcpy(user
.iocharset
, "utf8");
250 else if (server
->nls_io
&& server
->nls_io
->charset
) {
251 len
= strlen(server
->nls_io
->charset
);
252 if (len
> NCP_IOCSNAME_LEN
)
253 len
= NCP_IOCSNAME_LEN
;
254 strncpy(user
.iocharset
, server
->nls_io
->charset
, len
);
255 user
.iocharset
[len
] = 0;
258 if (copy_to_user(arg
, &user
, sizeof(user
)))
262 #endif /* CONFIG_NCPFS_NLS */
264 static long __ncp_ioctl(struct file
*filp
, unsigned int cmd
, unsigned long arg
)
266 struct inode
*inode
= filp
->f_dentry
->d_inode
;
267 struct ncp_server
*server
= NCP_SERVER(inode
);
269 struct ncp_ioctl_request request
;
271 void __user
*argp
= (void __user
*)arg
;
272 uid_t uid
= current_uid();
276 case NCP_IOC_NCPREQUEST_32
:
278 case NCP_IOC_NCPREQUEST
:
279 if (file_permission(filp
, MAY_WRITE
) != 0
280 && uid
!= server
->m
.mounted_uid
)
284 if (cmd
== NCP_IOC_NCPREQUEST_32
) {
285 struct compat_ncp_ioctl_request request32
;
286 if (copy_from_user(&request32
, argp
, sizeof(request32
)))
288 request
.function
= request32
.function
;
289 request
.size
= request32
.size
;
290 request
.data
= compat_ptr(request32
.data
);
293 if (copy_from_user(&request
, argp
, sizeof(request
)))
296 if ((request
.function
> 255)
298 NCP_PACKET_SIZE
- sizeof(struct ncp_request_header
))) {
301 bouncebuffer
= vmalloc(NCP_PACKET_SIZE_INTERNAL
);
304 if (copy_from_user(bouncebuffer
, request
.data
, request
.size
)) {
308 ncp_lock_server(server
);
310 /* FIXME: We hack around in the server's structures
311 here to be able to use ncp_request */
313 server
->has_subfunction
= 0;
314 server
->current_size
= request
.size
;
315 memcpy(server
->packet
, bouncebuffer
, request
.size
);
317 result
= ncp_request2(server
, request
.function
,
318 bouncebuffer
, NCP_PACKET_SIZE_INTERNAL
);
322 result
= server
->reply_size
;
323 ncp_unlock_server(server
);
324 DPRINTK("ncp_ioctl: copy %d bytes\n",
327 if (copy_to_user(request
.data
, bouncebuffer
, result
))
332 case NCP_IOC_CONN_LOGGED_IN
:
334 if (!capable(CAP_SYS_ADMIN
))
336 if (!(server
->m
.int_flags
& NCP_IMOUNT_LOGGEDIN_POSSIBLE
))
338 if (server
->root_setuped
)
340 server
->root_setuped
= 1;
341 return ncp_conn_logged_in(inode
->i_sb
);
343 case NCP_IOC_GET_FS_INFO
:
344 return ncp_get_fs_info(server
, filp
, argp
);
346 case NCP_IOC_GET_FS_INFO_V2
:
347 return ncp_get_fs_info_v2(server
, filp
, argp
);
350 case NCP_IOC_GET_FS_INFO_V2_32
:
351 return ncp_get_compat_fs_info_v2(server
, filp
, argp
);
353 /* we have too many combinations of CONFIG_COMPAT,
354 * CONFIG_64BIT and CONFIG_UID16, so just handle
355 * any of the possible ioctls */
356 case NCP_IOC_GETMOUNTUID16
:
357 case NCP_IOC_GETMOUNTUID32
:
358 case NCP_IOC_GETMOUNTUID64
:
359 if (file_permission(filp
, MAY_READ
) != 0
360 && uid
!= server
->m
.mounted_uid
)
363 if (cmd
== NCP_IOC_GETMOUNTUID16
) {
365 SET_UID(uid
, server
->m
.mounted_uid
);
366 if (put_user(uid
, (u16 __user
*)argp
))
368 } else if (cmd
== NCP_IOC_GETMOUNTUID32
) {
369 if (put_user(server
->m
.mounted_uid
,
373 if (put_user(server
->m
.mounted_uid
,
379 case NCP_IOC_GETROOT
:
381 struct ncp_setroot_ioctl sr
;
383 if (file_permission(filp
, MAY_READ
) != 0
384 && uid
!= server
->m
.mounted_uid
)
387 if (server
->m
.mounted_vol
[0]) {
388 struct dentry
* dentry
= inode
->i_sb
->s_root
;
391 struct inode
* s_inode
= dentry
->d_inode
;
394 sr
.volNumber
= NCP_FINFO(s_inode
)->volNumber
;
395 sr
.dirEntNum
= NCP_FINFO(s_inode
)->dirEntNum
;
396 sr
.namespace = server
->name_space
[sr
.volNumber
];
398 DPRINTK("ncpfs: s_root->d_inode==NULL\n");
400 DPRINTK("ncpfs: s_root==NULL\n");
406 if (copy_to_user(argp
, &sr
, sizeof(sr
)))
411 case NCP_IOC_SETROOT
:
413 struct ncp_setroot_ioctl sr
;
417 struct dentry
* dentry
;
419 if (!capable(CAP_SYS_ADMIN
))
423 if (server
->root_setuped
) return -EBUSY
;
424 if (copy_from_user(&sr
, argp
, sizeof(sr
)))
426 if (sr
.volNumber
< 0) {
427 server
->m
.mounted_vol
[0] = 0;
428 vnum
= NCP_NUMBER_OF_VOLUMES
;
431 } else if (sr
.volNumber
>= NCP_NUMBER_OF_VOLUMES
) {
433 } else if (ncp_mount_subdir(server
, sr
.volNumber
,
434 sr
.namespace, sr
.dirEntNum
,
435 &vnum
, &de
, &dosde
)) {
439 dentry
= inode
->i_sb
->s_root
;
440 server
->root_setuped
= 1;
442 struct inode
* s_inode
= dentry
->d_inode
;
445 NCP_FINFO(s_inode
)->volNumber
= vnum
;
446 NCP_FINFO(s_inode
)->dirEntNum
= de
;
447 NCP_FINFO(s_inode
)->DosDirNum
= dosde
;
449 DPRINTK("ncpfs: s_root->d_inode==NULL\n");
451 DPRINTK("ncpfs: s_root==NULL\n");
456 #ifdef CONFIG_NCPFS_PACKET_SIGNING
457 case NCP_IOC_SIGN_INIT
:
458 if (file_permission(filp
, MAY_WRITE
) != 0
459 && uid
!= server
->m
.mounted_uid
)
463 if (server
->sign_wanted
)
465 struct ncp_sign_init sign
;
467 if (copy_from_user(&sign
, argp
, sizeof(sign
)))
469 memcpy(server
->sign_root
,sign
.sign_root
,8);
470 memcpy(server
->sign_last
,sign
.sign_last
,16);
471 server
->sign_active
= 1;
473 /* ignore when signatures not wanted */
475 server
->sign_active
= 0;
479 case NCP_IOC_SIGN_WANTED
:
480 if (file_permission(filp
, MAY_READ
) != 0
481 && uid
!= server
->m
.mounted_uid
)
484 if (put_user(server
->sign_wanted
, (int __user
*)argp
))
488 case NCP_IOC_SET_SIGN_WANTED
:
492 if (file_permission(filp
, MAY_WRITE
) != 0
493 && uid
!= server
->m
.mounted_uid
)
496 /* get only low 8 bits... */
497 if (get_user(newstate
, (unsigned char __user
*)argp
))
499 if (server
->sign_active
) {
500 /* cannot turn signatures OFF when active */
501 if (!newstate
) return -EINVAL
;
503 server
->sign_wanted
= newstate
!= 0;
508 #endif /* CONFIG_NCPFS_PACKET_SIGNING */
510 #ifdef CONFIG_NCPFS_IOCTL_LOCKING
511 case NCP_IOC_LOCKUNLOCK
:
512 if (file_permission(filp
, MAY_WRITE
) != 0
513 && uid
!= server
->m
.mounted_uid
)
517 struct ncp_lock_ioctl rqdata
;
519 if (copy_from_user(&rqdata
, argp
, sizeof(rqdata
)))
521 if (rqdata
.origin
!= 0)
524 switch (rqdata
.cmd
) {
527 if (rqdata
.timeout
== 0)
528 rqdata
.timeout
= NCP_LOCK_DEFAULT_TIMEOUT
;
529 else if (rqdata
.timeout
> NCP_LOCK_MAX_TIMEOUT
)
530 rqdata
.timeout
= NCP_LOCK_MAX_TIMEOUT
;
533 rqdata
.timeout
= NCP_LOCK_DEFAULT_TIMEOUT
; /* has no effect */
539 /* locking needs both read and write access */
540 if ((result
= ncp_make_open(inode
, O_RDWR
)) != 0)
545 if (!ncp_conn_valid(server
))
548 if (!S_ISREG(inode
->i_mode
))
550 if (rqdata
.cmd
== NCP_LOCK_CLEAR
)
552 result
= ncp_ClearPhysicalRecord(NCP_SERVER(inode
),
553 NCP_FINFO(inode
)->file_handle
,
556 if (result
> 0) result
= 0; /* no such lock */
564 case NCP_LOCK_EX
: lockcmd
=1; break;
565 case NCP_LOCK_SH
: lockcmd
=3; break;
566 default: lockcmd
=0; break;
568 result
= ncp_LogPhysicalRecord(NCP_SERVER(inode
),
569 NCP_FINFO(inode
)->file_handle
,
574 if (result
> 0) result
= -EAGAIN
;
577 ncp_inode_close(inode
);
580 #endif /* CONFIG_NCPFS_IOCTL_LOCKING */
583 case NCP_IOC_GETOBJECTNAME_32
:
584 if (uid
!= server
->m
.mounted_uid
)
587 struct compat_ncp_objectname_ioctl user
;
590 if (copy_from_user(&user
, argp
, sizeof(user
)))
592 user
.auth_type
= server
->auth
.auth_type
;
593 outl
= user
.object_name_len
;
594 user
.object_name_len
= server
->auth
.object_name_len
;
595 if (outl
> user
.object_name_len
)
596 outl
= user
.object_name_len
;
598 if (copy_to_user(compat_ptr(user
.object_name
),
599 server
->auth
.object_name
,
600 outl
)) return -EFAULT
;
602 if (copy_to_user(argp
, &user
, sizeof(user
)))
608 case NCP_IOC_GETOBJECTNAME
:
609 if (uid
!= server
->m
.mounted_uid
)
612 struct ncp_objectname_ioctl user
;
615 if (copy_from_user(&user
, argp
, sizeof(user
)))
617 user
.auth_type
= server
->auth
.auth_type
;
618 outl
= user
.object_name_len
;
619 user
.object_name_len
= server
->auth
.object_name_len
;
620 if (outl
> user
.object_name_len
)
621 outl
= user
.object_name_len
;
623 if (copy_to_user(user
.object_name
,
624 server
->auth
.object_name
,
625 outl
)) return -EFAULT
;
627 if (copy_to_user(argp
, &user
, sizeof(user
)))
633 case NCP_IOC_SETOBJECTNAME_32
:
635 case NCP_IOC_SETOBJECTNAME
:
636 if (uid
!= server
->m
.mounted_uid
)
639 struct ncp_objectname_ioctl user
;
644 size_t oldprivatelen
;
647 if (cmd
== NCP_IOC_SETOBJECTNAME_32
) {
648 struct compat_ncp_objectname_ioctl user32
;
649 if (copy_from_user(&user32
, argp
, sizeof(user32
)))
651 user
.auth_type
= user32
.auth_type
;
652 user
.object_name_len
= user32
.object_name_len
;
653 user
.object_name
= compat_ptr(user32
.object_name
);
656 if (copy_from_user(&user
, argp
, sizeof(user
)))
659 if (user
.object_name_len
> NCP_OBJECT_NAME_MAX_LEN
)
661 if (user
.object_name_len
) {
662 newname
= memdup_user(user
.object_name
,
663 user
.object_name_len
);
665 return PTR_ERR(newname
);
669 /* enter critical section */
670 /* maybe that kfree can sleep so do that this way */
671 /* it is at least more SMP friendly (in future...) */
672 oldname
= server
->auth
.object_name
;
673 oldnamelen
= server
->auth
.object_name_len
;
674 oldprivate
= server
->priv
.data
;
675 oldprivatelen
= server
->priv
.len
;
676 server
->auth
.auth_type
= user
.auth_type
;
677 server
->auth
.object_name_len
= user
.object_name_len
;
678 server
->auth
.object_name
= newname
;
679 server
->priv
.len
= 0;
680 server
->priv
.data
= NULL
;
681 /* leave critical section */
688 case NCP_IOC_GETPRIVATEDATA_32
:
690 case NCP_IOC_GETPRIVATEDATA
:
691 if (uid
!= server
->m
.mounted_uid
)
694 struct ncp_privatedata_ioctl user
;
698 if (cmd
== NCP_IOC_GETPRIVATEDATA_32
) {
699 struct compat_ncp_privatedata_ioctl user32
;
700 if (copy_from_user(&user32
, argp
, sizeof(user32
)))
702 user
.len
= user32
.len
;
703 user
.data
= compat_ptr(user32
.data
);
706 if (copy_from_user(&user
, argp
, sizeof(user
)))
710 user
.len
= server
->priv
.len
;
711 if (outl
> user
.len
) outl
= user
.len
;
713 if (copy_to_user(user
.data
,
715 outl
)) return -EFAULT
;
718 if (cmd
== NCP_IOC_GETPRIVATEDATA_32
) {
719 struct compat_ncp_privatedata_ioctl user32
;
720 user32
.len
= user
.len
;
721 user32
.data
= (unsigned long) user
.data
;
722 if (copy_to_user(argp
, &user32
, sizeof(user32
)))
726 if (copy_to_user(argp
, &user
, sizeof(user
)))
733 case NCP_IOC_SETPRIVATEDATA_32
:
735 case NCP_IOC_SETPRIVATEDATA
:
736 if (uid
!= server
->m
.mounted_uid
)
739 struct ncp_privatedata_ioctl user
;
745 if (cmd
== NCP_IOC_SETPRIVATEDATA_32
) {
746 struct compat_ncp_privatedata_ioctl user32
;
747 if (copy_from_user(&user32
, argp
, sizeof(user32
)))
749 user
.len
= user32
.len
;
750 user
.data
= compat_ptr(user32
.data
);
753 if (copy_from_user(&user
, argp
, sizeof(user
)))
756 if (user
.len
> NCP_PRIVATE_DATA_MAX_LEN
)
759 new = memdup_user(user
.data
, user
.len
);
765 /* enter critical section */
766 old
= server
->priv
.data
;
767 oldlen
= server
->priv
.len
;
768 server
->priv
.len
= user
.len
;
769 server
->priv
.data
= new;
770 /* leave critical section */
775 #ifdef CONFIG_NCPFS_NLS
776 case NCP_IOC_SETCHARSETS
:
777 return ncp_set_charsets(server
, argp
);
779 case NCP_IOC_GETCHARSETS
:
780 return ncp_get_charsets(server
, argp
);
782 #endif /* CONFIG_NCPFS_NLS */
784 case NCP_IOC_SETDENTRYTTL
:
785 if (file_permission(filp
, MAY_WRITE
) != 0 &&
786 uid
!= server
->m
.mounted_uid
)
792 if (copy_from_user(&user
, argp
, sizeof(user
)))
794 /* 20 secs at most... */
797 user
= (user
* HZ
) / 1000;
798 server
->dentry_ttl
= user
;
802 case NCP_IOC_GETDENTRYTTL
:
804 u_int32_t user
= (server
->dentry_ttl
* 1000) / HZ
;
805 if (copy_to_user(argp
, &user
, sizeof(user
)))
814 static int ncp_ioctl_need_write(unsigned int cmd
)
817 case NCP_IOC_GET_FS_INFO
:
818 case NCP_IOC_GET_FS_INFO_V2
:
819 case NCP_IOC_NCPREQUEST
:
820 case NCP_IOC_SETDENTRYTTL
:
821 case NCP_IOC_SIGN_INIT
:
822 case NCP_IOC_LOCKUNLOCK
:
823 case NCP_IOC_SET_SIGN_WANTED
:
825 case NCP_IOC_GETOBJECTNAME
:
826 case NCP_IOC_SETOBJECTNAME
:
827 case NCP_IOC_GETPRIVATEDATA
:
828 case NCP_IOC_SETPRIVATEDATA
:
829 case NCP_IOC_SETCHARSETS
:
830 case NCP_IOC_GETCHARSETS
:
831 case NCP_IOC_CONN_LOGGED_IN
:
832 case NCP_IOC_GETDENTRYTTL
:
833 case NCP_IOC_GETMOUNTUID2
:
834 case NCP_IOC_SIGN_WANTED
:
835 case NCP_IOC_GETROOT
:
836 case NCP_IOC_SETROOT
:
839 /* unknown IOCTL command, assume write */
844 long ncp_ioctl(struct file
*filp
, unsigned int cmd
, unsigned long arg
)
849 if (ncp_ioctl_need_write(cmd
)) {
851 * inside the ioctl(), any failures which
852 * are because of file_permission() are
853 * -EACCESS, so it seems consistent to keep
856 if (mnt_want_write(filp
->f_path
.mnt
)) {
861 ret
= __ncp_ioctl(filp
, cmd
, arg
);
862 if (ncp_ioctl_need_write(cmd
))
863 mnt_drop_write(filp
->f_path
.mnt
);
871 long ncp_compat_ioctl(struct file
*file
, unsigned int cmd
, unsigned long arg
)
876 arg
= (unsigned long) compat_ptr(arg
);
877 ret
= ncp_ioctl(file
, cmd
, arg
);