home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / unreleased / patches / 5.6a.021 < prev    next >
Encoding:
Internet Message Format  |  2000-01-10  |  4.0 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 5.6a.021
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. I only solved half the problem...
  8.  
  9. Patch 5.6a.021
  10. Problem:    Recovering still may not work when the block size of the device
  11.         where the swap file is located is larger than 4096.
  12. Solution:   Read block 0 with the minimal block size.
  13. Files:        src/memfile.c, src/memline.c, src/vim.h
  14.  
  15.  
  16. *** ../vim-5.6a.20/src/memfile.c    Mon Jan 10 21:28:45 2000
  17. --- src/memfile.c    Tue Jan 11 16:19:43 2000
  18. ***************
  19. *** 170,183 ****
  20.       /*
  21.        * Try to set the page size equal to the block size of the device.
  22.        * Speeds up I/O a lot.
  23. !      * NOTE: minimal block size depends on size of block 0 data! It's not done
  24. !      * with a sizeof(), because block 0 is defined in memline.c (Sorry).
  25. !      * The maximal block size is arbitrary.
  26.        */
  27.       if (mfp->mf_fd >= 0
  28.           && fstatfs(mfp->mf_fd, &stf, sizeof(struct statfs), 0) == 0
  29. !         && stf.F_BSIZE >= 1048
  30. !         && stf.F_BSIZE <= 50000)
  31.       mfp->mf_page_size = stf.F_BSIZE;
  32.   #endif
  33.   
  34. --- 170,183 ----
  35.       /*
  36.        * Try to set the page size equal to the block size of the device.
  37.        * Speeds up I/O a lot.
  38. !      * When recovering, the actual block size will be retrieved from block 0
  39. !      * in ml_recover().  The size used here may be wrong, therefore
  40. !      * mf_blocknr_max must be rounded up.
  41.        */
  42.       if (mfp->mf_fd >= 0
  43.           && fstatfs(mfp->mf_fd, &stf, sizeof(struct statfs), 0) == 0
  44. !         && stf.F_BSIZE >= MIN_SWAP_PAGE_SIZE
  45. !         && stf.F_BSIZE <= MAX_SWAP_PAGE_SIZE)
  46.       mfp->mf_page_size = stf.F_BSIZE;
  47.   #endif
  48.   
  49. *** ../vim-5.6a.20/src/memline.c    Mon Dec 20 09:59:15 1999
  50. --- src/memline.c    Tue Jan 11 16:15:36 2000
  51. ***************
  52. *** 143,150 ****
  53.    * NOTE: DEFINITION OF BLOCK 0 SHOULD NOT CHANGE! It would make all existing
  54.    * swap files unusable!
  55.    *
  56. !  * If size of block0 changes anyway, adjust minimal block size
  57. !  * in mf_open()!!
  58.    *
  59.    * This block is built up of single bytes, to make it portable accros
  60.    * different machines. b0_magic_* is used to check the byte order and size of
  61. --- 143,149 ----
  62.    * NOTE: DEFINITION OF BLOCK 0 SHOULD NOT CHANGE! It would make all existing
  63.    * swap files unusable!
  64.    *
  65. !  * If size of block0 changes anyway, adjust MIN_SWAP_PAGE_SIZE in vim.h!!
  66.    *
  67.    * This block is built up of single bytes, to make it portable accros
  68.    * different machines. b0_magic_* is used to check the byte order and size of
  69. ***************
  70. *** 801,806 ****
  71. --- 800,813 ----
  72.       }
  73.       vim_free(p);
  74.       buf->b_ml.ml_mfp = mfp;
  75. +     /*
  76. +      * The page size set in mf_open() might be different from the page size
  77. +      * used in the swap file, we must get it from block 0.  But to read block
  78. +      * 0 we need a page size.  Use the minimal size for block 0 here, it will
  79. +      * be set to the real value below.
  80. +      */
  81. +     mfp->mf_page_size = MIN_SWAP_PAGE_SIZE;
  82.   
  83.   /*
  84.    * try to read block 0
  85. *** ../vim-5.6a.20/src/vim.h    Mon Dec 20 09:59:07 1999
  86. --- src/vim.h    Tue Jan 11 16:20:58 2000
  87. ***************
  88. *** 576,581 ****
  89. --- 576,590 ----
  90.   #define SEA_RECOVER    3    /* recover the file */
  91.   
  92.   /*
  93. +  * Minimal size for block 0 of a swap file.
  94. +  * NOTE: This depends on size of struct block0! It's not done with a sizeof(),
  95. +  * because struct block0 is defined in memline.c (Sorry).
  96. +  * The maximal block size is arbitrary.
  97. +  */
  98. + #define MIN_SWAP_PAGE_SIZE 1048
  99. + #define MAX_SWAP_PAGE_SIZE 50000
  100. + /*
  101.    * Events for autocommands.
  102.    */
  103.   enum auto_event
  104. *** ../vim-5.6a.20/src/version.c    Tue Jan 11 16:54:05 2000
  105. --- src/version.c    Tue Jan 11 16:54:36 2000
  106. ***************
  107. *** 420,421 ****
  108. --- 420,423 ----
  109.   {   /* Add new patch number below this line */
  110. + /**/
  111. +     21,
  112.   /**/
  113.  
  114. -- 
  115. hundred-and-one symptoms of being an internet addict:
  116. 106. When told to "go to your room" you inform your parents that you
  117.      can't...because you were kicked out and banned.
  118.  
  119. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  120.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  121.