1 #ifndef LINUX_UMSDOS_FS_H
2 #define LINUX_UMSDOS_FS_H
5 #define UMS_DEBUG 1 /* define for check_* functions */
6 /*#define UMSDOS_DEBUG 1*/
7 #define UMSDOS_PARANOIA 1
9 #define UMSDOS_VERSION 0
10 #define UMSDOS_RELEASE 4
12 #define UMSDOS_ROOT_INO 1
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
20 #ifndef _LINUX_TYPES_H
21 #include <linux/types.h>
23 #ifndef _LINUX_LIMITS_H
24 #include <linux/limits.h>
26 #ifndef _LINUX_DIRENT_H
27 #include <linux/dirent.h>
29 #ifndef _LINUX_IOCTL_H
30 #include <linux/ioctl.h>
35 /* #Specification: convention / PRINTK Printk and printk
36 * Here is the convention for the use of printk inside fs/umsdos
38 * printk carry important message (error or status).
39 * Printk is for debugging (it is a macro defined at the beginning of
41 * PRINTK is a nulled Printk macro.
43 * This convention makes the source easier to read, and Printk easier
48 # define Printk(x) printk x
55 struct umsdos_fake_info
{
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 uid_t uid
; /* Owner user id */
69 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 dev_t rdev
; /* major and minor number of a device */
75 umode_t mode
; /* Standard UNIX permissions bits + type of */
76 char spare
[12]; /* unused bytes for future extensions */
77 /* file, see linux/stat.h */
78 char name
[UMSDOS_MAXNAME
]; /* Not '\0' terminated */
79 /* but '\0' padded, so it will allow */
80 /* for adding news fields in this record */
81 /* by reducing the size of name[] */
84 #define UMSDOS_HIDDEN 1 /* Never show this entry in directory search */
85 #define UMSDOS_HLINK 2 /* It is a (pseudo) hard link */
87 /* #Specification: EMD file / record size
88 * Entry are 64 bytes wide in the EMD file. It allows for a 30 characters
89 * name. If a name is longer, contiguous entries are allocated. So a
90 * umsdos_dirent may span multiple records.
93 #define UMSDOS_REC_SIZE 64
95 /* Translation between MSDOS name and UMSDOS name */
98 int msdos_reject
; /* Tell if the file name is invalid for MSDOS */
99 /* See umsdos_parse */
100 struct umsdos_fake_info fake
;
101 struct umsdos_dirent entry
;
102 off_t f_pos
; /* offset of the entry in the EMD file
103 * or offset where the entry may be store
104 * if it is a new entry
106 int recsize
; /* Record size needed to store entry */
109 /* Definitions for ioctl (number randomly chosen)
110 * The next ioctl commands operate only on the DOS directory
111 * The file umsdos_progs/umsdosio.c contain a string table
112 * based on the order of those definition. Keep it in sync
114 #define UMSDOS_READDIR_DOS _IO(0x04,210) /* Do a readdir of the DOS directory */
115 #define UMSDOS_UNLINK_DOS _IO(0x04,211) /* Erase in the DOS directory only */
116 #define UMSDOS_RMDIR_DOS _IO(0x04,212) /* rmdir in the DOS directory only */
117 #define UMSDOS_STAT_DOS _IO(0x04,213) /* Get info about a file */
119 /* The next ioctl commands operate only on the EMD file */
120 #define UMSDOS_CREAT_EMD _IO(0x04,214) /* Create a file */
121 #define UMSDOS_UNLINK_EMD _IO(0x04,215) /* unlink (rmdir) a file */
122 #define UMSDOS_READDIR_EMD _IO(0x04,216) /* read the EMD file only. */
123 #define UMSDOS_GETVERSION _IO(0x04,217) /* Get the release number of UMSDOS */
124 #define UMSDOS_INIT_EMD _IO(0x04,218) /* Create the EMD file if not there */
125 #define UMSDOS_DOS_SETUP _IO(0x04,219) /* Set the defaults of the MS-DOS driver. */
127 #define UMSDOS_RENAME_DOS _IO(0x04,220) /* rename a file/directory in the DOS
129 struct umsdos_ioctl
{
130 struct dirent dos_dirent
;
131 struct umsdos_dirent umsdos_dirent
;
132 /* The following structure is used to exchange some data
133 * with utilities (umsdos_progs/util/umsdosio.c). The first
134 * releases were using struct stat from "sys/stat.h". This was
135 * causing some problem for cross compilation of the kernel
136 * Since I am not really using the structure stat, but only some field
137 * of it, I have decided to replicate the structure here
138 * for compatibility with the binaries out there
139 * FIXME PTW 1998, this has probably changed
144 unsigned short __pad1
;
151 unsigned short __pad2
;
153 unsigned long st_blksize
;
154 unsigned long st_blocks
;
156 unsigned long __unused1
;
158 unsigned long __unused2
;
160 unsigned long __unused3
;
161 unsigned long __unused4
;
162 unsigned long __unused5
;
164 char version
, release
;
167 /* Different macros to access struct umsdos_dirent */
168 #define EDM_ENTRY_ISUSED(e) ((e)->name_len!=0)
173 #include <linux/fs.h>
176 extern struct inode_operations umsdos_dir_inode_operations
;
177 extern struct inode_operations umsdos_symlink_inode_operations
;
178 extern int init_umsdos_fs (void);
180 #include <linux/umsdos_fs.p>
182 #endif /* __KERNEL__ */