Changeset 95c675b in mainline for uspace/srv/fs/fat/fat_directory.c


Ignore:
Timestamp:
2017-10-17T13:11:35Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
60af4cdb
Parents:
dbf32b1 (diff), a416d070 (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

File:
1 edited

Legend:

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

    rdbf32b1 r95c675b  
    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))
     
    300301                        return rc;
    301302               
    302                 lfn_size = utf16_length(wname);
     303                lfn_size = utf16_wsize(wname);
    303304                long_entry_count = lfn_size / FAT_LFN_ENTRY_SIZE;
    304305                if (lfn_size % FAT_LFN_ENTRY_SIZE)
     
    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.