* Downcast ref_store to files_ref_store. Die if ref_store is not a * files_ref_store. required_flags is compared with ref_store's * store_flags to ensure the ref_store has all required capabilities. * "caller" is used in any necessary error messages. */
| 157 | * "caller" is used in any necessary error messages. |
| 158 | */ |
| 159 | static struct files_ref_store *files_downcast(struct ref_store *ref_store, |
| 160 | unsigned int required_flags, |
| 161 | const char *caller) |
| 162 | { |
| 163 | struct files_ref_store *refs; |
| 164 | |
| 165 | if (ref_store->be != &refs_be_files) |
| 166 | BUG("ref_store is type \"%s\" not \"files\" in %s", |
| 167 | ref_store->be->name, caller); |
| 168 | |
| 169 | refs = (struct files_ref_store *)ref_store; |
| 170 | |
| 171 | if ((refs->store_flags & required_flags) != required_flags) |
| 172 | BUG("operation %s requires abilities 0x%x, but only have 0x%x", |
| 173 | caller, required_flags, refs->store_flags); |
| 174 | |
| 175 | return refs; |
| 176 | } |
| 177 | |
| 178 | static void files_ref_store_release(struct ref_store *ref_store) |
| 179 | { |
no outgoing calls
no test coverage detected