Skip to content

Commit e76c861

Browse files
authored
Refactors for consistency
1 parent 611c184 commit e76c861

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/libltfs/tape.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,15 +3062,13 @@ void set_tape_attribute(struct ltfs_volume *vol, struct tape_attr *t_attr)
30623062
* @param set attribute type
30633063
* @return 0 positive : success, negative : cannot set value to Cartridge Memory
30643064
*/
3065-
int tape_set_attribute_to_cm(struct device_data* dev,
3066-
struct tape_attr* t_attr,
3067-
int type)
3065+
int tape_set_attribute_to_cm(struct device_data *dev, struct tape_attr *t_attr, int type)
30683066
{
30693067
int ret;
30703068
int attr_size;
30713069
uint8_t format;
3072-
unsigned char* attr_data = NULL;
3073-
unsigned char* data;
3070+
unsigned char *attr_data = NULL;
3071+
unsigned char *data;
30743072
size_t len;
30753073

30763074
CHECK_ARG_NULL(dev, -LTFS_NULL_ARG);
@@ -3120,9 +3118,10 @@ int tape_set_attribute_to_cm(struct device_data* dev,
31203118

31213119
/* we reserve the size of the attribute + the MAM header size since the buffer will contain both */
31223120
attr_data = calloc(1, attr_size + TC_MAM_PAGE_HEADER_SIZE);
3123-
if (!attr_data)
3121+
if (!attr_data) {
31243122
return -LTFS_NO_MEMORY;
3125-
3123+
}
3124+
31263125
/* fill the MAM header information */
31273126
ltfs_u16tobe(attr_data, type); /* set attribute type */
31283127
attr_data[2] = format; /* set data format type */
@@ -3178,13 +3177,13 @@ int tape_set_attribute_to_cm(struct device_data* dev,
31783177
}
31793178

31803179
ret = dev->backend->write_attribute(dev->backend_data,
3181-
0,
3180+
0, /* partition */
31823181
attr_data,
31833182
attr_size + TC_MAM_PAGE_HEADER_SIZE);
31843183

3185-
if (ret < 0)
3184+
if (ret < 0) {
31863185
ltfsmsg(LTFS_ERR, 17205E, type, "tape_set_attribute_to_cm");
3187-
3186+
}
31883187
free(attr_data);
31893188
return ret;
31903189
}
@@ -3264,7 +3263,7 @@ int tape_get_attribute_from_cm(struct device_data *dev, struct tape_attr *t_attr
32643263
{
32653264
int ret;
32663265
int attr_len;
3267-
unsigned char* attr_data = NULL;
3266+
unsigned char *attr_data = NULL;
32683267

32693268
CHECK_ARG_NULL(dev, -LTFS_NULL_ARG);
32703269
CHECK_ARG_NULL(t_attr, -LTFS_NULL_ARG);
@@ -3305,7 +3304,7 @@ int tape_get_attribute_from_cm(struct device_data *dev, struct tape_attr *t_attr
33053304

33063305
int attr_size = sizeof(char) * (attr_len + TC_MAM_PAGE_HEADER_SIZE);
33073306
attr_data = (unsigned char*)malloc(attr_size);
3308-
if (!attr_data){
3307+
if (!attr_data) {
33093308
return -LTFS_NO_MEMORY;
33103309
}
33113310
ret = dev->backend->read_attribute(dev->backend_data,
@@ -3353,8 +3352,9 @@ int tape_get_attribute_from_cm(struct device_data *dev, struct tape_attr *t_attr
33533352
memcpy(t_attr->media_pool, attr_data + 5, attr_len);
33543353
t_attr->media_pool[attr_len] = '\0';
33553354
}
3356-
} else
3355+
} else {
33573356
ltfsmsg(LTFS_DEBUG, 17198D, type, "tape_get_attribute_from_cm");
3357+
}
33583358
free(attr_data);
33593359
return ret;
33603360
}

0 commit comments

Comments
 (0)