Commit 5af71cb2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] FAT: include/linux/msdos_fs.h cleanup

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

include/linux/msdos_fs.h cleanup
parent 002a7d6e
...@@ -4,13 +4,8 @@ ...@@ -4,13 +4,8 @@
/* /*
* The MS-DOS filesystem constants/structures * The MS-DOS filesystem constants/structures
*/ */
#include <linux/buffer_head.h>
#include <linux/string.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
struct statfs;
#define SECTOR_SIZE 512 /* sector size (bytes) */ #define SECTOR_SIZE 512 /* sector size (bytes) */
#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */ #define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */
#define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */ #define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */
...@@ -18,6 +13,9 @@ struct statfs; ...@@ -18,6 +13,9 @@ struct statfs;
#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ #define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */
#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
#define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */ #define MSDOS_ROOT_INO 1 /* == MINIX_ROOT_INO */
#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ #define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */
...@@ -25,8 +23,6 @@ struct statfs; ...@@ -25,8 +23,6 @@ struct statfs;
#define FAT_MAX_DIR_ENTRIES (65536) #define FAT_MAX_DIR_ENTRIES (65536)
#define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS) #define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS)
#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
#define ATTR_NONE 0 /* no attribute bits */ #define ATTR_NONE 0 /* no attribute bits */
#define ATTR_RO 1 /* read-only */ #define ATTR_RO 1 /* read-only */
#define ATTR_HIDDEN 2 /* hidden */ #define ATTR_HIDDEN 2 /* hidden */
...@@ -35,10 +31,10 @@ struct statfs; ...@@ -35,10 +31,10 @@ struct statfs;
#define ATTR_DIR 16 /* directory */ #define ATTR_DIR 16 /* directory */
#define ATTR_ARCH 32 /* archived */ #define ATTR_ARCH 32 /* archived */
/* attribute bits that are copied "as is" */
#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN) #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
/* attribute bits that are copied "as is" */ /* bits that are used by the Windows 95/Windows NT extended FAT */
#define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) #define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
/* bits that are used by the Windows 95/Windows NT extended FAT */
#define CASE_LOWER_BASE 8 /* base is lower case */ #define CASE_LOWER_BASE 8 /* base is lower case */
#define CASE_LOWER_EXT 16 /* extension is lower case */ #define CASE_LOWER_EXT 16 /* extension is lower case */
...@@ -46,8 +42,12 @@ struct statfs; ...@@ -46,8 +42,12 @@ struct statfs;
#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
/* valid file mode bits */
#define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO) #define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)
/* valid file mode bits */ /* Convert attribute bits and a mask to the UNIX mode. */
#define MSDOS_MKMODE(a, m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO))
/* Convert the UNIX mode to MS-DOS attribute bits. */
#define MSDOS_MKATTR(m) ((m & S_IWUGO) ? ATTR_NONE : ATTR_RO)
#define MSDOS_NAME 11 /* maximum name length */ #define MSDOS_NAME 11 /* maximum name length */
#define MSDOS_LONGNAME 256 /* maximum name length */ #define MSDOS_LONGNAME 256 /* maximum name length */
...@@ -179,15 +179,10 @@ struct vfat_slot_info { ...@@ -179,15 +179,10 @@ struct vfat_slot_info {
loff_t i_pos; /* on-disk position of directory entry */ loff_t i_pos; /* on-disk position of directory entry */
}; };
/* Convert attribute bits and a mask to the UNIX mode. */
#define MSDOS_MKMODE(a,m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO))
/* Convert the UNIX mode to MS-DOS attribute bits. */
#define MSDOS_MKATTR(m) ((m & S_IWUGO) ? ATTR_NONE : ATTR_RO)
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/buffer_head.h>
#include <linux/string.h>
#include <linux/nls.h> #include <linux/nls.h>
#include <linux/msdos_fs_i.h> #include <linux/msdos_fs_i.h>
#include <linux/msdos_fs_sb.h> #include <linux/msdos_fs_sb.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment