aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/msdos_fs.h
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2008-07-25 04:46:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:34 -0400
commit4596c8aaf96e8634ca755c9f34b91420a39bebd4 (patch)
treee9ef95f9bf619dfa50c2bde1de553b32860d469c /include/linux/msdos_fs.h
parent8d44d9741f6808c107a144f469fb89e6fe7c55e3 (diff)
fat: fix VFAT_IOCTL_READDIR_xxx and cleanup for userland
"struct dirent" is a kernel type here, but is a **different type** in userspace! This means both the structure and the IOCTL number is wrong! So, this adds new "struct __fat_dirent" to generate correct IOCTL number. And kernel stuff moves to under __KERNEL__. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/msdos_fs.h')
-rw-r--r--include/linux/msdos_fs.h47
1 files changed, 27 insertions, 20 deletions
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 81cd36b735b0..5161394c7894 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -2,11 +2,11 @@
2#define _LINUX_MSDOS_FS_H 2#define _LINUX_MSDOS_FS_H
3 3
4#include <linux/magic.h> 4#include <linux/magic.h>
5#include <asm/byteorder.h>
5 6
6/* 7/*
7 * The MS-DOS filesystem constants/structures 8 * The MS-DOS filesystem constants/structures
8 */ 9 */
9#include <asm/byteorder.h>
10 10
11#define SECTOR_SIZE 512 /* sector size (bytes) */ 11#define SECTOR_SIZE 512 /* sector size (bytes) */
12#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */ 12#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */
@@ -89,24 +89,22 @@
89#define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \ 89#define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \
90 && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2) 90 && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2)
91 91
92struct __fat_dirent {
93 long d_ino;
94 __kernel_off_t d_off;
95 unsigned short d_reclen;
96 char d_name[256]; /* We must not include limits.h! */
97};
98
92/* 99/*
93 * ioctl commands 100 * ioctl commands
94 */ 101 */
95#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2]) 102#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct __fat_dirent[2])
96#define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct dirent [2]) 103#define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct __fat_dirent[2])
97/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */ 104/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */
98#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) 105#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
99#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) 106#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
100 107
101/*
102 * vfat shortname flags
103 */
104#define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */
105#define VFAT_SFN_DISPLAY_WIN95 0x0002 /* emulate win95 rule for display */
106#define VFAT_SFN_DISPLAY_WINNT 0x0004 /* emulate winnt rule for display */
107#define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */
108#define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */
109
110struct fat_boot_sector { 108struct fat_boot_sector {
111 __u8 ignored[3]; /* Boot strap short or near jump */ 109 __u8 ignored[3]; /* Boot strap short or near jump */
112 __u8 system_id[8]; /* Name - can be used to special case 110 __u8 system_id[8]; /* Name - can be used to special case
@@ -168,14 +166,6 @@ struct msdos_dir_slot {
168 __u8 name11_12[4]; /* last 2 characters in name */ 166 __u8 name11_12[4]; /* last 2 characters in name */
169}; 167};
170 168
171struct fat_slot_info {
172 loff_t i_pos; /* on-disk position of directory entry */
173 loff_t slot_off; /* offset for slot or de start */
174 int nr_slots; /* number of slots + 1(de) in filename */
175 struct msdos_dir_entry *de;
176 struct buffer_head *bh;
177};
178
179#ifdef __KERNEL__ 169#ifdef __KERNEL__
180 170
181#include <linux/buffer_head.h> 171#include <linux/buffer_head.h>
@@ -184,6 +174,15 @@ struct fat_slot_info {
184#include <linux/fs.h> 174#include <linux/fs.h>
185#include <linux/mutex.h> 175#include <linux/mutex.h>
186 176
177/*
178 * vfat shortname flags
179 */
180#define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */
181#define VFAT_SFN_DISPLAY_WIN95 0x0002 /* emulate win95 rule for display */
182#define VFAT_SFN_DISPLAY_WINNT 0x0004 /* emulate winnt rule for display */
183#define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */
184#define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */
185
187struct fat_mount_options { 186struct fat_mount_options {
188 uid_t fs_uid; 187 uid_t fs_uid;
189 gid_t fs_gid; 188 gid_t fs_gid;
@@ -267,6 +266,14 @@ struct msdos_inode_info {
267 struct inode vfs_inode; 266 struct inode vfs_inode;
268}; 267};
269 268
269struct fat_slot_info {
270 loff_t i_pos; /* on-disk position of directory entry */
271 loff_t slot_off; /* offset for slot or de start */
272 int nr_slots; /* number of slots + 1(de) in filename */
273 struct msdos_dir_entry *de;
274 struct buffer_head *bh;
275};
276
270static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb) 277static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb)
271{ 278{
272 return sb->s_fs_info; 279 return sb->s_fs_info;