Changeset 39b0a51 in mainline for uspace/srv/fs/fat/fat_directory.c


Ignore:
Timestamp:
2017-06-28T16:05:37Z (8 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ee50130
Parents:
30eab78
Message:

FAT decoding of volume label.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_directory.c

    r30eab78 r39b0a51  
    223223                        *de = d;
    224224                        return EOK;
    225                 default:
    226225                case FAT_DENTRY_SKIP:
    227226                case FAT_DENTRY_FREE:
     227                case FAT_DENTRY_VOLLABEL:
     228                default:
    228229                        long_entry_count = 0;
    229230                        long_entry = false;
     
    252253        while (!flag && fat_directory_prev(di) == EOK) {
    253254                if (fat_directory_get(di, &d) == EOK &&
    254                     fat_classify_dentry(d) == FAT_DENTRY_LFN &&                
     255                    fat_classify_dentry(d) == FAT_DENTRY_LFN &&
    255256                    checksum == FAT_LFN_CHKSUM(d)) {
    256257                        if (FAT_IS_LFN(d))
     
    473474                        case FAT_DENTRY_LFN:
    474475                        case FAT_DENTRY_SKIP:
     476                        case FAT_DENTRY_VOLLABEL:
    475477                        default:
    476478                                found = 0;
     
    523525                case FAT_DENTRY_LFN:
    524526                case FAT_DENTRY_SKIP:
     527                case FAT_DENTRY_VOLLABEL:
    525528                case FAT_DENTRY_FREE:
    526529                        break;
    527530                }
    528         } while (fat_directory_next(di) == EOK);       
     531        } while (fat_directory_next(di) == EOK);
    529532
    530533        return false;
     534}
     535
     536/** Find volume label entry in a directory.
     537 *
     538 * @return EOK on success, ENOENT if not found, EIO on I/O error
     539 */
     540int fat_directory_vollabel_get(fat_directory_t *di, char *label)
     541{
     542        fat_dentry_t *d;
     543        int rc;
     544
     545        fat_directory_seek(di, 0);
     546        do {
     547                rc = fat_directory_get(di, &d);
     548                if (rc != EOK)
     549                        return EIO;
     550
     551                switch (fat_classify_dentry(d)) {
     552                case FAT_DENTRY_VOLLABEL:
     553                        fat_dentry_vollabel_get(d, label);
     554                        return EOK;
     555                default:
     556                        break;
     557                }
     558        } while (fat_directory_next(di) == EOK);
     559
     560        /* Not found */
     561        return ENOENT;
    531562}
    532563
Note: See TracChangeset for help on using the changeset viewer.