You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2016/07/07 18:20:02 UTC

[06/11] mesos git commit: Removed `jsonFileInfo()` implementation from files.hpp.

Removed `jsonFileInfo()` implementation from files.hpp.

Review: https://reviews.apache.org/r/49529/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/74edde66
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/74edde66
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/74edde66

Branch: refs/heads/master
Commit: 74edde66a60e38b3d90fa11479be85ed3cb1b4ac
Parents: 7d00e1c
Author: Abhishek Dasgupta <a1...@linux.vnet.ibm.com>
Authored: Thu Jul 7 10:52:13 2016 -0700
Committer: Anand Mazumdar <an...@apache.org>
Committed: Thu Jul 7 11:05:32 2016 -0700

----------------------------------------------------------------------
 src/files/files.hpp | 74 ------------------------------------------------
 1 file changed, 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/74edde66/src/files/files.hpp
----------------------------------------------------------------------
diff --git a/src/files/files.hpp b/src/files/files.hpp
index e28136a..c36ecfb 100644
--- a/src/files/files.hpp
+++ b/src/files/files.hpp
@@ -98,80 +98,6 @@ private:
   FilesProcess* process;
 };
 
-
-// Returns our JSON representation of a file or directory.
-// The JSON contains all of the information one would find in ls -l.
-// Example JSON:
-// {
-//   'path': '\/some\/file',
-//   'mode': '-rwxrwxrwx',
-//   'nlink': 5,
-//   'uid': 'bmahler',
-//   'gid': 'employee',
-//   'size': 4096,           // Bytes.
-//   'mtime': 1348258116,    // Unix timestamp.
-// }
-inline JSON::Object jsonFileInfo(const std::string& path,
-                                 const struct stat& s)
-{
-  JSON::Object file;
-  file.values["path"] = path;
-  file.values["nlink"] = s.st_nlink;
-  file.values["size"] = s.st_size;
-  file.values["mtime"] = s.st_mtime;
-
-  char filetype;
-  if (S_ISREG(s.st_mode)) {
-    filetype = '-';
-  } else if (S_ISDIR(s.st_mode)) {
-    filetype = 'd';
-  } else if (S_ISCHR(s.st_mode)) {
-    filetype = 'c';
-  } else if (S_ISBLK(s.st_mode)) {
-    filetype = 'b';
-  } else if (S_ISFIFO(s.st_mode)) {
-    filetype = 'p';
-  } else if (S_ISLNK(s.st_mode)) {
-    filetype = 'l';
-  } else if (S_ISSOCK(s.st_mode)) {
-    filetype = 's';
-  } else {
-    filetype = '-';
-  }
-
-  struct os::Permissions permissions(s.st_mode);
-
-  file.values["mode"] = strings::format(
-      "%c%c%c%c%c%c%c%c%c%c",
-      filetype,
-      permissions.owner.r ? 'r' : '-',
-      permissions.owner.w ? 'w' : '-',
-      permissions.owner.x ? 'x' : '-',
-      permissions.group.r ? 'r' : '-',
-      permissions.group.w ? 'w' : '-',
-      permissions.group.x ? 'x' : '-',
-      permissions.others.r ? 'r' : '-',
-      permissions.others.w ? 'w' : '-',
-      permissions.others.x ? 'x' : '-').get();
-
-  // NOTE: `getpwuid` and `getgrgid` return `nullptr` on Windows.
-  passwd* p = getpwuid(s.st_uid);
-  if (p != nullptr) {
-    file.values["uid"] = p->pw_name;
-  } else {
-    file.values["uid"] = stringify(s.st_uid);
-  }
-
-  struct group* g = getgrgid(s.st_gid);
-  if (g != nullptr) {
-    file.values["gid"] = g->gr_name;
-  } else {
-    file.values["gid"] = stringify(s.st_gid);
-  }
-
-  return file;
-}
-
 } // namespace internal {
 } // namespace mesos {