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