mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 23:42:43 +00:00
223468546d
This fixes non applying patches on buildbots. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> SVN-Revision: 44936
210 lines
6.8 KiB
Diff
210 lines
6.8 KiB
Diff
From e18d72f70e30109492e9602ace5560e0c90b4a8b Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
|
Date: Sat, 7 Mar 2015 13:23:23 +0100
|
|
Subject: [PATCH 11/14] Remove linux/msdos_fs.h includes
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
|
Signed-off-by: Andreas Bombe <aeb@debian.org>
|
|
---
|
|
src/file.c | 7 +------
|
|
src/file.h | 2 ++
|
|
src/fsck.fat.h | 8 ++------
|
|
src/mkfs.fat.c | 32 +++---------------------------
|
|
src/msdos_fs.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
5 files changed, 69 insertions(+), 41 deletions(-)
|
|
create mode 100644 src/msdos_fs.h
|
|
|
|
diff --git a/src/file.c b/src/file.c
|
|
index 0b53840..9519070 100644
|
|
--- a/src/file.c
|
|
+++ b/src/file.c
|
|
@@ -30,14 +30,9 @@
|
|
#include <ctype.h>
|
|
#include <unistd.h>
|
|
|
|
-#define _LINUX_STAT_H /* hack to avoid inclusion of <linux/stat.h> */
|
|
-#define _LINUX_STRING_H_ /* hack to avoid inclusion of <linux/string.h> */
|
|
-#define _LINUX_FS_H /* hack to avoid inclusion of <linux/fs.h> */
|
|
-
|
|
-#include <linux/msdos_fs.h>
|
|
-
|
|
#include "common.h"
|
|
#include "file.h"
|
|
+#include "msdos_fs.h"
|
|
#include "charconv.h"
|
|
|
|
FDSC *fp_root = NULL;
|
|
diff --git a/src/file.h b/src/file.h
|
|
index 3adfc96..eaaf356 100644
|
|
--- a/src/file.h
|
|
+++ b/src/file.h
|
|
@@ -23,6 +23,8 @@
|
|
#ifndef _FILE_H
|
|
#define _FILE_H
|
|
|
|
+#include "msdos_fs.h"
|
|
+
|
|
typedef enum { fdt_none, fdt_drop, fdt_undelete } FD_TYPE;
|
|
|
|
typedef struct _fptr {
|
|
diff --git a/src/fsck.fat.h b/src/fsck.fat.h
|
|
index 27e9d52..e5f6178 100644
|
|
--- a/src/fsck.fat.h
|
|
+++ b/src/fsck.fat.h
|
|
@@ -28,16 +28,12 @@
|
|
#define _DOSFSCK_H
|
|
|
|
#include <fcntl.h>
|
|
-#define _LINUX_STAT_H /* hack to avoid inclusion of <linux/stat.h> */
|
|
-#define _LINUX_STRING_H_ /* hack to avoid inclusion of <linux/string.h> */
|
|
-#define _LINUX_FS_H /* hack to avoid inclusion of <linux/fs.h> */
|
|
-
|
|
-#include <linux/msdos_fs.h>
|
|
-
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <endian.h>
|
|
|
|
+#include "msdos_fs.h"
|
|
+
|
|
#define VFAT_LN_ATTR (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
|
|
|
|
#define FAT_STATE_DIRTY 0x01
|
|
diff --git a/src/mkfs.fat.c b/src/mkfs.fat.c
|
|
index 3d1512f..76d40d8 100644
|
|
--- a/src/mkfs.fat.c
|
|
+++ b/src/mkfs.fat.c
|
|
@@ -67,6 +67,8 @@
|
|
#include <stdint.h>
|
|
#include <endian.h>
|
|
|
|
+#include "msdos_fs.h"
|
|
+
|
|
/* In earlier versions, an own llseek() was used, but glibc lseek() is
|
|
* sufficient (or even better :) for 64 bit offsets in the meantime */
|
|
#define llseek lseek
|
|
@@ -99,21 +101,6 @@ static inline int cdiv(int a, int b)
|
|
return (a + b - 1) / b;
|
|
}
|
|
|
|
-/* MS-DOS filesystem structures -- I included them here instead of
|
|
- including linux/msdos_fs.h since that doesn't include some fields we
|
|
- need */
|
|
-
|
|
-#define ATTR_RO 1 /* read-only */
|
|
-#define ATTR_HIDDEN 2 /* hidden */
|
|
-#define ATTR_SYS 4 /* system */
|
|
-#define ATTR_VOLUME 8 /* volume label */
|
|
-#define ATTR_DIR 16 /* directory */
|
|
-#define ATTR_ARCH 32 /* archived */
|
|
-
|
|
-#define ATTR_NONE 0 /* no attribute bits */
|
|
-#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
|
|
- /* attribute bits that are copied "as is" */
|
|
-
|
|
/* FAT values */
|
|
#define FAT_EOF (atari_format ? 0x0fffffff : 0x0ffffff8)
|
|
#define FAT_BAD 0x0ffffff7
|
|
@@ -200,19 +187,6 @@ struct fat32_fsinfo {
|
|
uint32_t reserved2[4];
|
|
};
|
|
|
|
-struct msdos_dir_entry {
|
|
- char name[8], ext[3]; /* name and extension */
|
|
- uint8_t attr; /* attribute bits */
|
|
- uint8_t lcase; /* Case for base and extension */
|
|
- uint8_t ctime_ms; /* Creation time, milliseconds */
|
|
- uint16_t ctime; /* Creation time */
|
|
- uint16_t cdate; /* Creation date */
|
|
- uint16_t adate; /* Last access date */
|
|
- uint16_t starthi; /* high 16 bits of first cl. (FAT32) */
|
|
- uint16_t time, date, start; /* time, date and first cluster */
|
|
- uint32_t size; /* file size (in bytes) */
|
|
-} __attribute__ ((packed));
|
|
-
|
|
/* The "boot code" we put into the filesystem... it writes a message and
|
|
tells the user to try again */
|
|
|
|
@@ -1244,7 +1218,7 @@ static void setup_tables(void)
|
|
htole16((unsigned short)(ctime->tm_mday +
|
|
((ctime->tm_mon + 1) << 5) +
|
|
((ctime->tm_year - 80) << 9)));
|
|
- de->ctime_ms = 0;
|
|
+ de->ctime_cs = 0;
|
|
de->ctime = de->time;
|
|
de->cdate = de->date;
|
|
de->adate = de->date;
|
|
diff --git a/src/msdos_fs.h b/src/msdos_fs.h
|
|
new file mode 100644
|
|
index 0000000..54b2a34
|
|
--- /dev/null
|
|
+++ b/src/msdos_fs.h
|
|
@@ -0,0 +1,61 @@
|
|
+/* msdos_fs.h - MS-DOS filesystem constants/structures
|
|
+
|
|
+ This program is free software: you can redistribute it and/or modify
|
|
+ it under the terms of the GNU General Public License as published by
|
|
+ the Free Software Foundation, either version 3 of the License, or
|
|
+ (at your option) any later version.
|
|
+
|
|
+ This program is distributed in the hope that it will be useful,
|
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
+ GNU General Public License for more details.
|
|
+
|
|
+ You should have received a copy of the GNU General Public License
|
|
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
+
|
|
+ The complete text of the GNU General Public License
|
|
+ can be found in /usr/share/common-licenses/GPL-3 file.
|
|
+*/
|
|
+
|
|
+#ifndef _MSDOS_FS_H
|
|
+#define _MSDOS_FS_H
|
|
+
|
|
+#include <stdint.h>
|
|
+
|
|
+#define SECTOR_SIZE 512 /* sector size (bytes) */
|
|
+#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
|
|
+#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */
|
|
+#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */
|
|
+
|
|
+#define ATTR_NONE 0 /* no attribute bits */
|
|
+#define ATTR_RO 1 /* read-only */
|
|
+#define ATTR_HIDDEN 2 /* hidden */
|
|
+#define ATTR_SYS 4 /* system */
|
|
+#define ATTR_VOLUME 8 /* volume label */
|
|
+#define ATTR_DIR 16 /* directory */
|
|
+#define ATTR_ARCH 32 /* archived */
|
|
+
|
|
+/* attribute bits that are copied "as is" */
|
|
+#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
|
|
+
|
|
+#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
|
|
+#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
|
|
+
|
|
+#define MSDOS_NAME 11 /* maximum name length */
|
|
+#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */
|
|
+#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
|
|
+
|
|
+struct msdos_dir_entry {
|
|
+ uint8_t name[8], ext[3]; /* name and extension */
|
|
+ uint8_t attr; /* attribute bits */
|
|
+ uint8_t lcase; /* Case for base and extension */
|
|
+ uint8_t ctime_cs; /* Creation time, centiseconds (0-199) */
|
|
+ uint16_t ctime; /* Creation time */
|
|
+ uint16_t cdate; /* Creation date */
|
|
+ uint16_t adate; /* Last access date */
|
|
+ uint16_t starthi; /* High 16 bits of cluster in FAT32 */
|
|
+ uint16_t time, date, start; /* time, date and first cluster */
|
|
+ uint32_t size; /* file size (in bytes) */
|
|
+} __attribute__ ((packed));
|
|
+
|
|
+#endif /* _MSDOS_FS_H */
|
|
--
|
|
1.9.1
|
|
|