- Export the SCSI TOC in the CD:toc attribute (required by the CDDB protocol).
- Do not save or load attributes in the protected namespace. Now cddb_server has everything it needs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27120 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9445c73970
commit
31ee3b53f5
@ -256,6 +256,7 @@ static const char* kProtectedAttrNamespace = "CD:";
|
|||||||
|
|
||||||
static const char* kCddbIdAttribute = "CD:cddbid";
|
static const char* kCddbIdAttribute = "CD:cddbid";
|
||||||
static const char* kDoLookupAttribute = "CD:do_lookup";
|
static const char* kDoLookupAttribute = "CD:do_lookup";
|
||||||
|
static const char* kTocAttribute = "CD:toc";
|
||||||
|
|
||||||
extern fs_volume_ops gCDDAVolumeOps;
|
extern fs_volume_ops gCDDAVolumeOps;
|
||||||
extern fs_vnode_ops gCDDAVnodeOps;
|
extern fs_vnode_ops gCDDAVnodeOps;
|
||||||
@ -324,8 +325,9 @@ write_attributes(int fd, Inode* inode, attr_mode attrMode = kDiscIDAttributes)
|
|||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
while (iterator.HasNext()) {
|
while (iterator.HasNext()) {
|
||||||
Attribute* attribute = iterator.Next();
|
Attribute* attribute = iterator.Next();
|
||||||
if (attrMode == kDiscIDAttributes
|
if ((attrMode == kDiscIDAttributes
|
||||||
|| is_special_attribute(attribute->Name(), attrMode))
|
|| is_special_attribute(attribute->Name(), attrMode))
|
||||||
|
&& !attribute->IsProtectedNamespace())
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,8 +344,9 @@ write_attributes(int fd, Inode* inode, attr_mode attrMode = kDiscIDAttributes)
|
|||||||
|
|
||||||
while (iterator.HasNext()) {
|
while (iterator.HasNext()) {
|
||||||
Attribute* attribute = iterator.Next();
|
Attribute* attribute = iterator.Next();
|
||||||
if (attrMode != kDiscIDAttributes
|
if ((attrMode != kDiscIDAttributes
|
||||||
&& !is_special_attribute(attribute->Name(), attrMode))
|
&& !is_special_attribute(attribute->Name(), attrMode))
|
||||||
|
|| attribute->IsProtectedNamespace())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 type = B_HOST_TO_BENDIAN_INT32(attribute->Type());
|
uint32 type = B_HOST_TO_BENDIAN_INT32(attribute->Type());
|
||||||
@ -416,6 +419,13 @@ read_attributes(int fd, Inode* inode)
|
|||||||
name[length] = '\0';
|
name[length] = '\0';
|
||||||
|
|
||||||
Attribute* attribute = new Attribute(name, type);
|
Attribute* attribute = new Attribute(name, type);
|
||||||
|
if (attribute->IsProtectedNamespace()) {
|
||||||
|
// Attributes in the protected namespace are handled internally
|
||||||
|
// so we do not load them even if they are present in the
|
||||||
|
// attributes file.
|
||||||
|
delete attribute;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (attribute->SetSize(size) != B_OK
|
if (attribute->SetSize(size) != B_OK
|
||||||
|| inode->AddAttribute(attribute, true) != B_OK) {
|
|| inode->AddAttribute(attribute, true) != B_OK) {
|
||||||
delete attribute;
|
delete attribute;
|
||||||
@ -554,7 +564,6 @@ Volume::Mount(const char* device)
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
status_t status = read_table_of_contents(fDevice, toc, 1024);
|
status_t status = read_table_of_contents(fDevice, toc, 1024);
|
||||||
|
|
||||||
// there has to be at least one audio track
|
// there has to be at least one audio track
|
||||||
if (status == B_OK && count_audio_tracks(toc) == 0)
|
if (status == B_OK && count_audio_tracks(toc) == 0)
|
||||||
status = B_BAD_TYPE;
|
status = B_BAD_TYPE;
|
||||||
@ -658,6 +667,10 @@ Volume::Mount(const char* device)
|
|||||||
// Add CD:do_lookup attribute.
|
// Add CD:do_lookup attribute.
|
||||||
fRootNode->AddAttribute(kDoLookupAttribute, B_BOOL_TYPE, true,
|
fRootNode->AddAttribute(kDoLookupAttribute, B_BOOL_TYPE, true,
|
||||||
(const uint8*)&doLookup, sizeof(bool));
|
(const uint8*)&doLookup, sizeof(bool));
|
||||||
|
|
||||||
|
// Add CD:toc attribute.
|
||||||
|
fRootNode->AddAttribute(kTocAttribute, B_RAW_TYPE, true,
|
||||||
|
(const uint8*)toc, B_BENDIAN_TO_HOST_INT16(toc->data_length) + 2);
|
||||||
|
|
||||||
_RestoreSharedAttributes();
|
_RestoreSharedAttributes();
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user