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 53 54 55struct 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 */ 64struct 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 97struct 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 */ 129struct umsdos_ioctl { 130 struct dirent dos_dirent; 131 struct umsdos_dirent umsdos_dirent; 132 133 struct { 134 dev_t st_dev; 135 unsigned short __pad1; 136 ino_t st_ino; 137 umode_t st_mode; 138 nlink_t st_nlink; 139 __kernel_uid_t st_uid; 140 __kernel_gid_t st_gid; 141 dev_t st_rdev; 142 unsigned short __pad2; 143 off_t st_size; 144 unsigned long st_blksize; 145 unsigned long st_blocks; 146 time_t st_atime; 147 unsigned long __unused1; 148 time_t st_mtime; 149 unsigned long __unused2; 150 time_t st_ctime; 151 unsigned long __unused3; 152 uid_t st_uid32; 153 gid_t st_gid32; 154 } stat; 155 char version, release; 156}; 157 158/* Different macros to access struct umsdos_dirent */ 159#define EDM_ENTRY_ISUSED(e) ((e)->name_len!=0) 160 161#ifdef __KERNEL__ 162 163#ifndef LINUX_FS_H 164#include <linux/fs.h> 165#endif 166 167extern struct inode_operations umsdos_dir_inode_operations; 168extern struct inode_operations umsdos_rdir_inode_operations; 169extern struct file_operations umsdos_dir_operations; 170extern struct file_operations umsdos_rdir_operations; 171 172#include <linux/umsdos_fs.p> 173 174#endif /* __KERNEL__ */ 175 176#endif 177