Commit | Line | Data |
---|---|---|
6d02c5c1 HD |
1 | /******************************************************************************* |
2 | * Copyright (c) 2016 École Polytechnique de Montréal | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | *******************************************************************************/ | |
9 | ||
10 | package org.eclipse.tracecompass.analysis.os.linux.core.inputoutput; | |
11 | ||
12 | /** | |
13 | * Enum type for IO operations | |
14 | * | |
15 | * @author Geneviève Bastien | |
6d02c5c1 HD |
16 | */ |
17 | public enum IoOperationType { | |
18 | ||
19 | /** | |
20 | * Write to the disk | |
21 | */ | |
22 | WRITE, | |
23 | /** | |
24 | * Read on the disk | |
25 | */ | |
26 | READ; | |
27 | ||
28 | /** | |
29 | * Get the BIO type from the rwbs value of a block operation. | |
30 | * | |
31 | * @param rwbs | |
32 | * The rwbs value of the block operation | |
33 | * @return The BIO type | |
34 | */ | |
35 | public static IoOperationType getType(int rwbs) { | |
36 | /* Even is a "read", odd is a "write" */ | |
37 | return (rwbs % 2 == 0) ? READ : WRITE; | |
38 | } | |
39 | } |