Fix indentation

This commit is contained in:
Amin Ben Ramdhane 2020-03-25 12:38:52 +01:00
parent fa07b8c3b6
commit 50f8d36627
2 changed files with 474 additions and 493 deletions

View file

@ -54,7 +54,6 @@ static int is_device_exist(char *device)
uci_path_foreach_sections(bbfdm, DMMAP, "link", s) {
dmuci_get_value_by_section_string(s, "device", &dev);
char *p = strtok(dev, ".");
if (p != NULL) {
if (strcmp(p, device) == 0) {
@ -109,7 +108,6 @@ static void create_link(char *ifname)
/* Check if section_name exists or not, if yes then do not add section just update
* the params else add section and update the params. */
struct uci_section *s = NULL;
char *sec_name;
int ret = 1;
@ -122,7 +120,6 @@ static void create_link(char *ifname)
dmuci_set_value_by_section(s, "section_name", ifname);
ret = 0;
break;
} else {
ret = 1;
}
@ -237,10 +234,8 @@ static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent
char *if_name = strtok(intf, " ");
if (NULL != if_name) {
char name[250] = {0};
strncpy(name, if_name, sizeof(name));
/* Support for both vlans and macvlans. */
int macvlan = 0;
char *p = strstr(name, ".");
@ -267,8 +262,6 @@ static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent
if (macvlan == 0) {
char tag[20] = {0};
strncpy(tag, end, sizeof(tag));
if (strncmp(tag, "1", sizeof(tag)) == 0) {
continue;
}
@ -330,7 +323,6 @@ static int addObjEthernetLink(char *refparam, struct dmctx *ctx, void *data, cha
struct uci_section *dmmap_network= NULL;
inst = get_last_instance_bbfdm(DMMAP, "link", "link_instance");
dmuci_add_section_bbfdm(DMMAP, "link", &dmmap_network, &v);
*instance = update_instance_bbfdm(dmmap_network, inst, "link_instance");
return 0;
@ -340,6 +332,7 @@ static int delObjEthernetLink(char *refparam, struct dmctx *ctx, void *data, cha
{
char *sect_name= NULL;
struct uci_section *s = NULL;
switch (del_action) {
case DEL_INST:
/* Fix : Deletion of EthernetLink to support L2 VLAN deployments. */
@ -357,7 +350,6 @@ static int delObjEthernetLink(char *refparam, struct dmctx *ctx, void *data, cha
dmuci_get_value_by_section_string(intf_s, "proto", &proto);
dmuci_delete_by_section(intf_s, "proto", proto);
break;
}
}
/* Remove the Link section from dmmap. */
@ -521,7 +513,6 @@ static int get_Ethernet_VLANTerminationNumberOfEntries(char *refparam, struct dm
}
}
char *tok, *end;
if (macvlan == 1) {
tok = strtok_r(name, "_", &end);
@ -536,13 +527,11 @@ static int get_Ethernet_VLANTerminationNumberOfEntries(char *refparam, struct dm
if (macvlan == 0) {
char tag[20] = {0};
strncpy(tag, end, sizeof(tag));
if (strncmp(tag, "1", sizeof(tag)) == 0) {
continue;
}
}
}
cnt++;
}
dmasprintf(value, "%d", cnt);
@ -1067,7 +1056,6 @@ static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
/* Set the value of proto to the section. */
dmuci_set_value_by_section(intf_s, "proto", "dhcp");
}
}
}

View file

@ -898,7 +898,7 @@ void synchronize_specific_config_sections_with_dmmap_vlan(char *package, char *s
if (access(dmmap_file_path, F_OK)) {
/*
*File does not exist
**/
*/
fp = fopen(dmmap_file_path, "w"); // new empty file
fclose(fp);
}
@ -912,9 +912,7 @@ void synchronize_specific_config_sections_with_dmmap_vlan(char *package, char *s
}
/* Fix : Entry for only VLANS. */
if (strcmp(package, "network") == 0 &&
strcmp(section_type, "interface") == 0 &&
strcmp(dmmap_package, "dmmap_network") == 0) {
if (strcmp(package, "network") == 0 && strcmp(section_type, "interface") == 0 && strcmp(dmmap_package, "dmmap_network") == 0) {
char *type, *intf;
dmuci_get_value_by_section_string(s, "type", &type);
dmuci_get_value_by_section_string(s, "ifname", &intf);
@ -979,9 +977,7 @@ void synchronize_specific_config_sections_with_dmmap(char *package, char *sectio
}
/* Fix : Change to fix multiple IP interface creation. */
if (strcmp(package, "network") == 0 &&
strcmp(section_type, "interface") == 0 &&
strcmp(dmmap_package, "dmmap_network") == 0) {
if (strcmp(package, "network") == 0 && strcmp(section_type, "interface") == 0 && strcmp(dmmap_package, "dmmap_network") == 0) {
char *value;
dmuci_get_value_by_section_string(s, "proto", &value);
if (*value == '\0') {
@ -1116,11 +1112,9 @@ void synchronize_multi_config_sections_with_dmmap_set(char *package, char *secti
}
uci_foreach_option_eq(package, section_type, option_name, option_value, s) {
/* Check if bridge_port_instance is present in dmmap_bridge_port.*/
struct uci_section *sec;
uci_path_foreach_option_eq(bbfdm, "dmmap_bridge_port", "bridge_port", "bridge_port_instance", instance, sec) {
dmuci_get_value_by_section_string(sec, "bridge_key", &key);
char bridge_key[10] = {0};
strncpy(bridge_key, br_key, sizeof(bridge_key));
@ -1386,7 +1380,6 @@ void delete_sections_save_next_sections(char* dmmap_package, char *section_type,
if(lsectname != NULL) dmfree(lsectname);
uci_path_foreach_sections_safe(bbfdm, dmmap_package, section_type, stmp, s) {
dmuci_get_value_by_section_string(s, instancename, &v);
inst= atoi(v);