{"action":"created","comment":{"url":"https://api.github.com/repos/storaged-project/storaged/pulls/comments/88824154","pull_request_review_id":9384842,"id":88824154,"diff_hunk":"@@ -0,0 +1,255 @@\n+/* -*- mode: C; c-file-style: \"gnu\"; indent-tabs-mode: nil; -*-\n+ *\n+ * Copyright (C) 2016 Gris Ge <fge@redhat.com>\n+ *\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program; if not, write to the Free Software\n+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\n+ *\n+ */\n+\n+/* Note: This is inspired by modules/dummy/dummylinuxdrive.c  */\n+\n+#include \"config.h\"\n+\n+#include <sys/types.h>\n+\n+#include <pwd.h>\n+#include <grp.h>\n+#include <string.h>\n+#include <stdlib.h>\n+#include <stdio.h>\n+#include <glib.h>\n+#include <libstoragemgmt/libstoragemgmt.h>\n+\n+#include <src/udiskslogging.h>\n+#include <src/udiskslinuxdriveobject.h>\n+#include <src/udisksdaemon.h>\n+#include <src/udisksdaemonutil.h>\n+#include <src/udisksbasejob.h>\n+#include <src/udiskssimplejob.h>\n+#include <src/udisksthreadedjob.h>\n+#include <src/udiskslinuxdevice.h>\n+#include <modules/udisksmoduleobject.h>\n+\n+#include \"lsm_types.h\"\n+\n+typedef struct _UDisksLinuxDriveLsmLocalClass\n+  UDisksLinuxDriveLsmLocalClass;\n+\n+struct _UDisksLinuxDriveLsmLocal\n+{\n+  UDisksDriveLsmLocalSkeleton parent_instance;\n+  UDisksLinuxDriveObject *ud_lx_drv_obj;\n+};\n+\n+struct _UDisksLinuxDriveLsmLocalClass\n+{\n+  UDisksDriveLsmLocalSkeletonClass parent_class;\n+};\n+\n+static void\n+udisks_linux_drive_lsm_local_iface_init\n+  (UDisksDriveLsmLocalIface *iface);\n+\n+G_DEFINE_TYPE_WITH_CODE\n+  (UDisksLinuxDriveLsmLocal, udisks_linux_drive_lsm_local,\n+   UDISKS_TYPE_DRIVE_LSM_LOCAL_SKELETON,\n+   G_IMPLEMENT_INTERFACE (UDISKS_TYPE_DRIVE_LSM_LOCAL,\n+                          udisks_linux_drive_lsm_local_iface_init));\n+\n+static const gchar *\n+get_blk_path (UDisksDriveLsmLocal *ud_drv_lsm_local,\n+               GDBusMethodInvocation *invocation);\n+\n+static gboolean\n+handle_turn_ident_ledon (UDisksDriveLsmLocal *ud_drv_lsm_local,\n+                         GDBusMethodInvocation *invocation);\n+\n+static gboolean\n+handle_turn_ident_ledoff (UDisksDriveLsmLocal *ud_drv_lsm_local,\n+                          GDBusMethodInvocation *invocation);\n+\n+static gboolean\n+handle_turn_fault_ledon (UDisksDriveLsmLocal *ud_drv_lsm_local,\n+                         GDBusMethodInvocation *invocation);\n+\n+static gboolean\n+handle_turn_fault_ledoff (UDisksDriveLsmLocal *ud_drv_lsm_local,\n+                          GDBusMethodInvocation *invocation);\n+\n+static const gchar *\n+get_blk_path (UDisksDriveLsmLocal *ud_drv_lsm_local,\n+              GDBusMethodInvocation *invocation)\n+{\n+  const gchar *blk_path = NULL;\n+  UDisksLinuxDriveLsmLocal *ud_lx_drv_lsm_local = NULL;\n+  UDisksLinuxDriveObject *ud_lx_drv_obj = NULL;\n+  UDisksLinuxBlockObject *ud_lx_blk_obj = NULL;\n+  UDisksBlock *ud_blk = NULL;\n+\n+  ud_lx_drv_lsm_local = UDISKS_LINUX_DRIVE_LSM_LOCAL (ud_drv_lsm_local);\n+\n+  ud_lx_drv_obj = ud_lx_drv_lsm_local->ud_lx_drv_obj;\n+\n+  ud_lx_blk_obj = udisks_linux_drive_object_get_block (ud_lx_drv_obj, FALSE);\n+  if (ud_lx_blk_obj == NULL)\n+    {\n+      g_dbus_method_invocation_return_error\n+        (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,\n+         \"Unable to find block device for drive\");\n+      goto out;\n+    }\n+\n+  ud_blk = udisks_object_peek_block (UDISKS_OBJECT (ud_lx_blk_obj));\n+  blk_path = g_strdup (udisks_block_get_device (ud_blk));","path":"modules/lsm/lsm_local.c","position":115,"original_position":115,"commit_id":"97b9d4f86fa533d6c9503389681eddfbe62ccd8d","original_commit_id":"97b9d4f86fa533d6c9503389681eddfbe62ccd8d","user":{"login":"cathay4t","id":934948,"avatar_url":"https://avatars.githubusercontent.com/u/934948?v=3","gravatar_id":"","url":"https://api.github.com/users/cathay4t","html_url":"https://github.com/cathay4t","followers_url":"https://api.github.com/users/cathay4t/followers","following_url":"https://api.github.com/users/cathay4t/following{/other_user}","gists_url":"https://api.github.com/users/cathay4t/gists{/gist_id}","starred_url":"https://api.github.com/users/cathay4t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathay4t/subscriptions","organizations_url":"https://api.github.com/users/cathay4t/orgs","repos_url":"https://api.github.com/users/cathay4t/repos","events_url":"https://api.github.com/users/cathay4t/events{/privacy}","received_events_url":"https://api.github.com/users/cathay4t/received_events","type":"User","site_admin":false},"body":"Thanks. I will take a look on that and maybe fix `handle_eject()` also.","created_at":"2016-11-21T03:20:49Z","updated_at":"2016-11-21T03:20:49Z","html_url":"https://github.com/storaged-project/storaged/pull/133#discussion_r88824154","pull_request_url":"https://api.github.com/repos/storaged-project/storaged/pulls/133","_links":{"self":{"href":"https://api.github.com/repos/storaged-project/storaged/pulls/comments/88824154"},"html":{"href":"https://github.com/storaged-project/storaged/pull/133#discussion_r88824154"},"pull_request":{"href":"https://api.github.com/repos/storaged-project/storaged/pulls/133"}}},"pull_request":{"url":"https://api.github.com/repos/storaged-project/storaged/pulls/133","id":93117214,"html_url":"https://github.com/storaged-project/storaged/pull/133","diff_url":"https://github.com/storaged-project/storaged/pull/133.diff","patch_url":"https://github.com/storaged-project/storaged/pull/133.patch","issue_url":"https://api.github.com/repos/storaged-project/storaged/issues/133","number":133,"state":"open","locked":false,"title":"Add SCSI enclosure disk LED control methods.","user":{"login":"cathay4t","id":934948,"avatar_url":"https://avatars.githubusercontent.com/u/934948?v=3","gravatar_id":"","url":"https://api.github.com/users/cathay4t","html_url":"https://github.com/cathay4t","followers_url":"https://api.github.com/users/cathay4t/followers","following_url":"https://api.github.com/users/cathay4t/following{/other_user}","gists_url":"https://api.github.com/users/cathay4t/gists{/gist_id}","starred_url":"https://api.github.com/users/cathay4t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathay4t/subscriptions","organizations_url":"https://api.github.com/users/cathay4t/orgs","repos_url":"https://api.github.com/users/cathay4t/repos","events_url":"https://api.github.com/users/cathay4t/events{/privacy}","received_events_url":"https://api.github.com/users/cathay4t/received_events","type":"User","site_admin":false},"body":"* Bus methods are:\r\n    * org.freedesktop.UDisks2.Drive.LsmLocal.TurnIdentLEDOn\r\n    * org.freedesktop.UDisks2.Drive.LsmLocal.TurnIdentLEDOff\r\n    * org.freedesktop.UDisks2.Drive.LsmLocal.TurnFaultLEDOn\r\n    * org.freedesktop.UDisks2.Drive.LsmLocal.TurnFaultLEDOff\r\n\r\n * Using libstoragemgmt C API which only support SAS/SATA enclosure yet.\r\n\r\nSigned-off-by: Gris Ge <fge@redhat.com>","created_at":"2016-11-10T09:46:58Z","updated_at":"2016-11-21T03:20:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9f9a0063e9f0e5d5faaa431370b7c17e823f83d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/storaged-project/storaged/pulls/133/commits","review_comments_url":"https://api.github.com/repos/storaged-project/storaged/pulls/133/comments","review_comment_url":"https://api.github.com/repos/storaged-project/storaged/pulls/comments{/number}","comments_url":"https://api.github.com/repos/storaged-project/storaged/issues/133/comments","statuses_url":"https://api.github.com/repos/storaged-project/storaged/statuses/97b9d4f86fa533d6c9503389681eddfbe62ccd8d","head":{"label":"cathay4t:lsm_led","ref":"lsm_led","sha":"97b9d4f86fa533d6c9503389681eddfbe62ccd8d","user":{"login":"cathay4t","id":934948,"avatar_url":"https://avatars.githubusercontent.com/u/934948?v=3","gravatar_id":"","url":"https://api.github.com/users/cathay4t","html_url":"https://github.com/cathay4t","followers_url":"https://api.github.com/users/cathay4t/followers","following_url":"https://api.github.com/users/cathay4t/following{/other_user}","gists_url":"https://api.github.com/users/cathay4t/gists{/gist_id}","starred_url":"https://api.github.com/users/cathay4t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathay4t/subscriptions","organizations_url":"https://api.github.com/users/cathay4t/orgs","repos_url":"https://api.github.com/users/cathay4t/repos","events_url":"https://api.github.com/users/cathay4t/events{/privacy}","received_events_url":"https://api.github.com/users/cathay4t/received_events","type":"User","site_admin":false},"repo":{"id":34441167,"name":"storaged","full_name":"cathay4t/storaged","owner":{"login":"cathay4t","id":934948,"avatar_url":"https://avatars.githubusercontent.com/u/934948?v=3","gravatar_id":"","url":"https://api.github.com/users/cathay4t","html_url":"https://github.com/cathay4t","followers_url":"https://api.github.com/users/cathay4t/followers","following_url":"https://api.github.com/users/cathay4t/following{/other_user}","gists_url":"https://api.github.com/users/cathay4t/gists{/gist_id}","starred_url":"https://api.github.com/users/cathay4t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cathay4t/subscriptions","organizations_url":"https://api.github.com/users/cathay4t/orgs","repos_url":"https://api.github.com/users/cathay4t/repos","events_url":"https://api.github.com/users/cathay4t/events{/privacy}","received_events_url":"https://api.github.com/users/cathay4t/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cathay4t/storaged","description":"The Storaged project provides a daemon, tools and libraries to access and manipulate disks, storage devices and technologies.","fork":true,"url":"https://api.github.com/repos/cathay4t/storaged","forks_url":"https://api.github.com/repos/cathay4t/storaged/forks","keys_url":"https://api.github.com/repos/cathay4t/storaged/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cathay4t/storaged/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cathay4t/storaged/teams","hooks_url":"https://api.github.com/repos/cathay4t/storaged/hooks","issue_events_url":"https://api.github.com/repos/cathay4t/storaged/issues/events{/number}","events_url":"https://api.github.com/repos/cathay4t/storaged/events","assignees_url":"https://api.github.com/repos/cathay4t/storaged/assignees{/user}","branches_url":"https://api.github.com/repos/cathay4t/storaged/branches{/branch}","tags_url":"https://api.github.com/repos/cathay4t/storaged/tags","blobs_url":"https://api.github.com/repos/cathay4t/storaged/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cathay4t/storaged/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cathay4t/storaged/git/refs{/sha}","trees_url":"https://api.github.com/repos/cathay4t/storaged/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cathay4t/storaged/statuses/{sha}","languages_url":"https://api.github.com/repos/cathay4t/storaged/languages","stargazers_url":"https://api.github.com/repos/cathay4t/storaged/stargazers","contributors_url":"https://api.github.com/repos/cathay4t/storaged/contributors","subscribers_url":"https://api.github.com/repos/cathay4t/storaged/subscribers","subscription_url":"https://api.github.com/repos/cathay4t/storaged/subscription","commits_url":"https://api.github.com/repos/cathay4t/storaged/commits{/sha}","git_commits_url":"https://api.github.com/repos/cathay4t/storaged/git/commits{/sha}","comments_url":"https://api.github.com/repos/cathay4t/storaged/comments{/number}","issue_comment_url":"https://api.github.com/repos/cathay4t/storaged/issues/comments{/number}","contents_url":"https://api.github.com/repos/cathay4t/storaged/contents/{+path}","compare_url":"https://api.github.com/repos/cathay4t/storaged/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cathay4t/storaged/merges","archive_url":"https://api.github.com/repos/cathay4t/storaged/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cathay4t/storaged/downloads","issues_url":"https://api.github.com/repos/cathay4t/storaged/issues{/number}","pulls_url":"https://api.github.com/repos/cathay4t/storaged/pulls{/number}","milestones_url":"https://api.github.com/repos/cathay4t/storaged/milestones{/number}","notifications_url":"https://api.github.com/repos/cathay4t/storaged/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cathay4t/storaged/labels{/name}","releases_url":"https://api.github.com/repos/cathay4t/storaged/releases{/id}","deployments_url":"https://api.github.com/repos/cathay4t/storaged/deployments","created_at":"2015-04-23T07:37:30Z","updated_at":"2016-01-18T08:34:26Z","pushed_at":"2016-11-18T10:40:42Z","git_url":"git://github.com/cathay4t/storaged.git","ssh_url":"git@github.com:cathay4t/storaged.git","clone_url":"https://github.com/cathay4t/storaged.git","svn_url":"https://github.com/cathay4t/storaged","homepage":"","size":5748,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"storaged-project:master","ref":"master","sha":"7ea176b79ea38b31df818a733d9be01a5fb1444c","user":{"login":"storaged-project","id":11505466,"avatar_url":"https://avatars.githubusercontent.com/u/11505466?v=3","gravatar_id":"","url":"https://api.github.com/users/storaged-project","html_url":"https://github.com/storaged-project","followers_url":"https://api.github.com/users/storaged-project/followers","following_url":"https://api.github.com/users/storaged-project/following{/other_user}","gists_url":"https://api.github.com/users/storaged-project/gists{/gist_id}","starred_url":"https://api.github.com/users/storaged-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storaged-project/subscriptions","organizations_url":"https://api.github.com/users/storaged-project/orgs","repos_url":"https://api.github.com/users/storaged-project/repos","events_url":"https://api.github.com/users/storaged-project/events{/privacy}","received_events_url":"https://api.github.com/users/storaged-project/received_events","type":"Organization","site_admin":false},"repo":{"id":31362286,"name":"storaged","full_name":"storaged-project/storaged","owner":{"login":"storaged-project","id":11505466,"avatar_url":"https://avatars.githubusercontent.com/u/11505466?v=3","gravatar_id":"","url":"https://api.github.com/users/storaged-project","html_url":"https://github.com/storaged-project","followers_url":"https://api.github.com/users/storaged-project/followers","following_url":"https://api.github.com/users/storaged-project/following{/other_user}","gists_url":"https://api.github.com/users/storaged-project/gists{/gist_id}","starred_url":"https://api.github.com/users/storaged-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/storaged-project/subscriptions","organizations_url":"https://api.github.com/users/storaged-project/orgs","repos_url":"https://api.github.com/users/storaged-project/repos","events_url":"https://api.github.com/users/storaged-project/events{/privacy}","received_events_url":"https://api.github.com/users/storaged-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/storaged-project/storaged","description":"The Storaged project provides a daemon, tools and libraries to access and manipulate disks, storage devices and technologies.","fork":false,"url":"https://api.github.com/repos/storaged-project/storaged","forks_url":"https://api.github.com/repos/storaged-project/storaged/forks","keys_url":"https://api.github.com/repos/storaged-project/storaged/keys{/key_id}","collaborators_url":"https://api.github.com/repos/storaged-project/storaged/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/storaged-project/storaged/teams","hooks_url":"https://api.github.com/repos/storaged-project/storaged/hooks","issue_events_url":"https://api.github.com/repos/storaged-project/storaged/issues/events{/number}","events_url":"https://api.github.com/repos/storaged-project/storaged/events","assignees_url":"https://api.github.com/repos/storaged-project/storaged/assignees{/user}","branches_url":"https://api.github.com/repos/storaged-project/storaged/branches{/branch}","tags_url":"https://api.github.com/repos/storaged-project/storaged/tags","blobs_url":"https://api.github.com/repos/storaged-project/storaged/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/storaged-project/storaged/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/storaged-project/storaged/git/refs{/sha}","trees_url":"https://api.github.com/repos/storaged-project/storaged/git/trees{/sha}","statuses_url":"https://api.github.com/repos/storaged-project/storaged/statuses/{sha}","languages_url":"https://api.github.com/repos/storaged-project/storaged/languages","stargazers_url":"https://api.github.com/repos/storaged-project/storaged/stargazers","contributors_url":"https://api.github.com/repos/storaged-project/storaged/contributors","subscribers_url":"https://api.github.com/repos/storaged-project/storaged/subscribers","subscription_url":"https://api.github.com/repos/storaged-project/storaged/subscription","commits_url":"https://api.github.com/repos/storaged-project/storaged/commits{/sha}","git_commits_url":"https://api.github.com/repos/storaged-project/storaged/git/commits{/sha}","comments_url":"https://api.github.com/repos/storaged-project/storaged/comments{/number}","issue_comment_url":"https://api.github.com/repos/storaged-project/storaged/issues/comments{/number}","contents_url":"https://api.github.com/repos/storaged-project/storaged/contents/{+path}","compare_url":"https://api.github.com/repos/storaged-project/storaged/compare/{base}...{head}","merges_url":"https://api.github.com/repos/storaged-project/storaged/merges","archive_url":"https://api.github.com/repos/storaged-project/storaged/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/storaged-project/storaged/downloads","issues_url":"https://api.github.com/repos/storaged-project/storaged/issues{/number}","pulls_url":"https://api.github.com/repos/storaged-project/storaged/pulls{/number}","milestones_url":"https://api.github.com/repos/storaged-project/storaged/milestones{/number}","notifications_url":"https://api.github.com/repos/storaged-project/storaged/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/storaged-project/storaged/labels{/name}","releases_url":"https://api.github.com/repos/storaged-project/storaged/releases{/id}","deployments_url":"https://api.github.com/repos/storaged-project/storaged/deployments","created_at":"2015-02-26T10:34:18Z","updated_at":"2016-11-04T14:46:54Z","pushed_at":"2016-11-18T10:40:42Z","git_url":"git://github.com/storaged-project/storaged.git","ssh_url":"git@github.com:storaged-project/storaged.git","clone_url":"https://github.com/storaged-project/storaged.git","svn_url":"https://github.com/storaged-project/storaged","homepage":"","size":6105,"stargazers_count":32,"watchers_count":32,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":20,"forks":21,"open_issues":20,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/storaged-project/storaged/pulls/133"},"html":{"href":"https://github.com/storaged-project/storaged/pull/133"},"issue":{"href":"https://api.github.com/repos/storaged-project/storaged/issues/133"},"comments":{"href":"https://api.github.com/repos/storaged-project/storaged/issues/133/comments"},"review_comments":{"href":"https://api.github.com/repos/storaged-project/storaged/pulls/133/comments"},"review_comment":{"href":"https://api.github.com/repos/storaged-project/storaged/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/storaged-project/storaged/pulls/133/commits"},"statuses":{"href":"https://api.github.com/repos/storaged-project/storaged/statuses/97b9d4f86fa533d6c9503389681eddfbe62ccd8d"}}}}
{"actor":{"display_login":"cathay4t"}}