home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / kernel-s / v1.1 / umsdos-0.000 < prev    next >
Text File  |  1995-10-10  |  28KB  |  1,019 lines

  1. This is a diff relative to linux 1.1.57 or later
  2. This is mostly enhancement of the msdos fs driver to speed things
  3. This is alpha!
  4.  
  5. diff -rc2P linux.1.1.57/fs/Makefile linux/fs/Makefile
  6. *** linux.1.1.57/fs/Makefile    Sat Oct 29 01:14:37 1994
  7. --- linux/fs/Makefile    Tue Oct 25 00:36:40 1994
  8. ***************
  9. *** 21,24 ****
  10. --- 21,26 ----
  11.   ifdef CONFIG_MSDOS_FS
  12.   FS_SUBDIRS := $(FS_SUBDIRS) msdos
  13. + else
  14. + MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) msdos
  15.   endif
  16.   ifdef CONFIG_PROC_FS
  17. ***************
  18. *** 36,39 ****
  19. --- 38,43 ----
  20.   ifdef CONFIG_UMSDOS_FS
  21.   FS_SUBDIRS := $(FS_SUBDIRS) umsdos
  22. + else
  23. + MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) umsdos
  24.   endif
  25.   ifdef CONFIG_SYSV_FS
  26. ***************
  27. *** 77,80 ****
  28. --- 81,88 ----
  29.       $(MAKE) CFLAGS="$(CFLAGS) -DMODULE" $(MODULES)
  30.       (cd ../modules;for i in $(MODULES); do ln -sf ../fs/$$i .; done)
  31. +     set -e; for i in $(MODULE_FS_SUBDIRS); do \
  32. +       test ! -d $$i || \
  33. +         { $(MAKE) -C $$i; }; done
  34.   
  35.   else
  36. diff -rc2P linux.1.1.57/fs/msdos/Makefile linux/fs/msdos/Makefile
  37. *** linux.1.1.57/fs/msdos/Makefile    Sun Jul 24 10:39:44 1994
  38. --- linux/fs/msdos/Makefile    Tue Oct 25 22:10:49 1994
  39. ***************
  40. *** 8,11 ****
  41. --- 8,15 ----
  42.   # Note 2! The CFLAGS definitions are now in the main makefile...
  43.   
  44. + ifndef CONFIG_MSDOS_FS
  45. + CFLAGS := $(CFLAGS) -DMODULE
  46. + endif
  47.   .c.s:
  48.       $(CC) $(CFLAGS) -S $<
  49. ***************
  50. *** 15,19 ****
  51.       $(AS) -o $*.o $<
  52.   
  53. ! OBJS=    namei.o inode.o file.o dir.o misc.o fat.o mmap.o
  54.   
  55.   msdos.o: $(OBJS)
  56. --- 19,23 ----
  57.       $(AS) -o $*.o $<
  58.   
  59. ! OBJS=    namei.o inode.o file.o dir.o misc.o fat.o
  60.   
  61.   msdos.o: $(OBJS)
  62. diff -rc2P linux.1.1.57/fs/msdos/dir.c linux/fs/msdos/dir.c
  63. *** linux.1.1.57/fs/msdos/dir.c    Sat Oct 29 01:14:39 1994
  64. --- linux/fs/msdos/dir.c    Tue Oct 25 22:05:19 1994
  65. ***************
  66. *** 19,22 ****
  67. --- 19,24 ----
  68.   
  69.   
  70. + #define PRINTK(X)
  71.   static int msdos_dir_read(struct inode * inode,struct file * filp, char * buf,int count)
  72.   {
  73. ***************
  74. *** 113,117 ****
  75. --- 115,121 ----
  76.                   memcpy_tofs(dirent->d_name,bufname,i+1);
  77.                   put_fs_word(i,&dirent->d_reclen);
  78. +                 PRINTK (("readdir avant brelse\n"));
  79.                   brelse(bh);
  80. +                 PRINTK (("readdir retourne %d\n",i));
  81.                   return ROUND_UP(NAME_OFFSET(dirent) + i + 1);
  82.               }
  83. diff -rc2P linux.1.1.57/fs/msdos/file.c linux/fs/msdos/file.c
  84. *** linux.1.1.57/fs/msdos/file.c    Sun Jul 24 10:39:44 1994
  85. --- linux/fs/msdos/file.c    Sat Oct 29 00:33:33 1994
  86. ***************
  87. *** 11,14 ****
  88. --- 11,15 ----
  89.   
  90.   #include <linux/sched.h>
  91. + #include <linux/locks.h>
  92.   #include <linux/fs.h>
  93.   #include <linux/msdos_fs.h>
  94. ***************
  95. *** 21,24 ****
  96. --- 22,27 ----
  97.   #define MAX(a,b) (((a) > (b)) ? (a) : (b))
  98.   
  99. + #define PRINTK(x)
  100.   static struct file_operations msdos_file_operations = {
  101.       NULL,            /* lseek - default */
  102. ***************
  103. *** 28,32 ****
  104.       NULL,            /* select - default */
  105.       NULL,            /* ioctl - default */
  106. !     msdos_mmap,        /* mmap */
  107.       NULL,            /* no special open is needed */
  108.       NULL,            /* release */
  109. --- 31,35 ----
  110.       NULL,            /* select - default */
  111.       NULL,            /* ioctl - default */
  112. !     generic_mmap,    /* mmap */
  113.       NULL,            /* no special open is needed */
  114.       NULL,            /* release */
  115. ***************
  116. *** 50,78 ****
  117.       msdos_truncate,        /* truncate */
  118.       NULL,            /* permission */
  119. !     msdos_smap        /* smap */
  120. ! };
  121. ! /* No bmap for MS-DOS FS' that don't align data at kByte boundaries. */
  122. ! struct inode_operations msdos_file_inode_operations_no_bmap = {
  123. !     &msdos_file_operations,    /* default file operations */
  124. !     NULL,            /* create */
  125. !     NULL,            /* lookup */
  126. !     NULL,            /* link */
  127. !     NULL,            /* unlink */
  128. !     NULL,            /* symlink */
  129. !     NULL,            /* mkdir */
  130. !     NULL,            /* rmdir */
  131. !     NULL,            /* mknod */
  132. !     NULL,            /* rename */
  133. !     NULL,            /* readlink */
  134. !     NULL,            /* follow_link */
  135. !     NULL,            /* bmap */
  136. !     msdos_truncate,        /* truncate */
  137. !     NULL,            /* permission */
  138. !     msdos_smap        /* smap */
  139.   };
  140.   
  141.   /*
  142.       Read a file into user space
  143. --- 53,59 ----
  144.       msdos_truncate,        /* truncate */
  145.       NULL,            /* permission */
  146. !     NULL        /* smap */
  147.   };
  148.   
  149.   /*
  150.       Read a file into user space
  151. ***************
  152. *** 85,94 ****
  153.   {
  154.       char *start;
  155. !     int left,offset,size,sector,cnt;
  156. !     char ch;
  157. !     struct buffer_head *bh;
  158. !     void *data;
  159.   
  160. - /* printk("msdos_file_read\n"); */
  161.       if (!inode) {
  162.           printk("msdos_file_read: inode = NULL\n");
  163. --- 66,81 ----
  164.   {
  165.       char *start;
  166. !     int left,offset,size,cnt;
  167. !     struct {
  168. !         int   to_reada;        /* How many block to read all at once */
  169. !         struct buffer_head *bhreq[64];    /* Buffers not already read */
  170. !         int nbreq;            /* Number of buffers to read */
  171. !         struct buffer_head *bhlist[64];    /* All buffers needed */
  172. !         int nblist;            /* Number of buffers in bhlist */
  173. !         int nolist;
  174. !     }pre;
  175. !     int i;
  176. !         
  177.   
  178.       if (!inode) {
  179.           printk("msdos_file_read: inode = NULL\n");
  180. ***************
  181. *** 101,110 ****
  182.       }
  183.       if (filp->f_pos >= inode->i_size || count <= 0) return 0;
  184.       start = buf;
  185.       while ((left = MIN(inode->i_size-filp->f_pos,count-(buf-start))) > 0){
  186. !         if (!(sector = msdos_smap(inode,filp->f_pos >> SECTOR_BITS)))
  187. !             break;
  188.           offset = filp->f_pos & (SECTOR_SIZE-1);
  189. -         if (!(bh = msdos_sread(inode->i_dev,sector,&data))) break;
  190.           filp->f_pos += (size = MIN(SECTOR_SIZE-offset,left));
  191.           if (MSDOS_I(inode)->i_binary) {
  192. --- 88,145 ----
  193.       }
  194.       if (filp->f_pos >= inode->i_size || count <= 0) return 0;
  195. +     /*
  196. +         Tell the buffer cache which block we expect to read in advance
  197. +         Since we are limited with the stack, we preread only 64
  198. +         because we have to keep the result into the local
  199. +         arrays pre.bhlist and pre.bhreq.
  200. +     */
  201. +     {
  202. +         int file_sector = filp->f_pos >> SECTOR_BITS;
  203. +         pre.to_reada = count / SECTOR_SIZE;
  204. +         if (filp->f_reada){
  205. +             int min_read = read_ahead[MAJOR(inode->i_dev)];
  206. +             if (min_read > pre.to_reada) pre.to_reada = min_read;
  207. +         }
  208. +         if (pre.to_reada > 64) pre.to_reada = 64;
  209. +         pre.nbreq = pre.nblist = 0;
  210. +         for (i=0; i<pre.to_reada; i++){
  211. +             int sector;
  212. +             struct buffer_head *bh;
  213. +             if (!(sector = msdos_smap(inode,file_sector++))) break;
  214. +             bh = getblk(inode->i_dev,sector,SECTOR_SIZE);
  215. +             if (bh == NULL)    break;
  216. +             pre.bhlist[pre.nblist++] = bh;
  217. +             if (!bh->b_uptodate){
  218. +                 pre.bhreq[pre.nbreq++] = bh;
  219. +             }
  220. +         }
  221. +         if (pre.nbreq > 0) ll_rw_block (READ,pre.nbreq,pre.bhreq);
  222. +     }
  223.       start = buf;
  224. +     pre.nolist = 0;
  225.       while ((left = MIN(inode->i_size-filp->f_pos,count-(buf-start))) > 0){
  226. !         struct buffer_head *bh;
  227. !         void *data;
  228. !         PRINTK (("file_read pos %d\n",filp->f_pos));
  229. !         if (pre.nolist >= pre.nblist){
  230. !             /* This code is executed when more than 64 sectors */
  231. !             /* are request at once */
  232. !             int sector;
  233. !             if (!(sector = msdos_smap(inode,filp->f_pos >> SECTOR_BITS)))
  234. !                 break;
  235. !             if (!(bh = msdos_sread(inode->i_dev,sector,&data)))
  236. !                 break;
  237. !         }else{
  238. !             bh = pre.bhlist[pre.nolist];
  239. !             pre.bhlist[pre.nolist++] = NULL;
  240. !             data = bh->b_data;
  241. !             wait_on_buffer(bh);
  242. !             if (!bh->b_uptodate){
  243. !                 /* read error  ? */
  244. !                 brelse (bh);
  245. !                 break;
  246. !             }
  247. !         }
  248.           offset = filp->f_pos & (SECTOR_SIZE-1);
  249.           filp->f_pos += (size = MIN(SECTOR_SIZE-offset,left));
  250.           if (MSDOS_I(inode)->i_binary) {
  251. ***************
  252. *** 113,116 ****
  253. --- 148,152 ----
  254.           }
  255.           else for (cnt = size; cnt; cnt--) {
  256. +                 char ch;
  257.                   if ((ch = *((char *) data+offset++)) == '\r')
  258.                       size--;
  259. ***************
  260. *** 120,128 ****
  261.                           filp->f_pos = inode->i_size;
  262.                           brelse(bh);
  263. !                         if (start != buf
  264. !                             && !IS_RDONLY(inode))
  265. !                             inode->i_atime
  266. !                                 = CURRENT_TIME;
  267. !                         return buf-start;
  268.                       }
  269.                   }
  270. --- 156,160 ----
  271.                           filp->f_pos = inode->i_size;
  272.                           brelse(bh);
  273. !                         break;
  274.                       }
  275.                   }
  276. ***************
  277. *** 130,136 ****
  278. --- 162,171 ----
  279.           brelse(bh);
  280.       }
  281. +     for (i=0; i<pre.nblist; i++) brelse (pre.bhlist[i]);
  282.       if (start == buf) return -EIO;
  283.       if (!IS_RDONLY(inode))
  284.           inode->i_atime = CURRENT_TIME;
  285. +     PRINTK (("file_read ret %d\n",(buf-start)));
  286. +     filp->f_reada = 1;    /* Will be reset if a lseek is done */
  287.       return buf-start;
  288.   }
  289. ***************
  290. *** 150,153 ****
  291. --- 185,189 ----
  292.       struct buffer_head *bh;
  293.       void *data;
  294. +     int binary_mode = MSDOS_I(inode)->i_binary;
  295.   
  296.       if (!inode) {
  297. ***************
  298. *** 176,186 ****
  299.           offset = filp->f_pos & (SECTOR_SIZE-1);
  300.           size = MIN(SECTOR_SIZE-offset,MAX(carry,count));
  301. !         if (!(bh = msdos_sread(inode->i_dev,sector,&data))) {
  302.               error = -EIO;
  303.               break;
  304.           }
  305. !         if (MSDOS_I(inode)->i_binary) {
  306. !             memcpy_fromfs(data+(filp->f_pos & (SECTOR_SIZE-1)),
  307. !                 buf,written = size);
  308.               buf += size;
  309.           }
  310. --- 212,229 ----
  311.           offset = filp->f_pos & (SECTOR_SIZE-1);
  312.           size = MIN(SECTOR_SIZE-offset,MAX(carry,count));
  313. !         if (binary_mode && offset == 0 && size == SECTOR_SIZE){
  314. !             /* No need to read the block first since we will */
  315. !             /* completely overwrite it */
  316. !             if (!(bh = getblk(inode->i_dev,sector,SECTOR_SIZE))){
  317. !                 error = -EIO;
  318. !                 break;
  319. !             }
  320. !             data = bh->b_data;
  321. !         }else if (!(bh = msdos_sread(inode->i_dev,sector,&data))) {
  322.               error = -EIO;
  323.               break;
  324.           }
  325. !         if (binary_mode) {
  326. !             memcpy_fromfs(data+offset,buf,written = size);
  327.               buf += size;
  328.           }
  329. ***************
  330. *** 211,214 ****
  331. --- 254,258 ----
  332.               inode->i_dirt = 1;
  333.           }
  334. +         bh->b_uptodate = 1;
  335.           mark_buffer_dirty(bh, 0);
  336.           brelse(bh);
  337. diff -rc2P linux.1.1.57/fs/msdos/inode.c linux/fs/msdos/inode.c
  338. *** linux.1.1.57/fs/msdos/inode.c    Sat Oct 29 01:14:50 1994
  339. --- linux/fs/msdos/inode.c    Thu Oct 27 02:09:11 1994
  340. ***************
  341. *** 11,19 ****
  342. --- 11,27 ----
  343.   #include <linux/string.h>
  344.   #include <linux/ctype.h>
  345. + #include <linux/major.h>
  346. + #include <linux/fs.h>
  347.   #include <linux/stat.h>
  348.   #include <linux/locks.h>
  349.   
  350. + #ifdef MODULE
  351. +     #include <linux/module.h>
  352. +     #include "../../tools/version.h"
  353. + #endif
  354.   #include <asm/segment.h>
  355.   
  356. + extern int *blksize_size[];
  357.   
  358.   void msdos_put_inode(struct inode *inode)
  359. ***************
  360. *** 48,54 ****
  361. --- 56,66 ----
  362.   {
  363.       cache_inval_dev(sb->s_dev);
  364. +     set_blocksize (sb->s_dev,BLOCK_SIZE);
  365.       lock_super(sb);
  366.       sb->s_dev = 0;
  367.       unlock_super(sb);
  368. +     #ifdef MODULE
  369. +         MOD_DEC_USE_COUNT;
  370. +     #endif
  371.       return;
  372.   }
  373. ***************
  374. *** 161,165 ****
  375.       cache_init();
  376.       lock_super(s);
  377. !     bh = bread(s->s_dev, 0, BLOCK_SIZE);
  378.       unlock_super(s);
  379.       if (bh == NULL) {
  380. --- 173,191 ----
  381.       cache_init();
  382.       lock_super(s);
  383. !     if (MAJOR(s->s_dev) == FLOPPY_MAJOR){
  384. !         /* Patch for floppy which lacks a table ??? */
  385. !         static int tbdef[]={
  386. !             1024,1024,1024,1024,1024,
  387. !             1024,1024,1024,1024,1024,
  388. !             1024,1024,1024,1024,1024,
  389. !             1024,1024,1024,1024,1024,
  390. !             1024,1024,1024,1024,1024,
  391. !             1024,1024,1024,1024,1024,
  392. !             1024,1024,1024,1024,1024,
  393. !         };
  394. !         blksize_size[FLOPPY_MAJOR] = tbdef;
  395. !     }
  396. !     set_blocksize (s->s_dev,SECTOR_SIZE);
  397. !     bh = bread(s->s_dev, 0, SECTOR_SIZE);
  398.       unlock_super(s);
  399.       if (bh == NULL) {
  400. ***************
  401. *** 169,175 ****
  402.       }
  403.       b = (struct msdos_boot_sector *) bh->b_data;
  404. !     s->s_blocksize = 1024;    /* we cannot handle anything else yet */
  405. !     s->s_blocksize_bits = 10;    /* we cannot handle anything else yet */
  406.   /*
  407.    * The DOS3 partition size limit is *not* 32M as many people think.  
  408. --- 195,203 ----
  409.       }
  410.       b = (struct msdos_boot_sector *) bh->b_data;
  411. !     s->s_blocksize = 512;    /* Using this small block size solve the */
  412. !                 /* the misfit with buffer cache and cluster */
  413. !                 /* because cluster (DOS) are often aligned */
  414. !                 /* on odd sector */
  415. !     s->s_blocksize_bits = 9;    /* we cannot handle anything else yet */
  416.   /*
  417.    * The DOS3 partition size limit is *not* 32M as many people think.  
  418. ***************
  419. *** 220,223 ****
  420. --- 248,252 ----
  421.       brelse(bh);
  422.       if (error || debug) {
  423. +         /* The MSDOS_CAN_BMAP is obsolete, but left just to remember */
  424.           printk("[MS-DOS FS Rel. 12,FAT %d,check=%c,conv=%c,"
  425.               "uid=%d,gid=%d,umask=%03o%s]\n",MSDOS_SB(s)->fat_bits,check,
  426. ***************
  427. *** 256,259 ****
  428. --- 285,291 ----
  429.           return NULL;
  430.       }
  431. +     #ifdef MODULE
  432. +         MOD_INC_USE_COUNT;
  433. +     #endif
  434.       return s;
  435.   }
  436. ***************
  437. *** 291,303 ****
  438.   
  439.       sb = MSDOS_SB(inode->i_sb);
  440. -     if ((sb->cluster_size & 1) || (sb->data_start & 1)) return 0;
  441.       if (inode->i_ino == MSDOS_ROOT_INO) {
  442. !         if (sb->dir_start & 1) return 0;
  443. !         return (sb->dir_start >> 1)+block;
  444.       }
  445. !     cluster = (block*2)/sb->cluster_size;
  446. !     offset = (block*2) % sb->cluster_size;
  447.       if (!(cluster = get_cluster(inode,cluster))) return 0;
  448. !     return ((cluster-2)*sb->cluster_size+sb->data_start+offset) >> 1;
  449.   }
  450.   
  451. --- 323,333 ----
  452.   
  453.       sb = MSDOS_SB(inode->i_sb);
  454.       if (inode->i_ino == MSDOS_ROOT_INO) {
  455. !         return sb->dir_start + block;
  456.       }
  457. !     cluster = block/sb->cluster_size;
  458. !     offset = block % sb->cluster_size;
  459.       if (!(cluster = get_cluster(inode,cluster))) return 0;
  460. !     return (cluster-2)*sb->cluster_size+sb->data_start+offset;
  461.   }
  462.   
  463. ***************
  464. *** 333,337 ****
  465.       }
  466.       if (!(bh = bread(inode->i_dev,inode->i_ino >> MSDOS_DPB_BITS,
  467. !         BLOCK_SIZE))) {
  468.           printk("dev = 0x%04X, ino = %ld\n",inode->i_dev,inode->i_ino);
  469.           panic("msdos_read_inode: unable to read i-node block");
  470. --- 363,367 ----
  471.       }
  472.       if (!(bh = bread(inode->i_dev,inode->i_ino >> MSDOS_DPB_BITS,
  473. !         SECTOR_SIZE))) {
  474.           printk("dev = 0x%04X, ino = %ld\n",inode->i_dev,inode->i_ino);
  475.           panic("msdos_read_inode: unable to read i-node block");
  476. ***************
  477. *** 368,374 ****
  478.               ? S_IRUGO|S_IWUGO : S_IRWXUGO) & ~MSDOS_SB(inode->i_sb)->fs_umask) |
  479.               S_IFREG;
  480. !         inode->i_op = MSDOS_CAN_BMAP(MSDOS_SB(inode->i_sb)) ? 
  481. !             &msdos_file_inode_operations :
  482. !             &msdos_file_inode_operations_no_bmap;
  483.           MSDOS_I(inode)->i_start = CF_LE_W(raw_entry->start);
  484.           inode->i_nlink = 1;
  485. --- 398,402 ----
  486.               ? S_IRUGO|S_IWUGO : S_IRWXUGO) & ~MSDOS_SB(inode->i_sb)->fs_umask) |
  487.               S_IFREG;
  488. !         inode->i_op = &msdos_file_inode_operations;    /* Now can always bmap */
  489.           MSDOS_I(inode)->i_start = CF_LE_W(raw_entry->start);
  490.           inode->i_nlink = 1;
  491. ***************
  492. *** 396,400 ****
  493.       if (inode->i_ino == MSDOS_ROOT_INO || !inode->i_nlink) return;
  494.       if (!(bh = bread(inode->i_dev,inode->i_ino >> MSDOS_DPB_BITS,
  495. !         BLOCK_SIZE))) {
  496.           printk("dev = 0x%04X, ino = %ld\n",inode->i_dev,inode->i_ino);
  497.           panic("msdos_write_inode: unable to read i-node block");
  498. --- 424,428 ----
  499.       if (inode->i_ino == MSDOS_ROOT_INO || !inode->i_nlink) return;
  500.       if (!(bh = bread(inode->i_dev,inode->i_ino >> MSDOS_DPB_BITS,
  501. !         SECTOR_SIZE))) {
  502.           printk("dev = 0x%04X, ino = %ld\n",inode->i_dev,inode->i_ino);
  503.           panic("msdos_write_inode: unable to read i-node block");
  504. ***************
  505. *** 452,453 ****
  506. --- 480,510 ----
  507.       return 0;
  508.   }
  509. + #ifdef MODULE
  510. + char kernel_version[] = UTS_RELEASE;
  511. + static struct file_system_type msdos_fs_type = {
  512. +     msdos_read_super, "msdos", 1, NULL
  513. + };
  514. + int init_module(void)
  515. + {
  516. +     register_filesystem(&msdos_fs_type);
  517. +     return 0;
  518. + }
  519. + void cleanup_module(void)
  520. + {
  521. +     if (MOD_IN_USE)
  522. +         printk("ne: device busy, remove delayed\n");
  523. +     else
  524. +     {
  525. +         unregister_filesystem(&msdos_fs_type);
  526. +         /* This is not clear why the floppy drivers does not initialise */
  527. +         /* the table, but we left it the way we saw it first */
  528. +         blksize_size[FLOPPY_MAJOR] = NULL;
  529. +     }
  530. + }
  531. + #endif
  532. diff -rc2P linux.1.1.57/fs/msdos/misc.c linux/fs/msdos/misc.c
  533. *** linux.1.1.57/fs/msdos/misc.c    Sat Oct 29 01:13:55 1994
  534. --- linux/fs/msdos/misc.c    Thu Oct 27 23:25:27 1994
  535. ***************
  536. *** 13,16 ****
  537. --- 13,18 ----
  538.   #include <linux/stat.h>
  539.   
  540. + #define PRINTK(x)
  541.   /* Well-known binary file extensions */
  542.   
  543. ***************
  544. *** 110,116 ****
  545.   int msdos_add_cluster(struct inode *inode)
  546.   {
  547. !     int count,nr,limit,last,current,sector;
  548. !     void *data;
  549.       struct buffer_head *bh;
  550.   
  551.       if (inode->i_ino == MSDOS_ROOT_INO) return -ENOSPC;
  552. --- 112,118 ----
  553.   int msdos_add_cluster(struct inode *inode)
  554.   {
  555. !     int count,nr,limit,last,current,sector,last_sector;
  556.       struct buffer_head *bh;
  557. +     int cluster_size = MSDOS_SB(inode->i_sb)->cluster_size;
  558.   
  559.       if (inode->i_ino == MSDOS_ROOT_INO) return -ENOSPC;
  560. ***************
  561. *** 162,190 ****
  562.   if (last) printk("next set to %d\n",fat_access(inode->i_sb,last,-1));
  563.   #endif
  564. !     for (current = 0; current < MSDOS_SB(inode->i_sb)->cluster_size;
  565. !         current++) {
  566. !         sector = MSDOS_SB(inode->i_sb)->data_start+(nr-2)*
  567. !             MSDOS_SB(inode->i_sb)->cluster_size+current;
  568. ! #ifdef DEBUG
  569. ! printk("zeroing sector %d\n",sector);
  570. ! #endif
  571. !         if (current < MSDOS_SB(inode->i_sb)->cluster_size-1 &&
  572. !             !(sector & 1)) {
  573. !             if (!(bh = getblk(inode->i_dev,sector >> 1,
  574. !                 BLOCK_SIZE)))
  575. !                 printk("getblk failed\n");
  576. !             else {
  577. !                 memset(bh->b_data,0,BLOCK_SIZE);
  578. !                 bh->b_uptodate = 1;
  579. !             }
  580. !             current++;
  581. !         }
  582.           else {
  583. !             if (!(bh = msdos_sread(inode->i_dev,sector,
  584. !                 &data)))
  585. !                 printk("msdos_sread failed\n");
  586. !             else memset(data,0,SECTOR_SIZE);
  587. !         }
  588. !         if (bh) {
  589.               mark_buffer_dirty(bh, 1);
  590.               brelse(bh);
  591. --- 164,178 ----
  592.   if (last) printk("next set to %d\n",fat_access(inode->i_sb,last,-1));
  593.   #endif
  594. !     sector = MSDOS_SB(inode->i_sb)->data_start+(nr-2)*cluster_size;
  595. !     last_sector = sector + cluster_size;
  596. !     for ( ; sector < last_sector; sector++) {
  597. !         #ifdef DEBUG
  598. !             printk("zeroing sector %d\n",sector);
  599. !         #endif
  600. !         if (!(bh = getblk(inode->i_dev,sector,SECTOR_SIZE)))
  601. !             printk("getblk failed\n");
  602.           else {
  603. !             memset(bh->b_data,0,SECTOR_SIZE);
  604. !             bh->b_uptodate = 1;
  605.               mark_buffer_dirty(bh, 1);
  606.               brelse(bh);
  607. ***************
  608. *** 191,195 ****
  609.           }
  610.       }
  611. !     inode->i_blocks += MSDOS_SB(inode->i_sb)->cluster_size;
  612.       if (S_ISDIR(inode->i_mode)) {
  613.           if (inode->i_size & (SECTOR_SIZE-1)) {
  614. --- 179,183 ----
  615.           }
  616.       }
  617. !     inode->i_blocks += cluster_size;
  618.       if (S_ISDIR(inode->i_mode)) {
  619.           if (inode->i_size & (SECTOR_SIZE-1)) {
  620. ***************
  621. *** 198,203 ****
  622.                   ~(SECTOR_SIZE-1);
  623.           }
  624. !         inode->i_size += SECTOR_SIZE*MSDOS_SB(inode->i_sb)->
  625. !             cluster_size;
  626.   #ifdef DEBUG
  627.   printk("size is %d now (%x)\n",inode->i_size,inode);
  628. --- 186,190 ----
  629.                   ~(SECTOR_SIZE-1);
  630.           }
  631. !         inode->i_size += SECTOR_SIZE*cluster_size;
  632.   #ifdef DEBUG
  633.   printk("size is %d now (%x)\n",inode->i_size,inode);
  634. ***************
  635. *** 274,279 ****
  636. --- 261,268 ----
  637.       while (1) {
  638.           offset = *pos;
  639. +         PRINTK (("get_entry offset %d\n",offset));
  640.           if ((sector = msdos_smap(dir,offset >> SECTOR_BITS)) == -1)
  641.               return -1;
  642. +         PRINTK (("get_entry sector %d %p\n",sector,*bh));
  643.           if (!sector)
  644.               return -1; /* beyond EOF */
  645. ***************
  646. *** 281,284 ****
  647. --- 270,274 ----
  648.           if (*bh)
  649.               brelse(*bh);
  650. +         PRINTK (("get_entry sector apres brelse\n"));
  651.           if (!(*bh = msdos_sread(dir->i_dev,sector,&data))) {
  652.               printk("Directory sread (sector %d) failed\n",sector);
  653. ***************
  654. *** 285,288 ****
  655. --- 275,279 ----
  656.               continue;
  657.           }
  658. +         PRINTK (("get_entry apres sread\n"));
  659.           *de = (struct msdos_dir_entry *) (data+(offset &
  660.               (SECTOR_SIZE-1)));
  661. Only in linux.1.1.57/fs/msdos: mmap.c
  662. diff -rc2P linux.1.1.57/fs/msdos/namei.c linux/fs/msdos/namei.c
  663. *** linux.1.1.57/fs/msdos/namei.c    Sat Oct 29 01:13:55 1994
  664. --- linux/fs/msdos/namei.c    Tue Oct 25 22:12:48 1994
  665. ***************
  666. *** 14,17 ****
  667. --- 14,19 ----
  668.   #include <linux/stat.h>
  669.   
  670. + #define PRINTK(x)
  671.   /* MS-DOS "device special files" */
  672.   
  673. ***************
  674. *** 110,113 ****
  675. --- 112,117 ----
  676.       struct buffer_head *bh;
  677.       struct inode *next;
  678. +     
  679. +     PRINTK (("msdos_lookup\n"));
  680.   
  681.       *result = NULL;
  682. ***************
  683. *** 117,120 ****
  684. --- 121,125 ----
  685.           return -ENOENT;
  686.       }
  687. +     PRINTK (("msdos_lookup 2\n"));
  688.       if (len == 1 && name[0] == '.') {
  689.           *result = dir;
  690. ***************
  691. *** 128,131 ****
  692. --- 133,137 ----
  693.           return 0;
  694.       }
  695. +     PRINTK (("msdos_lookup 3\n"));
  696.       if ((res = msdos_find(dir,name,len,&bh,&de,&ino)) < 0) {
  697.           iput(dir);
  698. ***************
  699. *** 132,136 ****
  700. --- 138,144 ----
  701.           return res;
  702.       }
  703. +     PRINTK (("msdos_lookup 4\n"));
  704.       if (bh) brelse(bh);
  705. +     PRINTK (("msdos_lookup 4.5\n"));
  706.   /* printk("lookup: ino=%d\n",ino); */
  707.       if (!(*result = iget(dir->i_sb,ino))) {
  708. ***************
  709. *** 138,141 ****
  710. --- 146,150 ----
  711.           return -EACCES;
  712.       }
  713. +     PRINTK (("msdos_lookup 5\n"));
  714.       if (MSDOS_I(*result)->i_busy) { /* mkdir in progress */
  715.           iput(*result);
  716. ***************
  717. *** 143,146 ****
  718. --- 152,156 ----
  719.           return -ENOENT;
  720.       }
  721. +     PRINTK (("msdos_lookup 6\n"));
  722.       while (MSDOS_I(*result)->i_old) {
  723.           next = MSDOS_I(*result)->i_old;
  724. ***************
  725. *** 152,156 ****
  726. --- 162,168 ----
  727.           }
  728.       }
  729. +     PRINTK (("msdos_lookup 7\n"));
  730.       iput(dir);
  731. +     PRINTK (("msdos_lookup 8\n"));
  732.       return 0;
  733.   }
  734. diff -rc2P linux.1.1.57/fs/umsdos/Makefile linux/fs/umsdos/Makefile
  735. *** linux.1.1.57/fs/umsdos/Makefile    Sun Jul 24 10:39:44 1994
  736. --- linux/fs/umsdos/Makefile    Mon Oct 24 23:16:36 1994
  737. ***************
  738. *** 8,11 ****
  739. --- 8,15 ----
  740.   # Note 2! The CFLAGS definitions are now in the main makefile...
  741.   
  742. + ifndef CONFIG_UMSDOS_FS
  743. + CFLAGS := $(CFLAGS) -DMODULE
  744. + endif
  745.   .c.s:
  746.       $(CC) $(CFLAGS) -S $<
  747. diff -rc2P linux.1.1.57/fs/umsdos/dir.c linux/fs/umsdos/dir.c
  748. *** linux.1.1.57/fs/umsdos/dir.c    Wed Aug 10 12:26:28 1994
  749. --- linux/fs/umsdos/dir.c    Fri Oct 28 23:49:10 1994
  750. ***************
  751. *** 351,354 ****
  752. --- 351,355 ----
  753.               /* This is a DOS directory */
  754.               struct file filp;
  755. +             filp.f_reada = 1;
  756.               filp.f_pos = 0;
  757.               while (1){
  758. ***************
  759. *** 371,374 ****
  760. --- 372,376 ----
  761.               /* skip . and .. see umsdos_readdir_x() */
  762.               struct file filp;
  763. +             filp.f_reada = 1;
  764.               filp.f_pos = UMSDOS_SPECIAL_DIRFPOS;
  765.               while (1){
  766. ***************
  767. *** 624,627 ****
  768. --- 626,630 ----
  769.       }else{
  770.           struct file filp;
  771. +         filp.f_reada = 1;
  772.           filp.f_pos = 0;
  773.           PRINTK (("hlink2inode "));
  774. diff -rc2P linux.1.1.57/fs/umsdos/emd.c linux/fs/umsdos/emd.c
  775. *** linux.1.1.57/fs/umsdos/emd.c    Wed Aug 10 12:26:28 1994
  776. --- linux/fs/umsdos/emd.c    Fri Oct 28 23:52:35 1994
  777. ***************
  778. *** 198,201 ****
  779. --- 198,202 ----
  780.       }
  781.       filp.f_pos = info->f_pos;
  782. +     filp.f_reada = 0;
  783.       ret = umsdos_emd_dir_write(emd_dir,&filp,(char*)entry,info->recsize);
  784.       if (ret != 0){
  785. ***************
  786. *** 297,300 ****
  787. --- 298,302 ----
  788.           buf.size = 0;
  789.           buf.filp.f_pos = 0;
  790. +         buf.filp.f_reada = 1;
  791.           empty.found = 0;
  792.           empty.posok = emd_dir->i_size;
  793. ***************
  794. *** 455,458 ****
  795. --- 457,461 ----
  796.           /* Find an empty slot */
  797.           filp.f_pos = 0;
  798. +         filp.f_reada = 1;
  799.           filp.f_flags = O_RDONLY;
  800.           ret = 1;
  801. diff -rc2P linux.1.1.57/fs/umsdos/file.c linux/fs/umsdos/file.c
  802. *** linux.1.1.57/fs/umsdos/file.c    Sat Oct 29 01:15:54 1994
  803. --- linux/fs/umsdos/file.c    Tue Oct 25 22:15:27 1994
  804. ***************
  805. *** 76,80 ****
  806.       NULL,                /* select - default */
  807.       NULL,                /* ioctl - default */
  808. !     msdos_mmap,            /* mmap */
  809.       NULL,                /* no special open is needed */
  810.       NULL,                /* release */
  811. --- 76,80 ----
  812.       NULL,                /* select - default */
  813.       NULL,                /* ioctl - default */
  814. !     generic_mmap,            /* mmap */
  815.       NULL,                /* no special open is needed */
  816.       NULL,                /* release */
  817. diff -rc2P linux.1.1.57/fs/umsdos/inode.c linux/fs/umsdos/inode.c
  818. *** linux.1.1.57/fs/umsdos/inode.c    Sat Oct 29 01:14:51 1994
  819. --- linux/fs/umsdos/inode.c    Thu Oct 27 02:10:43 1994
  820. ***************
  821. *** 19,22 ****
  822. --- 19,27 ----
  823.   #include <linux/umsdos_fs.h>
  824.   
  825. + #ifdef MODULE
  826. +     #include <linux/module.h>
  827. +     #include "../../tools/version.h"
  828. + #endif
  829.   struct inode *pseudo_root=NULL;        /* Useful to simulate the pseudo DOS */
  830.                                       /* directory. See UMSDOS_readdir_x() */
  831. ***************
  832. *** 49,52 ****
  833. --- 54,60 ----
  834.   {
  835.       msdos_put_super(sb);
  836. +     #ifdef MODULE
  837. +         MOD_DEC_USE_COUNT;
  838. +     #endif
  839.   }
  840.   
  841. ***************
  842. *** 396,400 ****
  843.       */
  844.       struct super_block *sb = msdos_read_super(s,data,silent);
  845. !     printk ("UMSDOS Alpha 0.4 (compatibility level %d.%d)\n"
  846.           ,UMSDOS_VERSION,UMSDOS_RELEASE);
  847.       if (sb != NULL){
  848. --- 404,408 ----
  849.       */
  850.       struct super_block *sb = msdos_read_super(s,data,silent);
  851. !     printk ("UMSDOS Alpha 0.5 (compatibility level %d.%d, fast msdos)\n"
  852.           ,UMSDOS_VERSION,UMSDOS_RELEASE);
  853.       if (sb != NULL){
  854. ***************
  855. *** 464,467 ****
  856. --- 472,478 ----
  857.               iput (pseudo);
  858.           }
  859. +         #ifdef MODULE
  860. +             MOD_INC_USE_COUNT;
  861. +         #endif
  862.       }
  863.       return sb;
  864. ***************
  865. *** 468,470 ****
  866. --- 479,507 ----
  867.   }
  868.   
  869. + #ifdef MODULE
  870. + char kernel_version[] = UTS_RELEASE;
  871. + static struct file_system_type umsdos_fs_type = {
  872. +     UMSDOS_read_super, "umsdos", 1, NULL
  873. + };
  874. + int init_module(void)
  875. + {
  876. +     register_filesystem(&umsdos_fs_type);
  877. +     return 0;
  878. + }
  879. + void cleanup_module(void)
  880. + {
  881. +     if (MOD_IN_USE)
  882. +         printk("Umsdos: file system in use, remove delayed\n");
  883. +     else
  884. +     {
  885. +         unregister_filesystem(&umsdos_fs_type);
  886. +     }
  887. + }
  888. + #endif
  889.   
  890. diff -rc2P linux.1.1.57/fs/umsdos/symlink.c linux/fs/umsdos/symlink.c
  891. *** linux.1.1.57/fs/umsdos/symlink.c    Wed Aug 10 12:26:28 1994
  892. --- linux/fs/umsdos/symlink.c    Fri Oct 28 23:53:46 1994
  893. ***************
  894. *** 35,38 ****
  895. --- 35,39 ----
  896.       struct file filp;
  897.       filp.f_pos = 0;
  898. +     filp.f_reada = 0;
  899.       if (ret > bufsiz) ret = bufsiz;
  900.       if ((*msdos_read) (inode, &filp, buffer,ret) != ret){
  901. diff -rc2P linux.1.1.57/include/linux/msdos_fs.h linux/include/linux/msdos_fs.h
  902. *** linux.1.1.57/include/linux/msdos_fs.h    Sat Oct 29 01:14:52 1994
  903. --- linux/include/linux/msdos_fs.h    Mon Oct 24 23:16:36 1994
  904. ***************
  905. *** 12,17 ****
  906.   #define SECTOR_SIZE     512 /* sector size (bytes) */
  907.   #define SECTOR_BITS    9 /* log2(SECTOR_SIZE) */
  908. ! #define MSDOS_DPB    (MSDOS_DPS*2) /* dir entries per block */
  909. ! #define MSDOS_DPB_BITS    5 /* log2(MSDOS_DPB) */
  910.   #define MSDOS_DPS    (SECTOR_SIZE/sizeof(struct msdos_dir_entry))
  911.   #define MSDOS_DPS_BITS    4 /* log2(MSDOS_DPS) */
  912. --- 12,17 ----
  913.   #define SECTOR_SIZE     512 /* sector size (bytes) */
  914.   #define SECTOR_BITS    9 /* log2(SECTOR_SIZE) */
  915. ! #define MSDOS_DPB    (MSDOS_DPS) /* dir entries per block */
  916. ! #define MSDOS_DPB_BITS    4 /* log2(MSDOS_DPB) */
  917.   #define MSDOS_DPS    (SECTOR_SIZE/sizeof(struct msdos_dir_entry))
  918.   #define MSDOS_DPS_BITS    4 /* log2(MSDOS_DPS) */
  919. ***************
  920. *** 113,121 ****
  921.   static inline struct buffer_head *msdos_sread(int dev,int sector,void **start)
  922.   {
  923. !      struct buffer_head *bh;
  924. !     if (!(bh = bread(dev,sector >> 1, 1024)))
  925. !         return NULL;
  926. !         *start = bh->b_data+((sector & 1) << SECTOR_BITS);
  927.       return bh;
  928.   }
  929. --- 113,120 ----
  930.   static inline struct buffer_head *msdos_sread(int dev,int sector,void **start)
  931.   {
  932. !      struct buffer_head *bh = bread(dev,sector, 512);
  933. !     if (bh != NULL){
  934. !         *start = bh->b_data;    /* From the time of 1024 bytes block */
  935. !     }
  936.       return bh;
  937.   }
  938. diff -rc2P linux.1.1.57/kernel/ksyms.c linux/kernel/ksyms.c
  939. *** linux.1.1.57/kernel/ksyms.c    Sat Oct 29 01:14:47 1994
  940. --- linux/kernel/ksyms.c    Sat Oct 29 00:43:56 1994
  941. ***************
  942. *** 28,31 ****
  943. --- 28,32 ----
  944.   #include <linux/tty.h>
  945.   #include <linux/serial.h>
  946. + #include <linux/locks.h>
  947.   #ifdef CONFIG_INET
  948.   #include <linux/net.h>
  949. ***************
  950. *** 45,48 ****
  951. --- 46,51 ----
  952.   #endif
  953.   
  954. + extern int sys_tz;
  955. + extern int ___strtok;
  956.   extern int request_dma(unsigned int dmanr, char * deviceID);
  957.   extern void free_dma(unsigned int dmanr);
  958. ***************
  959. *** 200,204 ****
  960.       X(dev_base),
  961.   #endif
  962.       /********************************************************
  963.        * Do not add anything below this line,
  964. --- 203,229 ----
  965.       X(dev_base),
  966.   #endif
  967. !     /* Added to make file system as module */
  968. !     X(set_writetime),
  969. !     X(getblk),
  970. !     X(inode_setattr),
  971. !     X(sys_tz),
  972. !     X(inode_change_ok),
  973. !     X(__wait_on_super),
  974. !     X(file_fsync),
  975. !     X(simple_strtoul),
  976. !     X(generic_mmap),
  977. !     X(set_blocksize),
  978. !     X(clear_inode),
  979. !     X(refile_buffer),
  980. !     X(___strtok),
  981. !     X(brelse),
  982. !     X(bread),
  983. !     X(init_fifo),
  984. !     X(super_blocks),
  985. !     X(chrdev_inode_operations),
  986. !     X(blkdev_inode_operations),
  987. !     X(ll_rw_block),
  988. !     X(__wait_on_buffer),
  989. !     X(read_ahead),
  990.       /********************************************************
  991.        * Do not add anything below this line,
  992.