Skip to content

Commit 9ba026e

Browse files
authored
Merge pull request #5 from grupoudea/feature/orden-inverso
Feature/orden inverso
2 parents 52e8c29 + 6d10564 commit 9ba026e

File tree

7 files changed

+22
-7
lines changed

7 files changed

+22
-7
lines changed

kernel-data-structure-lab1/bridge_load

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ device="bridgeOwn"
55
mode="664"
66
group="sudo"
77

8+
echo " Loading module from Load Script"
89
# invoke insmod with all arguments we got
910
# and use a pathname, as insmod doesn't look in . by default
1011
/sbin/insmod ./$module.ko $* || exit 1
@@ -20,3 +21,6 @@ mknod /dev/${device}0 c $major 0
2021
ln -sf ${device}0 /dev/${device}
2122
chgrp $group /dev/${device}0
2223
chmod $mode /dev/${device}0
24+
25+
echo " The Module has been loaded"
26+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
echo "1. Removing module..."
3+
sudo ./bridge_unload
4+
echo "2. Compiling module..."
5+
make
6+
echo "3. loading module into kernel..."
7+
sudo ./bridge_load

kernel-data-structure-lab1/bridge_unload

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ device="bridgeOwn"
44

55
# invoke rmmod with all arguments we got
66
/sbin/rmmod $module $* || exit 1
7+
echo " Removing from unload script"
78

89
# Remove stale nodes
910
rm -f /dev/${device} /dev/${device}0
11+
echo " The Module has been unloaded"

kernel-data-structure-lab1/clientBridge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void chooseOption(char* option){
4141

4242
char* pathfile = getPathFile();
4343
int numOfLines = 0;
44-
char **linesArray = readFile(pathfile,&numOfLines);
44+
char** linesArray = readFile(pathfile, &numOfLines);
4545

4646
if(strcmp(ORDEN_INVERSO, option) == 0){
4747
ordenInverso(linesArray, numOfLines);

kernel-data-structure-lab1/moduleImplement/bridgeLink.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ void ordenInverso(char** arrayLines, int numOfLines){
3030
printf("%s",arrayLines[i]);
3131
write_message(fd, BRIDGE_W_S, arrayLines[i]);
3232
}
33-
char test[100];
33+
char fileLine[100];
3434
printf("\n###### Lineas del archivo orden inverso ######\n");
3535
for (int i = 0; i < numOfLines; i++){
36-
write_message(fd, BRIDGE_R_S, test);
37-
printf("%s",test);
36+
write_message(fd, BRIDGE_R_S, fileLine);
37+
printf("%s",fileLine);
3838
}
3939
}
4040

kernel-data-structure-lab1/moduleImplement/bridgeLink.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ void validarSimetria(char** file, int numOfLines);
22

33
void ordenInverso(char** file, int numOfLines);
44

5-
void rotateToRight(int numberRotations);
5+
void rotateToRight(int numberRotations);
6+
7+
void randomLines(char* pathFile);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
int validateString(char*);
22
void killClientBridge(char*);
3-
char **readFile(char* filename, int *numOfLines);
3+
char** readFile(char* filename, int* numOfLines);
44
int numberOfLines(FILE* file, int* size);
5-
int stringLength(char * arrayChar);
5+
int stringLength(char* arrayChar);

0 commit comments

Comments
 (0)