client/src/unifycr.c
int unifycr_unmount() {
    if (fs_type == UNIFYCR_LOG) {
	    int cmd = COMM_UNMOUNT;
	    char cmd_buf[GEN_STR_LEN] = {0};
	    memcpy(cmd_buf, &cmd, sizeof(int));

	    int res = __real_write(cmd_fd.fd,\
	    		cmd_buf, sizeof(cmd_buf));
		if (res != 0) {
			 int bytes_read = 0;
		     int rc;
		     cmd_fd.events = POLLIN|POLLPRI;
		     cmd_fd.revents = 0;

		    rc = poll(&cmd_fd, 1, -1);
			if (rc == 0) {

			}
			else {
				if (rc > 0) {
					if (cmd_fd.revents != 0) {
						if (cmd_fd.revents == POLLIN) {
							bytes_read = __real_read(cmd_fd.fd, cmd_buf,\
								 sizeof(cmd_buf));
							if (bytes_read == 0) {
								return UNIFYCR_FAILURE;
							}
							else {
								if (*((int *)cmd_buf) != COMM_UNMOUNT\
										|| *((int *)cmd_buf + 1) \
									 != ACK_SUCCESS) {
								 return UNIFYCR_FAILURE;
								}
								return UNIFYCR_SUCCESS;
							}
						} else {
						}
					} else {
					}
				} else {

				}
			}
			} else {
				return UNIFYCR_FAILURE;
			}

		}
		else
			return UNIFYCR_FAILURE;

}
/**
* unmount the mounted file system, triggered
* by the root process of an application
* ToDo: add the support for more operations
* beyond terminating the servers. E.g.
* data flush for persistence.
* @return success/error code
*/
unmount the mounted file system, triggered
by the root process of an application
ToDo: add the support for more operations
beyond terminating the servers.
unmount the mounted file system triggered by the root process of an application ToDo : add the support for more operations beyond terminating the servers .
int unifycr_unmount() {
    if (fs_type == UNIFYCR_LOG) {
	    int cmd = COMM_UNMOUNT;
	    char cmd_buf[GEN_STR_LEN] = {0};
	    memcpy(cmd_buf, &cmd, sizeof(int));
	    int res = __real_write(cmd_fd.fd,\
	    		cmd_buf, sizeof(cmd_buf));
		if (res != 0) {
			 int bytes_read = 0;
		     int rc;
		     cmd_fd.events = POLLIN|POLLPRI;
		     cmd_fd.revents = 0;
		    rc = poll(&cmd_fd, 1, -1);
			if (rc == 0) {
			}
			else {
				if (rc > 0) {
					if (cmd_fd.revents != 0) {
						if (cmd_fd.revents == POLLIN) {
							bytes_read = __real_read(cmd_fd.fd, cmd_buf,\
								 sizeof(cmd_buf));
							if (bytes_read == 0) {
								return UNIFYCR_FAILURE;
							}
							else {
								if (*((int *)cmd_buf) != COMM_UNMOUNT\
										|| *((int *)cmd_buf + 1) \
									 != ACK_SUCCESS) {
								 return UNIFYCR_FAILURE;
								}
								return UNIFYCR_SUCCESS;
							}
						} else {
						}
					} else {
					}
				} else {
				}
			}
			} else {
				return UNIFYCR_FAILURE;
			}
		}
		else
			return UNIFYCR_FAILURE;
}
int unifycr_unmount ( ) { if ( fs_type == UNIFYCR_LOG ) { int cmd = COMM_UNMOUNT ; char cmd_buf [ GEN_STR_LEN ] = { 0 } ; memcpy ( cmd_buf , & cmd , sizeof ( int ) ) ; int res = __real_write ( cmd_fd . fd , cmd_buf , sizeof ( cmd_buf ) ) ; if ( res != 0 ) { int bytes_read = 0 ; int rc ; cmd_fd . events = POLLIN | POLLPRI ; cmd_fd . revents = 0 ; rc = poll ( & cmd_fd , 1 , -1 ) ; if ( rc == 0 ) { } else { if ( rc > 0 ) { if ( cmd_fd . revents != 0 ) { if ( cmd_fd . revents == POLLIN ) { bytes_read = __real_read ( cmd_fd . fd , cmd_buf , sizeof ( cmd_buf ) ) ; if ( bytes_read == 0 ) { return UNIFYCR_FAILURE ; } else { if ( * ( ( int * ) cmd_buf ) != COMM_UNMOUNT || * ( ( int * ) cmd_buf + 1 ) != ACK_SUCCESS ) { return UNIFYCR_FAILURE ; } return UNIFYCR_SUCCESS ; } } else { } } else { } } else { } } } else { return UNIFYCR_FAILURE ; } } else return UNIFYCR_FAILURE ; }
unmount the mounted file system, triggered
by the root process of an application
ToDo: add the support for more operations
beyond terminating the servers.
unmount the mounted file system triggered by the root process of an application ToDo : add the support for more operations beyond terminating the servers .