|
@@ -19,6 +19,7 @@
|
|
|
#include <linux/buffer_head.h>
|
|
|
#include <linux/compat.h>
|
|
|
#include <asm/uaccess.h>
|
|
|
+#include <linux/kernel.h>
|
|
|
#include "fat.h"
|
|
|
|
|
|
/*
|
|
@@ -140,28 +141,22 @@ static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len,
|
|
|
{
|
|
|
const wchar_t *ip;
|
|
|
wchar_t ec;
|
|
|
- unsigned char *op, nc;
|
|
|
+ unsigned char *op;
|
|
|
int charlen;
|
|
|
- int k;
|
|
|
|
|
|
ip = uni;
|
|
|
op = ascii;
|
|
|
|
|
|
while (*ip && ((len - NLS_MAX_CHARSET_SIZE) > 0)) {
|
|
|
ec = *ip++;
|
|
|
- if ( (charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {
|
|
|
+ if ((charlen = nls->uni2char(ec, op, NLS_MAX_CHARSET_SIZE)) > 0) {
|
|
|
op += charlen;
|
|
|
len -= charlen;
|
|
|
} else {
|
|
|
if (uni_xlate == 1) {
|
|
|
- *op = ':';
|
|
|
- for (k = 4; k > 0; k--) {
|
|
|
- nc = ec & 0xF;
|
|
|
- op[k] = nc > 9 ? nc + ('a' - 10)
|
|
|
- : nc + '0';
|
|
|
- ec >>= 4;
|
|
|
- }
|
|
|
- op += 5;
|
|
|
+ *op++ = ':';
|
|
|
+ op = pack_hex_byte(op, ec >> 8);
|
|
|
+ op = pack_hex_byte(op, ec);
|
|
|
len -= 5;
|
|
|
} else {
|
|
|
*op++ = '?';
|
|
@@ -758,9 +753,10 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *filp,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static int fat_dir_ioctl(struct inode *inode, struct file *filp,
|
|
|
- unsigned int cmd, unsigned long arg)
|
|
|
+static long fat_dir_ioctl(struct file *filp, unsigned int cmd,
|
|
|
+ unsigned long arg)
|
|
|
{
|
|
|
+ struct inode *inode = filp->f_path.dentry->d_inode;
|
|
|
struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg;
|
|
|
int short_only, both;
|
|
|
|
|
@@ -774,7 +770,7 @@ static int fat_dir_ioctl(struct inode *inode, struct file *filp,
|
|
|
both = 1;
|
|
|
break;
|
|
|
default:
|
|
|
- return fat_generic_ioctl(inode, filp, cmd, arg);
|
|
|
+ return fat_generic_ioctl(filp, cmd, arg);
|
|
|
}
|
|
|
|
|
|
if (!access_ok(VERIFY_WRITE, d1, sizeof(struct __fat_dirent[2])))
|
|
@@ -814,7 +810,7 @@ static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd,
|
|
|
both = 1;
|
|
|
break;
|
|
|
default:
|
|
|
- return -ENOIOCTLCMD;
|
|
|
+ return fat_generic_ioctl(filp, cmd, (unsigned long)arg);
|
|
|
}
|
|
|
|
|
|
if (!access_ok(VERIFY_WRITE, d1, sizeof(struct compat_dirent[2])))
|
|
@@ -836,7 +832,7 @@ const struct file_operations fat_dir_operations = {
|
|
|
.llseek = generic_file_llseek,
|
|
|
.read = generic_read_dir,
|
|
|
.readdir = fat_readdir,
|
|
|
- .ioctl = fat_dir_ioctl,
|
|
|
+ .unlocked_ioctl = fat_dir_ioctl,
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
.compat_ioctl = fat_compat_dir_ioctl,
|
|
|
#endif
|