Update smack APIs according to the new naming rule
authorSoyoung Kim <sy037.kim@samsung.com>
Fri, 16 Aug 2013 11:18:02 +0000 (20:18 +0900)
committerSoo-Hyun Choi <sh9.choi@samsung.com>
Mon, 19 Aug 2013 07:39:16 +0000 (16:39 +0900)
[Issue#]   N/A
[Problem]  The naming rule for SMACK APIs is changed.
[Cause]    Tomasz Swierczek (SRPoL) Systems team informed the change:
           The new APIs were introduced to standardize the naming scheme in the library,
           and make all libprivilege API functions start with a common prefix "perm_".
[Solution] Update SMACK APIs according to the change.
[SCMRequest] N/A

Change-Id: Ieb73f1a32dcedbdbfb61f23300d1d40a4db8db21

src/jobs/widget_install/task_smack.cpp
src/jobs/widget_uninstall/task_smack.cpp

index f338fc3..2082cbc 100644 (file)
@@ -77,7 +77,7 @@ void TaskSmack::StepSetInstall()
     if (m_context.widgetConfig.packagingType !=
             WrtDB::PkgType::PKG_TYPE_HYBRID_WEB_APP)
     {
-            if (PC_OPERATION_SUCCESS != app_install(m_pkgId)) {
+            if (PC_OPERATION_SUCCESS != perm_app_install(m_pkgId)) {
             free(m_pkgId);
             ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
                     "failure in creating smack rules file.");
@@ -92,7 +92,7 @@ void TaskSmack::StepSmackFolderLabeling()
             Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()");
 #ifdef WRT_SMACK_ENABLED
     /* /opt/usr/apps/[pkgid] directory's label is "_" */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+    if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
                 m_context.locations->getPackageInstallationDir().c_str(),
                 APP_PATH_ANY_LABEL, "_")) {
         LogWarning("Add label to " <<
@@ -103,7 +103,7 @@ void TaskSmack::StepSmackFolderLabeling()
     if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD &&
             m_context.mode.extension != InstallMode::ExtensionType::DIR)
     {
-        if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+        if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
                     m_context.locations->getUserDataRootDir().c_str(),
                     APP_PATH_ANY_LABEL, "_")) {
         }
@@ -113,20 +113,20 @@ void TaskSmack::StepSmackFolderLabeling()
     std::string resDir = m_context.locations->getPackageInstallationDir() +
         "/res";
 
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, resDir.c_str(),
+    if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId, resDir.c_str(),
                 APP_PATH_PRIVATE)) {
         LogWarning("Add label to " << resDir);
     }
 
     /* data directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+    if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
                 m_context.locations->getPrivateStorageDir().c_str(),
                 APP_PATH_PRIVATE)) {
         LogWarning("Add label to " << m_context.locations->getPrivateStorageDir());
     }
 
     /* tmp directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+    if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
                 m_context.locations->getPrivateTempStorageDir().c_str(),
                 APP_PATH_PRIVATE))
     {
@@ -134,7 +134,7 @@ void TaskSmack::StepSmackFolderLabeling()
     }
 
     /* bin directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+    if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
                 m_context.locations->getBinaryDir().c_str(),
                 APP_PATH_PRIVATE)) {
         LogWarning("Add label to " << m_context.locations->getBinaryDir());
@@ -178,7 +178,7 @@ void TaskSmack::StepSmackPrivilege()
     }
     perm_list[index] = NULL;
 
-    if (PC_OPERATION_SUCCESS != app_enable_permissions(appId, APP_TYPE_WGT,
+    if (PC_OPERATION_SUCCESS != perm_app_enable_permissions(appId, APP_TYPE_WGT,
                 const_cast<const char **>(perm_list), true)) {
         LogWarning("failure in contructing smack rules based on perm_list");
     }
@@ -201,7 +201,7 @@ void TaskSmack::StepRevokeForUpdate()
     LogDebug("----------------> SMACK:\
             Jobs::WidgetInstall::TaskSmack::StepRevokePrivilegeForUpdate()");
 #ifdef WRT_SMACK_ENABLED
-    if (PC_OPERATION_SUCCESS != app_revoke_permissions(m_pkgId)) {
+    if (PC_OPERATION_SUCCESS != perm_app_revoke_permissions(m_pkgId)) {
         LogWarning("failure in revoking smack permissions");
     }
 #endif
@@ -213,11 +213,11 @@ void TaskSmack::StepAbortSmack()
             Jobs::WidgetInstall::TaskSmack::StepAbortSmack()");
 #ifdef WRT_SMACK_ENABLED
 
-    if (PC_OPERATION_SUCCESS != app_revoke_permissions(m_pkgId)) {
+    if (PC_OPERATION_SUCCESS != perm_app_revoke_permissions(m_pkgId)) {
         LogWarning("failure in revoking smack permissions");
     }
 
-    if (PC_OPERATION_SUCCESS != app_uninstall(m_pkgId)) {
+    if (PC_OPERATION_SUCCESS != perm_app_uninstall(m_pkgId)) {
         LogWarning("failure in removing smack rules file");
     }
     free(m_pkgId);
@@ -227,14 +227,14 @@ void TaskSmack::StepAbortSmack()
 bool TaskSmack::setLabelForSharedDir(const char* pkgId)
 {
     /* /shared directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+    if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
                 m_context.locations->getSharedRootDir().c_str(),
                 APP_PATH_ANY_LABEL, "_")) {
         LogWarning("Add label to " << m_context.locations->getUserDataRootDir());
     }
 
     /* /shared/res directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+    if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
                 m_context.locations->getSharedResourceDir().c_str(),
                 APP_PATH_ANY_LABEL, "_")) {
         LogWarning("Add label to " << m_context.locations->getSharedResourceDir());
@@ -255,7 +255,7 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId)
 
         LogDebug("sha1 label string : " << sha1String);
 
-        if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+        if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
                     m_context.locations->getSharedTrustedDir().c_str(),
                     APP_PATH_GROUP_RW, sha1String.c_str())) {
             LogWarning("Add label to " << m_context.locations->getBinaryDir());
@@ -263,7 +263,7 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId)
     }
 
     /* /shared/data directory */
-    if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
+    if (PC_OPERATION_SUCCESS != perm_app_setup_path(m_pkgId,
                 m_context.locations->getSharedDataDir().c_str(),
                 APP_PATH_PUBLIC_RO)) {
         LogWarning("Add label to " << m_context.locations->getSharedDataDir());
index 353aaaf..c8079a2 100644 (file)
@@ -46,11 +46,11 @@ void TaskSmack::Step()
         "------------------------> SMACK: Jobs::WidgetUninstall::TaskSmack::Step()");
 #ifdef WRT_SMACK_ENABLED
     const char* pkgId = m_context.tzPkgid.c_str();
-    if (PC_OPERATION_SUCCESS != app_revoke_permissions(pkgId)) {
+    if (PC_OPERATION_SUCCESS != perm_app_revoke_permissions(pkgId)) {
         LogError("failure in revoking smack permissions");
     }
 
-    if (PC_OPERATION_SUCCESS != app_uninstall(pkgId)) {
+    if (PC_OPERATION_SUCCESS != perm_app_uninstall(pkgId)) {
         LogError("failure in removing smack rules file");
     }
 #endif