Skip to content

Commit 84f97b2

Browse files
committed
algos cambios para manejo de pilas
1 parent ada4b76 commit 84f97b2

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

kernel-data-structure-lab1/bridgeOwn.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static long bridge_ioctl(struct file *f, unsigned int cmd, unsigned long arg){
5252
int data;
5353
char message[100];
5454
struct string_node *tmp_element;
55+
printk("llego al kernel");
5556
switch(cmd){
5657
case BRIDGE_CREATE_Q:
5758
printk(KERN_INFO "message %s\n", "bla");
@@ -88,11 +89,13 @@ static long bridge_ioctl(struct file *f, unsigned int cmd, unsigned long arg){
8889
printk(KERN_INFO "Stack succesfully created\n");
8990
break;
9091
case BRIDGE_W_S:
92+
printk(KERN_INFO "Creando");
9193
raw_copy_from_user(message, (char *)arg, 100);
92-
add_element_to_stack(message);
94+
add_element_to_stack(message);
9395
printk(KERN_INFO "Element succesfully added to the stack\n");
9496
break;
9597
case BRIDGE_R_S:
98+
printk(KERN_INFO "Leyendo");
9699
tmp_element = list_last_entry(&stack, struct string_node, list);
97100
list_del(&(tmp_element->list));
98101
raw_copy_to_user((char *)arg, tmp_element->message, 100);

kernel-data-structure-lab1/clientBridge.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,31 @@ char* getPathFile(){
109109
return pathfile;
110110
}
111111

112+
void validarSimetria(int fd,char *file,int numOfLines){
113+
char test[100];
114+
ioctl(fd, BRIDGE_W_S, "Hola este es un mensaje a la pila \n");
115+
ioctl(fd, BRIDGE_R_S, test);
116+
printf("%s\n",test);
117+
}
112118
void chooseOption(char* option){
119+
120+
int fd = callModule();
113121
char* pathfile = getPathFile();
114122
int numOfLines = 0;
115123
char **linesArray=readFile(pathfile,&numOfLines);
124+
printf("informacion del archivo : \n");
116125
for ( int i = 0; i < numOfLines; i++)
117126
{
118-
printf("valor regreso= %s",linesArray[i]);
127+
printf("%s",linesArray[i]);
119128
}
120129
printf("\n");
130+
121131
if(strcmp(ORDEN_INVERSO, option) == 0){
122132

123133
}else if(strcmp(RANDOM, option) == 0){
124134

125135
}else if(strcmp(VALIDAR_SIMETRIA, option) == 0){
136+
validarSimetria(fd,linesArray,numOfLines);
126137

127138
}else if(strcmp(COLA_PRIORIDAD, option) == 0){
128139

0 commit comments

Comments
 (0)