[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hurd/fatfs ChangeLog fat.c fatfs.h inode.c pager.c
From: |
Jeff Bailey |
Subject: |
hurd/fatfs ChangeLog fat.c fatfs.h inode.c pager.c |
Date: |
Sun, 27 Jul 2003 21:48:27 -0400 |
CVSROOT: /cvsroot/hurd
Module name: hurd
Branch:
Changes by: Jeff Bailey <address@hidden> 03/07/27 21:48:26
Modified files:
fatfs : ChangeLog fat.c fatfs.h inode.c pager.c
Log message:
2003-07-14 Marco Gerards <address@hidden>
* fat.c (fat_read_sblock): Don't test if the root dir size is a
multiple of sectors_per_cluster. Reported by Barry deFreese
(address@hidden).
* fatfs.h (LOG2_BLOCKS_PER_CLUSTER): New macro.
(FAT_FIRST_CLUSTER_BLOCK): Likewise.
(fat_first_cluster_byte): Macro removed.
* inode.c (read_node): Correctly setup diskfs_root_node for FAT32
filesystems.
* pager.c (fat_getcluster): Check for reading beyond allocsize
correctly for file systems with a clustersize > vm_page_size.
(file_pager_read_small_page): Don't use byte offsets when
calculating the block.
(file_pager_read_huge_page): Likewise.
(pending_clusters_write): Likewise.
(file_pager_write_small_page): Likewise.
(STAT_INC): Cast to void to suppress warning.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/fatfs/ChangeLog.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/fatfs/fat.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/fatfs/fatfs.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/fatfs/inode.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd/fatfs/pager.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: hurd/fatfs/ChangeLog
diff -u hurd/fatfs/ChangeLog:1.2 hurd/fatfs/ChangeLog:1.3
--- hurd/fatfs/ChangeLog:1.2 Fri May 9 20:12:29 2003
+++ hurd/fatfs/ChangeLog Sun Jul 27 21:48:26 2003
@@ -1,3 +1,25 @@
+2003-07-14 Marco Gerards <address@hidden>
+
+ * fat.c (fat_read_sblock): Don't test if the root dir size is a
+ multiple of sectors_per_cluster. Reported by Barry deFreese
+ (address@hidden).
+
+ * fatfs.h (LOG2_BLOCKS_PER_CLUSTER): New macro.
+ (FAT_FIRST_CLUSTER_BLOCK): Likewise.
+ (fat_first_cluster_byte): Macro removed.
+
+ * inode.c (read_node): Correctly setup diskfs_root_node for FAT32
+ filesystems.
+
+ * pager.c (fat_getcluster): Check for reading beyond allocsize
+ correctly for file systems with a clustersize > vm_page_size.
+ (file_pager_read_small_page): Don't use byte offsets when
+ calculating the block.
+ (file_pager_read_huge_page): Likewise.
+ (pending_clusters_write): Likewise.
+ (file_pager_write_small_page): Likewise.
+ (STAT_INC): Cast to void to suppress warning.
+
2003-04-26 Marco Gerards <address@hidden>
* dir.c (diskfs_get_directs): Consider ENTRY when adding
Index: hurd/fatfs/fat.c
diff -u hurd/fatfs/fat.c:1.1 hurd/fatfs/fat.c:1.2
--- hurd/fatfs/fat.c:1.1 Tue Dec 3 15:52:59 2002
+++ hurd/fatfs/fat.c Sun Jul 27 21:48:26 2003
@@ -1,5 +1,5 @@
/* fat.c - Support for FAT filesystems.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann.
This file is part of the GNU Hurd.
@@ -151,8 +151,8 @@
error (1, 0, "Number of total sectors is zero");
if (bytes_per_sector & (store->block_size - 1))
- error (1, 0, "Block size of filesystem is not a multiple of the block size
"
- "of the store");
+ error (1, 0, "Block size of filesystem is not
+ " a multiple of the block size of the store");
if (read_word (sblock->reserved_sectors) == 0)
error (1, 0, "Number of reserved sectors is zero");
@@ -164,14 +164,13 @@
if (sectors_per_fat == 0)
error (1, 0, "Number of sectors per fat is zero");
- nr_of_root_dir_sectors = ((read_word (sblock->nr_of_root_dirents) *
FAT_DIR_REC_LEN)
- - 1) / bytes_per_sector + 1;
- if (nr_of_root_dir_sectors & (sectors_per_cluster - 1))
- error (1, 0, "Number of root dir sectors is not a multiple of
sectors_per_cluster");
+ nr_of_root_dir_sectors = ((read_word (sblock->nr_of_root_dirents) *
+ FAT_DIR_REC_LEN) - 1) / bytes_per_sector + 1;
first_root_dir_byte = (read_word (sblock->reserved_sectors)
+ (sblock->nr_of_fat_tables * sectors_per_fat)) << log2_bytes_per_sector;
- first_data_sector = (first_root_dir_byte >> log2_bytes_per_sector) +
nr_of_root_dir_sectors;
+ first_data_sector = (first_root_dir_byte >> log2_bytes_per_sector)
+ + nr_of_root_dir_sectors;
first_data_byte = first_data_sector << log2_bytes_per_sector;
nr_of_clusters = (total_sectors - first_data_sector) / sectors_per_cluster;
Index: hurd/fatfs/fatfs.h
diff -u hurd/fatfs/fatfs.h:1.1 hurd/fatfs/fatfs.h:1.2
--- hurd/fatfs/fatfs.h:1.1 Tue Dec 3 15:52:59 2002
+++ hurd/fatfs/fatfs.h Sun Jul 27 21:48:26 2003
@@ -1,5 +1,5 @@
/* fatfs.h - Interface for fatfs.
- Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2002, 2003 Free Software Foundation, Inc.
Written by Thomas Bushnell, n/BSG and Marcus Brinkmann.
This file is part of the GNU Hurd.
@@ -95,12 +95,16 @@
extern struct dirrect dr_root_node;
+#define LOG2_BLOCKS_PER_CLUSTER
+ (log2_bytes_per_cluster - store->logs2_block_size)
+
#define round_cluster(offs) \
((((offs) + bytes_per_cluster - 1) \
>> log2_bytes_per_cluster) << log2_bytes_per_cluster)
-#define fat_first_cluster_byte(cluster) \
- (first_data_byte + ((cluster - 2) << log2_bytes_per_cluster))
+#define FAT_FIRST_CLUSTER_BLOCK(cluster) \
+ (((cluster - 2) << LOG2_BLOCKS_PER_CLUSTER) +
+ (first_data_byte >> store->log2_block_size))
void drop_pager_softrefs (struct node *);
void allow_pager_softrefs (struct node *);
Index: hurd/fatfs/inode.c
diff -u hurd/fatfs/inode.c:1.2 hurd/fatfs/inode.c:1.3
--- hurd/fatfs/inode.c:1.2 Fri May 9 20:12:29 2003
+++ hurd/fatfs/inode.c Sun Jul 27 21:48:26 2003
@@ -329,8 +329,8 @@
st->st_mode = S_IFDIR | 0777;
/* When we read in the node the first time, diskfs_root_node is
zero. */
- if (diskfs_root_node == 0 ||
- (np == diskfs_root_node && (fat_type == FAT12 || fat_type == FAT16)))
+ if ((diskfs_root_node == 0 || np == diskfs_root_node) &&
+ (fat_type = FAT12 || fat_type == FAT16))
{
st->st_size = read_dword (dr->file_size);
np->allocsize = nr_of_root_dir_sectors << log2_bytes_per_sector;
Index: hurd/fatfs/pager.c
diff -u hurd/fatfs/pager.c:1.1 hurd/fatfs/pager.c:1.2
--- hurd/fatfs/pager.c:1.1 Tue Dec 3 15:52:59 2002
+++ hurd/fatfs/pager.c Sun Jul 27 21:48:26 2003
@@ -1,5 +1,5 @@
/* pager.c - Pager for fatfs.
- Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2002, 2003 Free Software Foundation, Inc.
Written by Thomas Bushnell, n/BSG and Marcus Brinkmann.
This file is part of the GNU Hurd.
@@ -36,7 +36,7 @@
#define MAY_CACHE 1
#endif
-#define STAT_INC(field) /* nop */0
+#define STAT_INC(field) (void) 0
#define MAX_FREE_PAGE_BUFS 32
@@ -178,9 +178,11 @@
if (!err)
{
err = store_read (store,
- (fat_first_cluster_byte(cluster) +
- (page % bytes_per_cluster)) >> store->log2_block_size,
+ FAT_FIRST_CLUSTER_BLOCK(cluster)
+ + ((page % bytes_per_cluster)
+ >> store->log2_block_size),
vm_page_size, (void **) buf, &read);
+
if (read != vm_page_size)
err = EIO;
}
@@ -215,7 +217,7 @@
{
if (num_pending_clusters > 0)
{
- size_t dev_block = fat_first_cluster_byte(pending_clusters) >>
store->log2_block_size;
+ size_t dev_block = FAT_FIRST_CLUSTER_BLOCK(pending_clusters);
size_t amount = num_pending_clusters << log2_bytes_per_cluster;
/* The buffer we try to read into; on the first read, we pass in a
size of zero, so that the read is guaranteed to allocate a new
@@ -317,7 +319,8 @@
if (pc->num > 0)
{
error_t err;
- size_t dev_block = fat_first_cluster_byte(pc->cluster) >>
store->log2_block_size;
+ size_t dev_block = FAT_FIRST_CLUSTER_BLOCK(pc->cluster);
+
size_t length = pc->num << log2_bytes_per_cluster, amount;
if (pc->offs > 0)
@@ -477,10 +480,10 @@
if (!err)
{
- err = store_write (store,
- (fat_first_cluster_byte(cluster) +
- (offset % bytes_per_cluster)) >>
store->log2_block_size,
- (void **) buf, vm_page_size, &write);
+ err = store_write (store, FAT_FIRST_CLUSTER_BLOCK(cluster)
+ + ((offset % bytes_per_cluster)
+ >> store->log2_block_size),
+ (void **) buf, vm_page_size, &write);
if (write != vm_page_size)
err = EIO;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- hurd/fatfs ChangeLog fat.c fatfs.h inode.c pager.c,
Jeff Bailey <=