patch-2.2.7 linux/fs/ncpfs/ioctl.c
Next file: linux/fs/ncpfs/ncplib_kernel.c
Previous file: linux/fs/ncpfs/inode.c
Back to the patch index
Back to the overall index
- Lines: 86
- Date:
Tue Apr 20 15:17:20 1999
- Orig file:
v2.2.6/linux/fs/ncpfs/ioctl.c
- Orig date:
Tue Mar 17 22:18:15 1998
diff -u --recursive --new-file v2.2.6/linux/fs/ncpfs/ioctl.c linux/fs/ncpfs/ioctl.c
@@ -3,6 +3,7 @@
*
* Copyright (C) 1995, 1996 by Volker Lendecke
* Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache
+ * Modified 1998 Wolfram Pienkoss for NLS
*
*/
@@ -17,6 +18,7 @@
#include <linux/ncp.h>
#include <linux/ncp_fs.h>
+
#include "ncplib_kernel.h"
/* maximum limit for ncp_objectname_ioctl */
@@ -485,6 +487,69 @@
return 0;
}
#endif /* CONFIG_NCPFS_NDS_DOMAINS */
+
+#ifdef CONFIG_NCPFS_NLS
+/* Here we are select the iocharset and the codepage for NLS.
+ * Thanks Petr Vandrovec for idea and many hints.
+ */
+ case NCP_IOC_SETCHARSETS:
+ if ( (permission(inode, MAY_WRITE) != 0)
+ && (current->uid != server->m.mounted_uid))
+ {
+ return -EACCES;
+ }
+ if (server->root_setuped) return -EBUSY;
+ {
+ struct ncp_nls_ioctl user;
+ struct nls_table *codepage;
+ struct nls_table *iocharset;
+ struct nls_table *oldset_io;
+ struct nls_table *oldset_cp;
+
+ if (copy_from_user(&user,
+ (struct ncp_nls_ioctl*)arg,
+ sizeof(user))) return -EFAULT;
+
+ codepage = NULL;
+ if (!user.codepage[0]) {
+ codepage = load_nls_default();
+ }
+ else {
+ codepage = load_nls(user.codepage);
+ if (! codepage) {
+ return -EBADRQC;
+ }
+ }
+
+ iocharset = NULL;
+ if (user.iocharset[0] == 0) {
+ iocharset = load_nls_default();
+ }
+ else {
+ iocharset = load_nls(user.iocharset);
+ if (! iocharset) {
+ unload_nls(codepage);
+ return -EBADRQC;
+ }
+ }
+
+ oldset_cp = server->nls_vol;
+ server->nls_vol = codepage;
+ oldset_io = server->nls_io;
+ server->nls_io = iocharset;
+ server->nls_charsets = user;
+ if (oldset_cp) unload_nls(oldset_cp);
+ if (oldset_io) unload_nls(oldset_io);
+ return 0;
+ }
+
+ case NCP_IOC_GETCHARSETS: /* not tested */
+ if (copy_to_user((struct ncp_nls_ioctl*)arg,
+ &(server->nls_charsets),
+ sizeof(server->nls_charsets))) return -EFAULT;
+ return 0;
+#endif /* CONFIG_NCPFS_NLS */
+
default:
return -EINVAL;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)