Changeset ac31040 in mainline for uspace/srv/fs/udf/udf_volume.c


Ignore:
Timestamp:
2012-09-04T19:48:22Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
78ca12b
Parents:
85f7369 (diff), 8ec4144 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/udf/udf_volume.c

    r85f7369 rac31040  
    151151 *
    152152 */
    153 void udf_prepare_tag(udf_descriptor_tag_t *tag)
     153static void udf_prepare_tag(udf_descriptor_tag_t *tag)
    154154{
    155155        GET_LE16(tag->id);
     
    159159        GET_LE16(tag->descriptor_crc_length);
    160160        GET_LE32(tag->location);
     161}
     162
     163/** Read AVD by using one of default sector size from array
     164 *
     165 * @param service_id
     166 * @param avd         Returned value - Anchor Volume Descriptor
     167 * @param sector_size Expected sector size
     168 *
     169 * @return EOK on success or a negative error code.
     170 *
     171 */
     172static int udf_get_anchor_volume_descriptor_by_ssize(service_id_t service_id,
     173    udf_anchor_volume_descriptor_t *avd, uint32_t sector_size)
     174{
     175        int rc = block_read_bytes_direct(service_id,
     176            UDF_AVDP_SECTOR * sector_size,
     177            sizeof(udf_anchor_volume_descriptor_t), avd);
     178        if (rc != EOK)
     179                return rc;
     180       
     181        if (avd->tag.checksum != udf_tag_checksum((uint8_t *) &avd->tag))
     182                return EINVAL;
     183       
     184        // TODO: Should be tested in big-endian mode
     185        udf_prepare_tag(&avd->tag);
     186       
     187        if (avd->tag.id != UDF_TAG_AVDP)
     188                return EINVAL;
     189       
     190        GET_LE32(avd->main_extent.length);
     191        GET_LE32(avd->main_extent.location);
     192        GET_LE32(avd->reserve_extent.length);
     193        GET_LE32(avd->reserve_extent.location);
     194       
     195        return EOK;
    161196}
    162197
     
    200235       
    201236        return EINVAL;
    202 }
    203 
    204 /** Read AVD by using one of default sector size from array
    205  *
    206  * @param service_id
    207  * @param avd         Returned value - Anchor Volume Descriptor
    208  * @param sector_size Expected sector size
    209  *
    210  * @return EOK on success or a negative error code.
    211  *
    212  */
    213 int udf_get_anchor_volume_descriptor_by_ssize(service_id_t service_id,
    214     udf_anchor_volume_descriptor_t *avd, uint32_t sector_size)
    215 {
    216         int rc = block_read_bytes_direct(service_id,
    217             UDF_AVDP_SECTOR * sector_size,
    218             sizeof(udf_anchor_volume_descriptor_t), avd);
    219         if (rc != EOK)
    220                 return rc;
    221        
    222         if (avd->tag.checksum != udf_tag_checksum((uint8_t *) &avd->tag))
    223                 return EINVAL;
    224        
    225         // TODO: Should be tested in BegEndian mode
    226         udf_prepare_tag(&avd->tag);
    227        
    228         if (avd->tag.id != UDF_TAG_AVDP)
    229                 return EINVAL;
    230        
    231         GET_LE32(avd->main_extent.length);
    232         GET_LE32(avd->main_extent.location);
    233         GET_LE32(avd->reserve_extent.length);
    234         GET_LE32(avd->reserve_extent.location);
    235        
    236         return EOK;
    237237}
    238238
Note: See TracChangeset for help on using the changeset viewer.