bigbiff | 1f9e484 | 2020-10-31 11:33:15 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Team Win Recovery Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * The purpose of these functions is to try to get and set the proper |
| 19 | * file permissions, SELinux contexts, owner, and group so that these |
| 20 | * files are accessible when we boot up to normal Android via MTP and to |
| 21 | * file manager apps. During early boot we try to read the contexts and |
| 22 | * owner / group info from /data/media or from /data/media/0 and store |
| 23 | * them in static variables. From there, we'll try to set the same |
| 24 | * contexts, owner, and group information on most files we create during |
| 25 | * operations like backups, copying the log, and MTP operations. |
| 26 | */ |
| 27 | |
| 28 | #ifndef _RECOVERY_SET_CONTEXTS_H |
| 29 | #define _RECOVERY_SET_CONTEXTS_H |
| 30 | |
| 31 | #include <sys/stat.h> |
| 32 | #include "selinux/selinux.h" |
| 33 | |
| 34 | int tw_get_default_metadata(const char* filename); |
| 35 | int tw_set_default_metadata(const char* filename); |
| 36 | |
| 37 | #endif //_RECOVERY_SET_CONTEXTS_H |