• Home
  • Raw
  • Download

Lines Matching refs:shm

94 	struct cras_audio_shm *shm;  in cras_audio_shm_create()  local
109 shm = calloc(1, sizeof(*shm)); in cras_audio_shm_create()
110 if (!shm) { in cras_audio_shm_create()
123 ret = cras_shm_info_move(header_info, &shm->header_info); in cras_audio_shm_create()
126 header_info = &shm->header_info; in cras_audio_shm_create()
128 ret = cras_shm_info_move(samples_info, &shm->samples_info); in cras_audio_shm_create()
131 samples_info = &shm->samples_info; in cras_audio_shm_create()
133 shm->header = mmap(NULL, header_info->length, PROT_READ | PROT_WRITE, in cras_audio_shm_create()
135 if (shm->header == (struct cras_audio_shm_header *)-1) { in cras_audio_shm_create()
141 shm->samples = mmap(NULL, samples_info->length, samples_prot, in cras_audio_shm_create()
143 if (shm->samples == (uint8_t *)-1) { in cras_audio_shm_create()
150 cras_shm_set_volume_scaler(shm, 1.0); in cras_audio_shm_create()
152 *shm_out = shm; in cras_audio_shm_create()
156 munmap(shm->header, shm->header_info.length); in cras_audio_shm_create()
158 free(shm); in cras_audio_shm_create()
165 void cras_audio_shm_destroy(struct cras_audio_shm *shm) in cras_audio_shm_destroy() argument
167 if (!shm) in cras_audio_shm_destroy()
170 munmap(shm->samples, shm->samples_info.length); in cras_audio_shm_destroy()
171 cras_shm_info_cleanup(&shm->samples_info); in cras_audio_shm_destroy()
172 munmap(shm->header, shm->header_info.length); in cras_audio_shm_destroy()
173 cras_shm_info_cleanup(&shm->header_info); in cras_audio_shm_destroy()
174 free(shm); in cras_audio_shm_destroy()