Ticket #11014: 0001-file_systems-cdda-Various-fixes.patch

File 0001-file_systems-cdda-Various-fixes.patch, 3.9 KB (added by waddlesplash, 10 years ago)

Git patch with my fixes.

  • src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp

    From 99caeb8e345e01ce8c243a4284f5a2353fc2009e Mon Sep 17 00:00:00 2001
    From: Augustin Cavalier <waddlesplash@gmail.com>
    Date: Mon, 7 Jul 2014 11:33:29 -0400
    Subject: [PATCH] file_systems/cdda: Various fixes.
    
     * When restoring shared attributes, don't affect CDDB:lookup status
     * Volume renames should not affect CDDB:lookup status, only file renames should
    
    This fixes some of the "cddb_daemon not updating CD info" problems.
    ---
     .../kernel/file_systems/cdda/kernel_interface.cpp  | 31 +++++++++++-----------
     1 file changed, 15 insertions(+), 16 deletions(-)
    
    diff --git a/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp b/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
    index d6f1916..4c97144 100644
    a b public:  
    105105            size_t          BufferSize() const { return 32 * kFrameSize; }
    106106                                // TODO: for now
    107107
    108             void            DisableCDDBLookUps();
     108            void            SetCDDBLookupsEnabled(bool doLookup);
    109109
    110110    static  void            DetermineName(uint32 cddbId, int device, char* name,
    111111                                size_t length);
    private:  
    129129            ino_t           fNextID;
    130130            char*           fName;
    131131            off_t           fNumBlocks;
     132            bool            fIgnoreCDDBLookupChanges;
    132133
    133134            // root directory contents - we don't support other directories
    134135            Inode*          fFirstEntry;
    Volume::Volume(fs_volume* fsVolume)  
    569570    fNextID(1),
    570571    fName(NULL),
    571572    fNumBlocks(0),
     573    fIgnoreCDDBLookupChanges(false),
    572574    fFirstEntry(NULL)
    573575{
    574576}
    Volume::Mount(const char* device)  
    730732    fRootNode->AddAttribute(kCddbIdAttribute, B_UINT32_TYPE, fDiscID);
    731733
    732734    // Add CD:do_lookup attribute.
    733     fRootNode->AddAttribute(kDoLookupAttribute, B_BOOL_TYPE, true,
    734         (const uint8*)&doLookup, sizeof(bool));
     735    SetCDDBLookupsEnabled(true);
    735736
    736737    // Add CD:toc attribute.
    737738    fRootNode->AddAttribute(kTocAttribute, B_RAW_TYPE, true,
    Volume::Find(const char* name)  
    805806
    806807
    807808void
    808 Volume::DisableCDDBLookUps()
     809Volume::SetCDDBLookupsEnabled(bool doLookup)
    809810{
    810     bool doLookup = false;
    811     RootNode().AddAttribute(kDoLookupAttribute, B_BOOL_TYPE, true,
    812         (const uint8*)&doLookup, sizeof(bool));
     811    if (!fIgnoreCDDBLookupChanges) {
     812        fRootNode->AddAttribute(kDoLookupAttribute, B_BOOL_TYPE, true,
     813            (const uint8*)&doLookup, sizeof(bool));
     814    }
    813815}
    814816
    815817
    Volume::_StoreAttributes()  
    958960void
    959961Volume::_RestoreSharedAttributes()
    960962{
    961     // device attributes overwrite shared attributes
     963    // Don't affect CDDB lookup status while changing shared attributes
     964    fIgnoreCDDBLookupChanges = true;
    962965
     966    // device attributes overwrite shared attributes
    963967    int fd = _OpenAttributes(O_RDONLY, kSharedAttributes);
    964968    if (fd >= 0) {
    965969        read_attributes(fd, fRootNode);
    Volume::_RestoreSharedAttributes()  
    971975        read_attributes(fd, fRootNode);
    972976        close(fd);
    973977    }
     978
     979    fIgnoreCDDBLookupChanges = false;
    974980}
    975981
    976982
    cdda_write_fs_stat(fs_volume* _volume, const struct fs_info* info, uint32 mask)  
    15401546
    15411547    if ((mask & FS_WRITE_FSINFO_NAME) != 0) {
    15421548        status = volume->SetName(info->volume_name);
    1543         if (status == B_OK) {
    1544             // The volume had its name changed from outside the filesystem
    1545             // add-on. Disable CDDB lookups. Note this will usually mean that
    1546             // the user manually renamed the volume or that cddblinkd (or other
    1547             // program) did this so we do not want to do it again.
    1548             volume->DisableCDDBLookUps();
    1549         }
    15501549    }
    15511550
    15521551    return status;
    cdda_rename(fs_volume* _volume, fs_vnode* _oldDir, const char* oldName,  
    18111810        // add-on. Disable CDDB lookups. Note this will usually mean that the
    18121811        // user manually renamed a track or that cddblinkd (or other program)
    18131812        // did this so we do not want to do it again.
    1814         volume->DisableCDDBLookUps();
     1813        volume->SetCDDBLookupsEnabled(false);
    18151814
    18161815        notify_entry_moved(volume->ID(), volume->RootNode().ID(), oldName,
    18171816            volume->RootNode().ID(), newName, inode->ID());