Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: platform.h

Issue 6729012: cryptohome: Add new platform functions (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cryptohome.git@master
Patch Set: . Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mock_platform.h ('k') | platform.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: platform.h
diff --git a/platform.h b/platform.h
index ee6d862a9fb8626dcc11fb097c4fcb618baa210b..fad1144be0fec4771e1758a7211d6122517cca5f 100644
--- a/platform.h
+++ b/platform.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -130,15 +130,27 @@ class Platform {
// pids (OUT) - the list of PIDs
void GetPidsForUser(uid_t uid, std::vector<pid_t>* pids);
- // Calls the platform chown() function recursively on the directory
+ // Calls the platform chown() function on the given path.
+ //
+ // The path may be a directory or a file.
//
// Parameters
- // directory - The directory to set ownership on
+ // path - The path to set ownership on
// user_id - The user_id to assign ownership to
// group_id - The group_id to assign ownership to
virtual bool SetOwnership(const std::string& directory, uid_t user_id,
gid_t group_id);
+ // Calls the platform chown() function recursively on the directory
+ //
+ // Parameters
+ // directory - The directory to set ownership on
+ // user_id - The user_id to assign ownership to
+ // group_id - The group_id to assign ownership to
+ virtual bool SetOwnershipRecursive(const std::string& directory,
+ uid_t user_id,
+ gid_t group_id);
+
// Sets the current umask, returning the old mask
//
// Parameters
@@ -154,6 +166,13 @@ class Platform {
virtual bool GetUserId(const std::string& user, uid_t* user_id,
gid_t* group_id);
+ // Returns the group id for a group
+ //
+ // Parameters
+ // group - The group name to query for
+ // group_id (OUT) - The group ID on success
+ virtual bool GetGroupId(const std::string& group, gid_t* group_id);
+
// Return the available disk space in bytes on the volume containing |path|,
// or -1 on failure.
// Code duplicated from Chrome's base::SysInfo::AmountOfFreeDiskSpace().
@@ -165,6 +184,25 @@ class Platform {
// Clears the user keyring
static void ClearUserKeyring();
+ // Creates a symbolic link from one path to the other
+ //
+ // Parameters
+ // from - source path that the symlink points to
+ // to - symlink to create which points to the source path
+ virtual bool Symlink(const std::string& from, const std::string& to);
+
+ // Executes a command with the specified arguments and waits for it to finish
+ //
+ // Parameters
+ // command - string containing the filename of the binary to execute
+ // args - list of arguments to pass to the run the command with
+ // uid - effective user id to run the command with
+ // gid - effective group id to run the command with
+ bool Exec(const std::string& command,
+ const std::vector<std::string>& args,
+ uid_t uid,
+ gid_t gid);
+
// Overrides the default mount options
void set_mount_options(int value) {
mount_options_ = value;
« no previous file with comments | « mock_platform.h ('k') | platform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698