/[hurd]/hurd/fatfs/pager.c
ViewVC logotype

Diff of /hurd/fatfs/pager.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by marcus, Tue Dec 3 20:52:59 2002 UTC revision 1.2 by jbailey, Mon Jul 28 01:48:26 2003 UTC
# Line 1  Line 1 
1  /* pager.c - Pager for fatfs.  /* pager.c - Pager for fatfs.
2     Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.     Copyright (C) 1997, 1999, 2002, 2003 Free Software Foundation, Inc.
3     Written by Thomas Bushnell, n/BSG and Marcus Brinkmann.     Written by Thomas Bushnell, n/BSG and Marcus Brinkmann.
4    
5     This file is part of the GNU Hurd.     This file is part of the GNU Hurd.
# Line 36  spin_lock_t node_to_page_lock = SPIN_LOC Line 36  spin_lock_t node_to_page_lock = SPIN_LOC
36  #define MAY_CACHE 1  #define MAY_CACHE 1
37  #endif  #endif
38    
39  #define STAT_INC(field) /* nop */0  #define STAT_INC(field) (void) 0
40    
41  #define MAX_FREE_PAGE_BUFS 32  #define MAX_FREE_PAGE_BUFS 32
42    
# Line 178  file_pager_read_small_page (struct node Line 178  file_pager_read_small_page (struct node
178    if (!err)    if (!err)
179      {      {
180        err = store_read (store,        err = store_read (store,
181                          (fat_first_cluster_byte(cluster) +                          FAT_FIRST_CLUSTER_BLOCK(cluster)
182                           (page % bytes_per_cluster)) >> store->log2_block_size,                          + ((page % bytes_per_cluster)
183                              >> store->log2_block_size),
184                          vm_page_size, (void **) buf, &read);                          vm_page_size, (void **) buf, &read);
185    
186        if (read != vm_page_size)        if (read != vm_page_size)
187          err = EIO;          err = EIO;
188      }      }
# Line 215  file_pager_read_huge_page (struct node * Line 217  file_pager_read_huge_page (struct node *
217      {      {
218        if (num_pending_clusters > 0)        if (num_pending_clusters > 0)
219          {          {
220            size_t dev_block = fat_first_cluster_byte(pending_clusters) >> store->log2_block_size;            size_t dev_block = FAT_FIRST_CLUSTER_BLOCK(pending_clusters);
221            size_t amount = num_pending_clusters << log2_bytes_per_cluster;            size_t amount = num_pending_clusters << log2_bytes_per_cluster;
222            /* The buffer we try to read into; on the first read, we pass in a            /* The buffer we try to read into; on the first read, we pass in a
223               size of zero, so that the read is guaranteed to allocate a new               size of zero, so that the read is guaranteed to allocate a new
# Line 317  pending_clusters_write (struct pending_c Line 319  pending_clusters_write (struct pending_c
319    if (pc->num > 0)    if (pc->num > 0)
320      {      {
321        error_t err;        error_t err;
322        size_t dev_block = fat_first_cluster_byte(pc->cluster) >> store->log2_block_size;        size_t dev_block = FAT_FIRST_CLUSTER_BLOCK(pc->cluster);
323    
324        size_t length = pc->num << log2_bytes_per_cluster, amount;        size_t length = pc->num << log2_bytes_per_cluster, amount;
325    
326        if (pc->offs > 0)        if (pc->offs > 0)
# Line 477  file_pager_write_small_page (struct node Line 480  file_pager_write_small_page (struct node
480    
481    if (!err)    if (!err)
482      {      {
483        err = store_write (store,        err = store_write (store, FAT_FIRST_CLUSTER_BLOCK(cluster)
484                           (fat_first_cluster_byte(cluster) +                          + ((offset % bytes_per_cluster)
485                            (offset % bytes_per_cluster)) >> store->log2_block_size,                             >> store->log2_block_size),
486                            (void **) buf, vm_page_size, &write);                          (void **) buf, vm_page_size, &write);
487        if (write != vm_page_size)        if (write != vm_page_size)
488          err = EIO;          err = EIO;
489      }      }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26