1 |
1275 |
phoenix |
#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
|
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 |
|
|
dev_t rdev; /* major and minor number of a device */
|
74 |
|
|
/* special file */
|
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[] */
|
82 |
|
|
};
|
83 |
|
|
|
84 |
|
|
#define UMSDOS_HIDDEN 1 /* Never show this entry in directory search */
|
85 |
|
|
#define UMSDOS_HLINK 2 /* It is a (pseudo) hard link */
|
86 |
|
|
|
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.
|
91 |
|
|
*/
|
92 |
|
|
|
93 |
|
|
#define UMSDOS_REC_SIZE 64
|
94 |
|
|
|
95 |
|
|
/* Translation between MSDOS name and UMSDOS name */
|
96 |
|
|
|
97 |
|
|
struct umsdos_info {
|
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
|
105 |
|
|
*/
|
106 |
|
|
int recsize; /* Record size needed to store entry */
|
107 |
|
|
};
|
108 |
|
|
|
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
|
113 |
|
|
*/
|
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 */
|
118 |
|
|
|
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. */
|
126 |
|
|
|
127 |
|
|
#define UMSDOS_RENAME_DOS _IO(0x04,220) /* rename a file/directory in the DOS
|
128 |
|
|
* directory only */
|
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
|
140 |
|
|
*/
|
141 |
|
|
|
142 |
|
|
struct {
|
143 |
|
|
dev_t st_dev;
|
144 |
|
|
unsigned short __pad1;
|
145 |
|
|
ino_t st_ino;
|
146 |
|
|
umode_t st_mode;
|
147 |
|
|
nlink_t st_nlink;
|
148 |
|
|
__kernel_uid_t st_uid;
|
149 |
|
|
__kernel_gid_t st_gid;
|
150 |
|
|
dev_t st_rdev;
|
151 |
|
|
unsigned short __pad2;
|
152 |
|
|
off_t st_size;
|
153 |
|
|
unsigned long st_blksize;
|
154 |
|
|
unsigned long st_blocks;
|
155 |
|
|
time_t st_atime;
|
156 |
|
|
unsigned long __unused1;
|
157 |
|
|
time_t st_mtime;
|
158 |
|
|
unsigned long __unused2;
|
159 |
|
|
time_t st_ctime;
|
160 |
|
|
unsigned long __unused3;
|
161 |
|
|
uid_t st_uid32;
|
162 |
|
|
gid_t st_gid32;
|
163 |
|
|
} stat;
|
164 |
|
|
char version, release;
|
165 |
|
|
};
|
166 |
|
|
|
167 |
|
|
/* Different macros to access struct umsdos_dirent */
|
168 |
|
|
#define EDM_ENTRY_ISUSED(e) ((e)->name_len!=0)
|
169 |
|
|
|
170 |
|
|
#ifdef __KERNEL__
|
171 |
|
|
|
172 |
|
|
#ifndef LINUX_FS_H
|
173 |
|
|
#include <linux/fs.h>
|
174 |
|
|
#endif
|
175 |
|
|
|
176 |
|
|
extern struct inode_operations umsdos_dir_inode_operations;
|
177 |
|
|
extern struct inode_operations umsdos_rdir_inode_operations;
|
178 |
|
|
extern struct file_operations umsdos_dir_operations;
|
179 |
|
|
extern struct file_operations umsdos_rdir_operations;
|
180 |
|
|
|
181 |
|
|
#include <linux/umsdos_fs.p>
|
182 |
|
|
|
183 |
|
|
#endif /* __KERNEL__ */
|
184 |
|
|
|
185 |
|
|
#endif
|