]> rtime.felk.cvut.cz Git - rtems-devel.git/blob - rtems-patches/mount-problems-noisy-reporting.patch
The FAT mount becomes significantly more noisy if there is some problem.
[rtems-devel.git] / rtems-patches / mount-problems-noisy-reporting.patch
1 Index: rtems-051009/cpukit/libcsupport/src/mount.c
2 ===================================================================
3 --- rtems-051009.orig/cpukit/libcsupport/src/mount.c
4 +++ rtems-051009/cpukit/libcsupport/src/mount.c
5 @@ -85,9 +85,9 @@ int mount(
6    /*
7     *  Is there a file system operations table?
8     */
9 -
10    if ( fs_ops == NULL ) {
11      errno = EINVAL;
12 +    printk("mount: fs_ops cannot be zero\n",mount_point);
13      return -1;
14    }
15  
16 @@ -98,12 +98,14 @@ int mount(
17    if ( options != RTEMS_FILESYSTEM_READ_ONLY &&
18         options != RTEMS_FILESYSTEM_READ_WRITE ) {
19      errno = EINVAL;
20 +    printk("mount: bad options\n");
21      return -1;
22    }
23  
24    /* Do they support being mounted at all ? */
25    if ( !fs_ops->fsmount_me_h ) {
26      errno = ENOTSUP;
27 +    printk("mount: mounting not supported for this fs\n");
28      goto cleanup_and_bail;
29    }
30  
31 @@ -118,6 +120,7 @@ int mount(
32     temp_mt_entry = malloc( size );
33  
34     if ( !temp_mt_entry ) {
35 +     printk("mount: cannot allocate memory for temp_mt_entry\n");
36       errno = ENOMEM;
37       return -1;
38     }
39 @@ -139,8 +142,10 @@ int mount(
40    if ( mount_point ) {
41  
42      if ( rtems_filesystem_evaluate_path(
43 -            mount_point, RTEMS_LIBIO_PERMS_RWX, &loc, TRUE ) == -1 )
44 +            mount_point, RTEMS_LIBIO_PERMS_RWX, &loc, TRUE ) == -1 ){
45 +      printk("mount: evaluate mount point path \"%s\" failed\n",mount_point);
46        goto cleanup_and_bail;
47 +    }
48  
49      loc_to_free = &loc;
50  
51 @@ -150,6 +155,7 @@ int mount(
52  
53      if (!loc.ops->node_type_h) {
54        errno =  ENOTSUP;
55 +      printk("mount: mount point \"%s\" has no node_type_h\n",mount_point);
56        goto cleanup_and_bail;
57      }
58  
59 @@ -159,6 +165,7 @@ int mount(
60  
61      if ( loc.ops->node_type_h( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) {
62        errno = ENOTDIR;
63 +      printk("mount: mount point \"%s\" is not a directory\n",mount_point);
64        goto cleanup_and_bail;
65      }
66  
67 @@ -168,6 +175,7 @@ int mount(
68  
69      if ( Is_node_fs_root(  &loc ) ){
70        errno = EBUSY;
71 +      printk("mount: mount point \"%s\" Is_node_fs_root\n",mount_point);
72        goto cleanup_and_bail;
73      }
74  
75 @@ -191,10 +199,12 @@ int mount(
76  
77      if ( !loc.ops->mount_h ){
78        errno = ENOTSUP;
79 +      printk("mount: mount point \"%s\" does not support mount_h\n",mount_point);
80        goto cleanup_and_bail;
81      }
82  
83      if ( loc.ops->mount_h( temp_mt_entry ) ) {
84 +      printk("mount: mount_h at mount point \"%s\" failed\n",mount_point);
85        goto cleanup_and_bail;
86      }
87    } else {
88 @@ -220,6 +230,7 @@ int mount(
89         if ( loc.ops->unmount_h ) {
90                 loc.ops->unmount_h( temp_mt_entry );
91      }
92 +    printk("mount: unmounting because problem arose\n",mount_point);
93      goto cleanup_and_bail;
94    }
95  
96 @@ -240,6 +251,7 @@ cleanup_and_bail:
97    if ( loc_to_free )
98      rtems_filesystem_freenode( loc_to_free );
99  
100 +  printk("mount: bailing out\n");
101    return -1;
102  }
103  
104 Index: rtems-051009/cpukit/libmisc/fsmount/fsmount.c
105 ===================================================================
106 --- rtems-051009.orig/cpukit/libmisc/fsmount/fsmount.c
107 +++ rtems-051009/cpukit/libmisc/fsmount/fsmount.c
108 @@ -160,13 +160,15 @@ int rtems_fsmount
109                      fstab_ptr->mount_options,
110                      fstab_ptr->dev,
111                      fstab_ptr->mount_point);
112 +      
113        if (tmp_rc != RTEMS_SUCCESSFUL) {
114         if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNT_FAILED)) {
115           fprintf(stdout,"fsmount: mounting of \"%s\" to"
116 -                " \"%s\" failed: %s\n",
117 +                " \"%s\" failed: %s , tmp_rc=%d\n",
118                  fstab_ptr->dev,
119                  fstab_ptr->mount_point,
120 -                strerror(errno));
121 +                strerror(errno),
122 +                tmp_rc);
123         }
124         if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNT_FAILED)) {
125           terminate = TRUE;
126 Index: rtems-051009/cpukit/libfs/src/dosfs/msdos_initsupp.c
127 ===================================================================
128 --- rtems-051009.orig/cpukit/libfs/src/dosfs/msdos_initsupp.c
129 +++ rtems-051009/cpukit/libfs/src/dosfs/msdos_initsupp.c
130 @@ -69,6 +69,7 @@ msdos_initialize_support(
131      if (rc != RC_OK)
132      {
133          free(fs_info);
134 +       printk("msdos_initialize_support: fat_init_volume_info failed\n");
135          return rc;
136      }
137  
138 @@ -84,6 +85,7 @@ msdos_initialize_support(
139      {
140          fat_shutdown_drive(temp_mt_entry);
141          free(fs_info);
142 +       printk("msdos_initialize_support: fat_file_open\n");
143          return rc;
144      }
145  
146 @@ -104,6 +106,7 @@ msdos_initialize_support(
147          cl_buf_size = (fs_info->fat.vol.bpc > fs_info->fat.vol.rdir_size) ?
148                        fs_info->fat.vol.bpc                                :
149                        fs_info->fat.vol.rdir_size;
150 +       printk("msdos_initialize_support: FAT12/16\n");
151      }
152      else
153      {
154 @@ -113,9 +116,11 @@ msdos_initialize_support(
155              fat_file_close(temp_mt_entry, fat_fd);
156              fat_shutdown_drive(temp_mt_entry);
157              free(fs_info);
158 +           printk("msdos_initialize_support: fat_file_size\n");
159              return rc;
160          }
161          cl_buf_size = fs_info->fat.vol.bpc;
162 +       printk("msdos_initialize_support: FAT32\n");
163      }
164  
165      fs_info->cl_buf = (uint8_t *)calloc(cl_buf_size, sizeof(char));
166 @@ -124,6 +129,7 @@ msdos_initialize_support(
167          fat_file_close(temp_mt_entry, fat_fd);
168          fat_shutdown_drive(temp_mt_entry);
169          free(fs_info);
170 +        printk("msdos_initialize_support: alloc fs_info->cl_buf\n");
171          set_errno_and_return_minus_one(ENOMEM);
172      }
173  
174 @@ -138,6 +144,7 @@ msdos_initialize_support(
175          fat_shutdown_drive(temp_mt_entry);
176          free(fs_info->cl_buf);
177          free(fs_info);
178 +        printk("msdos_initialize_support: semaphore\n");
179          set_errno_and_return_minus_one( EIO );
180      }
181  
182 Index: rtems-051009/cpukit/libfs/src/dosfs/fat.c
183 ===================================================================
184 --- rtems-051009.orig/cpukit/libfs/src/dosfs/fat.c
185 +++ rtems-051009/cpukit/libfs/src/dosfs/fat.c
186 @@ -217,17 +217,23 @@ fat_init_volume_info(rtems_filesystem_mo
187      int                 i = 0;
188  
189      rc = stat(mt_entry->dev, &stat_buf);
190 -    if (rc == -1)
191 +    if (rc == -1){
192 +        printk("fat_init_volume_info: stat\n");
193          return rc;
194 +    }
195  
196      /* rtmes feature: no block devices, all are character devices */
197 -    if (!S_ISCHR(stat_buf.st_mode))
198 +    if (!S_ISCHR(stat_buf.st_mode)){
199 +        printk("fat_init_volume_info: S_ISCHR\n");
200          set_errno_and_return_minus_one(ENOTBLK);
201 +    }
202  
203      /* check that  device is registred as block device and lock it */
204      vol->dd = rtems_disk_lookup(stat_buf.st_dev);
205 -    if (vol->dd == NULL)
206 +    if (vol->dd == NULL){
207 +        printk("fat_init_volume_info: vol->dd == NULL\n");
208          set_errno_and_return_minus_one(ENOTBLK);
209 +    }
210  
211      vol->dev = stat_buf.st_dev;
212  
213 @@ -235,6 +241,7 @@ fat_init_volume_info(rtems_filesystem_mo
214      if (fd == -1)
215      {
216          rtems_disk_release(vol->dd);
217 +        printk("fat_init_volume_info: open\n");
218          return -1;
219      }
220  
221 @@ -243,6 +250,7 @@ fat_init_volume_info(rtems_filesystem_mo
222      {
223          close(fd);
224          rtems_disk_release(vol->dd);
225 +        printk("fat_init_volume_info: read BPB\n");
226          set_errno_and_return_minus_one( EIO );
227      }
228      close(fd);
229 @@ -255,6 +263,7 @@ fat_init_volume_info(rtems_filesystem_mo
230           (vol->bps != 4096))
231      {
232          rtems_disk_release(vol->dd);
233 +        printk("fat_init_volume_info: vol->bps %d\n",vol->bps);
234          set_errno_and_return_minus_one( EINVAL );
235      }
236  
237 @@ -271,6 +280,7 @@ fat_init_volume_info(rtems_filesystem_mo
238      if (vol->spc == 0)
239      {
240          rtems_disk_release(vol->dd);
241 +        printk("fat_init_volume_info: vol->spc == 0\n");
242          set_errno_and_return_minus_one(EINVAL);
243      }
244  
245 @@ -283,6 +293,7 @@ fat_init_volume_info(rtems_filesystem_mo
246      if ((vol->bpc = vol->bps << vol->spc_log2) > MS_BYTES_PER_CLUSTER_LIMIT)
247      {
248          rtems_disk_release(vol->dd);
249 +        printk("fat_init_volume_info: bytes per cluster value greater than 32K is invalid\n");
250          set_errno_and_return_minus_one(EINVAL);
251      }
252  
253 @@ -357,6 +368,7 @@ fat_init_volume_info(rtems_filesystem_mo
254          if( vol->info_sec == 0 )
255          {
256              rtems_disk_release(vol->dd);
257 +            printk("fat_init_volume_info: FAT_GET_BR_FAT32_FS_INFO_SECTOR\n");
258              set_errno_and_return_minus_one( EINVAL );
259          }
260          else
261 @@ -366,6 +378,7 @@ fat_init_volume_info(rtems_filesystem_mo
262              if ( ret < 0 )
263              {
264                  rtems_disk_release(vol->dd);
265 +                printk("fat_init_volume_info: _fat_block_read 0\n");
266                  return -1;
267              }    
268        
269 @@ -373,6 +386,7 @@ fat_init_volume_info(rtems_filesystem_mo
270                  FAT_FSINFO_LEAD_SIGNATURE_VALUE)
271              {
272                  rtems_disk_release(vol->dd);
273 +                printk("fat_init_volume_info: FAT_GET_FSINFO_LEAD_SIGNATURE\n");
274                  set_errno_and_return_minus_one( EINVAL );
275              }
276              else
277 @@ -382,6 +396,7 @@ fat_init_volume_info(rtems_filesystem_mo
278                  if ( ret < 0 )
279                  {
280                      rtems_disk_release(vol->dd);
281 +                    printk("fat_init_volume_info: _fat_block_read FAT_FSI_INFO\n");
282                      return -1;
283                  }    
284                      
285 @@ -392,6 +407,7 @@ fat_init_volume_info(rtems_filesystem_mo
286                  if ( rc != RC_OK )
287                  {
288                      rtems_disk_release(vol->dd);
289 +                    printk("fat_init_volume_info: fat_fat32_update_fsinfo_sector\n");
290                      return rc;
291                  }
292              }
293 @@ -412,6 +428,7 @@ fat_init_volume_info(rtems_filesystem_mo
294      if ( fs_info->vhash == NULL )
295      {
296          rtems_disk_release(vol->dd);
297 +        printk("fat_init_volume_info: fs_info->vhash == NULL\n");
298          set_errno_and_return_minus_one( ENOMEM );
299      }
300  
301 @@ -423,6 +440,7 @@ fat_init_volume_info(rtems_filesystem_mo
302      {
303          rtems_disk_release(vol->dd);
304          free(fs_info->vhash);
305 +        printk("fat_init_volume_info: fs_info->rhash == NULL\n");
306          set_errno_and_return_minus_one( ENOMEM );
307      }
308      for (i = 0; i < FAT_HASH_SIZE; i++)
309 @@ -437,6 +455,7 @@ fat_init_volume_info(rtems_filesystem_mo
310          rtems_disk_release(vol->dd);
311          free(fs_info->vhash);
312          free(fs_info->rhash);
313 +        printk("fat_init_volume_info: fs_info->uino == NULL\n");
314          set_errno_and_return_minus_one( ENOMEM );
315      }
316      fs_info->sec_buf = (uint8_t *)calloc(vol->bps, sizeof(uint8_t));
317 @@ -446,6 +465,7 @@ fat_init_volume_info(rtems_filesystem_mo
318          free(fs_info->vhash);
319          free(fs_info->rhash);
320          free(fs_info->uino);
321 +        printk("fat_init_volume_info: fs_info->sec_buf\n");
322          set_errno_and_return_minus_one( ENOMEM );
323      }
324