Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef LINUX_UMSDOS_FS_H |
2 | #define LINUX_UMSDOS_FS_H |
||
3 | |||
4 | |||
5 | /*#define UMS_DEBUG 1 // define for check_* functions */ |
||
6 | /*#define UMSDOS_DEBUG 1*/ |
||
7 | #define UMSDOS_PARANOIA 1 |
||
8 | |||
9 | #define UMSDOS_VERSION 0 |
||
10 | #define UMSDOS_RELEASE 4 |
||
11 | |||
12 | #define UMSDOS_ROOT_INO 1 |
||
13 | |||
14 | /* This is the file acting as a directory extension */ |
||
15 | #define UMSDOS_EMD_FILE "--linux-.---" |
||
16 | #define UMSDOS_EMD_NAMELEN 12 |
||
17 | #define UMSDOS_PSDROOT_NAME "linux" |
||
18 | #define UMSDOS_PSDROOT_LEN 5 |
||
19 | |||
20 | #ifndef _LINUX_TYPES_H |
||
21 | #include <linux/types.h> |
||
22 | #endif |
||
23 | #ifndef _LINUX_LIMITS_H |
||
24 | #include <linux/limits.h> |
||
25 | #endif |
||
26 | #ifndef _LINUX_DIRENT_H |
||
27 | #include <linux/dirent.h> |
||
28 | #endif |
||
29 | #ifndef _LINUX_IOCTL_H |
||
30 | #include <linux/ioctl.h> |
||
31 | #endif |
||
32 | |||
33 | |||
34 | #ifdef __KERNEL__ |
||
35 | /* #Specification: convention / PRINTK Printk and printk |
||
36 | * Here is the convention for the use of printk inside fs/umsdos |
||
37 | * |
||
38 | * printk carry important message (error or status). |
||
39 | * Printk is for debugging (it is a macro defined at the beginning of |
||
40 | * most source. |
||
41 | * PRINTK is a nulled Printk macro. |
||
42 | * |
||
43 | * This convention makes the source easier to read, and Printk easier |
||
44 | * to shut off. |
||
45 | */ |
||
46 | # define PRINTK(x) |
||
47 | # ifdef UMSDOS_DEBUG |
||
48 | # define Printk(x) printk x |
||
49 | # else |
||
50 | # define Printk(x) |
||
51 | # endif |
||
52 | #endif /* __KERNEL__ */ |
||
53 | |||
54 | |||
55 | struct umsdos_fake_info { |
||
56 | char fname[13]; |
||
57 | int len; |
||
58 | }; |
||
59 | |||
60 | #define UMSDOS_MAXNAME 220 |
||
61 | /* This structure is 256 bytes large, depending on the name, only part */ |
||
62 | /* of it is written to disk */ |
||
63 | /* nice though it would be, I can't change this and preserve backward compatibility */ |
||
64 | struct umsdos_dirent { |
||
65 | unsigned char name_len; /* if == 0, then this entry is not used */ |
||
66 | unsigned char flags; /* UMSDOS_xxxx */ |
||
67 | unsigned short nlink; /* How many hard links point to this entry */ |
||
68 | __kernel_uid_t uid; /* Owner user id */ |
||
69 | __kernel_gid_t gid; /* Group id */ |
||
70 | time_t atime; /* Access time */ |
||
71 | time_t mtime; /* Last modification time */ |
||
72 | time_t ctime; /* Creation time */ |
||
73 | unsigned short rdev; /* major and minor of a device special file */ |
||
74 | umode_t mode; /* Standard UNIX permissions bits + type of */ |
||
75 | char spare[12]; /* unused bytes for future extensions */ |
||
76 | /* file, see linux/stat.h */ |
||
77 | char name[UMSDOS_MAXNAME]; /* Not '\0' terminated */ |
||
78 | /* but '\0' padded, so it will allow */ |
||
79 | /* for adding news fields in this record */ |
||
80 | /* by reducing the size of name[] */ |
||
81 | }; |
||
82 | |||
83 | #define UMSDOS_HIDDEN 1 /* Never show this entry in directory search */ |
||
84 | #define UMSDOS_HLINK 2 /* It is a (pseudo) hard link */ |
||
85 | |||
86 | /* #Specification: EMD file / record size |
||
87 | * Entry are 64 bytes wide in the EMD file. It allows for a 30 characters |
||
88 | * name. If a name is longer, contiguous entries are allocated. So a |
||
89 | * umsdos_dirent may span multiple records. |
||
90 | */ |
||
91 | |||
92 | #define UMSDOS_REC_SIZE 64 |
||
93 | |||
94 | /* Translation between MSDOS name and UMSDOS name */ |
||
95 | |||
96 | struct umsdos_info { |
||
97 | int msdos_reject; /* Tell if the file name is invalid for MSDOS */ |
||
98 | /* See umsdos_parse */ |
||
99 | struct umsdos_fake_info fake; |
||
100 | struct umsdos_dirent entry; |
||
101 | off_t f_pos; /* offset of the entry in the EMD file |
||
102 | * or offset where the entry may be store |
||
103 | * if it is a new entry |
||
104 | */ |
||
105 | int recsize; /* Record size needed to store entry */ |
||
106 | }; |
||
107 | |||
108 | /* Definitions for ioctl (number randomly chosen) |
||
109 | * The next ioctl commands operate only on the DOS directory |
||
110 | * The file umsdos_progs/umsdosio.c contain a string table |
||
111 | * based on the order of those definition. Keep it in sync |
||
112 | */ |
||
113 | #define UMSDOS_READDIR_DOS _IO(0x04,210) /* Do a readdir of the DOS directory */ |
||
114 | #define UMSDOS_UNLINK_DOS _IO(0x04,211) /* Erase in the DOS directory only */ |
||
115 | #define UMSDOS_RMDIR_DOS _IO(0x04,212) /* rmdir in the DOS directory only */ |
||
116 | #define UMSDOS_STAT_DOS _IO(0x04,213) /* Get info about a file */ |
||
117 | |||
118 | /* The next ioctl commands operate only on the EMD file */ |
||
119 | #define UMSDOS_CREAT_EMD _IO(0x04,214) /* Create a file */ |
||
120 | #define UMSDOS_UNLINK_EMD _IO(0x04,215) /* unlink (rmdir) a file */ |
||
121 | #define UMSDOS_READDIR_EMD _IO(0x04,216) /* read the EMD file only. */ |
||
122 | #define UMSDOS_GETVERSION _IO(0x04,217) /* Get the release number of UMSDOS */ |
||
123 | #define UMSDOS_INIT_EMD _IO(0x04,218) /* Create the EMD file if not there */ |
||
124 | #define UMSDOS_DOS_SETUP _IO(0x04,219) /* Set the defaults of the MS-DOS driver. */ |
||
125 | |||
126 | #define UMSDOS_RENAME_DOS _IO(0x04,220) /* rename a file/directory in the DOS |
||
127 | * directory only */ |
||
128 | struct umsdos_ioctl { |
||
129 | struct dirent dos_dirent; |
||
130 | struct umsdos_dirent umsdos_dirent; |
||
131 | /* The following structure is used to exchange some data with |
||
132 | * utilities (umsdos_progs/util/umsdosio.c). The first releases |
||
133 | * were using struct stat from "sys/stat.h". This was causing |
||
134 | * some problem for cross compilation of the kernel. |
||
135 | * Since I am not really using the structure stat, but only |
||
136 | * some fields of it, I have decided to replicate the structure |
||
137 | * here for compatibility with the binaries out there. |
||
138 | * FIXME PTW 1998, this has probably changed |
||
139 | */ |
||
140 | |||
141 | struct { |
||
142 | unsigned long st_dev; |
||
143 | ino_t st_ino; /* used */ |
||
144 | umode_t st_mode; /* used */ |
||
145 | nlink_t st_nlink; |
||
146 | __kernel_uid_t st_uid; |
||
147 | __kernel_gid_t st_gid; |
||
148 | unsigned long st_rdev; |
||
149 | off_t st_size; /* used */ |
||
150 | unsigned long st_blksize; |
||
151 | unsigned long st_blocks; |
||
152 | time_t st_atime; /* used */ |
||
153 | unsigned long __unused1; |
||
154 | time_t st_mtime; /* used */ |
||
155 | unsigned long __unused2; |
||
156 | time_t st_ctime; /* used */ |
||
157 | unsigned long __unused3; |
||
158 | uid_t st_uid32; |
||
159 | gid_t st_gid32; |
||
160 | } stat; |
||
161 | char version, release; |
||
162 | }; |
||
163 | |||
164 | /* Different macros to access struct umsdos_dirent */ |
||
165 | #define EDM_ENTRY_ISUSED(e) ((e)->name_len!=0) |
||
166 | |||
167 | #ifdef __KERNEL__ |
||
168 | |||
169 | #ifndef LINUX_FS_H |
||
170 | #include <linux/fs.h> |
||
171 | #endif |
||
172 | |||
173 | extern struct inode_operations umsdos_dir_inode_operations; |
||
174 | extern struct inode_operations umsdos_rdir_inode_operations; |
||
175 | extern struct file_operations umsdos_dir_operations; |
||
176 | extern struct file_operations umsdos_rdir_operations; |
||
177 | |||
178 | #include <linux/umsdos_fs.p> |
||
179 | |||
180 | #endif /* __KERNEL__ */ |
||
181 | |||
182 | #endif |