Skip to content

Commit

Permalink
osd-target: Avoid definition of FALSE/TRUE
Browse files Browse the repository at this point in the history
just use stdbool.h and the lower-case false/true

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
  • Loading branch information
Boaz Harrosh committed Mar 15, 2010
1 parent 4039042 commit 6907f67
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
11 changes: 6 additions & 5 deletions osd-target/cdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,13 @@ static int get_attributes(struct command *cmd, uint64_t pid, uint64_t oid,
uint16_t numoid, uint32_t cdb_cont_len)
{
int ret = 0;
uint8_t isembedded = TRUE;
uint8_t isembedded = true;

if (numoid < 1)
goto out_cdb_err;

if (cmd->action == OSD_GET_ATTRIBUTES)
isembedded = FALSE;
isembedded = true;

if (cmd->getset_cdbfmt == GETPAGE_SETVALUE) {
return get_attr_page(cmd, pid, oid, isembedded, numoid, cdb_cont_len);
Expand All @@ -537,13 +537,13 @@ static int set_attributes(struct command *cmd, uint64_t pid, uint64_t oid,
uint32_t numoid, uint32_t cdb_cont_len)
{
int ret = 0;
uint8_t isembedded = TRUE;
uint8_t isembedded = true;

if (numoid < 1)
goto out_cdb_err;

if (cmd->action == OSD_SET_ATTRIBUTES)
isembedded = FALSE;
isembedded = true;

if (cmd->getset_cdbfmt == GETPAGE_SETVALUE) {
return set_attr_value(cmd, pid, oid, isembedded, numoid, cdb_cont_len);
Expand Down Expand Up @@ -1094,7 +1094,8 @@ static int exec_cas_setattr(struct command *cmd, uint64_t pid, uint64_t oid,
pad = 0;

ret = osd_set_attributes(cmd->osd, pid, oid, page, number,
&list[10], len, TRUE, cdb_cont_len, cmd->sense);
&list[10], len, true, cdb_cont_len,
cmd->sense);
if (ret != 0) {
cmd->senselen = ret;
goto out_err;
Expand Down
6 changes: 1 addition & 5 deletions osd-target/osd-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define __OSD_TYPES_H

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <sqlite3.h>

Expand Down Expand Up @@ -198,11 +199,6 @@ struct osd_device {
struct id_list idl;
};

enum {
FALSE = 0,
TRUE = 1
};

enum {
GATHER_VAL = 1,
GATHER_ATTR = 2,
Expand Down
24 changes: 12 additions & 12 deletions osd-target/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static inline int check_valid_pg(uint8_t obj_type, uint32_t page)
case ROOT:
return (ROOT_PG <= page && page < RESERVED_PG);
default:
return FALSE;
return false;
}
}

Expand All @@ -147,17 +147,17 @@ static int issettable_page(uint8_t obj_type, uint32_t page)

if (!valid_pg) {
if (page >= ANY_PG)
return TRUE;
return true;
else
return FALSE;
return false;
}

rel_page = get_rel_page(obj_type, page);
if ((STD_PG_LB <= rel_page && rel_page <= STD_PG_UB) ||
(LUN_PG_LB <= rel_page && rel_page <= LUN_PG_UB))
return TRUE;
return true;
else
return FALSE;
return false;
}

static int isgettable_page(uint8_t obj_type, uint32_t page)
Expand All @@ -167,17 +167,17 @@ static int isgettable_page(uint8_t obj_type, uint32_t page)

if (!valid_pg) {
if (page >= ANY_PG)
return TRUE;
return true;
else
return FALSE;
return false;
}

rel_page = get_rel_page(obj_type, page);
if ((RSRV_PG_LB <= rel_page && rel_page <= RSRV_PG_UB) ||
rel_page > VEND_PG_UB)
return FALSE;
return false;
else
return TRUE;
return true;

}

Expand Down Expand Up @@ -2246,7 +2246,7 @@ int osd_getattr_list(struct osd_device *osd, uint64_t pid, uint64_t oid,
if (obj_type == ILLEGAL_OBJ)
goto out_cdb_err;

if (isgettable_page(obj_type, page) == FALSE)
if (isgettable_page(obj_type, page) == false)
goto out_param_list;

ret = lazy_init_attr(osd, pid, oid, page, number);
Expand Down Expand Up @@ -2356,7 +2356,7 @@ int osd_getattr_page(struct osd_device *osd, uint64_t pid, uint64_t oid,
if (obj_type == ILLEGAL_OBJ)
goto out_cdb_err;

if (isgettable_page(obj_type, page) == FALSE)
if (isgettable_page(obj_type, page) == false)
goto out_param_list;

if (!isembedded)
Expand Down Expand Up @@ -3452,7 +3452,7 @@ int osd_set_attributes(struct osd_device *osd, uint64_t pid, uint64_t oid,
if (obj_type == ILLEGAL_OBJ)
goto out_cdb_err;

if (issettable_page(obj_type, page) == FALSE)
if (issettable_page(obj_type, page) == false)
goto out_param_list;

if (number == ATTRNUM_UNMODIFIABLE)
Expand Down

0 comments on commit 6907f67

Please sign in to comment.