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. Signed-off-by: Jérôme Duval <[email protected]>
This commit is contained in:
committed by
Jérôme Duval
parent
e8f82cdb6e
commit
8566c721c7
@@ -105,7 +105,7 @@ public:
|
|||||||
size_t BufferSize() const { return 32 * kFrameSize; }
|
size_t BufferSize() const { return 32 * kFrameSize; }
|
||||||
// TODO: for now
|
// TODO: for now
|
||||||
|
|
||||||
void DisableCDDBLookUps();
|
void SetCDDBLookupsEnabled(bool doLookup);
|
||||||
|
|
||||||
static void DetermineName(uint32 cddbId, int device, char* name,
|
static void DetermineName(uint32 cddbId, int device, char* name,
|
||||||
size_t length);
|
size_t length);
|
||||||
@@ -129,6 +129,7 @@ private:
|
|||||||
ino_t fNextID;
|
ino_t fNextID;
|
||||||
char* fName;
|
char* fName;
|
||||||
off_t fNumBlocks;
|
off_t fNumBlocks;
|
||||||
|
bool fIgnoreCDDBLookupChanges;
|
||||||
|
|
||||||
// root directory contents - we don't support other directories
|
// root directory contents - we don't support other directories
|
||||||
Inode* fFirstEntry;
|
Inode* fFirstEntry;
|
||||||
@@ -569,6 +570,7 @@ Volume::Volume(fs_volume* fsVolume)
|
|||||||
fNextID(1),
|
fNextID(1),
|
||||||
fName(NULL),
|
fName(NULL),
|
||||||
fNumBlocks(0),
|
fNumBlocks(0),
|
||||||
|
fIgnoreCDDBLookupChanges(false),
|
||||||
fFirstEntry(NULL)
|
fFirstEntry(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -730,8 +732,7 @@ Volume::Mount(const char* device)
|
|||||||
fRootNode->AddAttribute(kCddbIdAttribute, B_UINT32_TYPE, fDiscID);
|
fRootNode->AddAttribute(kCddbIdAttribute, B_UINT32_TYPE, fDiscID);
|
||||||
|
|
||||||
// Add CD:do_lookup attribute.
|
// Add CD:do_lookup attribute.
|
||||||
fRootNode->AddAttribute(kDoLookupAttribute, B_BOOL_TYPE, true,
|
SetCDDBLookupsEnabled(true);
|
||||||
(const uint8*)&doLookup, sizeof(bool));
|
|
||||||
|
|
||||||
// Add CD:toc attribute.
|
// Add CD:toc attribute.
|
||||||
fRootNode->AddAttribute(kTocAttribute, B_RAW_TYPE, true,
|
fRootNode->AddAttribute(kTocAttribute, B_RAW_TYPE, true,
|
||||||
@@ -807,11 +808,12 @@ Volume::Find(const char* name)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Volume::DisableCDDBLookUps()
|
Volume::SetCDDBLookupsEnabled(bool doLookup)
|
||||||
{
|
{
|
||||||
bool doLookup = false;
|
if (!fIgnoreCDDBLookupChanges) {
|
||||||
RootNode().AddAttribute(kDoLookupAttribute, B_BOOL_TYPE, true,
|
fRootNode->AddAttribute(kDoLookupAttribute, B_BOOL_TYPE, true,
|
||||||
(const uint8*)&doLookup, sizeof(bool));
|
(const uint8*)&doLookup, sizeof(bool));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -960,8 +962,10 @@ Volume::_StoreAttributes()
|
|||||||
void
|
void
|
||||||
Volume::_RestoreSharedAttributes()
|
Volume::_RestoreSharedAttributes()
|
||||||
{
|
{
|
||||||
// device attributes overwrite shared attributes
|
// Don't affect CDDB lookup status while changing shared attributes
|
||||||
|
fIgnoreCDDBLookupChanges = true;
|
||||||
|
|
||||||
|
// device attributes overwrite shared attributes
|
||||||
int fd = _OpenAttributes(O_RDONLY, kSharedAttributes);
|
int fd = _OpenAttributes(O_RDONLY, kSharedAttributes);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
read_attributes(fd, fRootNode);
|
read_attributes(fd, fRootNode);
|
||||||
@@ -973,6 +977,8 @@ Volume::_RestoreSharedAttributes()
|
|||||||
read_attributes(fd, fRootNode);
|
read_attributes(fd, fRootNode);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fIgnoreCDDBLookupChanges = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1542,13 +1548,6 @@ cdda_write_fs_stat(fs_volume* _volume, const struct fs_info* info, uint32 mask)
|
|||||||
|
|
||||||
if ((mask & FS_WRITE_FSINFO_NAME) != 0) {
|
if ((mask & FS_WRITE_FSINFO_NAME) != 0) {
|
||||||
status = volume->SetName(info->volume_name);
|
status = volume->SetName(info->volume_name);
|
||||||
if (status == B_OK) {
|
|
||||||
// The volume had its name changed from outside the filesystem
|
|
||||||
// add-on. Disable CDDB lookups. Note this will usually mean that
|
|
||||||
// the user manually renamed the volume or that cddblinkd (or other
|
|
||||||
// program) did this so we do not want to do it again.
|
|
||||||
volume->DisableCDDBLookUps();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@@ -1813,7 +1812,7 @@ cdda_rename(fs_volume* _volume, fs_vnode* _oldDir, const char* oldName,
|
|||||||
// add-on. Disable CDDB lookups. Note this will usually mean that the
|
// add-on. Disable CDDB lookups. Note this will usually mean that the
|
||||||
// user manually renamed a track or that cddblinkd (or other program)
|
// user manually renamed a track or that cddblinkd (or other program)
|
||||||
// did this so we do not want to do it again.
|
// did this so we do not want to do it again.
|
||||||
volume->DisableCDDBLookUps();
|
volume->SetCDDBLookupsEnabled(false);
|
||||||
|
|
||||||
notify_entry_moved(volume->ID(), volume->RootNode().ID(), oldName,
|
notify_entry_moved(volume->ID(), volume->RootNode().ID(), oldName,
|
||||||
volume->RootNode().ID(), newName, inode->ID());
|
volume->RootNode().ID(), newName, inode->ID());
|
||||||
|
|||||||
Reference in New Issue
Block a user