diff options
author | INSUN PYO <insun.pyo@samsung.com> | 2017-09-12 10:40:16 +0900 |
---|---|---|
committer | INSUN PYO <insun.pyo@samsung.com> | 2017-09-12 01:55:43 +0000 |
commit | 7ad7e284c5620d79617c98e7c9edeb4e2b1b1f6f (patch) | |
tree | 09ded1d4be2dbfe9b9a087705a7cabaed46b19fa /src/liblazymount/lazy_mount_interface.c | |
parent | 2cf4b2ae63894713b46d01fb46af6d2fbab70123 (diff) | |
download | system-plugin-7ad7e284c5620d79617c98e7c9edeb4e2b1b1f6f.tar.gz system-plugin-7ad7e284c5620d79617c98e7c9edeb4e2b1b1f6f.tar.bz2 system-plugin-7ad7e284c5620d79617c98e7c9edeb4e2b1b1f6f.zip |
Modification of coding rule violationsubmit/tizen/20170912.020543accepted/tizen/unified/20170912.191913
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I8999b410117069e1370a796b254ee52f7f6eea09
(cherry picked from commit cce23cf0bc507da44bee301de3f8b1955df5cb69)
Diffstat (limited to 'src/liblazymount/lazy_mount_interface.c')
-rw-r--r-- | src/liblazymount/lazy_mount_interface.c | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/src/liblazymount/lazy_mount_interface.c b/src/liblazymount/lazy_mount_interface.c index d7034a7..25fcdea 100644 --- a/src/liblazymount/lazy_mount_interface.c +++ b/src/liblazymount/lazy_mount_interface.c @@ -39,12 +39,12 @@ #define LAZY_MOUNT_CHECK_FILE LAZY_MOUNT_CHECK_DIR "/" UNLOCK_MNT_STR #define EVENT_NAME_MAX 256 -#define EVENT_SIZE ( sizeof (struct inotify_event) ) -#define EVENT_BUF_LEN ( 512 * ( EVENT_SIZE + EVENT_NAME_MAX ) ) +#define EVENT_SIZE (sizeof(struct inotify_event)) +#define EVENT_BUF_LEN (512 * (EVENT_SIZE + EVENT_NAME_MAX)) /* Enumerate list of FDs to poll */ enum { - FD_POLL_INOTIFY=0, + FD_POLL_INOTIFY = 0, FD_POLL_MAX }; @@ -53,14 +53,10 @@ int get_need_ui_for_lazy_mount() int sl_result = 0; /* get touchkey light duration setting */ if (vconf_get_int(VCONFKEY_SYSTEM_LAZY_MOUNT_SHOW_UI, &sl_result) < 0) - { return DEFAULT_VALUE_LAZY_MOUNT_SHOW_UI; - } - if(sl_result != 1 && sl_result != 0) - { + if (sl_result != 1 && sl_result != 0) return DEFAULT_VALUE_LAZY_MOUNT_SHOW_UI; - } return sl_result; } @@ -71,9 +67,7 @@ int do_mount_user() f = fopen(LAZY_MOUNT_FILE, "w"); if (!f) - { return -errno; - } fclose(f); return 0; @@ -89,53 +83,42 @@ int wait_mount_user() fd = access(LAZY_MOUNT_CHECK_FILE, F_OK); - if(fd == 0) - { + if (fd == 0) return 0; - } fd = inotify_init(); - if(fd < 0) - { + if (fd < 0) return -errno; - } wd = inotify_add_watch(fd, LAZY_MOUNT_CHECK_DIR, IN_CREATE|IN_MODIFY|IN_ATTRIB); fds[FD_POLL_INOTIFY].fd = fd; fds[FD_POLL_INOTIFY].events = POLLIN; - while(1) - { - if(poll(fds, FD_POLL_MAX, -1) < 0) - { + while (1) { + if (poll(fds, FD_POLL_MAX, -1) < 0) { inotify_rm_watch(fd, wd); close(fd); return -errno; } - if(fds[FD_POLL_INOTIFY].revents & POLLIN) - { + + if (fds[FD_POLL_INOTIFY].revents & POLLIN) { length = read(fds[FD_POLL_INOTIFY].fd, buffer, EVENT_BUF_LEN); - if( length < 0 ) - { + if (length < 0) { inotify_rm_watch(fd, wd); close(fd); return -errno; } i = 0; - while ( i < length ) { - struct inotify_event *event = ( struct inotify_event * ) &buffer[ i ]; - if ( event->len > 0 && event->len < EVENT_NAME_MAX) - { - if ( event->mask & (IN_CREATE|IN_MODIFY|IN_ATTRIB) ) - { - if (!(event->mask & IN_ISDIR)) - { - if(!strncmp(event->name, UNLOCK_MNT_STR, sizeof(UNLOCK_MNT_STR))) - { + while (i < length) { + struct inotify_event *event = (struct inotify_event *) &buffer[i]; + if (event->len > 0 && event->len < EVENT_NAME_MAX) { + if (event->mask & (IN_CREATE|IN_MODIFY|IN_ATTRIB)) { + if (!(event->mask & IN_ISDIR)) { + if (!strncmp(event->name, UNLOCK_MNT_STR, sizeof(UNLOCK_MNT_STR))) { inotify_rm_watch(fd, wd); close(fd); return 0; |