1 #ifndef LINUX_UMSDOS_FS_H
2 #define LINUX_UMSDOS_FS_H
3
4 #define UMSDOS_VERSION 0
5 #define UMSDOS_RELEASE 4
6
7 /* This is the file acting as a directory extension */
8 #define UMSDOS_EMD_FILE "--linux-.---"
9 #define UMSDOS_EMD_NAMELEN 12
10 #define UMSDOS_PSDROOT_NAME "linux"
11 #define UMSDOS_PSDROOT_LEN 5
12
13 #ifndef _LINUX_TYPES_H
14 #include <linux/types.h>
15 #endif
16 #ifndef _LINUX_DIRENT_H
17 #include <linux/dirent.h>
18 #endif
19
20 struct umsdos_fake_info {
21 char fname[13];
22 int len;
23 };
24
25 #define UMSDOS_MAXNAME 220
26 /* This structure is 256 bytes large, depending on the name, only part */
27 /* of it is written to disk */
28 struct umsdos_dirent {
29 unsigned char name_len; /* if == 0, then this entry is not used */
30 unsigned char flags; /* UMSDOS_xxxx */
31 unsigned short nlink; /* How many hard links point to this entry */
32 uid_t uid; /* Owner user id */
33 gid_t gid; /* Group id */
34 time_t atime; /* Access time */
35 time_t mtime; /* Last modification time */
36 time_t ctime; /* Creation time */
37 dev_t rdev; /* major and minor number of a device */
38 /* special file */
39 umode_t mode; /* Standard UNIX permissions bits + type of */
40 char spare[12]; /* unused bytes for future extensions */
41 /* file, see linux/stat.h */
42 char name[UMSDOS_MAXNAME]; /* Not '\0' terminated */
43 /* but '\0' padded, so it will allow */
44 /* for adding news fields in this record */
45 /* by reducing the size of name[] */
46 };
47 #define UMSDOS_HIDDEN 1 /* Never show this entry in directory search */
48 #define UMSDOS_HLINK 2 /* It is a (pseudo) hard link */
49
50 /* #Specification: EMD file / record size
51 Entry are 64 bytes wide in the EMD file. It allows for a 30 characters
52 name. If a name is longer, contiguous entries are allocated. So a
53 umsdos_dirent may span multiple records.
54 */
55 #define UMSDOS_REC_SIZE 64
56
57 /* Translation between MSDOS name and UMSDOS name */
58 struct umsdos_info{
59 int msdos_reject; /* Tell if the file name is invalid for MSDOS */
60 /* See umsdos_parse */
61 struct umsdos_fake_info fake;
62 struct umsdos_dirent entry;
63 off_t f_pos; /* offset of the entry in the EMD file */
64 /* or offset where the entry may be store */
65 /* if it is a new entry */
66 int recsize; /* Record size needed to store entry */
67 };
68
69 /* Definitions for ioctl (number randomly chosen) */
70 /* The next ioctl commands operate only on the DOS directory */
71 /* The file umsdos_progs/umsdosio.c contain a string table */
72 /* based on the order of those definition. Keep it in sync */
73 #define UMSDOS_READDIR_DOS 1234 /* Do a readdir of the DOS directory */
74 #define UMSDOS_UNLINK_DOS 1235 /* Erase in the DOS directory only */
75 #define UMSDOS_RMDIR_DOS 1236 /* rmdir in the DOS directory only */
76 #define UMSDOS_STAT_DOS 1237 /* Get info about a file */
77 /* The next ioctl commands operate only on the EMD file */
78 #define UMSDOS_CREAT_EMD 1238 /* Create a file */
79 #define UMSDOS_UNLINK_EMD 1239 /* unlink (rmdir) a file */
80 #define UMSDOS_READDIR_EMD 1240 /* read the EMD file only. */
81 #define UMSDOS_GETVERSION 1241 /* Get the release number of UMSDOS */
82 #define UMSDOS_INIT_EMD 1242 /* Create the EMD file if not there */
83 #define UMSDOS_DOS_SETUP 1243 /* Set the defaults of the MsDOS driver */
84
85 #define UMSDOS_RENAME_DOS 1244 /* rename a file/directory in the DOS */
86 /* directory only */
87 struct umsdos_ioctl{
88 struct dirent dos_dirent;
89 struct umsdos_dirent umsdos_dirent;
90 /* The following structure is used to exchange some data */
91 /* with utilities (umsdos_progs/util/umsdosio.c). The first */
92 /* releases were using struct stat from "sys/stat.h". This was */
93 /* causing some problem for cross compilation of the kernel */
94 /* Since I am not really using the structure stat, but only some field */
95 /* of it, I have decided to replicate the structure here */
96 /* for compatibility with the binaries out there */
97 struct {
98 dev_t st_dev;
99 unsigned short __pad1;
100 ino_t st_ino;
101 umode_t st_mode;
102 nlink_t st_nlink;
103 uid_t st_uid;
104 gid_t st_gid;
105 dev_t st_rdev;
106 unsigned short __pad2;
107 off_t st_size;
108 unsigned long st_blksize;
109 unsigned long st_blocks;
110 time_t st_atime;
111 unsigned long __unused1;
112 time_t st_mtime;
113 unsigned long __unused2;
114 time_t st_ctime;
115 unsigned long __unused3;
116 unsigned long __unused4;
117 unsigned long __unused5;
118 }stat;
119 char version,release;
120 };
121
122 /* Different macros to access struct umsdos_dirent */
123 #define EDM_ENTRY_ISUSED(e) ((e)->name_len!=0)
124
125 #ifdef __KERNEL__
126
127 #ifndef LINUX_FS_H
128 #include <linux/fs.h>
129 #endif
130
131 extern struct inode_operations umsdos_dir_inode_operations;
132 extern struct file_operations umsdos_file_operations;
133 extern struct inode_operations umsdos_file_inode_operations;
134 extern struct inode_operations umsdos_file_inode_operations_no_bmap;
135 extern struct inode_operations umsdos_symlink_inode_operations;
136
137 #include <linux/umsdos_fs.p>
138
139 #endif /* __KERNEL__ */
140
141 #endif