int load_afd(int shmid, struct audio_file_data *afd)
{
void *shm_afd;
- char *buf;
int ret;
ret = shm_attach(shmid, ATTACH_RO, &shm_afd);
if (ret < 0)
return ret;
*afd = *(struct audio_file_data *)shm_afd;
- buf = shm_afd;
- buf += sizeof(*afd);
- load_chunk_table(&afd->afhi, buf);
+ load_chunk_table(&afd->afhi, shm_afd + sizeof(*afd));
shm_detach(shm_afd);
return 1;
}
return ret;
ret = mmap_full_file(d->path, O_RDONLY, &map.data, &map.size, &afd->fd);
if (ret < 0)
- goto err;
+ goto out;
hash_function(map.data, map.size, file_hash);
ret = hash_compare(file_hash, d->hash);
para_munmap(map.data, map.size);
if (ret) {
ret = -E_HASH_MISMATCH;
- goto err;
+ goto out;
}
new_afsi = d->afsi;
new_afsi.num_played++;
*/
afs_event(AFSI_CHANGE, NULL, &aced);
ret = save_afd(afd);
-err:
+out:
free(afd->afhi.chunk_table);
osl_close_disk_object(&chunk_table_obj);
if (ret < 0) {
struct touch_action_data tad = {.cto = query->data,
.pb = {
.max_size = shm_get_shmmax(),
- .private_data = &fd,
+ .private_data = &(struct afs_max_size_handler_data) {
+ .fd = fd,
+ .band = SBD_OUTPUT
+ },
.max_size_handler = afs_max_size_handler
}
};
struct com_rm_action_data crd = {.flags = *(uint32_t *)query->data,
.pb = {
.max_size = shm_get_shmmax(),
- .private_data = &fd,
+ .private_data = &(struct afs_max_size_handler_data) {
+ .fd = fd,
+ .band = SBD_OUTPUT
+ },
.max_size_handler = afs_max_size_handler
}
};
.flags = *(unsigned *)query->data,
.pb = {
.max_size = shm_get_shmmax(),
- .private_data = &fd,
+ .private_data = &(struct afs_max_size_handler_data) {
+ .fd = fd,
+ .band = SBD_OUTPUT
+ },
.max_size_handler = afs_max_size_handler
}
};