Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CRYPTOHOME_PLATFORM_H_ | 5 #ifndef CRYPTOHOME_PLATFORM_H_ |
| 6 #define CRYPTOHOME_PLATFORM_H_ | 6 #define CRYPTOHOME_PLATFORM_H_ |
| 7 | 7 |
| 8 #include <base/basictypes.h> | 8 #include <base/basictypes.h> |
| 9 #include <chromeos/utility.h> | 9 #include <chromeos/utility.h> |
| 10 #include <sys/stat.h> | |
| 10 #include <set> | 11 #include <set> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 namespace cryptohome { | 15 namespace cryptohome { |
| 15 | 16 |
| 16 // Default mount options | 17 // Default mount options |
| 17 extern const int kDefaultMountOptions; | 18 extern const int kDefaultMountOptions; |
| 18 // Default length to use in call to getpwnam_r if the system default is not | 19 // Default length to use in call to getpwnam_r if the system default is not |
| 19 // available | 20 // available |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 // Calls the platform chown() function recursively on the directory | 146 // Calls the platform chown() function recursively on the directory |
| 146 // | 147 // |
| 147 // Parameters | 148 // Parameters |
| 148 // directory - The directory to set ownership on | 149 // directory - The directory to set ownership on |
| 149 // user_id - The user_id to assign ownership to | 150 // user_id - The user_id to assign ownership to |
| 150 // group_id - The group_id to assign ownership to | 151 // group_id - The group_id to assign ownership to |
| 151 virtual bool SetOwnershipRecursive(const std::string& directory, | 152 virtual bool SetOwnershipRecursive(const std::string& directory, |
| 152 uid_t user_id, | 153 uid_t user_id, |
| 153 gid_t group_id); | 154 gid_t group_id); |
| 154 | 155 |
| 156 // Calls the platform chmod() function on the given path. | |
| 157 // | |
| 158 // The path may be a directory or a file. | |
| 159 // | |
| 160 // Parameters | |
| 161 // path - The path to set ownership on | |
| 162 // new_perms - an OR'd together bitfield of permissions per chmod(2) | |
| 163 virtual bool SetPermissions(const std::string& path, mode_t new_perms); | |
|
Will Drewry
2011/04/21 21:42:09
nit: mind adding it to mock_platform.h?
| |
| 164 | |
| 155 // Sets the current umask, returning the old mask | 165 // Sets the current umask, returning the old mask |
| 156 // | 166 // |
| 157 // Parameters | 167 // Parameters |
| 158 // new_mask - The mask to set | 168 // new_mask - The mask to set |
| 159 virtual int SetMask(int new_mask); | 169 virtual int SetMask(int new_mask); |
| 160 | 170 |
| 161 // Returns the user and group ids for a user | 171 // Returns the user and group ids for a user |
| 162 // | 172 // |
| 163 // Parameters | 173 // Parameters |
| 164 // user - The username to query for | 174 // user - The username to query for |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 private: | 346 private: |
| 337 std::vector<std::string> cmd_line_; | 347 std::vector<std::string> cmd_line_; |
| 338 std::set<std::string> open_files_; | 348 std::set<std::string> open_files_; |
| 339 std::string cwd_; | 349 std::string cwd_; |
| 340 int process_id_; | 350 int process_id_; |
| 341 }; | 351 }; |
| 342 | 352 |
| 343 } // namespace cryptohome | 353 } // namespace cryptohome |
| 344 | 354 |
| 345 #endif // CRYPTOHOME_PLATFORM_H_ | 355 #endif // CRYPTOHOME_PLATFORM_H_ |
| OLD | NEW |