├── .gitignore ├── Fase2.pdf ├── FileSystem_2 ├── FileSystem_2.pro ├── FileSystem_2.pro.user ├── Lexico.l ├── Sintactico.y ├── disco.cpp ├── disco.h ├── graficador.cpp ├── graficador.h ├── listamount.cpp ├── listamount.h ├── main.cpp ├── mainheader.h ├── nodo.cpp ├── nodo.h ├── nodomount.cpp ├── nodomount.h ├── parser.cpp ├── parser.h ├── reporte.cpp ├── reporte.h ├── scanner.cpp ├── scanner.h └── structs.h ├── Imagenes ├── Comandos │ ├── cat.png │ ├── cat2.png │ ├── cat3.png │ ├── chmod.png │ ├── errorPermisos.png │ ├── fdisk.png │ ├── login.png │ ├── logoi.png │ ├── logoi2.png │ ├── logoi3.png │ ├── loss.png │ ├── mkdir1.png │ ├── mkdir2.png │ ├── mkdir3.png │ ├── mkdir4.png │ ├── mkdisk.png │ ├── mkfile1.png │ ├── mkfile2.png │ ├── mkfile3.png │ ├── mkfile4.png │ ├── mkfs.png │ ├── mkgrp.png │ ├── mkusr.png │ ├── mount.png │ ├── mv.png │ ├── recovery.png │ ├── rem.png │ ├── rem2.png │ ├── rep1.png │ ├── rmgrp.png │ └── rmusr.png └── Reportes │ ├── Journaling.jpg │ ├── SuperBloque.jpg │ ├── bitmaps.png │ ├── bitmapss.png │ ├── blocks.jpg │ ├── blocks_zoom.png │ ├── contenido.png │ ├── inodes.jpg │ ├── inodes_zoom.png │ ├── reporte1_tree.jpg │ ├── reporte2.1_tree.jpg │ ├── reporte2.2_tree.jpg │ ├── reporte2.3_tree.jpg │ ├── reporte2.4_tree.jpg │ ├── reporte3.1_tree.jpg │ ├── reporte3.1_zoom.png │ ├── reporte3.2_tree.jpg │ ├── reporte3.2_zoom.png │ ├── reporte3.3_tree.jpg │ ├── reporte3.3_zoom.png │ ├── reporte3.4_tree.jpg │ ├── reporte3.4_zoom.png │ ├── reporte4.1_tree.jpg │ ├── reporte4.1_zoom.png │ ├── reporte4.2_tree.jpg │ ├── reporte4.2_zoom.png │ ├── reporte4.3_tree.jpg │ ├── reporte4.3_zoom.png │ └── reporte7_tree.jpg ├── LICENSE ├── README.md ├── archivoMaster.sh └── archivoNoobie.sh /.gitignore: -------------------------------------------------------------------------------- 1 | build-FileSystem_2-Desktop_Qt_5_12_1_GCC_64bit-Debug 2 | -------------------------------------------------------------------------------- /Fase2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Fase2.pdf -------------------------------------------------------------------------------- /FileSystem_2/FileSystem_2.pro: -------------------------------------------------------------------------------- 1 | QT -= gui 2 | 3 | CONFIG += c++11 console 4 | CONFIG -= app_bundle 5 | 6 | # The following define makes your compiler emit warnings if you use 7 | # any Qt feature that has been marked deprecated (the exact warnings 8 | # depend on your compiler). Please consult the documentation of the 9 | # deprecated API in order to know how to port your code away from it. 10 | DEFINES += QT_DEPRECATED_WARNINGS 11 | 12 | # You can also make your code fail to compile if it uses deprecated APIs. 13 | # In order to do so, uncomment the following line. 14 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 15 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 16 | 17 | SOURCES += \ 18 | main.cpp \ 19 | nodo.cpp \ 20 | parser.cpp \ 21 | scanner.cpp \ 22 | graficador.cpp \ 23 | listamount.cpp \ 24 | nodomount.cpp \ 25 | reporte.cpp \ 26 | disco.cpp 27 | 28 | # Default rules for deployment. 29 | qnx: target.path = /tmp/$${TARGET}/bin 30 | else: unix:!android: target.path = /opt/$${TARGET}/bin 31 | !isEmpty(target.path): INSTALLS += target 32 | 33 | HEADERS += \ 34 | nodo.h \ 35 | parser.h \ 36 | scanner.h \ 37 | graficador.h \ 38 | listamount.h \ 39 | nodomount.h \ 40 | reporte.h \ 41 | structs.h \ 42 | mainheader.h \ 43 | disco.h 44 | 45 | DISTFILES += \ 46 | Lexico.l \ 47 | Sintactico.y 48 | -------------------------------------------------------------------------------- /FileSystem_2/FileSystem_2.pro.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {e63c3737-63cc-45a3-8cdd-27bc8c9ef827} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 0 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | true 41 | false 42 | 0 43 | true 44 | true 45 | 0 46 | 8 47 | true 48 | 1 49 | true 50 | true 51 | true 52 | false 53 | 54 | 55 | 56 | ProjectExplorer.Project.PluginSettings 57 | 58 | 59 | true 60 | 61 | 62 | 63 | ProjectExplorer.Project.Target.0 64 | 65 | Desktop Qt 5.12.1 GCC 64bit 66 | Desktop Qt 5.12.1 GCC 64bit 67 | qt.qt5.5121.gcc_64_kit 68 | 0 69 | 0 70 | 0 71 | 72 | /home/raul/Documents/Archivos/Proyecto1_Fase2/build-FileSystem_2-Desktop_Qt_5_12_1_GCC_64bit-Debug 73 | 74 | 75 | true 76 | qmake 77 | 78 | QtProjectManager.QMakeBuildStep 79 | true 80 | 81 | false 82 | false 83 | false 84 | 85 | 86 | true 87 | Make 88 | 89 | Qt4ProjectManager.MakeStep 90 | 91 | false 92 | 93 | 94 | false 95 | 96 | 2 97 | Build 98 | 99 | ProjectExplorer.BuildSteps.Build 100 | 101 | 102 | 103 | true 104 | Make 105 | 106 | Qt4ProjectManager.MakeStep 107 | 108 | true 109 | clean 110 | 111 | false 112 | 113 | 1 114 | Clean 115 | 116 | ProjectExplorer.BuildSteps.Clean 117 | 118 | 2 119 | false 120 | 121 | Debug 122 | Debug 123 | Qt4ProjectManager.Qt4BuildConfiguration 124 | 2 125 | true 126 | 127 | 128 | /home/raul/Documents/Archivos/Proyecto1_Fase2/build-FileSystem_2-Desktop_Qt_5_12_1_GCC_64bit-Release 129 | 130 | 131 | true 132 | qmake 133 | 134 | QtProjectManager.QMakeBuildStep 135 | false 136 | 137 | false 138 | false 139 | true 140 | 141 | 142 | true 143 | Make 144 | 145 | Qt4ProjectManager.MakeStep 146 | 147 | false 148 | 149 | 150 | false 151 | 152 | 2 153 | Build 154 | 155 | ProjectExplorer.BuildSteps.Build 156 | 157 | 158 | 159 | true 160 | Make 161 | 162 | Qt4ProjectManager.MakeStep 163 | 164 | true 165 | clean 166 | 167 | false 168 | 169 | 1 170 | Clean 171 | 172 | ProjectExplorer.BuildSteps.Clean 173 | 174 | 2 175 | false 176 | 177 | Release 178 | Release 179 | Qt4ProjectManager.Qt4BuildConfiguration 180 | 0 181 | true 182 | 183 | 184 | /home/raul/Documents/Archivos/Proyecto1_Fase2/build-FileSystem_2-Desktop_Qt_5_12_1_GCC_64bit-Profile 185 | 186 | 187 | true 188 | qmake 189 | 190 | QtProjectManager.QMakeBuildStep 191 | true 192 | 193 | false 194 | true 195 | true 196 | 197 | 198 | true 199 | Make 200 | 201 | Qt4ProjectManager.MakeStep 202 | 203 | false 204 | 205 | 206 | false 207 | 208 | 2 209 | Build 210 | 211 | ProjectExplorer.BuildSteps.Build 212 | 213 | 214 | 215 | true 216 | Make 217 | 218 | Qt4ProjectManager.MakeStep 219 | 220 | true 221 | clean 222 | 223 | false 224 | 225 | 1 226 | Clean 227 | 228 | ProjectExplorer.BuildSteps.Clean 229 | 230 | 2 231 | false 232 | 233 | Profile 234 | Profile 235 | Qt4ProjectManager.Qt4BuildConfiguration 236 | 0 237 | true 238 | 239 | 3 240 | 241 | 242 | 0 243 | Deploy 244 | 245 | ProjectExplorer.BuildSteps.Deploy 246 | 247 | 1 248 | Deploy Configuration 249 | 250 | ProjectExplorer.DefaultDeployConfiguration 251 | 252 | 1 253 | 254 | 255 | false 256 | false 257 | 1000 258 | 259 | true 260 | 261 | false 262 | false 263 | false 264 | false 265 | true 266 | 0.01 267 | 10 268 | true 269 | 1 270 | 25 271 | 272 | 1 273 | true 274 | false 275 | true 276 | valgrind 277 | 278 | 0 279 | 1 280 | 2 281 | 3 282 | 4 283 | 5 284 | 6 285 | 7 286 | 8 287 | 9 288 | 10 289 | 11 290 | 12 291 | 13 292 | 14 293 | 294 | 2 295 | 296 | FileSystem_2 297 | 298 | Qt4ProjectManager.Qt4RunConfiguration:/home/raul/Documents/Archivos/Proyecto1_Fase2/FileSystem_2/FileSystem_2.pro 299 | FileSystem_2.pro 300 | 301 | 3768 302 | false 303 | true 304 | true 305 | false 306 | false 307 | true 308 | 309 | /home/raul/Documents/Archivos/Proyecto1_Fase2/build-FileSystem_2-Desktop_Qt_5_12_1_GCC_64bit-Debug 310 | 311 | 1 312 | 313 | 314 | 315 | ProjectExplorer.Project.TargetCount 316 | 1 317 | 318 | 319 | ProjectExplorer.Project.Updater.FileVersion 320 | 20 321 | 322 | 323 | Version 324 | 20 325 | 326 | 327 | -------------------------------------------------------------------------------- /FileSystem_2/Lexico.l: -------------------------------------------------------------------------------- 1 | %{ 2 | #include 3 | #include "parser.h" 4 | Nodo *raiz; 5 | char coment[400]; 6 | %} 7 | 8 | %option case-insensitive 9 | %option noyywrap 10 | 11 | /*Regular expresions*/ 12 | letra [a-zA-Z] 13 | entero ("-")?[0-9]+ 14 | caracter ({letra}|{entero}) 15 | id {letra}({letra}|{entero}|"_")* 16 | password ({letra}|{entero}|[!$@+*])+ 17 | cadena "\""[^"\""]*"\"" 18 | extension "."{id} 19 | diagonal "/" 20 | ruta ({diagonal}{id})*({diagonal}{id}{extension}) 21 | directorio ({diagonal}{id})+ 22 | 23 | %x COM 24 | 25 | %% 26 | INITIAL 27 | { 28 | "#" { BEGIN COM; } 29 | 30 | "mkdisk" { return mkdisk; } 31 | "rmdisk" { return rmdisk; } 32 | "fdisk" { return fdisk; } 33 | "mount" { return mount; } 34 | "unmount" { return unmount; } 35 | "rep" { return rep; } 36 | "exec" { return exec; } 37 | "-size" { return size; } 38 | "-unit" { return unit; } 39 | "-path" { return path; } 40 | "-fit" { return fit; } 41 | "-name" { return name; } 42 | "-type" { return type; } 43 | "-delete" { return del; } 44 | "-add" { return add; } 45 | "-id" { return id; } 46 | "bf" { return bf; } 47 | "ff" { return ff; } 48 | "wf" { return wf; } 49 | "Fast" { return fast; } 50 | "Full" { return full; } 51 | "mbr" { return mbr; } 52 | "disk" { return disk; } 53 | 54 | 55 | "mkfs" { return mkfs; } 56 | "login" { return login; } 57 | "logout" { return logout; } 58 | "mkgrp" { return mkgrp; } 59 | "rmgrp" { return rmgrp; } 60 | "mkusr" { return mkusr; } 61 | "rmusr" { return rmusr; } 62 | "chmod" { return Rchmod; } 63 | "mkfile" { return mkfile; } 64 | "cat" { return cat; } 65 | "rem" { return rem; } 66 | "edit" { return edit; } 67 | "ren" { return ren; } 68 | "mkdir" { return Rmkdir; } 69 | "cp" { return cp; } 70 | "mv" { return mv; } 71 | "find" { return find; } 72 | "chown" { return Rchown; } 73 | "chgrp" { return chgrp; } 74 | "pause" { return pausa; } 75 | "recovery" { return recovery; } 76 | "loss" { return loss; } 77 | "-fs" { return fs; } 78 | "2fs" { return fs2; } 79 | "3fs" { return fs3; } 80 | "-usr" { return usr; } 81 | "-pwd" { return pwd; } 82 | "-grp" { return grp; } 83 | "-ugo" { return ugo; } 84 | "-r" { return r; } 85 | "-p" { return p; } 86 | "-cont" { return cont; } 87 | "-file" { return file; } 88 | "-dest" { return dest; } 89 | "-ruta" { return rutaRep; } 90 | "inode" { return inode; } 91 | "journaling" { return journaling; } 92 | "block" { return block; } 93 | "bm_inode" { return bm_inode; } 94 | "bm_block" { return bm_block; } 95 | "tree" { return tree; } 96 | "sb" { return sb; } 97 | "file" { return fileRep; } 98 | "ls" { return ls; } 99 | 100 | 101 | "=" { return igual; } 102 | 103 | {entero} {strcpy(yylval.text, yytext); return num;} 104 | {caracter} {strcpy(yylval.text, yytext); return caracter;} 105 | {cadena} {strcpy(yylval.text, yytext); return cadena;} 106 | {id} {strcpy(yylval.text, yytext); return identificador;} 107 | {ruta} {strcpy(yylval.text, yytext); return ruta;} 108 | {extension} {strcpy(yylval.text, yytext); return extension;} 109 | {password} {strcpy(yylval.text, yytext); return password; } 110 | {directorio} {strcpy(yylval.text, yytext); return directorio;} 111 | 112 | [[:blank:]] {} 113 | 114 | . {std::cout <"\n" { BEGIN INITIAL; /*strcpy(yylval.text, coment); memset(coment,0,400); return comentario;*/ }; 118 | . { /*strcat(coment, yytext);*/ }; 119 | 120 | %% 121 | -------------------------------------------------------------------------------- /FileSystem_2/Sintactico.y: -------------------------------------------------------------------------------- 1 | %{ 2 | #include "scanner.h" 3 | #include "nodo.h" 4 | #include 5 | 6 | extern int yylineno; //linea actual donde se encuentra el parser (analisis lexico) lo maneja BISON 7 | extern int columna; //columna actual donde se encuentra el parser (analisis lexico) lo maneja BISON 8 | extern char *yytext; //lexema actual donde esta el parser (analisis lexico) lo maneja BISON 9 | extern Nodo *raiz; // Raiz del arbol 10 | 11 | int yyerror(const char* mens){ 12 | std::cout< mkdisk 28 | %token rmdisk 29 | %token fdisk 30 | %token mount 31 | %token unmount 32 | %token rep 33 | %token exec 34 | %token size 35 | %token unit 36 | %token path 37 | %token fit 38 | %token name 39 | %token type 40 | %token del 41 | %token add 42 | %token id 43 | %token bf 44 | %token ff 45 | %token wf 46 | %token fast 47 | %token full 48 | %token mbr 49 | %token disk 50 | %token igual 51 | %token extension 52 | %token num 53 | %token caracter 54 | %token cadena 55 | %token identificador 56 | %token ruta 57 | 58 | %token mkfs 59 | %token login 60 | %token logout 61 | %token mkgrp 62 | %token rmgrp 63 | %token mkusr 64 | %token rmusr 65 | %token Rchmod 66 | %token mkfile 67 | %token cat 68 | %token rem 69 | %token edit 70 | %token ren 71 | %token Rmkdir 72 | %token cp 73 | %token mv 74 | %token find 75 | %token Rchown 76 | %token chgrp 77 | %token pausa 78 | %token recovery 79 | %token loss 80 | %token fs 81 | %token fs2 82 | %token fs3 83 | %token usr 84 | %token pwd 85 | %token grp 86 | %token ugo 87 | %token r 88 | %token p 89 | %token cont 90 | %token file 91 | %token dest 92 | %token rutaRep 93 | %token inode 94 | %token journaling 95 | %token block 96 | %token bm_inode 97 | %token bm_block 98 | %token tree 99 | %token sb 100 | %token fileRep 101 | %token ls 102 | %token password 103 | %token directorio 104 | 105 | /*----------Not terminals------------*/ 106 | %type INIT 107 | %type COMANDO 108 | %type MKDISK 109 | %type PARAMETRO_MK 110 | %type RMDISK 111 | %type FDISK 112 | %type PARAMETRO_FK 113 | %type MOUNT 114 | %type PARAMETRO_M 115 | %type UNMOUNT 116 | %type AJUSTE 117 | %type REP 118 | %type PARAMETRO_R 119 | %type SCRIPT 120 | 121 | %type MKFS 122 | %type PARAM_MKFS 123 | %type LOGIN 124 | %type PARAM_LOGIN 125 | %type MKGRP 126 | %type RMGRP 127 | %type MKUSR 128 | %type PARAM_MKUSR 129 | %type RMUSR 130 | %type CHMOD 131 | %type PARAM_CHMOD 132 | %type MKFILE 133 | %type PARAM_MKFILE 134 | %type CAT 135 | %type REM 136 | %type EDIT 137 | %type PARAM_EDIT 138 | %type REN 139 | %type PARAM_REN 140 | %type MKDIR 141 | %type PARAM_MKDIR 142 | %type CP 143 | %type PARAM_CP 144 | %type MV 145 | %type FIND 146 | %type PARAM_FIND 147 | %type CHOWN 148 | %type PARAM_CHOWN 149 | %type CHGRP 150 | %type PARAM_CHGRP 151 | %type RECOVERY 152 | %type LOSS 153 | %start INIT 154 | 155 | %% 156 | 157 | INIT: COMANDO { raiz = $$; }; 158 | 159 | COMANDO: mkdisk MKDISK { 160 | $$ = new Nodo("MKDISK",""); 161 | $$->add(*$2); 162 | } 163 | | RMDISK { $$ = $1; } 164 | | fdisk FDISK { 165 | $$ = new Nodo("FDISK",""); 166 | $$->add(*$2); 167 | } 168 | | mount MOUNT { 169 | $$ = new Nodo("MOUNT", ""); 170 | $$->add(*$2); 171 | } 172 | | UNMOUNT { $$ = $1; } 173 | | rep REP { $$ = new Nodo("REP",""); 174 | $$->add(*$2); 175 | } 176 | | SCRIPT { $$ = $1; } 177 | | mkfs MKFS { 178 | $$ = new Nodo("MKFS",""); 179 | $$->add(*$2); 180 | } 181 | | login LOGIN { 182 | $$ = new Nodo("LOGIN", ""); 183 | $$->add(*$2); 184 | } 185 | | logout { $$ = new Nodo("LOGOUT",""); } 186 | | MKGRP { $$ = $1; } 187 | | RMGRP { $$ = $1; } 188 | | mkusr MKUSR { 189 | $$ = new Nodo("MKUSR",""); 190 | $$->add(*$2); 191 | } 192 | | RMUSR { $$ = $1; } 193 | | Rchmod CHMOD { 194 | $$ = new Nodo("CHMOD",""); 195 | $$->add(*$2); 196 | } 197 | | mkfile MKFILE { 198 | $$ = new Nodo("MKFILE",""); 199 | $$->add(*$2); 200 | } 201 | | CAT { $$ = $1; } 202 | | REM { $$ = $1; } 203 | | edit EDIT { 204 | $$ = new Nodo("EDIT",""); 205 | $$->add(*$2); 206 | } 207 | | ren REN{ 208 | $$ = new Nodo("REN",""); 209 | $$->add(*$2); 210 | } 211 | | Rmkdir MKDIR{ 212 | $$ = new Nodo("MKDIR",""); 213 | $$->add(*$2); 214 | } 215 | | cp CP{ 216 | $$ = new Nodo("CP",""); 217 | $$->add(*$2); 218 | } 219 | | mv MV{ 220 | $$ = new Nodo("MV",""); 221 | $$->add(*$2); 222 | } 223 | | find FIND{ 224 | $$ = new Nodo("FIND",""); 225 | $$->add(*$2); 226 | } 227 | | Rchown CHOWN{ 228 | $$ = new Nodo("CHOWN",""); 229 | $$->add(*$2); 230 | } 231 | | chgrp CHGRP{ 232 | $$ = new Nodo("CHGRP",""); 233 | $$->add(*$2); 234 | } 235 | | pausa { $$ = new Nodo("PAUSE",""); } 236 | | RECOVERY { $$ = $1; }; 237 | | LOSS { $$ = $1; } 238 | ; 239 | 240 | 241 | 242 | MKDISK: MKDISK PARAMETRO_MK { 243 | $$ = $1; 244 | $$->add(*$2); 245 | } 246 | |PARAMETRO_MK { 247 | $$ = new Nodo("PARAMETRO",""); 248 | $$->add(*$1); 249 | }; 250 | 251 | PARAMETRO_MK: size igual num { $$= new Nodo("size",$3); } 252 | |fit igual AJUSTE { 253 | $$ = new Nodo ("fit", ""); 254 | $$->add(*$3); 255 | } 256 | |unit igual caracter { $$ = new Nodo("unit",$3); } 257 | |path igual cadena { 258 | $$ = new Nodo("path",$3); 259 | } 260 | |path igual ruta { 261 | $$ = new Nodo("path", $3); 262 | 263 | }; 264 | 265 | RMDISK: rmdisk path igual ruta { 266 | $$ = new Nodo("RMDISK",""); 267 | Nodo *n = new Nodo("path",$4); 268 | $$->add(*n); 269 | } 270 | | rmdisk path igual cadena { 271 | $$ = new Nodo("RMDISK",""); 272 | Nodo *ruta = new Nodo("path",$4); 273 | $$->add(*ruta); 274 | }; 275 | FDISK: FDISK PARAMETRO_FK { 276 | $$ = $1; 277 | $$->add(*$2); 278 | } 279 | | PARAMETRO_FK { 280 | $$ = new Nodo("PARAMETRO",""); 281 | $$->add(*$1); 282 | }; 283 | 284 | PARAMETRO_FK: PARAMETRO_MK { $$ = $1; } 285 | | type igual caracter { $$ = new Nodo("type",$3); } 286 | | del igual fast { $$ = new Nodo("delete", "fast"); } 287 | | del igual full { $$ = new Nodo("delete", "full"); } 288 | | name igual identificador { $$ = new Nodo("name", $3); } 289 | | name igual cadena { $$ = new Nodo("name", $3); } 290 | | add igual num { $$ = new Nodo("add", $3); }; 291 | 292 | MOUNT: MOUNT PARAMETRO_M { 293 | $$ = $1; 294 | $$->add(*$2); 295 | } 296 | | PARAMETRO_M { 297 | $$ = new Nodo("PARAMETRO",""); 298 | $$->add(*$1); 299 | }; 300 | 301 | PARAMETRO_M: path igual cadena { $$ = new Nodo("path",$3); } 302 | | path igual ruta { $$ = new Nodo("path", $3); } 303 | | name igual identificador { $$ = new Nodo("name", $3); } 304 | | name igual cadena { $$ = new Nodo("name",$3); }; 305 | 306 | UNMOUNT: unmount id igual identificador { 307 | $$ = new Nodo("UNMOUNT", ""); 308 | Nodo *n = new Nodo("id",$4); 309 | $$->add(*n); 310 | } 311 | 312 | AJUSTE: bf { $$ = new Nodo("ajuste", "bf"); } 313 | | ff { $$ = new Nodo("ajuste", "ff"); } 314 | | wf { $$ = new Nodo("ajuste", "wf"); }; 315 | 316 | 317 | REP: REP PARAMETRO_R{ 318 | $$ = $1; 319 | $$->add(*$2); 320 | } 321 | | PARAMETRO_R{ 322 | $$ = new Nodo("PARAMETRO", ""); 323 | $$->add(*$1); 324 | }; 325 | 326 | PARAMETRO_R: name igual mbr { $$ = new Nodo("name","mbr"); } 327 | | name igual disk { $$ = new Nodo("name","disk"); } 328 | | name igual inode { $$ = new Nodo("name", "inode"); } 329 | | name igual journaling { $$ = new Nodo("name", "journaling"); } 330 | | name igual block { $$ = new Nodo("name", "block"); } 331 | | name igual bm_inode { $$ = new Nodo("name", "bm_inode"); } 332 | | name igual bm_block { $$ = new Nodo("name", "bm_block"); } 333 | | name igual tree { $$ = new Nodo("name", "tree"); } 334 | | name igual sb { $$ = new Nodo("name", "sb"); } 335 | | name igual fileRep { $$ = new Nodo("name", "file"); } 336 | | name igual ls { $$ = new Nodo("name", "ls"); } 337 | | path igual cadena{ $$ = new Nodo("path", $3); } 338 | | path igual ruta { $$ = new Nodo("path",$3); } 339 | | id igual identificador { $$ = new Nodo("id", $3); } 340 | | rutaRep igual ruta { $$ = new Nodo("ruta", $3); } 341 | | rutaRep igual cadena { $$ = new Nodo("ruta", $3); }; 342 | 343 | SCRIPT: exec path igual cadena { 344 | $$ = new Nodo("EXEC",""); 345 | Nodo *path = new Nodo("path", $4); 346 | $$->add(*path); 347 | } 348 | | exec path igual ruta { 349 | $$ = new Nodo("EXEC",""); 350 | Nodo *n = new Nodo("path", $4); 351 | $$->add(*n); 352 | }; 353 | 354 | MKFS: MKFS PARAM_MKFS { 355 | $$ = $1; 356 | $$->add(*$2); 357 | } 358 | | PARAM_MKFS { 359 | $$ = new Nodo("PARAMETRO", ""); 360 | $$->add(*$1); 361 | }; 362 | 363 | PARAM_MKFS: id igual identificador { $$ = new Nodo("id",$3); } 364 | | type igual fast { $$ = new Nodo("type", "fast"); } 365 | | type igual full { $$ = new Nodo("type", "full"); } 366 | | fs igual fs2 { $$ = new Nodo("fs", "2fs"); } 367 | | fs igual fs3 { $$ = new Nodo("fs", "3fs"); }; 368 | 369 | LOGIN: LOGIN PARAM_LOGIN { 370 | $$ = $1; 371 | $$->add(*$2); 372 | } 373 | | PARAM_LOGIN { 374 | $$ = new Nodo("PARAMETRO",""); 375 | $$->add(*$1); 376 | }; 377 | 378 | PARAM_LOGIN: usr igual identificador { $$ = new Nodo("user", $3); } 379 | | usr igual cadena { $$ = new Nodo("user", $3); } 380 | | pwd igual num { $$ = new Nodo("password",$3); } 381 | | pwd igual identificador { $$ = new Nodo("password", $3); } 382 | | pwd igual password { $$ = new Nodo("password", $3); } 383 | | pwd igual cadena { $$ = new Nodo("password", $3); } 384 | | id igual identificador { $$ = new Nodo("id", $3); }; 385 | 386 | MKGRP: mkgrp name igual identificador { 387 | $$ = new Nodo("MKGRP",""); 388 | Nodo *n = new Nodo("name",$4); 389 | $$->add(*n); 390 | } 391 | | mkgrp name igual cadena { 392 | $$ = new Nodo("MKGRP",""); 393 | Nodo *n = new Nodo("name",$4); 394 | $$->add(*n); 395 | }; 396 | 397 | RMGRP: rmgrp name igual identificador { 398 | $$ = new Nodo("RMGRP",""); 399 | Nodo *n = new Nodo("name", $4); 400 | $$->add(*n); 401 | } 402 | | rmgrp name igual cadena { 403 | $$ = new Nodo("RMGRP", ""); 404 | Nodo *n = new Nodo("name",$4); 405 | $$->add(*n); 406 | }; 407 | MKUSR: MKUSR PARAM_MKUSR { 408 | $$ = $1; 409 | $$->add(*$2); 410 | } 411 | | PARAM_MKUSR { 412 | $$ = new Nodo("PARAMETRO", ""); 413 | $$->add(*$1); 414 | }; 415 | 416 | PARAM_MKUSR: usr igual identificador { $$ = new Nodo("user",$3); } 417 | | usr igual cadena { $$ = new Nodo("user",$3); } 418 | | pwd igual num { $$ = new Nodo("password",$3); } 419 | | pwd igual identificador { $$ = new Nodo("password", $3); } 420 | | pwd igual password { $$ = new Nodo("password", $3); } 421 | | pwd igual cadena { $$ = new Nodo("password",$3); } 422 | | grp igual identificador { $$ = new Nodo("group", $3); } 423 | | grp igual cadena { $$ = new Nodo("group",$3); }; 424 | 425 | RMUSR: rmusr usr igual identificador { 426 | $$ = new Nodo("RMUSR",""); 427 | Nodo *n = new Nodo("user",$4); 428 | $$->add(*n); 429 | } 430 | | rmusr usr igual cadena { 431 | $$ = new Nodo("RMUSR", ""); 432 | Nodo *n = new Nodo("user",$4); 433 | $$->add(*n); 434 | }; 435 | 436 | CHMOD: CHMOD PARAM_CHMOD { 437 | $$ = $1; 438 | $$->add(*$2); 439 | } 440 | | PARAM_CHMOD { 441 | $$ = new Nodo("PARAMETRO",""); 442 | $$->add(*$1); 443 | }; 444 | 445 | PARAM_CHMOD: path igual cadena { $$ = new Nodo("path",$3); } 446 | | path igual directorio { $$ = new Nodo("path",$3); } 447 | | ugo igual num { $$ = new Nodo("ugo",$3); } 448 | | r { $$ = new Nodo("r",""); }; 449 | 450 | MKFILE: MKFILE PARAM_MKFILE { 451 | $$ = $1; 452 | $$->add(*$2); 453 | } 454 | | PARAM_MKFILE{ 455 | $$ = new Nodo("PARAMETRO",""); 456 | $$->add(*$1); 457 | }; 458 | 459 | 460 | PARAM_MKFILE: path igual ruta { $$ = new Nodo("path",$3); } 461 | | path igual cadena { $$ = new Nodo("path",$3); } 462 | | size igual num { $$ = new Nodo("size",$3); } 463 | | cont igual ruta { $$ = new Nodo("cont",$3); } 464 | | cont igual cadena { $$ = new Nodo("cont",$3); } 465 | | p { $$ = new Nodo("p",""); }; 466 | 467 | CAT: cat file igual ruta{ 468 | $$ = new Nodo("CAT",""); 469 | Nodo *n = new Nodo("file",$4); 470 | $$->add(*n); 471 | } 472 | | cat file igual cadena{ 473 | $$ = new Nodo("CAT",""); 474 | Nodo *n = new Nodo("file",$4); 475 | $$->add(*n); 476 | }; 477 | 478 | REM: rem path igual ruta{ 479 | $$ = new Nodo("REM",""); 480 | Nodo *n = new Nodo("path",$4); 481 | $$->add(*n); 482 | } 483 | | rem path igual cadena{ 484 | $$ = new Nodo("REM",""); 485 | Nodo *n = new Nodo("path",$4); 486 | $$->add(*n); 487 | } 488 | | rem path igual directorio{ 489 | $$ = new Nodo("REM",""); 490 | Nodo *n = new Nodo("path",$4); 491 | $$->add(*n); 492 | }; 493 | 494 | EDIT: EDIT PARAM_EDIT { 495 | $$ = $1; 496 | $$->add(*$2); 497 | } 498 | | PARAM_EDIT { 499 | $$ = new Nodo("PARAMETRO",""); 500 | $$->add(*$1); 501 | }; 502 | 503 | PARAM_EDIT: path igual ruta { $$ = new Nodo("path",$3); } 504 | | path igual cadena { $$ = new Nodo("path",$3); } 505 | | cont igual cadena { $$ = new Nodo("cont", $3); }; 506 | 507 | REN: REN PARAM_REN { 508 | $$ = $1; 509 | $$->add(*$2); 510 | } 511 | | PARAM_REN { 512 | $$ = new Nodo("PARAMETRO",""); 513 | $$->add(*$1); 514 | }; 515 | 516 | PARAM_REN: path igual ruta { $$ = new Nodo("path", $3); } 517 | | path igual cadena { $$ = new Nodo("path",$3); } 518 | | name igual identificador extension { 519 | $$ = new Nodo("name",""); 520 | Nodo *n = new Nodo($3,$4); 521 | $$->add(*n); 522 | } 523 | | name igual cadena { $$ = new Nodo("name",$3); }; 524 | 525 | MKDIR: MKDIR PARAM_MKDIR { 526 | $$ = $1; 527 | $$->add(*$2); 528 | } 529 | | PARAM_MKDIR{ 530 | $$ = new Nodo("PARAMETRO",""); 531 | $$->add(*$1); 532 | }; 533 | 534 | PARAM_MKDIR: path igual directorio { $$ = new Nodo("path",$3); } 535 | | path igual cadena { $$ = new Nodo("path",$3); } 536 | | id igual identificador { $$ = new Nodo("id",$3);} 537 | | p { $$ = new Nodo("p",""); }; 538 | 539 | CP: CP PARAM_CP{ 540 | $$ = $1; 541 | $$->add(*$2); 542 | } 543 | | PARAM_CP{ 544 | $$ = new Nodo("PARAMETRO",""); 545 | $$->add(*$1); 546 | }; 547 | 548 | PARAM_CP: path igual ruta { $$ = new Nodo("path",$3); } 549 | | path igual cadena { $$ = new Nodo("path",$3); } 550 | | path igual directorio { $$ = new Nodo("path",$3); } 551 | | dest igual ruta { $$ = new Nodo("dest",$3); } 552 | | dest igual cadena { $$ = new Nodo("dest",$3); } 553 | | dest igual directorio { $$ = new Nodo("dest",$3); }; 554 | 555 | MV: MV PARAM_CP { 556 | $$ = $1; 557 | $$->add(*$2); 558 | } 559 | | PARAM_CP{ 560 | $$ = new Nodo("PARAMETRO",""); 561 | $$->add(*$1); 562 | }; 563 | 564 | FIND: FIND PARAM_FIND { 565 | $$ =$1; 566 | $$->add(*$2); 567 | } 568 | | PARAM_FIND { 569 | $$ = new Nodo("PARAMETRO",""); 570 | $$->add(*$1); 571 | }; 572 | 573 | PARAM_FIND: path igual ruta { $$ = new Nodo("path",$3); } 574 | | path igual cadena { $$ = new Nodo("path",$3); } 575 | | name igual identificador extension { 576 | $$ = new Nodo("name",""); 577 | Nodo *n = new Nodo($3,$4); 578 | $$->add(*n); 579 | } 580 | | name igual caracter extension { 581 | $$ = new Nodo("name",""); 582 | Nodo *n = new Nodo($3,$4); 583 | $$->add(*n); 584 | } 585 | | name igual cadena { $$ = new Nodo("name",$3); }; 586 | 587 | CHOWN: CHOWN PARAM_CHOWN { 588 | $$ = $1; 589 | $$->add(*$2); 590 | } 591 | | PARAM_CHOWN { 592 | $$ = new Nodo("PARAMETRO",""); 593 | $$->add(*$1); 594 | }; 595 | 596 | PARAM_CHOWN: path igual ruta { $$ = new Nodo("path",$3); } 597 | | path igual cadena { $$ = new Nodo("path", $3); } 598 | | path igual directorio { $$ = new Nodo("path",$3); } 599 | | usr igual identificador { $$ = new Nodo("user",$3); } 600 | | usr igual cadena { $$ = new Nodo("user",$3); } 601 | | r { $$ = new Nodo("r",""); }; 602 | 603 | CHGRP: CHGRP PARAM_CHGRP { 604 | $$ = $1; 605 | $$->add(*$2); 606 | } 607 | | PARAM_CHGRP{ 608 | $$ = new Nodo("PARAMETRO",""); 609 | $$->add(*$1); 610 | }; 611 | 612 | PARAM_CHGRP: usr igual identificador { $$ = new Nodo("user",$3); } 613 | | usr igual cadena { $$ = new Nodo("user",$3); } 614 | | grp igual identificador { $$ = new Nodo("group",$3);} 615 | | grp igual cadena { $$ = new Nodo("group", $3); }; 616 | 617 | RECOVERY: recovery id igual identificador { 618 | $$ = new Nodo("RECOVERY",""); 619 | Nodo *n = new Nodo("id",$4); 620 | $$->add(*n); 621 | }; 622 | 623 | LOSS: loss id igual identificador{ 624 | $$ = new Nodo("LOSS",""); 625 | Nodo *n = new Nodo("id",$4); 626 | $$->add(*n); 627 | }; 628 | -------------------------------------------------------------------------------- /FileSystem_2/disco.h: -------------------------------------------------------------------------------- 1 | #ifndef DISCO_H 2 | #define DISCO_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "structs.h" 8 | 9 | using namespace std; 10 | 11 | class Disco 12 | { 13 | public: 14 | Disco(); 15 | void crearParticionPrimaria(QString, QString, int, char, char, QString); 16 | void crearParticionExtendida(QString, QString, int, char, char, QString); 17 | void crearParticionLogica(QString, QString, int, char, char, QString) ; 18 | void eliminarParticion(QString, QString, QString, QString); 19 | void agregarQuitarParticion(QString, QString ,int ,char,QString); 20 | bool existeParticion(QString, QString); 21 | int buscarParticion_P_E(QString, QString); 22 | int buscarParticion_L(QString, QString); 23 | }; 24 | 25 | #endif // DISCO_H 26 | -------------------------------------------------------------------------------- /FileSystem_2/graficador.cpp: -------------------------------------------------------------------------------- 1 | #include "graficador.h" 2 | 3 | #include 4 | #include 5 | 6 | Graficador::Graficador(Nodo *r) 7 | { 8 | raiz = r; 9 | dot = ""; 10 | cont = 0; 11 | } 12 | 13 | QString Graficador::generarCodigoGraphviz(){ 14 | dot = "digraph G{\n"; 15 | dot += "node [shape=\"box\"]\n"; 16 | dot += "NodoAST0[label=\"" + limpiarString(""+raiz->tipo+" "+raiz->valor)+ "\"];\n"; 17 | cont = 1; 18 | recorrerAST("NodoAST0",raiz); 19 | dot += "}"; 20 | return dot; 21 | } 22 | 23 | void Graficador::recorrerAST(QString padre, Nodo *hijo){ 24 | for(int i = 0; i < hijo->hijos.count(); i++) 25 | { 26 | Nodo nodoAST = hijo->hijos[i]; 27 | QString nombreHijo = "NodoAST" +QString::number(cont); 28 | dot += nombreHijo + "[label= \"" +limpiarString("" +nodoAST.tipo + " " + nodoAST.valor + "")+"\"];\n"; 29 | dot += padre + "->" + nombreHijo + ";\n"; 30 | cont++; 31 | recorrerAST(nombreHijo,&nodoAST); 32 | } 33 | } 34 | 35 | QString Graficador::limpiarString(QString str){ 36 | str = str.replace("\\", "\\\\"); 37 | str = str.replace("\"", "\\\""); 38 | return str; 39 | } 40 | 41 | void Graficador::generarImagen(){ 42 | FILE *archivo; 43 | generarCodigoGraphviz(); 44 | archivo = fopen("temp.dot","w"); 45 | QByteArray aux = dot.toLocal8Bit(); 46 | char *aux2 = aux.data(); 47 | fprintf(archivo, "%s",aux2); 48 | fclose(archivo); 49 | system("dot -Tjpg temp.dot -o AST.jpg"); 50 | //system("eog AST.jpg"); 51 | } 52 | 53 | -------------------------------------------------------------------------------- /FileSystem_2/graficador.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAFICADOR_H 2 | #define GRAFICADOR_H 3 | 4 | #include "nodo.h" 5 | 6 | class Graficador 7 | { 8 | public: 9 | //Constructor 10 | Graficador(Nodo *root); 11 | //Atributos 12 | Nodo *raiz; 13 | QString dot; 14 | int cont; 15 | //Metodos, funciones 16 | QString generarCodigoGraphviz(); 17 | QString limpiarString(QString str); 18 | void recorrerAST(QString padre, Nodo *hijo); 19 | void generarImagen(); 20 | }; 21 | 22 | #endif // GRAFICADOR_H 23 | -------------------------------------------------------------------------------- /FileSystem_2/listamount.cpp: -------------------------------------------------------------------------------- 1 | #include "listamount.h" 2 | 3 | ListaMount::ListaMount(){ 4 | primero = nullptr; 5 | } 6 | 7 | /* Metodo para insertar al final de la lista 8 | * @param NodoMount nuevo: El nodo a insertar 9 | */ 10 | void ListaMount::insertarNodo(NodoMount *nuevo){ 11 | NodoMount *aux = primero; 12 | if(primero == nullptr){ 13 | primero = nuevo; 14 | }else{ 15 | while(aux->siguiente!=nullptr){ 16 | aux = aux->siguiente; 17 | } 18 | aux->siguiente = nuevo; 19 | } 20 | 21 | } 22 | 23 | /* Funcion para eliminar un nodo de la lista 24 | * @param QString ID: identificador 25 | * @return 1 = se elimino exitosamente | 0 = No se encontro el nodo 26 | */ 27 | int ListaMount::eliminarNodo(QString ID){ 28 | NodoMount *aux = primero; 29 | QString tempID = "vd"; 30 | tempID += aux->letra + QString::number(aux->num); 31 | if(ID == tempID){ 32 | primero = aux->siguiente; 33 | free(aux); 34 | return 1; 35 | }else{ 36 | NodoMount *aux2 = nullptr; 37 | while(aux!=nullptr){ 38 | tempID = "vd"; 39 | tempID += aux->letra + QString::number(aux->num); 40 | if(ID == tempID){ 41 | aux2->siguiente = aux->siguiente; 42 | return 1; 43 | } 44 | aux2 = aux; 45 | aux = aux->siguiente; 46 | } 47 | } 48 | return 0; 49 | } 50 | 51 | /* Funcion para verificar que letra asignarle al id de un nodo 52 | * @param QString direccion: Ruta del disco 53 | * @param QString nombre: nombre de la particion 54 | * @return -1 = ya esta montada | # = letra 55 | */ 56 | int ListaMount::buscarLetra(QString direccion, QString nombre){ 57 | NodoMount *aux = primero; 58 | int retorno = 'a'; 59 | while(aux!=NULL){ 60 | if((direccion == aux->direccion) && (nombre == aux->nombre)){ 61 | return -1; 62 | }else{ 63 | if(direccion == aux->direccion){ 64 | return aux->letra; 65 | }else if(retorno <= aux->letra){ 66 | retorno++; 67 | } 68 | } 69 | aux = aux->siguiente; 70 | } 71 | return retorno; 72 | } 73 | 74 | /* Funcion para verificar que numero asignarle al id de un nodo 75 | * @param QString direccion: Ruta del disco 76 | * @param QString nombre: nombre de la particion 77 | * @return retorno = numero a asignar 78 | */ 79 | int ListaMount::buscarNumero(QString direccion, QString nombre){ 80 | int retorno = 1; 81 | NodoMount *aux = primero; 82 | while(aux!=nullptr){ 83 | if((direccion == aux->direccion) && (retorno == aux->num)){ 84 | retorno++; 85 | } 86 | aux = aux->siguiente; 87 | } 88 | return retorno; 89 | } 90 | 91 | /* Funcion que retorna un booleano para verificar si existe un nodo 92 | * @param QString direccion: direccion del disco 93 | * @param QString nombre: nombre de la particion 94 | * @return true = si lo encuentra | false = si no lo encuentra 95 | */ 96 | bool ListaMount::buscarNodo(QString direccion, QString nombre){ 97 | NodoMount *aux = primero; 98 | while(aux!=nullptr){ 99 | if((aux->direccion == direccion) && (aux->nombre == nombre)){ 100 | return true; 101 | } 102 | aux = aux->siguiente; 103 | } 104 | return false; 105 | } 106 | 107 | /* Funcion que retorna un nodo de la lista para verificar si una particion esta montada 108 | * @param QString id: identificador de la particion 109 | * @return aux = si lo encontro | nullptr = no lo encuentra 110 | */ 111 | NodoMount* ListaMount::getNodo(QString id){ 112 | NodoMount *aux = primero; 113 | while(aux!=nullptr){ 114 | QString tempID = "vd"; 115 | tempID += aux->letra + QString::number(aux->num); 116 | if(id == tempID){ 117 | return aux; 118 | } 119 | aux = aux->siguiente; 120 | } 121 | return nullptr; 122 | } 123 | 124 | /* Metodo para desplegar las particiones montadas 125 | */ 126 | void ListaMount::mostrarLista(){ 127 | cout << "---------------------------------" << endl; 128 | cout << "| Particiones montadas |" << endl; 129 | cout << "---------------------------------" << endl; 130 | cout << "| Nombre | ID |" << endl; 131 | cout << "---------------------------------" << endl; 132 | NodoMount *aux = primero; 133 | while(aux!=nullptr){ 134 | cout << "| "<< aux->nombre.toStdString() << " " << "vd"<letra<num << endl; 135 | cout << "---------------------------------" << endl; 136 | aux = aux->siguiente; 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /FileSystem_2/listamount.h: -------------------------------------------------------------------------------- 1 | #ifndef LISTAMOUNT_H 2 | #define LISTAMOUNT_H 3 | 4 | #include 5 | 6 | #include "nodomount.h" 7 | 8 | using namespace std; 9 | 10 | class ListaMount 11 | { 12 | public: 13 | NodoMount *primero; 14 | ListaMount(); 15 | int buscarLetra(QString direccion, QString nombre); 16 | int buscarNumero(QString direccion, QString nombre); 17 | void mostrarLista(); 18 | void insertarNodo(NodoMount*); 19 | int eliminarNodo(QString); 20 | bool buscarNodo(QString, QString); 21 | QString getDireccion(QString); 22 | NodoMount* getNodo(QString); 23 | }; 24 | 25 | #endif // LISTAMOUNT_H 26 | -------------------------------------------------------------------------------- /FileSystem_2/mainheader.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINHEADER_H 2 | #define MAINHEADER_H 3 | 4 | #include 5 | #include "nodo.h" 6 | #include "structs.h" 7 | #include "listamount.h" 8 | #include "disco.h" 9 | 10 | /*Variables globales*/ 11 | ListaMount *lista = new ListaMount(); 12 | Disco disco; 13 | Sesion currentSession; 14 | bool flag_global = true; 15 | bool flag_login = false; 16 | 17 | /* Declaracion de metodos y funciones */ 18 | void reconocerComando(Nodo*); 19 | void recorrerMKDISK(Nodo*); 20 | void recorrerRMDISK(Nodo*); 21 | void recorrerFDISK(Nodo*); 22 | void recorrerMOUNT(Nodo*); 23 | void recorrerUNMOUNT(Nodo*); 24 | void recorrerREP(Nodo*); 25 | void recorrerEXEC(Nodo*); 26 | void recorrerMKFS(Nodo*); 27 | void recorrerLOGIN(Nodo*); 28 | void recorrerMKGRP(Nodo*); 29 | void recorrerRMGRP(Nodo*); 30 | void recorrerMKUSR(Nodo*); 31 | void recorrerRMUSR(Nodo*); 32 | void recorrerCHMOD(Nodo*); 33 | void recorrerMKFILE(Nodo*); 34 | void recorrerCAT(Nodo*); 35 | void recorrerREM(Nodo*); 36 | void recorrerEDIT(Nodo*); 37 | void recorrerREN(Nodo*); 38 | void recorrerMKDIR(Nodo*); 39 | void recorrerCP(Nodo*); 40 | void recorrerMV(Nodo*); 41 | void recorrerFIND(Nodo*); 42 | void recorrerCHOWN(Nodo*); 43 | void recorrerCHGRP(Nodo*); 44 | void recorrerRECOVERY(Nodo*); 45 | void recorrerLOSS(Nodo*); 46 | void leerComando(char*); 47 | void crearDisco(QString); 48 | QString getDirectorio(QString); 49 | QString getExtension(QString); 50 | QString getFileName(QString); 51 | void formatearEXT2(int,int,QString); 52 | void formatearEXT3(int,int,QString); 53 | int log_in(QString, QString, QString, QString); 54 | int verificarDatos(QString,QString,QString); 55 | void log_out(); 56 | int buscarGrupo(QString); 57 | int getID_grp(); 58 | void agregarUsersTXT(QString); 59 | char getLogicFit(QString,QString); 60 | int buscarBit(FILE*,char,char); 61 | void eliminarGrupo(QString); 62 | bool buscarUsuario(QString); 63 | int getID_usr(); 64 | void eliminarUsuario(QString); 65 | int crearCarpeta(QString, bool); 66 | int nuevaCarpeta(FILE*,char,bool,char*,int); 67 | int crearArchivo(QString,bool,int,QString); 68 | int nuevoArchivo(FILE*,char,bool,char*,int,QString,int,char*); 69 | int buscarCarpetaArchivo(FILE*,char*); 70 | void bloqueCarpetaArchivo(FILE*,char*,int&,int&,int&,int&); 71 | int byteInodoBloque(FILE*,int,char); 72 | bool permisosDeEscritura(int,bool,bool); 73 | bool permisosDeLectura(int,bool,bool); 74 | bool permisosEscrituraRecursivo(FILE*,int); 75 | bool permisosLecturaRecursivo(FILE*,int); 76 | void eliminarCarpetaArchivo(FILE*,int); 77 | void moverCarpetaArchivo(FILE*,int,char*,int); 78 | void cambiarPermisosRecursivo(FILE*,int,int); 79 | void guardarJournal(char*,int,int,char*,char*); 80 | void systemLoss(QString); 81 | void systemRecovery(QString); 82 | Usuario getUsuario(QString,int,int); 83 | bool isNumber(string); 84 | InodoTable crearInodo(int,char,int); 85 | BloqueCarpeta crearBloqueCarpeta(); 86 | int buscarContentLibre(FILE*,int,InodoTable&,BloqueCarpeta&,BloqueApuntadores&,int&,int&,int&); 87 | 88 | #endif // MAINHEADER_H 89 | -------------------------------------------------------------------------------- /FileSystem_2/nodo.cpp: -------------------------------------------------------------------------------- 1 | #include "nodo.h" 2 | 3 | Nodo::Nodo(QString t, QString v){ 4 | tipo =t; 5 | valor = v; 6 | tipo_ = getTipo(); 7 | hijos = QList(); 8 | } 9 | 10 | int Nodo::getTipo() 11 | { 12 | if(this->tipo == "MKDISK") return 1; 13 | if(this->tipo == "RMDISK") return 2; 14 | if(this->tipo == "FDISK") return 3; 15 | if(this->tipo == "MOUNT") return 4; 16 | if(this->tipo == "UNMOUNT") return 5; 17 | if(this->tipo == "REP") return 6; 18 | if(this->tipo == "PARAMETRO") return 7; 19 | if(this->tipo == "EXEC") return 8; 20 | if(this->tipo == "size") return 9; 21 | if(this->tipo == "fit") return 10; 22 | if(this->tipo == "unit") return 11; 23 | if(this->tipo == "path") return 12; 24 | if(this->tipo == "type") return 13; 25 | if(this->tipo == "delete") return 14; 26 | if(this->tipo == "name") return 15; 27 | if(this->tipo == "add") return 16; 28 | if(this->tipo == "id") return 17; 29 | 30 | if(this->tipo == "MKFS") return 18; 31 | if(this->tipo == "LOGIN") return 19; 32 | if(this->tipo == "LOGOUT") return 20; 33 | if(this->tipo == "MKGRP") return 21; 34 | if(this->tipo == "RMGRP") return 22; 35 | if(this->tipo == "MKUSR") return 23; 36 | if(this->tipo == "RMUSR") return 24; 37 | if(this->tipo == "CHMOD") return 25; 38 | if(this->tipo == "MKFILE") return 26; 39 | if(this->tipo == "CAT") return 27; 40 | if(this->tipo == "REM") return 28; 41 | if(this->tipo == "EDIT") return 29; 42 | if(this->tipo == "REN") return 30; 43 | if(this->tipo == "MKDIR") return 31; 44 | if(this->tipo == "CP") return 32; 45 | if(this->tipo == "MV") return 33; 46 | if(this->tipo == "FIND") return 34; 47 | if(this->tipo == "CHOWN") return 35; 48 | if(this->tipo == "CHGRP") return 36; 49 | if(this->tipo == "PAUSE") return 37; 50 | if(this->tipo == "RECOVERY") return 38; 51 | if(this->tipo == "LOSS") return 39; 52 | if(this->tipo == "fs") return 40; 53 | if(this->tipo == "user") return 41; 54 | if(this->tipo == "password") return 42; 55 | if(this->tipo == "group") return 43; 56 | if(this->tipo == "ugo") return 44; 57 | if(this->tipo == "cont") return 45; 58 | if(this->tipo == "file") return 46; 59 | if(this->tipo == "p") return 47; 60 | if(this->tipo == "dest") return 48; 61 | if(this->tipo == "r") return 49; 62 | if(this->tipo == "inode") return 50; 63 | if(this->tipo == "journaling") return 51; 64 | if(this->tipo == "block") return 52; 65 | if(this->tipo == "bm_inode") return 53; 66 | if(this->tipo == "bm_block") return 54; 67 | if(this->tipo == "tree") return 55; 68 | if(this->tipo == "sb") return 56; 69 | if(this->tipo == "ruta") return 57; 70 | return 0; 71 | } 72 | 73 | void Nodo::add(Nodo n){ 74 | hijos.append(n); 75 | } 76 | -------------------------------------------------------------------------------- /FileSystem_2/nodo.h: -------------------------------------------------------------------------------- 1 | #ifndef NODO_H 2 | #define NODO_H 3 | 4 | #include 5 | #include 6 | 7 | class Nodo 8 | { 9 | public: 10 | Nodo(QString tipo, QString valor); 11 | QString tipo; 12 | QString valor; 13 | int linea; 14 | int columna; 15 | int tipo_; // Este nos servirá para la ejecución, ya que aquí no hay swicht(QString); vamos a hacer un Swicht(int); 16 | QString cadenaDot; 17 | QList hijos; 18 | int getTipo(); 19 | void add(Nodo n); 20 | }; 21 | 22 | #endif // NODO_H 23 | -------------------------------------------------------------------------------- /FileSystem_2/nodomount.cpp: -------------------------------------------------------------------------------- 1 | #include "nodomount.h" 2 | 3 | NodoMount::NodoMount(QString direccion, QString nombre, char letra, int num) 4 | { 5 | this->direccion = direccion; 6 | this->nombre = nombre; 7 | this->letra = letra; 8 | this->num = num; 9 | this->siguiente = nullptr; 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /FileSystem_2/nodomount.h: -------------------------------------------------------------------------------- 1 | #ifndef NODOMOUNT_H 2 | #define NODOMOUNT_H 3 | 4 | #include 5 | 6 | class NodoMount 7 | { 8 | public: 9 | NodoMount(QString, QString, char, int); 10 | QString direccion; 11 | QString nombre; 12 | char letra; 13 | int num; 14 | NodoMount *siguiente; 15 | }; 16 | 17 | #endif // NODOMOUNT_H 18 | -------------------------------------------------------------------------------- /FileSystem_2/parser.h: -------------------------------------------------------------------------------- 1 | /* A Bison parser, made by GNU Bison 3.0.4. */ 2 | 3 | /* Bison interface for Yacc-like parsers in C 4 | 5 | Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . */ 19 | 20 | /* As a special exception, you may create a larger work that contains 21 | part or all of the Bison parser skeleton and distribute that work 22 | under terms of your choice, so long as that work isn't itself a 23 | parser generator using the skeleton or a modified version thereof 24 | as a parser skeleton. Alternatively, if you modify or redistribute 25 | the parser skeleton itself, you may (at your option) remove this 26 | special exception, which will cause the skeleton and the resulting 27 | Bison output files to be licensed under the GNU General Public 28 | License without this special exception. 29 | 30 | This special exception was added by the Free Software Foundation in 31 | version 2.2 of Bison. */ 32 | 33 | #ifndef YY_YY_PARSER_H_INCLUDED 34 | # define YY_YY_PARSER_H_INCLUDED 35 | /* Debug traces. */ 36 | #ifndef YYDEBUG 37 | # define YYDEBUG 0 38 | #endif 39 | #if YYDEBUG 40 | extern int yydebug; 41 | #endif 42 | 43 | /* Token type. */ 44 | #ifndef YYTOKENTYPE 45 | # define YYTOKENTYPE 46 | enum yytokentype 47 | { 48 | mkdisk = 258, 49 | rmdisk = 259, 50 | fdisk = 260, 51 | mount = 261, 52 | unmount = 262, 53 | rep = 263, 54 | exec = 264, 55 | size = 265, 56 | unit = 266, 57 | path = 267, 58 | fit = 268, 59 | name = 269, 60 | type = 270, 61 | del = 271, 62 | add = 272, 63 | id = 273, 64 | bf = 274, 65 | ff = 275, 66 | wf = 276, 67 | fast = 277, 68 | full = 278, 69 | mbr = 279, 70 | disk = 280, 71 | igual = 281, 72 | extension = 282, 73 | num = 283, 74 | caracter = 284, 75 | cadena = 285, 76 | identificador = 286, 77 | ruta = 287, 78 | mkfs = 288, 79 | login = 289, 80 | logout = 290, 81 | mkgrp = 291, 82 | rmgrp = 292, 83 | mkusr = 293, 84 | rmusr = 294, 85 | Rchmod = 295, 86 | mkfile = 296, 87 | cat = 297, 88 | rem = 298, 89 | edit = 299, 90 | ren = 300, 91 | Rmkdir = 301, 92 | cp = 302, 93 | mv = 303, 94 | find = 304, 95 | Rchown = 305, 96 | chgrp = 306, 97 | pausa = 307, 98 | recovery = 308, 99 | loss = 309, 100 | fs = 310, 101 | fs2 = 311, 102 | fs3 = 312, 103 | usr = 313, 104 | pwd = 314, 105 | grp = 315, 106 | ugo = 316, 107 | r = 317, 108 | p = 318, 109 | cont = 319, 110 | file = 320, 111 | dest = 321, 112 | rutaRep = 322, 113 | inode = 323, 114 | journaling = 324, 115 | block = 325, 116 | bm_inode = 326, 117 | bm_block = 327, 118 | tree = 328, 119 | sb = 329, 120 | fileRep = 330, 121 | ls = 331, 122 | password = 332, 123 | directorio = 333 124 | }; 125 | #endif 126 | 127 | /* Value type. */ 128 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 129 | 130 | union YYSTYPE 131 | { 132 | #line 21 "Sintactico.y" /* yacc.c:1909 */ 133 | 134 | char text[400]; 135 | class Nodo *nodito; 136 | 137 | 138 | #line 139 "parser.h" /* yacc.c:1909 */ 139 | }; 140 | 141 | typedef union YYSTYPE YYSTYPE; 142 | # define YYSTYPE_IS_TRIVIAL 1 143 | # define YYSTYPE_IS_DECLARED 1 144 | #endif 145 | 146 | 147 | extern YYSTYPE yylval; 148 | 149 | int yyparse (void); 150 | 151 | #endif /* !YY_YY_PARSER_H_INCLUDED */ 152 | -------------------------------------------------------------------------------- /FileSystem_2/reporte.cpp: -------------------------------------------------------------------------------- 1 | #include "reporte.h" 2 | 3 | Reporte::Reporte() 4 | { 5 | 6 | } 7 | 8 | /* Metodo para graficar un disco con su estructura de las particiones 9 | * @param QString direccion: Es la direccion donde se encuentra la particion 10 | * @param QString destino: Es la ruta donde se creara el reporte 11 | * @param QString extension: La extension que tendra nuestro reporte .jpg|.png|etc 12 | */ 13 | void Reporte::graficarDisco(QString direccion, QString destino, QString extension){ 14 | FILE *fp; 15 | FILE *graphDot; 16 | if((fp = fopen(direccion.toStdString().c_str(),"r"))){ 17 | graphDot = fopen("grafica.dot","w"); 18 | fprintf(graphDot,"digraph G{\n\n"); 19 | fprintf(graphDot, " tbl [\n shape=box\n label=<\n"); 20 | fprintf(graphDot, " \n"); 21 | fprintf(graphDot, " \n"); 22 | fprintf(graphDot, " \n"); 23 | MBR masterboot; 24 | fseek(fp,0,SEEK_SET); 25 | fread(&masterboot,sizeof(MBR),1,fp); 26 | int total = masterboot.mbr_size; 27 | double espacioUsado = 0; 28 | for(int i = 0; i < 4; i++){ 29 | int parcial = masterboot.mbr_partition[i].part_size; 30 | if(masterboot.mbr_partition[i].part_start != -1){//Particion vacia 31 | double porcentaje_real = (parcial*100)/total; 32 | double porcentaje_aux = (porcentaje_real*500)/100; 33 | espacioUsado += porcentaje_real; 34 | if(masterboot.mbr_partition[i].part_status != '1'){ 35 | if(masterboot.mbr_partition[i].part_type == 'P'){ 36 | fprintf(graphDot, " \n",porcentaje_aux,porcentaje_real,'%'); 37 | //Verificar que no haya espacio fragmentado 38 | if(i!=3){ 39 | int p1 = masterboot.mbr_partition[i].part_start + masterboot.mbr_partition[i].part_size; 40 | int p2 = masterboot.mbr_partition[i+1].part_start; 41 | if(masterboot.mbr_partition[i+1].part_start != -1){ 42 | if((p2-p1)!=0){//Hay fragmentacion 43 | int fragmentacion = p2-p1; 44 | double porcentaje_real = (fragmentacion*100)/total; 45 | double porcentaje_aux = (porcentaje_real*500)/100; 46 | fprintf(graphDot," \n",porcentaje_aux,porcentaje_real,'%'); 47 | } 48 | } 49 | 50 | }else{ 51 | int p1 = masterboot.mbr_partition[i].part_start + masterboot.mbr_partition[i].part_size; 52 | int mbr_size = total + (int)sizeof(MBR); 53 | if((mbr_size-p1)!=0){//Libre 54 | double libre = (mbr_size - p1) + sizeof(MBR); 55 | double porcentaje_real = (libre*100)/total; 56 | double porcentaje_aux = (porcentaje_real*500)/100; 57 | fprintf(graphDot, " \n",porcentaje_aux, porcentaje_real, '%'); 58 | } 59 | } 60 | }else{//Extendida 61 | EBR extendedBoot; 62 | fprintf(graphDot," \n"); 93 | //Verificar que no haya espacio fragmentado 94 | if(i!=3){ 95 | int p1 = masterboot.mbr_partition[i].part_start + masterboot.mbr_partition[i].part_size; 96 | int p2 = masterboot.mbr_partition[i+1].part_start; 97 | if(masterboot.mbr_partition[i+1].part_start != -1){ 98 | if((p2-p1)!=0){//Hay fragmentacion 99 | int fragmentacion = p2-p1; 100 | double porcentaje_real = (fragmentacion*100)/total; 101 | double porcentaje_aux = (porcentaje_real*500)/100; 102 | fprintf(graphDot," \n",porcentaje_aux,porcentaje_real,'%'); 103 | } 104 | } 105 | }else{ 106 | int p1 = masterboot.mbr_partition[i].part_start + masterboot.mbr_partition[i].part_size; 107 | int mbr_size = total + (int)sizeof(MBR); 108 | if((mbr_size-p1)!=0){//Libre 109 | double libre = (mbr_size - p1) + sizeof(MBR); 110 | double porcentaje_real = (libre*100)/total; 111 | double porcentaje_aux = (porcentaje_real*500)/100; 112 | fprintf(graphDot, " \n",porcentaje_aux, porcentaje_real, '%'); 113 | } 114 | } 115 | } 116 | }else{//Espacio no asignado 117 | fprintf(graphDot," \n",porcentaje_aux,porcentaje_real,'%'); 118 | } 119 | } 120 | } 121 | 122 | //fprintf(graphDot," ",(100-espacioUsado),'%'); 123 | 124 | 125 | fprintf(graphDot," \n
MBR PRIMARIA
Ocupado: %.1f%c
LIBRE
Ocupado: %.1f%c
LIBRE
Ocupado: %.1f%c
\n \n",porcentaje_real,porcentaje_real); 63 | fprintf(graphDot," \n \n"); 64 | fseek(fp, masterboot.mbr_partition[i].part_start,SEEK_SET); 65 | fread(&extendedBoot,sizeof(EBR),1,fp); 66 | if(extendedBoot.part_size != 0){//Si hay mas de alguna logica 67 | fseek(fp, masterboot.mbr_partition[i].part_start,SEEK_SET); 68 | while(fread(&extendedBoot,sizeof (EBR),1,fp)!=0 && (ftell(fp) < (masterboot.mbr_partition[i].part_start + masterboot.mbr_partition[i].part_size))){ 69 | parcial = extendedBoot.part_size; 70 | porcentaje_real = (parcial*100)/total; 71 | if(porcentaje_real!=0){ 72 | if(extendedBoot.part_status != '1'){ 73 | fprintf(graphDot, " \n"); 74 | fprintf(graphDot, " \n",porcentaje_real,'%'); 75 | }else{//Espacio no asignado 76 | fprintf(graphDot, " \n",porcentaje_real,'%'); 77 | } 78 | if(extendedBoot.part_next==-1){ 79 | parcial = (masterboot.mbr_partition[i].part_start + masterboot.mbr_partition[i].part_size) - (extendedBoot.part_start + extendedBoot.part_size); 80 | porcentaje_real = (parcial*100)/total; 81 | if(porcentaje_real!=0){ 82 | fprintf(graphDot, " \n",porcentaje_real,'%'); 83 | } 84 | break; 85 | }else 86 | fseek(fp,extendedBoot.part_next,SEEK_SET); 87 | } 88 | } 89 | }else{ 90 | fprintf(graphDot," ",porcentaje_real,'%'); 91 | } 92 | fprintf(graphDot," \n
EXTENDIDA
EBRLOGICA
Ocupado: %.1f%c
LIBRE 1
Ocupado: %.1f%c
LIBRE 2
Ocupado: %.1f%c
Ocupado %.1f%c
\n
LIBRE
Ocupado: %.1f%c
LIBRE
Ocupado: %.1f%c
LIBRE
Ocupado: %.1f%c
ESPACIO LIBRE
Ocupado: %.1f%c\n
\n>];\n\n}"); 126 | fclose(graphDot); 127 | fclose(fp); 128 | string comando = "dot -T"+extension.toStdString()+" grafica.dot -o "+destino.toStdString(); 129 | system(comando.c_str()); 130 | cout << "Reporte generado con exito " << endl; 131 | }else{ 132 | cout << "ERROR al crear reporte, disco no encontrado" << endl; 133 | } 134 | } 135 | 136 | /* Metodo para generar un reporte del MBR de un disco 137 | * @param QString direccion: Es la direccion donde se encuentra la particion 138 | * @param QString destino: Es la ruta donde se creara el reporte 139 | * @param QString extension: La extension que tendra nuestro reporte .jpg|.png|etc 140 | */ 141 | void Reporte::graficarMBR(QString direccion, QString destino, QString extension){ 142 | string auxDir = direccion.toStdString(); 143 | FILE *fp; 144 | FILE *graphDot; 145 | if((fp = fopen(auxDir.c_str(),"r"))){ 146 | graphDot = fopen("grafica.dot", "w"); 147 | fprintf(graphDot,"digraph G{ \n"); 148 | fprintf(graphDot,"subgraph cluster{\n label=\"MBR\""); 149 | fprintf(graphDot,"\ntbl[shape=box,label=<\n"); 150 | fprintf(graphDot,"\n"); 151 | fprintf(graphDot, "\n"); 152 | MBR masterBoot; 153 | fseek(fp,0,SEEK_SET); 154 | fread(&masterBoot,sizeof(MBR),1,fp); 155 | int tamano = masterBoot.mbr_size; 156 | fprintf(graphDot,"\n",tamano); 157 | struct tm *tm; 158 | char fecha[100]; 159 | tm = localtime(&masterBoot.mbr_date_created); 160 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 161 | fprintf(graphDot,"\n",fecha); 162 | fprintf(graphDot,"\n",masterBoot.mbr_disk_signature); 163 | fprintf(graphDot,"\n",masterBoot.mbr_disk_fit); 164 | 165 | int index_Extendida = -1; 166 | for (int i = 0; i < 4; i++){ 167 | if(masterBoot.mbr_partition[i].part_start!=-1 && masterBoot.mbr_partition[i].part_status!='1'){ 168 | if(masterBoot.mbr_partition[i].part_type == 'E'){ 169 | index_Extendida = i; 170 | } 171 | char status[3]; 172 | if(masterBoot.mbr_partition[i].part_status == '0') 173 | strcpy(status,"0"); 174 | else if(masterBoot.mbr_partition[i].part_status == '2') 175 | strcpy(status,"2"); 176 | fprintf(graphDot,"\n",(i+1),status); 177 | fprintf(graphDot,"\n",(i+1),masterBoot.mbr_partition[i].part_type); 178 | fprintf(graphDot,"\n",(i+1),masterBoot.mbr_partition[i].part_fit); 179 | fprintf(graphDot,"\n",(i+1),masterBoot.mbr_partition[i].part_start); 180 | fprintf(graphDot,"\n",(i+1),masterBoot.mbr_partition[i].part_size); 181 | fprintf(graphDot,"\n",(i+1),masterBoot.mbr_partition[i].part_name); 182 | } 183 | } 184 | 185 | fprintf(graphDot,"
Nombre Valor
mbr_tamaño%d
mbr_fecha_creacion %s
mbr_disk_signature %d
Disk_fit %c
part_status_%d %s
part_type_%d %c
part_fit_%d %c
part_start_%d %d
part_size_%d %d
part_name_%d %s
\n"); 186 | fprintf(graphDot, ">];\n}\n"); 187 | 188 | if(index_Extendida != -1){ 189 | int index_ebr = 1; 190 | EBR extendedBoot; 191 | fseek(fp,masterBoot.mbr_partition[index_Extendida].part_start,SEEK_SET); 192 | while(fread(&extendedBoot,sizeof(EBR),1,fp)!=0 && (ftell(fp) < masterBoot.mbr_partition[index_Extendida].part_start + masterBoot.mbr_partition[index_Extendida].part_size)) { 193 | if(extendedBoot.part_status != '1'){ 194 | fprintf(graphDot,"subgraph cluster_%d{\n label=\"EBR_%d\"\n",index_ebr,index_ebr); 195 | fprintf(graphDot,"\ntbl_%d[shape=box, label=<\n ",index_ebr); 196 | fprintf(graphDot, "\n "); 197 | fprintf(graphDot, "\n"); 198 | char status[3]; 199 | if(extendedBoot.part_status == '0') 200 | strcpy(status,"0"); 201 | else if(extendedBoot.part_status == '2') 202 | strcpy(status,"2"); 203 | fprintf(graphDot, "\n",status); 204 | fprintf(graphDot, "\n",extendedBoot.part_fit); 205 | fprintf(graphDot, "\n",extendedBoot.part_start); 206 | fprintf(graphDot, "\n",extendedBoot.part_size); 207 | fprintf(graphDot, "\n",extendedBoot.part_next); 208 | fprintf(graphDot, "\n",extendedBoot.part_name); 209 | fprintf(graphDot, "
Nombre Valor
part_status_1 %s
part_fit_1 %c
part_start_1 %d
part_size_1 %d
part_next_1 %d
part_name_1 %s
\n"); 210 | fprintf(graphDot, ">];\n}\n"); 211 | index_ebr++; 212 | } 213 | 214 | if(extendedBoot.part_next == -1) 215 | break; 216 | else 217 | fseek(fp,extendedBoot.part_next,SEEK_SET); 218 | } 219 | } 220 | fprintf(graphDot,"}\n"); 221 | fclose(graphDot); 222 | fclose(fp); 223 | string comando = "dot -T"+extension.toStdString()+" grafica.dot -o "+destino.toStdString(); 224 | system(comando.c_str()); 225 | cout << "Reporte generado con exito " << endl; 226 | } 227 | } 228 | 229 | /* Metodo para generar el reporte de inodos de una particion 230 | * @param QString direccion: Es la direccion donde se encuentra la particion 231 | * @param QString destino: Es la ruta donde se creara el reporte 232 | * @param QString extension: La extension que tendra el reporte .jpg|.png|etc 233 | * @param int bm_inode_start: Byte donde inicia el bitmap de inodos de la particion 234 | * @param int inode_start: Byte donde inicia la tabla de inodos de la particion 235 | * @param int bm_block_start: Byte donde inicia el bitmap de bloques de la particion 236 | */ 237 | void Reporte::graficarInodos(QString direccion, QString destino, QString extension,int bm_inode_start,int inode_start,int bm_block_start){ 238 | FILE *fp = fopen(direccion.toStdString().c_str(), "r"); 239 | 240 | InodoTable inodo; 241 | int aux = bm_inode_start; 242 | int i = 0; 243 | char buffer; 244 | 245 | FILE *graph = fopen("grafica.dot","w"); 246 | fprintf(graph,"digraph G{\n\n"); 247 | 248 | while(aux < bm_block_start){ 249 | fseek(fp,bm_inode_start + i,SEEK_SET); 250 | buffer = static_cast(fgetc(fp)); 251 | aux++; 252 | if(buffer == '1'){ 253 | fseek(fp,inode_start + static_cast(sizeof(InodoTable))*i,SEEK_SET); 254 | fread(&inodo,sizeof(InodoTable),1,fp); 255 | fprintf(graph, " nodo_%d [ shape=none fontname=\"Century Gothic\" label=<\n",i); 256 | fprintf(graph, " "); 257 | fprintf(graph, " \n",i); 258 | fprintf(graph, " \n",inodo.i_uid); 259 | fprintf(graph, " \n",inodo.i_gid); 260 | fprintf(graph, " \n",inodo.i_size); 261 | struct tm *tm; 262 | char fecha[100]; 263 | tm=localtime(&inodo.i_atime); 264 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 265 | fprintf(graph, " \n",fecha); 266 | tm=localtime(&inodo.i_ctime); 267 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 268 | fprintf(graph, " \n",fecha); 269 | tm=localtime(&inodo.i_mtime); 270 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 271 | fprintf(graph, " \n",fecha); 272 | for(int b = 0; b < 15; b++) 273 | fprintf(graph, " \n",b,inodo.i_block[b]); 274 | fprintf(graph, " \n",inodo.i_type); 275 | fprintf(graph, " \n",inodo.i_perm); 276 | fprintf(graph, "
Inodo %d
i_uid %d
i_gid %d
i_size %d
i_atime %s
i_ctime %s
i_mtime %s
i_block_%d %d
i_type %c
i_perm %d
>]\n"); 277 | } 278 | i++; 279 | } 280 | fprintf(graph,"\n}"); 281 | fclose(graph); 282 | 283 | fclose(fp); 284 | 285 | string comando = "dot -T"+extension.toStdString()+" grafica.dot -o "+destino.toStdString(); 286 | system(comando.c_str()); 287 | cout << "Reporte de inodos generado con exito " << endl; 288 | } 289 | 290 | /* Metodo para generar el reporte de bloques de una particion 291 | * @param QString direccion: Es la direccion donde se encuentra la particion 292 | * @param QString destino: Es la ruta donde se creara el reporte 293 | * @param QString extension: La extension que tendra el reporte .jpg|.png|etc 294 | * @param int bm_block_start: Byte donde inicia el bitmap de bloques de la particion 295 | * @param int block_start: Byte donde inicia la tabla de bloques de la particion 296 | * @param int inode_start: Byte donde inicia la tabla de inodos 297 | */ 298 | void Reporte::graficarBloques(QString direccion, QString destino, QString extension, int bm_block_start, int block_start, int inode_start){ 299 | FILE *fp = fopen(direccion.toStdString().c_str(),"r"); 300 | 301 | BloqueCarpeta carpeta; 302 | BloqueArchivo archivo; 303 | BloqueApuntadores apuntador; 304 | 305 | int aux = bm_block_start; 306 | int i = 0; 307 | char buffer; 308 | 309 | FILE *graph = fopen("grafica.dot","w"); 310 | fprintf(graph,"digraph G{\n\n"); 311 | 312 | while(aux < inode_start){ 313 | fseek(fp,bm_block_start + i,SEEK_SET); 314 | buffer = static_cast(fgetc(fp)); 315 | aux++; 316 | if(buffer == '1'){ 317 | fseek(fp,block_start + static_cast(sizeof(BloqueCarpeta))*i,SEEK_SET); 318 | fread(&carpeta,sizeof(BloqueCarpeta),1,fp); 319 | fprintf(graph, " nodo_%d [ shape=none, fontname=\"Century Gothic\" label=< \n",i); 320 | fprintf(graph, " "); 321 | fprintf(graph, " \n",i); 322 | fprintf(graph, " \n"); 323 | for(int c = 0;c < 4;c++) 324 | fprintf(graph, " \n",carpeta.b_content[c].b_name,carpeta.b_content[c].b_inodo); 325 | fprintf(graph, "
Bloque Carpeta %d
b_name b_inode
%s %d
>]\n\n"); 326 | }else if(buffer == '2'){ 327 | fseek(fp,block_start + static_cast(sizeof(BloqueArchivo))*i,SEEK_SET); 328 | fread(&archivo,sizeof(BloqueArchivo),1,fp); 329 | fprintf(graph, " nodo_%d [ shape=none, label=< \n",i); 330 | fprintf(graph, " "); 331 | fprintf(graph, " \n",i); 332 | fprintf(graph, " \n",archivo.b_content); 333 | fprintf(graph, "
Bloque Archivo %d
%s
>]\n\n"); 334 | }else if(buffer == '3'){ 335 | fseek(fp,block_start + static_cast(sizeof(BloqueApuntadores))*i,SEEK_SET); 336 | fread(&apuntador,sizeof(BloqueApuntadores),1,fp); 337 | fseek(fp,block_start + static_cast(sizeof(BloqueApuntadores))*i,SEEK_SET); 338 | fread(&apuntador,sizeof(BloqueApuntadores),1,fp); 339 | fprintf(graph, " bloque_%d [shape=plaintext fontname=\"Century Gothic\" label=< \n",i); 340 | fprintf(graph, " \n"); 341 | fprintf(graph, " \n",i); 342 | for(int j = 0; j < 16; j++) 343 | fprintf(graph, " \n",apuntador.b_pointer[j]); 344 | fprintf(graph, "
Pointer block %d
%d
>]\n\n"); 345 | } 346 | i++; 347 | } 348 | 349 | fprintf(graph,"\n}"); 350 | fclose(graph); 351 | 352 | fclose(fp); 353 | 354 | string comando = "dot -T"+extension.toStdString()+" grafica.dot -o "+destino.toStdString(); 355 | system(comando.c_str()); 356 | cout << "Reporte generado con exito " << endl; 357 | } 358 | 359 | /* Metodo para generar el reporte de bitmaps de una particion 360 | * @param QString direccion: Es la direccion donde se encuentra la particion 361 | * @param QString destino: Es la ruta donde se creara el reporte 362 | * @param int bm_start: Byte donde inicia el bitmap de la particion 363 | * @param int n: numero de bits 364 | */ 365 | void Reporte::reporteBM(QString direccion, QString destino, int start_bm, int n){ 366 | FILE *fp = fopen(direccion.toStdString().c_str(),"rb+"); 367 | 368 | char byte; 369 | FILE *report = fopen(destino.toStdString().c_str(),"w+"); 370 | fseek(report,0,SEEK_SET); 371 | int cont = 0; 372 | 373 | for (int i = 0; i < n; i++) { 374 | fseek(fp,start_bm + i,SEEK_SET); 375 | byte = static_cast(fgetc(fp)); 376 | if(byte == '0') 377 | fprintf(report,"0 "); 378 | else 379 | fprintf(report,"1 "); 380 | if(cont == 19){ 381 | cont = 0; 382 | fprintf(report, "\n"); 383 | }else 384 | cont++; 385 | } 386 | fclose(report); 387 | 388 | fclose(fp); 389 | cout << "Reporte generado con exito " << endl; 390 | } 391 | 392 | /* Metodo para generar el reporte del SuperBloque de una particion 393 | * @param QString direccion: Es la direccion donde se encuentra la particion 394 | * @param QString destino: Es la ruta donde se creara el reporte 395 | * @param QString extension: La extension que tendra el reporte .jpg|.png 396 | * @param int start_super: Byte donde inicia el super bloque 397 | */ 398 | void Reporte::graficarSuper(QString direccion, QString destino, QString extension, int start_super){ 399 | FILE* fp = fopen(direccion.toStdString().c_str(),"r"); 400 | 401 | SuperBloque super; 402 | 403 | fseek(fp,start_super,SEEK_SET); 404 | fread(&super,sizeof (super),1,fp); 405 | 406 | FILE *graph = fopen("grafica.dot","w"); 407 | fprintf(graph,"digraph G{\n"); 408 | fprintf(graph, " nodo [shape=none, fontname=\"Century Gothic\" label=<"); 409 | fprintf(graph, " "); 410 | fprintf(graph, " \n"); 411 | fprintf(graph, " \n",super.s_inodes_count); 412 | fprintf(graph, " \n",super.s_blocks_count); 413 | fprintf(graph, " \n",super.s_free_blocks_count); 414 | fprintf(graph, " \n",super.s_free_inodes_count); 415 | struct tm *tm; 416 | char fecha[100]; 417 | tm=localtime(&super.s_mtime); 418 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 419 | fprintf(graph, " \n",fecha); 420 | tm=localtime(&super.s_umtime); 421 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 422 | fprintf(graph, " \n",fecha); 423 | fprintf(graph, " \n",super.s_mnt_count); 424 | fprintf(graph, " \n",super.s_magic); 425 | fprintf(graph, " \n",super.s_inode_size); 426 | fprintf(graph, " \n",super.s_block_size); 427 | fprintf(graph, " \n",super.s_first_ino); 428 | fprintf(graph, " \n",super.s_first_blo); 429 | fprintf(graph, " \n",super.s_bm_inode_start); 430 | fprintf(graph, " \n",super.s_bm_block_start); 431 | fprintf(graph, " \n",super.s_inode_start); 432 | fprintf(graph, " \n",super.s_block_start); 433 | fprintf(graph, "
SUPERBLOQUE
s_inodes_count %d
s_blocks_count %d
s_free_block_count %d
s_free_inodes_count %d
s_mtime %s
s_umtime %s
s_mnt_count %d
s_magic %d
s_inode_size %d
s_block_size %d
s_first_ino %d
s_first_blo %d
s_bm_inode_start %d
s_bm_block_start %d
s_inode_start %d
s_block_start %d
>]\n"); 434 | fprintf(graph,"\n}"); 435 | fclose(graph); 436 | 437 | fclose(fp); 438 | 439 | string comando = "dot -T"+extension.toStdString()+" grafica.dot -o "+destino.toStdString(); 440 | system(comando.c_str()); 441 | cout << "Reporte SuperBloque generado con exito " << endl; 442 | } 443 | 444 | /* Metodo para generar el reporte de permisos de un archivo/carpeta 445 | * @param QString direccion: Es la direccion donde se encuentra la particion 446 | * @param QString destino: Es la ruta donde se creara el reporte 447 | * @param QString extension: La extension que tendra el reporte .jpg|.png 448 | * @param int start_super: byte donde inicia el super bloque 449 | * @param int n: numero inodo del archivo/carpeta 450 | * @param Usuario user: Informacion del propietario del archivo/carpeta 451 | * @param name: nombre de la carpeta/archivo 452 | */ 453 | void Reporte::graficarPermisos(QString direccion, QString destino, QString extension, int start_super, int n, Usuario user, QString name){ 454 | FILE *fp = fopen(direccion.toStdString().c_str(),"rb+"); 455 | 456 | SuperBloque super; 457 | InodoTable inodo; 458 | 459 | fseek(fp,start_super,SEEK_SET); 460 | fread(&super,sizeof(SuperBloque),1,fp); 461 | fseek(fp,super.s_inode_start + static_cast(sizeof(InodoTable))*n,SEEK_SET); 462 | fread(&inodo,sizeof(InodoTable),1,fp); 463 | 464 | FILE *graph = fopen("grafica.dot","w"); 465 | fprintf(graph,"digraph G{\n\n"); 466 | fprintf(graph, " nodo [ shape=none, fontname=\"Century Gothic\" \n"); 467 | fprintf(graph, " label=< \n"); 468 | fprintf(graph, " \n"); 469 | 470 | string auxPermisos = to_string(inodo.i_perm); 471 | char propietario = auxPermisos[0]; 472 | char grupo = auxPermisos[1]; 473 | char otros = auxPermisos[2]; 474 | char permisos[50]; 475 | 476 | //Tipo de permisos para el propietario 477 | if(propietario == '0') 478 | strcpy(permisos,"---"); 479 | else if(propietario == '1') 480 | strcpy(permisos,"--x"); 481 | else if(propietario == '2') 482 | strcpy(permisos,"-w-"); 483 | else if(propietario == '3') 484 | strcpy(permisos,"-wx"); 485 | else if(propietario == '4') 486 | strcpy(permisos,"r--"); 487 | else if(propietario == '5') 488 | strcpy(permisos,"r-x"); 489 | else if(propietario == '6') 490 | strcpy(permisos,"rw-"); 491 | else if(propietario == '7') 492 | strcpy(permisos,"rwx"); 493 | 494 | //Tipo de permisos para grupo 495 | if(grupo == '0') 496 | strcat(permisos," ---"); 497 | else if(grupo == '1') 498 | strcat(permisos," --x"); 499 | else if(grupo == '2') 500 | strcat(permisos," -w-"); 501 | else if(grupo == '3') 502 | strcat(permisos," -wx"); 503 | else if(grupo == '4') 504 | strcat(permisos," r--"); 505 | else if(grupo == '5') 506 | strcat(permisos," r-x"); 507 | else if(grupo == '6') 508 | strcat(permisos," rw-"); 509 | else if(grupo == '7') 510 | strcat(permisos," rwx"); 511 | 512 | //Tipo de permisos para otros 513 | if(otros == '0') 514 | strcat(permisos," ---"); 515 | else if(otros == '1') 516 | strcat(permisos," --x"); 517 | else if(otros == '2') 518 | strcat(permisos," -w-"); 519 | else if(otros == '3') 520 | strcat(permisos," -wx"); 521 | else if(otros == '4') 522 | strcat(permisos," r--"); 523 | else if(otros == '5') 524 | strcat(permisos," r-x"); 525 | else if(otros == '6') 526 | strcat(permisos," rw-"); 527 | else if(otros == '7') 528 | strcat(permisos," rwx"); 529 | 530 | fprintf(graph," ",permisos); 531 | fprintf(graph, "",user.username); 532 | fprintf(graph, "",user.group); 533 | fprintf(graph, "",inodo.i_size); 534 | 535 | struct tm *tm; 536 | char fecha[100]; 537 | tm=localtime(&inodo.i_atime); 538 | strftime(fecha,100,"%d/%m/%y",tm); 539 | fprintf(graph, "",fecha); 540 | strftime(fecha,100,"%H:%S",tm); 541 | fprintf(graph,"",fecha); 542 | if(inodo.i_type == '0') 543 | fprintf(graph,"","Carpeta"); 544 | else if(inodo.i_type == '1') 545 | fprintf(graph,"","Archivo"); 546 | fprintf(graph, "\n",name.toStdString().c_str()); 547 | 548 | fprintf(graph, "
PermisosOwnerGrupoSizeFechaHoraTipoName
%s%s%s%d%s%s%s%s%s
>]\n"); 549 | fprintf(graph,"\n}"); 550 | fclose(graph); 551 | 552 | fclose(fp); 553 | 554 | string comando = "dot -T"+extension.toStdString()+" grafica.dot -o "+destino.toStdString(); 555 | system(comando.c_str()); 556 | cout << "Reporte ls generado con exito " << endl; 557 | } 558 | 559 | /* Metodo para generar el reporte del arbol de inodos con bloques de un sistema de archivos 560 | * @param QString direccion: Es la direccion donde se encuentra la particion 561 | * @param QString destino: Es la ruta donde se creara el reporte 562 | * @param QString extension: La extension que tendra el reporte .jpg|.png 563 | * @param int start_super: byte donde inicia el super bloque 564 | */ 565 | void Reporte::graficarTree(QString direccion, QString destino, QString extension, int start_super){ 566 | FILE *fp = fopen(direccion.toStdString().c_str(),"r"); 567 | 568 | SuperBloque super; 569 | InodoTable inodo; 570 | BloqueCarpeta carpeta; 571 | BloqueArchivo archivo; 572 | BloqueApuntadores apuntador; 573 | 574 | fseek(fp,start_super,SEEK_SET); 575 | fread(&super,sizeof(SuperBloque),1,fp); 576 | 577 | int aux = super.s_bm_inode_start; 578 | int i = 0; 579 | 580 | char buffer; 581 | 582 | FILE *graph = fopen("grafica.dot", "w"); 583 | fprintf(graph, "digraph G{\n\n"); 584 | fprintf(graph, " rankdir=\"LR\" \n"); 585 | 586 | //Creamos los inodos 587 | while(aux < super.s_bm_block_start){ 588 | fseek(fp,super.s_bm_inode_start + i,SEEK_SET); 589 | buffer = static_cast(fgetc(fp)); 590 | aux++; 591 | int port = 0; 592 | if(buffer == '1'){ 593 | fseek(fp,super.s_inode_start + static_cast(sizeof(InodoTable))*i,SEEK_SET); 594 | fread(&inodo,sizeof(InodoTable),1,fp); 595 | fprintf(graph, " inodo_%d [ shape=plaintext fontname=\"Century Gothic\" label=<\n",i); 596 | fprintf(graph, " "); 597 | fprintf(graph, " \n",i); 598 | fprintf(graph, " \n",inodo.i_uid); 599 | fprintf(graph, " \n",inodo.i_gid); 600 | fprintf(graph, " \n",inodo.i_size); 601 | struct tm *tm; 602 | char fecha[100]; 603 | tm=localtime(&inodo.i_atime); 604 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 605 | fprintf(graph, " \n",fecha); 606 | tm=localtime(&inodo.i_ctime); 607 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 608 | fprintf(graph, " \n",fecha); 609 | tm=localtime(&inodo.i_mtime); 610 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 611 | fprintf(graph, " \n",fecha); 612 | for(int b = 0; b < 15; b++){ 613 | fprintf(graph, " \n",port,b,inodo.i_block[b]); 614 | port++; 615 | } 616 | fprintf(graph, " \n",inodo.i_type); 617 | fprintf(graph, " \n",inodo.i_perm); 618 | fprintf(graph, "
Inode %d
i_uid %d
i_gid %d
i_size %d
i_atime %s
i_ctime %s
i_mtime %s
i_block_%d %d
i_type %c
i_perm %d
>]\n\n"); 619 | //Creamos los bloques relacionados al inodo 620 | for (int j = 0; j < 15; j++) { 621 | port = 0; 622 | if(inodo.i_block[j] != -1){ 623 | fseek(fp,super.s_bm_block_start + inodo.i_block[j],SEEK_SET); 624 | buffer = static_cast(fgetc(fp)); 625 | if(buffer == '1'){//Bloque carpeta 626 | fseek(fp,super.s_block_start + static_cast(sizeof(BloqueCarpeta))*inodo.i_block[j],SEEK_SET); 627 | fread(&carpeta,sizeof(BloqueCarpeta),1,fp); 628 | fprintf(graph, " bloque_%d [shape=plaintext fontname=\"Century Gothic\" label=< \n",inodo.i_block[j]); 629 | fprintf(graph, " \n"); 630 | fprintf(graph, " \n",inodo.i_block[j]); 631 | fprintf(graph, " \n"); 632 | for(int c = 0;c < 4; c++){ 633 | fprintf(graph, " \n",carpeta.b_content[c].b_name,port,carpeta.b_content[c].b_inodo); 634 | port++; 635 | } 636 | fprintf(graph, "
Folder block %d
b_name b_inode
%s %d
>]\n\n"); 637 | //Relacion de bloques a inodos 638 | for(int c = 0; c < 4; c++){ 639 | if(carpeta.b_content[c].b_inodo !=-1){ 640 | if(strcmp(carpeta.b_content[c].b_name,".")!=0 && strcmp(carpeta.b_content[c].b_name,"..")!=0) 641 | fprintf(graph, " bloque_%d:f%d -> inodo_%d;\n",inodo.i_block[j],c,carpeta.b_content[c].b_inodo); 642 | } 643 | } 644 | }else if(buffer == '2'){//Bloque archivo 645 | fseek(fp,super.s_block_start + static_cast(sizeof(BloqueArchivo))*inodo.i_block[j],SEEK_SET); 646 | fread(&archivo,sizeof(BloqueArchivo),1,fp); 647 | fprintf(graph, " bloque_%d [shape=plaintext fontname=\"Century Gothic\" label=< \n",inodo.i_block[j]); 648 | fprintf(graph, " \n"); 649 | fprintf(graph, " \n",inodo.i_block[j]); 650 | fprintf(graph, " \n",archivo.b_content); 651 | fprintf(graph, "
File block %d
%s
>]\n\n"); 652 | }else if(buffer == '3'){//Bloque apuntador 653 | fseek(fp,super.s_block_start + static_cast(sizeof(BloqueApuntadores))*inodo.i_block[j],SEEK_SET); 654 | fread(&apuntador,sizeof(BloqueApuntadores),1,fp); 655 | fprintf(graph, " bloque_%d [shape=plaintext fontname=\"Century Gothic\" label=< \n",inodo.i_block[j]); 656 | fprintf(graph, " \n"); 657 | fprintf(graph, " \n",inodo.i_block[j]); 658 | for(int a = 0; a < 16; a++){ 659 | fprintf(graph, " \n",port,apuntador.b_pointer[a]); 660 | port++; 661 | } 662 | fprintf(graph, "
Pointer block %d
%d
>]\n\n"); 663 | //Bloques carpeta/archivos del bloque de apuntadores 664 | for (int x = 0; x < 16; x++) { 665 | port = 0; 666 | if(apuntador.b_pointer[x] != -1){ 667 | fseek(fp,super.s_bm_block_start + apuntador.b_pointer[x],SEEK_SET); 668 | buffer = static_cast(fgetc(fp)); 669 | if(buffer == '1'){ 670 | fseek(fp,super.s_block_start + static_cast(sizeof(BloqueCarpeta))*apuntador.b_pointer[x],SEEK_SET); 671 | fread(&carpeta,sizeof(BloqueCarpeta),1,fp); 672 | fprintf(graph, " bloque_%d [shape=plaintext fontname=\"Century Gothic\" label=< \n",apuntador.b_pointer[x]); 673 | fprintf(graph, " \n"); 674 | fprintf(graph, " \n",apuntador.b_pointer[x]); 675 | fprintf(graph, " \n"); 676 | for(int c = 0;c < 4; c++){ 677 | fprintf(graph, " \n",carpeta.b_content[c].b_name,port,carpeta.b_content[c].b_inodo); 678 | port++; 679 | } 680 | fprintf(graph, "
Folder block %d
b_name b_inode
%s %d
>]\n\n"); 681 | //Relacion de bloques a inodos 682 | for(int c = 0; c < 4; c++){ 683 | if(carpeta.b_content[c].b_inodo !=-1){ 684 | if(strcmp(carpeta.b_content[c].b_name,".")!=0 && strcmp(carpeta.b_content[c].b_name,"..")!=0) 685 | fprintf(graph, " bloque_%d:f%d -> inodo_%d;\n",apuntador.b_pointer[x],c,carpeta.b_content[c].b_inodo); 686 | } 687 | } 688 | }else if(buffer == '2'){ 689 | fseek(fp,super.s_block_start + static_cast(sizeof(BloqueArchivo))*apuntador.b_pointer[x],SEEK_SET); 690 | fread(&archivo,sizeof(BloqueArchivo),1,fp); 691 | fprintf(graph, " bloque_%d [shape=plaintext fontname=\"Century Gothic\" label=< \n",apuntador.b_pointer[x]); 692 | fprintf(graph, " \n"); 693 | fprintf(graph, " \n",apuntador.b_pointer[x]); 694 | fprintf(graph, " \n",archivo.b_content); 695 | fprintf(graph, "
File block %d
%s
>]\n\n"); 696 | }else if(buffer == '3'){ 697 | 698 | } 699 | } 700 | } 701 | 702 | //Relacion de bloques apuntador a bloques archivos/carpetas 703 | for(int b = 0; b < 16; b++){ 704 | if(apuntador.b_pointer[b] != -1) 705 | fprintf(graph, " bloque_%d:f%d -> bloque_%d;\n",inodo.i_block[j],b,apuntador.b_pointer[b]); 706 | } 707 | } 708 | //Relacion de inodos a bloques 709 | fprintf(graph, " inodo_%d:f%d -> bloque_%d; \n",i,j,inodo.i_block[j]); 710 | } 711 | } 712 | } 713 | i++; 714 | } 715 | 716 | fprintf(graph,"\n\n}"); 717 | fclose(graph); 718 | 719 | fclose(fp); 720 | 721 | string comando = "dot -T"+extension.toStdString()+" grafica.dot -o "+destino.toStdString(); 722 | system(comando.c_str()); 723 | cout << "Reporte Tree generado con exito " << endl; 724 | } 725 | 726 | /* Metodo para generar el reporte del Journaling de un sistema 727 | * @param QString direccion: Es la direccion donde se encuentra la particion 728 | * @param QString destino: Es la ruta donde se creara el reporte 729 | * @param QString extension: La extension que tendra el reporte .jpg|.png 730 | * @param int fin: byte donde finaliza el journaling 731 | */ 732 | void Reporte::graficarJournaling(QString direccion, QString destino, QString extension,int inicio_super){ 733 | FILE *fp = fopen(direccion.toStdString().c_str(),"r"); 734 | 735 | SuperBloque super; 736 | Journal j; 737 | fseek(fp,inicio_super,SEEK_SET); 738 | fread(&super,sizeof(SuperBloque),1,fp); 739 | 740 | FILE *graph = fopen("grafica.dot","w"); 741 | fprintf(graph,"digraph G{\n"); 742 | fprintf(graph, " nodo [shape=none, fontname=\"Century Gothic\" label=<\n"); 743 | fprintf(graph, " \n"); 744 | fprintf(graph, " \n"); 745 | fprintf(graph, " \n"); 746 | fprintf(graph, " \n"); 747 | // 748 | fseek(fp,inicio_super + static_cast(sizeof(SuperBloque)),SEEK_SET); 749 | while(ftell(fp) < super.s_bm_inode_start){ 750 | fread(&j,sizeof(Journal),1,fp); 751 | if(j.journal_type == 0 || j.journal_type == 1){ 752 | struct tm *tm; 753 | char fecha[100]; 754 | tm = localtime(&j.journal_date); 755 | strftime(fecha,100,"%d/%m/%y %H:%S",tm); 756 | fprintf(graph,"\n",j.journal_operation_type,j.journal_type,j.journal_name,j.journal_content,j.journal_owner,j.journal_permissions,fecha); 757 | } 758 | } 759 | fprintf(graph, "
JOURNALING
Operacion TipoNombreContenidoPropietarioPermisosFecha
%s%d%s%s%d%d%s
>]\n"); 760 | fprintf(graph,"}"); 761 | fclose(graph); 762 | 763 | fclose(fp); 764 | 765 | string comando = "dot -T"+extension.toStdString()+" grafica.dot -o "+destino.toStdString(); 766 | system(comando.c_str()); 767 | cout << "Reporte Journaling generado con exito " << endl; 768 | } 769 | 770 | /* Metodo para generar el reporte del Journaling de un sistema 771 | * @param QString direccion: Es la direccion donde se encuentra la particion 772 | * @param QString destino: Es la ruta donde se creara el reporte 773 | * @param QString extension: La extension que tendra el reporte .jpg|.png 774 | * @param QString name: El nombre del archivo 775 | * @param int start_super: byte donde inicia el super bloque 776 | * @param int n: numero de inodo del archivo 777 | */ 778 | void Reporte::graficarFILE(QString direccion, QString destino, QString extension, QString name,int start_super,int n){ 779 | FILE *fp = fopen(direccion.toStdString().c_str(),"r"); 780 | 781 | SuperBloque super; 782 | InodoTable inodo; 783 | BloqueArchivo archivo; 784 | 785 | fseek(fp,start_super,SEEK_SET); 786 | fread(&super,sizeof(SuperBloque),1,fp); 787 | fseek(fp,super.s_inode_start + static_cast(sizeof(InodoTable))*n,SEEK_SET); 788 | fread(&inodo,sizeof(InodoTable),1,fp); 789 | 790 | FILE *graph = fopen("grafica.dot","w"); 791 | fprintf(graph,"digraph G{\n"); 792 | fprintf(graph, " nodo [shape=none, fontname=\"Century Gothic\" label=<"); 793 | fprintf(graph, " "); 794 | fprintf(graph, " \n",name.toStdString().c_str()); 795 | fprintf(graph, " \n"); 821 | fprintf(graph, "
%s
"); 796 | for (int i = 0; i < 15; i++) { 797 | if(inodo.i_block[i] != -1){ 798 | if(i == 12){//Apuntador indirecto simple 799 | BloqueApuntadores apuntador; 800 | fseek(fp,super.s_block_start + static_cast(sizeof(BloqueApuntadores))*inodo.i_block[i],SEEK_SET); 801 | fread(&apuntador,sizeof(BloqueApuntadores),1,fp); 802 | for(int j = 0; j < 16; j++){ 803 | if(apuntador.b_pointer[j] != -1){ 804 | fseek(fp,super.s_block_start + static_cast(sizeof(BloqueCarpeta))*apuntador.b_pointer[j],SEEK_SET); 805 | fread(&archivo,sizeof(BloqueArchivo),1,fp); 806 | fprintf(graph,"%s
",archivo.b_content); 807 | } 808 | } 809 | }else if(i == 13){ 810 | 811 | }else if(i == 14){ 812 | 813 | }else{//Apuntadores directos 814 | fseek(fp,super.s_block_start + static_cast(sizeof(BloqueCarpeta))*inodo.i_block[i],SEEK_SET); 815 | fread(&archivo,sizeof(BloqueArchivo),1,fp); 816 | fprintf(graph,"%s
",archivo.b_content); 817 | } 818 | } 819 | } 820 | fprintf(graph, "
>]\n"); 822 | fprintf(graph,"\n}"); 823 | fclose(graph); 824 | 825 | fclose(fp); 826 | 827 | string comando = "dot -T"+extension.toStdString()+" grafica.dot -o "+destino.toStdString(); 828 | system(comando.c_str()); 829 | cout << "Reporte file generado con exito " << endl; 830 | } 831 | -------------------------------------------------------------------------------- /FileSystem_2/reporte.h: -------------------------------------------------------------------------------- 1 | #ifndef REPORTE_H 2 | #define REPORTE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "structs.h" 8 | 9 | using namespace std; 10 | 11 | class Reporte 12 | { 13 | public: 14 | Reporte(); 15 | void graficarMBR(QString, QString, QString); 16 | void graficarDisco(QString, QString, QString); 17 | void graficarInodos(QString,QString,QString,int,int,int); 18 | void graficarBloques(QString,QString,QString,int,int,int); 19 | void reporteBM(QString, QString, int, int); 20 | void graficarSuper(QString,QString,QString,int); 21 | void graficarFILE(QString,QString,QString,QString,int,int); 22 | void graficarPermisos(QString,QString,QString,int,int,Usuario,QString); 23 | void graficarTree(QString,QString,QString,int); 24 | void graficarJournaling(QString,QString,QString,int); 25 | }; 26 | 27 | #endif // REPORTE_H 28 | -------------------------------------------------------------------------------- /FileSystem_2/scanner.h: -------------------------------------------------------------------------------- 1 | #ifndef yyHEADER_H 2 | #define yyHEADER_H 1 3 | #define yyIN_HEADER 1 4 | 5 | #line 6 "scanner.h" 6 | 7 | #line 8 "scanner.h" 8 | 9 | #define YY_INT_ALIGNED short int 10 | 11 | /* A lexical scanner generated by flex */ 12 | 13 | #define FLEX_SCANNER 14 | #define YY_FLEX_MAJOR_VERSION 2 15 | #define YY_FLEX_MINOR_VERSION 6 16 | #define YY_FLEX_SUBMINOR_VERSION 4 17 | #if YY_FLEX_SUBMINOR_VERSION > 0 18 | #define FLEX_BETA 19 | #endif 20 | 21 | /* First, we deal with platform-specific or compiler-specific issues. */ 22 | 23 | /* begin standard C headers. */ 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | /* end standard C headers. */ 30 | 31 | /* flex integer type definitions */ 32 | 33 | #ifndef FLEXINT_H 34 | #define FLEXINT_H 35 | 36 | /* C99 systems have . Non-C99 systems may or may not. */ 37 | 38 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 39 | 40 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 41 | * if you want the limit (max/min) macros for int types. 42 | */ 43 | #ifndef __STDC_LIMIT_MACROS 44 | #define __STDC_LIMIT_MACROS 1 45 | #endif 46 | 47 | #include 48 | typedef int8_t flex_int8_t; 49 | typedef uint8_t flex_uint8_t; 50 | typedef int16_t flex_int16_t; 51 | typedef uint16_t flex_uint16_t; 52 | typedef int32_t flex_int32_t; 53 | typedef uint32_t flex_uint32_t; 54 | #else 55 | typedef signed char flex_int8_t; 56 | typedef short int flex_int16_t; 57 | typedef int flex_int32_t; 58 | typedef unsigned char flex_uint8_t; 59 | typedef unsigned short int flex_uint16_t; 60 | typedef unsigned int flex_uint32_t; 61 | 62 | /* Limits of integral types. */ 63 | #ifndef INT8_MIN 64 | #define INT8_MIN (-128) 65 | #endif 66 | #ifndef INT16_MIN 67 | #define INT16_MIN (-32767-1) 68 | #endif 69 | #ifndef INT32_MIN 70 | #define INT32_MIN (-2147483647-1) 71 | #endif 72 | #ifndef INT8_MAX 73 | #define INT8_MAX (127) 74 | #endif 75 | #ifndef INT16_MAX 76 | #define INT16_MAX (32767) 77 | #endif 78 | #ifndef INT32_MAX 79 | #define INT32_MAX (2147483647) 80 | #endif 81 | #ifndef UINT8_MAX 82 | #define UINT8_MAX (255U) 83 | #endif 84 | #ifndef UINT16_MAX 85 | #define UINT16_MAX (65535U) 86 | #endif 87 | #ifndef UINT32_MAX 88 | #define UINT32_MAX (4294967295U) 89 | #endif 90 | 91 | #ifndef SIZE_MAX 92 | #define SIZE_MAX (~(size_t)0) 93 | #endif 94 | 95 | #endif /* ! C99 */ 96 | 97 | #endif /* ! FLEXINT_H */ 98 | 99 | /* begin standard C++ headers. */ 100 | 101 | /* TODO: this is always defined, so inline it */ 102 | #define yyconst const 103 | 104 | #if defined(__GNUC__) && __GNUC__ >= 3 105 | #define yynoreturn __attribute__((__noreturn__)) 106 | #else 107 | #define yynoreturn 108 | #endif 109 | 110 | /* Size of default input buffer. */ 111 | #ifndef YY_BUF_SIZE 112 | #ifdef __ia64__ 113 | /* On IA-64, the buffer size is 16k, not 8k. 114 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 115 | * Ditto for the __ia64__ case accordingly. 116 | */ 117 | #define YY_BUF_SIZE 32768 118 | #else 119 | #define YY_BUF_SIZE 16384 120 | #endif /* __ia64__ */ 121 | #endif 122 | 123 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE 124 | #define YY_TYPEDEF_YY_BUFFER_STATE 125 | typedef struct yy_buffer_state *YY_BUFFER_STATE; 126 | #endif 127 | 128 | #ifndef YY_TYPEDEF_YY_SIZE_T 129 | #define YY_TYPEDEF_YY_SIZE_T 130 | typedef size_t yy_size_t; 131 | #endif 132 | 133 | extern int yyleng; 134 | 135 | extern FILE *yyin, *yyout; 136 | 137 | #ifndef YY_STRUCT_YY_BUFFER_STATE 138 | #define YY_STRUCT_YY_BUFFER_STATE 139 | struct yy_buffer_state 140 | { 141 | FILE *yy_input_file; 142 | 143 | char *yy_ch_buf; /* input buffer */ 144 | char *yy_buf_pos; /* current position in input buffer */ 145 | 146 | /* Size of input buffer in bytes, not including room for EOB 147 | * characters. 148 | */ 149 | int yy_buf_size; 150 | 151 | /* Number of characters read into yy_ch_buf, not including EOB 152 | * characters. 153 | */ 154 | int yy_n_chars; 155 | 156 | /* Whether we "own" the buffer - i.e., we know we created it, 157 | * and can realloc() it to grow it, and should free() it to 158 | * delete it. 159 | */ 160 | int yy_is_our_buffer; 161 | 162 | /* Whether this is an "interactive" input source; if so, and 163 | * if we're using stdio for input, then we want to use getc() 164 | * instead of fread(), to make sure we stop fetching input after 165 | * each newline. 166 | */ 167 | int yy_is_interactive; 168 | 169 | /* Whether we're considered to be at the beginning of a line. 170 | * If so, '^' rules will be active on the next match, otherwise 171 | * not. 172 | */ 173 | int yy_at_bol; 174 | 175 | int yy_bs_lineno; /**< The line count. */ 176 | int yy_bs_column; /**< The column count. */ 177 | 178 | /* Whether to try to fill the input buffer when we reach the 179 | * end of it. 180 | */ 181 | int yy_fill_buffer; 182 | 183 | int yy_buffer_status; 184 | 185 | }; 186 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 187 | 188 | void yyrestart ( FILE *input_file ); 189 | void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); 190 | YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); 191 | void yy_delete_buffer ( YY_BUFFER_STATE b ); 192 | void yy_flush_buffer ( YY_BUFFER_STATE b ); 193 | void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); 194 | void yypop_buffer_state ( void ); 195 | 196 | YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); 197 | YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); 198 | YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); 199 | 200 | void *yyalloc ( yy_size_t ); 201 | void *yyrealloc ( void *, yy_size_t ); 202 | void yyfree ( void * ); 203 | 204 | /* Begin user sect3 */ 205 | 206 | #define yywrap() (/*CONSTCOND*/1) 207 | #define YY_SKIP_YYWRAP 208 | 209 | extern int yylineno; 210 | 211 | extern char *yytext; 212 | #ifdef yytext_ptr 213 | #undef yytext_ptr 214 | #endif 215 | #define yytext_ptr yytext 216 | 217 | #ifdef YY_HEADER_EXPORT_START_CONDITIONS 218 | #define INITIAL 0 219 | #define COM 1 220 | 221 | #endif 222 | 223 | #ifndef YY_NO_UNISTD_H 224 | /* Special case for "unistd.h", since it is non-ANSI. We include it way 225 | * down here because we want the user's section 1 to have been scanned first. 226 | * The user has a chance to override it with an option. 227 | */ 228 | #include 229 | #endif 230 | 231 | #ifndef YY_EXTRA_TYPE 232 | #define YY_EXTRA_TYPE void * 233 | #endif 234 | 235 | /* Accessor methods to globals. 236 | These are made visible to non-reentrant scanners for convenience. */ 237 | 238 | int yylex_destroy ( void ); 239 | 240 | int yyget_debug ( void ); 241 | 242 | void yyset_debug ( int debug_flag ); 243 | 244 | YY_EXTRA_TYPE yyget_extra ( void ); 245 | 246 | void yyset_extra ( YY_EXTRA_TYPE user_defined ); 247 | 248 | FILE *yyget_in ( void ); 249 | 250 | void yyset_in ( FILE * _in_str ); 251 | 252 | FILE *yyget_out ( void ); 253 | 254 | void yyset_out ( FILE * _out_str ); 255 | 256 | int yyget_leng ( void ); 257 | 258 | char *yyget_text ( void ); 259 | 260 | int yyget_lineno ( void ); 261 | 262 | void yyset_lineno ( int _line_number ); 263 | 264 | /* Macros after this point can all be overridden by user definitions in 265 | * section 1. 266 | */ 267 | 268 | #ifndef YY_SKIP_YYWRAP 269 | #ifdef __cplusplus 270 | extern "C" int yywrap ( void ); 271 | #else 272 | extern int yywrap ( void ); 273 | #endif 274 | #endif 275 | 276 | #ifndef yytext_ptr 277 | static void yy_flex_strncpy ( char *, const char *, int ); 278 | #endif 279 | 280 | #ifdef YY_NEED_STRLEN 281 | static int yy_flex_strlen ( const char * ); 282 | #endif 283 | 284 | #ifndef YY_NO_INPUT 285 | 286 | #endif 287 | 288 | /* Amount of stuff to slurp up with each read. */ 289 | #ifndef YY_READ_BUF_SIZE 290 | #ifdef __ia64__ 291 | /* On IA-64, the buffer size is 16k, not 8k */ 292 | #define YY_READ_BUF_SIZE 16384 293 | #else 294 | #define YY_READ_BUF_SIZE 8192 295 | #endif /* __ia64__ */ 296 | #endif 297 | 298 | /* Number of entries by which start-condition stack grows. */ 299 | #ifndef YY_START_STACK_INCR 300 | #define YY_START_STACK_INCR 25 301 | #endif 302 | 303 | /* Default declaration of generated scanner - a define so the user can 304 | * easily add parameters. 305 | */ 306 | #ifndef YY_DECL 307 | #define YY_DECL_IS_OURS 1 308 | 309 | extern int yylex (void); 310 | 311 | #define YY_DECL int yylex (void) 312 | #endif /* !YY_DECL */ 313 | 314 | /* yy_get_previous_state - get the state just before the EOB char was reached */ 315 | 316 | #undef YY_NEW_FILE 317 | #undef YY_FLUSH_BUFFER 318 | #undef yy_set_bol 319 | #undef yy_new_buffer 320 | #undef yy_set_interactive 321 | #undef YY_DO_BEFORE_ACTION 322 | 323 | #ifdef YY_DECL_IS_OURS 324 | #undef YY_DECL_IS_OURS 325 | #undef YY_DECL 326 | #endif 327 | 328 | #ifndef yy_create_buffer_ALREADY_DEFINED 329 | #undef yy_create_buffer 330 | #endif 331 | #ifndef yy_delete_buffer_ALREADY_DEFINED 332 | #undef yy_delete_buffer 333 | #endif 334 | #ifndef yy_scan_buffer_ALREADY_DEFINED 335 | #undef yy_scan_buffer 336 | #endif 337 | #ifndef yy_scan_string_ALREADY_DEFINED 338 | #undef yy_scan_string 339 | #endif 340 | #ifndef yy_scan_bytes_ALREADY_DEFINED 341 | #undef yy_scan_bytes 342 | #endif 343 | #ifndef yy_init_buffer_ALREADY_DEFINED 344 | #undef yy_init_buffer 345 | #endif 346 | #ifndef yy_flush_buffer_ALREADY_DEFINED 347 | #undef yy_flush_buffer 348 | #endif 349 | #ifndef yy_load_buffer_state_ALREADY_DEFINED 350 | #undef yy_load_buffer_state 351 | #endif 352 | #ifndef yy_switch_to_buffer_ALREADY_DEFINED 353 | #undef yy_switch_to_buffer 354 | #endif 355 | #ifndef yypush_buffer_state_ALREADY_DEFINED 356 | #undef yypush_buffer_state 357 | #endif 358 | #ifndef yypop_buffer_state_ALREADY_DEFINED 359 | #undef yypop_buffer_state 360 | #endif 361 | #ifndef yyensure_buffer_stack_ALREADY_DEFINED 362 | #undef yyensure_buffer_stack 363 | #endif 364 | #ifndef yylex_ALREADY_DEFINED 365 | #undef yylex 366 | #endif 367 | #ifndef yyrestart_ALREADY_DEFINED 368 | #undef yyrestart 369 | #endif 370 | #ifndef yylex_init_ALREADY_DEFINED 371 | #undef yylex_init 372 | #endif 373 | #ifndef yylex_init_extra_ALREADY_DEFINED 374 | #undef yylex_init_extra 375 | #endif 376 | #ifndef yylex_destroy_ALREADY_DEFINED 377 | #undef yylex_destroy 378 | #endif 379 | #ifndef yyget_debug_ALREADY_DEFINED 380 | #undef yyget_debug 381 | #endif 382 | #ifndef yyset_debug_ALREADY_DEFINED 383 | #undef yyset_debug 384 | #endif 385 | #ifndef yyget_extra_ALREADY_DEFINED 386 | #undef yyget_extra 387 | #endif 388 | #ifndef yyset_extra_ALREADY_DEFINED 389 | #undef yyset_extra 390 | #endif 391 | #ifndef yyget_in_ALREADY_DEFINED 392 | #undef yyget_in 393 | #endif 394 | #ifndef yyset_in_ALREADY_DEFINED 395 | #undef yyset_in 396 | #endif 397 | #ifndef yyget_out_ALREADY_DEFINED 398 | #undef yyget_out 399 | #endif 400 | #ifndef yyset_out_ALREADY_DEFINED 401 | #undef yyset_out 402 | #endif 403 | #ifndef yyget_leng_ALREADY_DEFINED 404 | #undef yyget_leng 405 | #endif 406 | #ifndef yyget_text_ALREADY_DEFINED 407 | #undef yyget_text 408 | #endif 409 | #ifndef yyget_lineno_ALREADY_DEFINED 410 | #undef yyget_lineno 411 | #endif 412 | #ifndef yyset_lineno_ALREADY_DEFINED 413 | #undef yyset_lineno 414 | #endif 415 | #ifndef yyget_column_ALREADY_DEFINED 416 | #undef yyget_column 417 | #endif 418 | #ifndef yyset_column_ALREADY_DEFINED 419 | #undef yyset_column 420 | #endif 421 | #ifndef yywrap_ALREADY_DEFINED 422 | #undef yywrap 423 | #endif 424 | #ifndef yyget_lval_ALREADY_DEFINED 425 | #undef yyget_lval 426 | #endif 427 | #ifndef yyset_lval_ALREADY_DEFINED 428 | #undef yyset_lval 429 | #endif 430 | #ifndef yyget_lloc_ALREADY_DEFINED 431 | #undef yyget_lloc 432 | #endif 433 | #ifndef yyset_lloc_ALREADY_DEFINED 434 | #undef yyset_lloc 435 | #endif 436 | #ifndef yyalloc_ALREADY_DEFINED 437 | #undef yyalloc 438 | #endif 439 | #ifndef yyrealloc_ALREADY_DEFINED 440 | #undef yyrealloc 441 | #endif 442 | #ifndef yyfree_ALREADY_DEFINED 443 | #undef yyfree 444 | #endif 445 | #ifndef yytext_ALREADY_DEFINED 446 | #undef yytext 447 | #endif 448 | #ifndef yyleng_ALREADY_DEFINED 449 | #undef yyleng 450 | #endif 451 | #ifndef yyin_ALREADY_DEFINED 452 | #undef yyin 453 | #endif 454 | #ifndef yyout_ALREADY_DEFINED 455 | #undef yyout 456 | #endif 457 | #ifndef yy_flex_debug_ALREADY_DEFINED 458 | #undef yy_flex_debug 459 | #endif 460 | #ifndef yylineno_ALREADY_DEFINED 461 | #undef yylineno 462 | #endif 463 | #ifndef yytables_fload_ALREADY_DEFINED 464 | #undef yytables_fload 465 | #endif 466 | #ifndef yytables_destroy_ALREADY_DEFINED 467 | #undef yytables_destroy 468 | #endif 469 | #ifndef yyTABLES_NAME_ALREADY_DEFINED 470 | #undef yyTABLES_NAME 471 | #endif 472 | 473 | #line 120 "Lexico.l" 474 | 475 | 476 | #line 477 "scanner.h" 477 | #undef yyIN_HEADER 478 | #endif /* yyHEADER_H */ 479 | -------------------------------------------------------------------------------- /FileSystem_2/structs.h: -------------------------------------------------------------------------------- 1 | #ifndef STRUCTS_H 2 | #define STRUCTS_H 3 | 4 | #include 5 | #include 6 | 7 | //Header en donde se definen todos los structs que se usaran en el proyecto 8 | 9 | /* 10 | * Structs necesarios para guardar la informacion de los discos 11 | * Los discos tendran informacion del MBR y el MBR tendra el espacio de las particiones 12 | */ 13 | 14 | typedef struct { 15 | char part_status; //Indica si la particion esta activa o no 16 | char part_type; //Indica el tipo de particion 17 | char part_fit; //Tipo de ajuste de la particion 18 | int part_start; //Indica en que byte del disco inicia la particion 19 | int part_size; //Contiene el tamano de la particion en bytes 20 | char part_name[16]; //Nombre de la particion 21 | } Partition; 22 | 23 | typedef struct{ 24 | int mbr_size; //Tamano total del disco en bytes 25 | time_t mbr_date_created; //Fecha y hora de creacion del disco 26 | int mbr_disk_signature; //Numero random, que identifica de forma unica cada disco 27 | char mbr_disk_fit; //Tipo de ajuste 28 | Partition mbr_partition[4]; //4 particiones 29 | }MBR; 30 | 31 | typedef struct{ 32 | char part_status; //Indica si la particion esta activa o no 33 | char part_fit; //Tipo de ajuste 34 | int part_start; //Indica en que byte del disco inicia la particion 35 | int part_size; //Contiene el tamano total de la particion en bytes 36 | int part_next; //Byte en el que esta el proxima EBR. -1 si no hay siguiente 37 | char part_name[16]; //Nombre de la particion 38 | }EBR; 39 | 40 | /* 41 | * Structs para sistema de archivos 42 | */ 43 | 44 | typedef struct{ 45 | int s_filesystem_type; //Guarda el numero que identifica al sistea de archivos utilizados 46 | int s_inodes_count; //Guarda el numero total de inodos 47 | int s_blocks_count; //Guarda el numero total de bloques 48 | int s_free_blocks_count; //Contiene el numero de bloques libres 49 | int s_free_inodes_count; //Contiene el numero inodos libres 50 | time_t s_mtime; //Ultima fecha en el que el sistema fue montado 51 | time_t s_umtime; //Ultima fecha en que el sistema fue desmontado 52 | int s_mnt_count; //Indica cuantas veces se ha montado el sistema 53 | int s_magic; //Valor que identifica al sistema de archivos 0xEF53 54 | int s_inode_size; //Tamano del inodo 55 | int s_block_size; //Tamano del bloque 56 | int s_first_ino; //Primer inodo libre 57 | int s_first_blo; //Primero bloque libre 58 | int s_bm_inode_start; //Guardara el inicio del bitmap de inodos 59 | int s_bm_block_start; //Guardara el inicio del bitmap de bloques 60 | int s_inode_start; //Guarada el inicio de la tabla de inodos 61 | int s_block_start; //Guardara el inicio de la tabla de bloques 62 | }SuperBloque; 63 | 64 | typedef struct{ 65 | int i_uid; //UID del usuario propiertario del archivo/carpeta 66 | int i_gid; //GID del grupo al que pertenece el archivo/carpeta 67 | int i_size; //Tamano del archivo en bytes 68 | int i_block[15]; //Array de bloques 69 | char i_type; //Indica si es archivo o carpeta 70 | int i_perm; //Guarada los permisos del archivo/carpeta 71 | time_t i_atime; //Ultima fecha en que se leyo el inodo sin modificarlo 72 | time_t i_ctime; //Fecha en que se creo el el inodo 73 | time_t i_mtime; //Ultima fecha en la que se modifco 74 | }InodoTable; 75 | 76 | typedef struct{ 77 | char b_name[12];//Nombre carpeta/archivo 78 | int b_inodo;//Apuntador hacia un inodo asociado al archivo o carpeta 79 | }Content; 80 | 81 | typedef struct{ 82 | Content b_content[4];//Array con el contenido de la carpeta 83 | }BloqueCarpeta; 84 | 85 | typedef struct{ 86 | char b_content[64]; 87 | }BloqueArchivo; 88 | 89 | typedef struct{ 90 | int b_pointer[16];//Array con los apuntadores hacia bloques 91 | }BloqueApuntadores; 92 | 93 | /* Struct para guardar un registro de las operaciones que se hacen el sistema 94 | * de archivos ejemplo: creacion de carpetas o archivos */ 95 | typedef struct{ 96 | char journal_operation_type[10]; 97 | int journal_type;//Archivo/Carpeta 98 | char journal_name[100]; 99 | char journal_content[100]; 100 | time_t journal_date; 101 | int journal_owner; 102 | int journal_permissions; 103 | }Journal; 104 | 105 | /*Struct para guardar los datos del usuario loggeado*/ 106 | typedef struct{ 107 | int id_user; 108 | int id_grp; 109 | int inicioSuper; 110 | int inicioJournal; 111 | int tipo_sistema; 112 | QString direccion; 113 | char fit; 114 | }Sesion; 115 | 116 | typedef struct{ 117 | int id_usr; 118 | int id_grp; 119 | char username[12]; 120 | char password[12]; 121 | char group[12]; 122 | }Usuario; 123 | 124 | #endif // STRUCTS_H 125 | -------------------------------------------------------------------------------- /Imagenes/Comandos/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/cat.png -------------------------------------------------------------------------------- /Imagenes/Comandos/cat2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/cat2.png -------------------------------------------------------------------------------- /Imagenes/Comandos/cat3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/cat3.png -------------------------------------------------------------------------------- /Imagenes/Comandos/chmod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/chmod.png -------------------------------------------------------------------------------- /Imagenes/Comandos/errorPermisos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/errorPermisos.png -------------------------------------------------------------------------------- /Imagenes/Comandos/fdisk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/fdisk.png -------------------------------------------------------------------------------- /Imagenes/Comandos/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/login.png -------------------------------------------------------------------------------- /Imagenes/Comandos/logoi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/logoi.png -------------------------------------------------------------------------------- /Imagenes/Comandos/logoi2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/logoi2.png -------------------------------------------------------------------------------- /Imagenes/Comandos/logoi3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/logoi3.png -------------------------------------------------------------------------------- /Imagenes/Comandos/loss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/loss.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkdir1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkdir1.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkdir2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkdir2.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkdir3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkdir3.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkdir4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkdir4.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkdisk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkdisk.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkfile1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkfile1.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkfile2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkfile2.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkfile3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkfile3.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkfile4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkfile4.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkfs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkfs.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkgrp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkgrp.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mkusr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mkusr.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mount.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mount.png -------------------------------------------------------------------------------- /Imagenes/Comandos/mv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/mv.png -------------------------------------------------------------------------------- /Imagenes/Comandos/recovery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/recovery.png -------------------------------------------------------------------------------- /Imagenes/Comandos/rem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/rem.png -------------------------------------------------------------------------------- /Imagenes/Comandos/rem2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/rem2.png -------------------------------------------------------------------------------- /Imagenes/Comandos/rep1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/rep1.png -------------------------------------------------------------------------------- /Imagenes/Comandos/rmgrp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/rmgrp.png -------------------------------------------------------------------------------- /Imagenes/Comandos/rmusr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Comandos/rmusr.png -------------------------------------------------------------------------------- /Imagenes/Reportes/Journaling.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/Journaling.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/SuperBloque.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/SuperBloque.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/bitmaps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/bitmaps.png -------------------------------------------------------------------------------- /Imagenes/Reportes/bitmapss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/bitmapss.png -------------------------------------------------------------------------------- /Imagenes/Reportes/blocks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/blocks.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/blocks_zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/blocks_zoom.png -------------------------------------------------------------------------------- /Imagenes/Reportes/contenido.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/contenido.png -------------------------------------------------------------------------------- /Imagenes/Reportes/inodes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/inodes.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/inodes_zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/inodes_zoom.png -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte1_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte1_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte2.1_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte2.1_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte2.2_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte2.2_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte2.3_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte2.3_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte2.4_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte2.4_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte3.1_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte3.1_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte3.1_zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte3.1_zoom.png -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte3.2_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte3.2_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte3.2_zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte3.2_zoom.png -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte3.3_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte3.3_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte3.3_zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte3.3_zoom.png -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte3.4_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte3.4_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte3.4_zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte3.4_zoom.png -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte4.1_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte4.1_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte4.1_zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte4.1_zoom.png -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte4.2_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte4.2_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte4.2_zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte4.2_zoom.png -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte4.3_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte4.3_tree.jpg -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte4.3_zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte4.3_zoom.png -------------------------------------------------------------------------------- /Imagenes/Reportes/reporte7_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raulxiloj/FileSystem_2/8548ca2c856f5e2e9f96d7a801a2e933aa6dfce9/Imagenes/Reportes/reporte7_tree.jpg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Raul Xiloj 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://img.shields.io/github/stars/raulxiloj/FileSystem_2) ![](https://img.shields.io/github/forks/raulxiloj/FileSystem_2) ![](https://img.shields.io/github/issues/raulxiloj/FileSystem_2) 2 | # Sistema de archivos EXT2/EXT3 3 | 4 | Es una aplicacion en consola que simulara un sistema de archivos linux EXT2/EXT3. No distinguira entre mayúsculas y minúsculas. Solo se puede colocar un comando por línea. Toda la informacion se detalla mas en el archivo Fase2.pdf 5 | 6 | ## Instalacion 7 | - Descargar repositorio 8 | - Abrir el archivo FileSystem_2.pro desde Qt Creator 9 | 10 | ## Comandos 11 | **A continuacion de se describe la funcion de cada comando. Los parametros y validaciones se encuentran en el enunciado del proyecto(fase2.pdf)** 12 | * FASE 1 13 | - mkdisk: Creara un archivo binario, simulando un disco duro. 14 | - rmkdisk: Borrara el archivo. 15 | - fdisk: Administrara las operaciones que se hagan en una particion como crear, eliminar o quitar espacio. 16 | - mount: Montara una particion 17 | - unmount: Desmontara una particion 18 | - rep: Generara un reporte tipo imagen 19 | - exec: Ejecutara un archivo con comandos ya escritos. 20 | * FASE 2 21 | - mkfs: Realiza el formateo copleto de una particion. 22 | - login: Inicia sesion en el sistema de una particion 23 | - logout: Cierra sesion en el sistema 24 | * Los siguientes comandos *necesitan que exista una sesion en el sistema ya que se ejecuta sobre la particion en la que inicia sesion* 25 | - mkgrp: Creara un grupo para los usuarios de la particion 26 | - rmgrp: Eliminara un grupo de la particion 27 | - mkusr: Crea un usuario en la particion 28 | - rmusr: Elimina un usuario en la particion 29 | - chmod: Cambia los permisos de uno o varios archivos o carpetas 30 | - mkfile: Crea archivo 31 | - cat: Muestra el contenido de un archivo 32 | - rem: Elimina un archivo o carpeta y todo su contenido 33 | - edit: Edita el contenido de un an achivo para asignarle otro contenido (pendiente) 34 | - ren: Permite cambiar el nombre de un archivo o carpeta (pendiente) 35 | - mkdir: Crea carpetas 36 | - cp: Realiza una copia de un archivo o carpeta y todo su contenido hacia otro destino(pendiente) 37 | - mv: Permite mover un archivo o carpeta y todo su contenido hacia otro destino 38 | - find: Realiza una busqueda por el nombre del archivo o carpeta especifica. 39 | - chown: Cambia el propietario de uno o varios archivos o carpetas 40 | - chgrp: Cambia el grpo al que pertenece el usuario 41 | - pause: Realiza una pausa en la ejecucion 42 | - loss: Hace la simulacion de perdida de informacion del sistema, formateando los bloques e inodos del sistema 43 | - recovery: Realiza la recuperacion del sistema por medio del Super bloque y el Jorunaling (Solo EXT3) 44 | 45 | ## Tutorial 46 | - Empezaremos con la creacion de un disco de 20 MB y lo crearemos en el escritorio 47 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkdisk.png) 48 | - Luego crearemos una particion primaria de 7.5 MB 49 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/fdisk.png) 50 | - Montamos la particion creada 51 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mount.png) 52 | - Procedemos a darle formato a la particion montada y le daremos un EXT3 que praticamente es lo mismo que un EXT2 a diferencia que este tiene un registro por diario (journaling) 53 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkfs.png) 54 | - Cuando se formatea una particion, se crea la carpeta raiz (Inodo 0) y se crea un archivo users.txt (Inodo 1) en la carpeta raiz. Creamos el primer reporte del arbol de inodos y bloques para entenderlo mejor. 55 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte1_tree.jpg) 56 | - Iniciamos sesion con el usuario root que viene por defecto y tiene todos los permisos del sistema 57 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/login.png) 58 | - Crearemos algunos grupos para poder asociar a los usuarios. Este comando solo lo puede utilizar el usuario root 59 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkgrp.png) 60 | - Eliminaremos los grupos 'mail' y 'news'. Este comando solo lo puede utilizar el usuario root 61 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/rmgrp.png) 62 | - Mostramos el contenido del archivo users.txt que es donde se guardan los grupos y usuarios creados 63 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/cat.png) 64 | - Crearemos algunos usuarios en la particion. Este comando solo lo puede utilizar el usuario root 65 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkusr.png) 66 | - Eliminamos al user2 con el objetivo de mostrar el funcionamiento del comando 67 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/rmusr.png) 68 | - Volvemos a mostrar el contenido del archivo users.txt para ver como quedo 69 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/cat2.png) 70 | - Ahora crearemos carpetas, empezaremos creando la carpeta bin en la raiz y tambien crearemos el reporte arbol para ver como va creciendo. Cuando se crea una carptea se crea un inodo (Inodo 2) y un bloque de tipo carpeta (Bloque 4) en donde se almacenaran sus subcarpetas 71 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkdir1.png) 72 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte2.1_tree.jpg) 73 | - Proseguimos con la creacion de carpetas, por motivos de ejemplo y que el arbol no sea muy grande para poder observar los cambios, crearemos solo 3 carpetas mas (dev, home, lib) en la carpeta raiz. 74 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkdir2.png) 75 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte2.2_tree.jpg) 76 | - Ahora crearemos la carpeta "archivos 19" en la carpeta home 77 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkdir3.png) 78 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte2.3_tree.jpg) 79 | - Ahora crearemos carpetas de manera recursiva, esto se logra gracias al parametro -p 80 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkdir4.png) 81 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte2.4_tree.jpg) 82 | - Cerramos sesion del usuario root e iniciamos con el usuario 'raulx' 83 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/logoi.png) 84 | - Ahora crearemos archivos, empezaremos creando el archivo 'Tarea1.txt' con un tamano de 75 bytes en la carpeta docs. Cuando se crea un archivo, se crea un inodo y dependiendo si el archivo tiene el parametro -size o -cont se crean n bloques archivos necesarios para guardar la informacion de lo contrario no se crean bloques archivos solo el inodo. Los bloques archivos tienen una capacidad de 64 bytes, entonces si la informacion sobrepasa este tamaño se crea otro y asi sucesivamente hasta poder guardar toda la informacion. 85 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkfile1.png) 86 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte3.1_tree.jpg) 87 | - Como ahora cuesta un poco mas ver los cambios pondremos una imagen auxiliar, en donde se ve mejor que es lo que paso 88 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte3.1_zoom.png) 89 | - Ahora crearemos el archivo 'Tarea2.txt' con un tamaño de 1700 bytes para poder ver el primer apuntador indirecto. 90 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkfile2.png) 91 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte3.2_tree.jpg) 92 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte3.2_zoom.png) 93 | - Ahora crearemos el archivo 'Tarea3.txt' que tendra el parametro -cont lo que indica que copiara el contenido de un archivo fisico de la computadora hacia el archivo creado en este caso Tarea3.txt 94 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkfile4.png) 95 | - El contenido del archivo IA.txt es el siguiente: 96 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/contenido.png) 97 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte3.3_tree.jpg) 98 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte3.3_zoom.png) 99 | - Y por ultimo crearemos un archivo de manera recursiva, o sea creando las carpetas si no existen. Esto se logra con el parametro -p y crearemos el archivo 'entrada.txt' en una ruta no existente 100 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mkfile3.png) 101 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte3.4_tree.jpg) 102 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte3.4_zoom.png) 103 | - Eliminaremos el archivo Tarea.txt que se encuentra en la carpeta docs, como se puede observar se elimino la referencia del bloque carpeta ahora esta como -1, desaparecio el inodo 15 y su respectivo bloque carpeta. 104 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/rem.png) 105 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte4.1_tree.jpg) 106 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte4.1_zoom.png) 107 | - Eliminaremos la carpeta usac, cuando se elimina una carpeta se elimina sus subcarpetas y archivos. 108 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/rem2.png) 109 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte4.2_tree.jpg) 110 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte4.2_zoom.png) 111 | - Movemos el archivo 'Tarea3.txt' a la carpeta home, si fuera una carpeta se moveria todo su contenido 112 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/mv.png) 113 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte4.3_tree.jpg) 114 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte4.3_zoom.png) 115 | - Cerramos sesion del usuario 'raulx' e iniciamos sesion con el usuario root 116 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/logoi2.png) 117 | - Cambiamos los permisos de la carpeta 'archivos 19' de manera recursiva, o sea que cualquier carpeta perteneciente a 'archivos 19' sera afectada. Y le cambiamos los permisos al archivo Tarea2.txt 118 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/chmod.png) 119 | - Cerramos sesion y volvemos a iniciar sesion con 'raulx' 120 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/logoi3.png) 121 | - Como el usuario root cambio los permisos ahora solo el puede escribir o leer en esa carpeta y archivo 122 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/errorPermisos.png) 123 | - Simulacion de perdida del sistema, se borra todo el contenido de bloques e inodos a excepcion del journaling y SB. 124 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/loss.png) 125 | - Gracias a que el sistema EXT3 cuenta con un registro por diario (journaling) se puede recuperar el sistema, lo cual consiste en formatear la particion y volver a crear los grupos, usuarios, archivos y carpetas creadas antes de la perdida. 126 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Comandos/recovery.png) 127 | - El arbol de inodos y bloques quedaria asi 128 | ![No se encuentra la imagen](https://github.com/raulxiloj/FileSystem_2/blob/master/Imagenes/Reportes/reporte7_tree.jpg) 129 | 130 | ## Herramientas utilizadas: 131 | - C/C++ (Lenguaje de programacion) 132 | - Qt Creator (IDE) 133 | - Linux Ubuntu (Sistema operativo) 134 | - Flex / Bison para el analizador 135 | - Graphviz (Para los reportes) 136 | 137 | ## Autor 138 | Raul Xiloj 139 | -------------------------------------------------------------------------------- /archivoMaster.sh: -------------------------------------------------------------------------------- 1 | #Archivo de prueba fase 2 2 | 3 | #CREACION DE DISCOS 4 | mkdisk -size=75 -unit=m -path=/home/archivos/fase2/Disco1.disk 5 | mkdisk -size=51200 -unit=K -path=/home/archivos/fase2/Disco2.disk 6 | 7 | #CREACION DE PARTICIONES 8 | #Disco1 9 | fdisk -type=P -unit=m -name=Part1 -size=20 -path=/home/archivos/fase2/Disco1.disk -fit=BF 10 | fdisk -type=P -unit=m -name=Part2 -size=15 -path=/home/archivos/fase2/Disco1.disk -fit=BF 11 | fdisk -type=P -unit=m -name=Part3 -size=20 -path=/home/archivos/fase2/Disco1.disk -fit=BF 12 | 13 | #Disco2 14 | fdisk -type=P -unit=M -name=Part1_D2 -size=20 -path=/home/archivos/fase2/Disco2.disk -fit=BF 15 | fdisk -type=P -unit=M -name=Part2_D2 -size=10 -path=/home/archivos/fase2/Disco2.disk -fit=BF 16 | fdisk -type=P -unit=M -name=Part3_D2 -size=10 -path=/home/archivos/fase2/Disco2.disk -fit=BF 17 | 18 | #MONTAR PARTICIONES 19 | mount -path=/home/archivos/fase2/Disco1.disk -name=Part1 #vda1 20 | mount -path=/home/archivos/fase2/Disco1.disk -name=Part2 #vda2 21 | mount -path=/home/archivos/fase2/Disco1.disk -name=Part3 #vda3 22 | 23 | mount -path=/home/archivos/fase2/Disco2.disk -name=Part1_D2 #vdb1 24 | mount -path=/home/archivos/fase2/Disco2.disk -name=Part2_D2 #vdb2 25 | mount -path=/home/archivos/fase2/Disco2.disk -name=Part3_D2 #vdb3 26 | 27 | #CREACION DEL SISTEMA DE ARCHIVOS EN LAS PARTICIONES 28 | mkfs -type=fast -id=vda1 -fs=3fs 29 | mkfs -type=full -id=vda2 -fs=3fs 30 | mkfs -type=fast -id=vda3 -fs=3fs 31 | 32 | #----------------REPORTES 1---------------- 33 | rep -id=vda1 -path="/home/archivos/reports2/reporte1_vda1_sb.pdf" -name=sb 34 | rep -id=vda1 -path="/home/archivos/reports2/reporte1_vda1_tree.jpg" -name=tree 35 | rep -id=vda2 -path="/home/archivos/reports2/reporte1_vda2_sb.pdf" -name=sb 36 | rep -id=vda2 -path="/home/archivos/reports2/reporte1_vda2_tree.jpg" -name=tree 37 | rep -id=vda3 -path="/home/archivos/reports2/reporte1_vda3_sb.pdf" -name=sb 38 | rep -id=vda3 -path="/home/archivos/reports2/reporte1_vda3_tree.jpg" -name=tree 39 | #pause 40 | 41 | #LOGIN 42 | #Login como root en el vda1 - Part1 de tipo EXT3 43 | #Debe dar error porque no existe el usuario roca 44 | login -pwd=567 -usr=roca -id=vda1 45 | #debe dar error porque no existe nada activo 46 | logout 47 | #Debe dar error contraseña incorrecta 48 | Login -pwd=12345 -usr=root -id=vda1 49 | Login -pwd=123 -usr=root -id=vda1 50 | #Debe dar error porque ya hay un login activo 51 | login -pwd=error -usr=error -id=vda1 52 | #pause 53 | 54 | #CREANDO GRUPOS 55 | mkgrp -name=Archivos 56 | mkgrp -name=Arqui 57 | mkgrp -name="Compi 2" 58 | mkgrp -name="Compi 2" 59 | cat -file=/users.txt 60 | #pause 61 | 62 | #BORRANDO GRUPOS 63 | #ERROR no existe este grupo 64 | rmgrp -name="DB2" 65 | rmgrp -name=Arqui 66 | cat -file=/users.txt 67 | #pause 68 | 69 | #CREACION DE USUARIOS 70 | #crearemos 3 usuarios llamados user1, user2, user3 71 | Mkusr -usr="user1" -grp=root -pwd=user1 72 | mkusr -usr="user2" -grp="Compi 2" -pwd=user2 73 | mkUsr -usr="user3" -grp="Compi 2" -pwd=user3 74 | #Da error porque ya existe ese usuario 75 | Mkusr -usr="user2" -grp="Compi 2" -pwd=user2 76 | #Da error porque no existe ese grupo 77 | Mkusr -usr="user2" -grp=Arqui -pwd=user2 78 | Cat -file=/users.txt 79 | #pause 80 | 81 | #BORRANDO USUARIOS 82 | rmusr -usr=user3 83 | rmusr -usr=user3 #Debe dar error porque ya no existe 84 | cat -file=/users.txt 85 | #pause 86 | 87 | #CREACION DE CARPETAS 88 | mkdir -p -path=/home/archivos/mia/fase1 89 | mkdir -p -path=/home/archivos/mia/carpeta2 90 | mkdir -p -path=/home/archivos/mia/z 91 | mkdir -p -path=/home/archivos/mia/carpeta3/carpeta7/carpeta8/carpeta9/carpeta10/carpeta11 92 | mkdir -p -path=/home/archivos/mia/carpeta4/carpeta7/carpeta8/carpeta9/carpeta10/carpeta11/carpeta7/carpeta8/carpeta9/carpeta10/carpeta11 93 | mkdir -path=/home/archivos/mia/carpeta2/a1 94 | mkdir -path=/home/archivos/mia/carpeta2/a2 95 | mkdir -path=/home/archivos/mia/carpeta2/a3 96 | mkdir -path=/home/archivos/mia/carpeta2/a4 97 | mkdir -path=/home/archivos/mia/carpeta2/a5 98 | mkdir -path=/home/archivos/mia/carpeta2/a6 99 | mkdir -path=/home/archivos/mia/carpeta2/a7 100 | mkdir -path=/home/archivos/mia/carpeta2/a8 101 | mkdir -path=/home/archivos/mia/carpeta2/a9 102 | mkdir -path=/home/archivos/mia/carpeta2/a10 103 | 104 | mkdir -p -path=/home/archivos/mia/fase2/a1 105 | mkdir -path=/home/archivos/mia/fase2/a2 106 | mkdir -path=/home/archivos/mia/fase2/a3 107 | mkdir -path=/home/archivos/mia/fase2/a4 108 | mkdir -path=/home/archivos/mia/fase2/a5 109 | mkdir -path=/home/archivos/mia/fase2/a6 110 | mkdir -path=/home/archivos/mia/fase2/a7 111 | mkdir -path=/home/archivos/mia/fase2/a8 112 | mkdir -path=/home/archivos/mia/fase2/a9 113 | mkdir -path=/home/archivos/mia/fase2/a10 114 | mkdir -path=/home/archivos/mia/fase2/a11 115 | mkdir -path=/home/archivos/mia/fase2/a12 116 | mkdir -path=/home/archivos/mia/fase2/a13 117 | mkdir -path=/home/archivos/mia/fase2/a14 118 | mkdir -path=/home/archivos/mia/fase2/a15 119 | mkdir -path=/home/archivos/mia/fase2/a16 120 | mkdir -path=/home/archivos/mia/fase2/a17 121 | mkdir -path=/home/archivos/mia/fase2/a18 122 | mkdir -path=/home/archivos/mia/fase2/a19 123 | mkdir -path=/home/archivos/mia/fase2/a20 124 | mkdir -path=/home/archivos/mia/fase2/a21 125 | mkdir -path=/home/archivos/mia/fase2/a22 126 | mkdir -path=/home/archivos/mia/fase2/a23 127 | mkdir -path=/home/archivos/mia/fase2/a24 128 | mkdir -path=/home/archivos/mia/fase2/a25 129 | mkdir -path=/home/archivos/mia/fase2/a26 130 | mkdir -path=/home/archivos/mia/fase2/a27 131 | mkdir -path=/home/archivos/mia/fase2/a28 132 | mkdir -path=/home/archivos/mia/fase2/a29 133 | mkdir -path=/home/archivos/mia/fase2/a30 134 | mkdir -path=/home/archivos/mia/fase2/a31 135 | mkdir -path=/home/archivos/mia/fase2/a32 136 | mkdir -path=/home/archivos/mia/fase2/a33 137 | mkdir -path=/home/archivos/mia/fase2/a34 138 | mkdir -path=/home/archivos/mia/fase2/a35 139 | mkdir -path=/home/archivos/mia/fase2/a36 140 | mkdir -path=/home/archivos/mia/fase2/a37 141 | mkdir -path=/home/archivos/mia/fase2/a38 142 | mkdir -path=/home/archivos/mia/fase2/a39 143 | mkdir -path=/home/archivos/mia/fase2/a40 144 | mkdir -path=/home/archivos/mia/fase2/a41 145 | mkdir -path=/home/archivos/mia/fase2/a42 146 | mkdir -path=/home/archivos/mia/fase2/a43 147 | mkdir -path=/home/archivos/mia/fase2/a44 148 | mkdir -path=/home/archivos/mia/fase2/a45 149 | mkdir -path=/home/archivos/mia/fase2/a46 150 | #Debe dar error porque ya existe a46 151 | mkdir -path=/home/archivos/mia/fase2/a46 152 | 153 | #Primer apuntador indirecto simple 154 | mkdir -path="/home/archivos/mia/fase2/b1" 155 | mkdir -path="/home/archivos/mia/fase2/b2" 156 | mkdir -path="/home/archivos/mia/fase2/b3" 157 | mkdir -path="/home/archivos/mia/fase2/b4" 158 | mkdir -path="/home/archivos/mia/fase2/b5" 159 | mkdir -path="/home/archivos/mia/fase2/b6" 160 | mkdir -path="/home/archivos/mia/fase2/b7" 161 | mkdir -path="/home/archivos/mia/fase2/b8" 162 | mkdir -path="/home/archivos/mia/fase2/b9" 163 | mkdir -path="/home/archivos/mia/fase2/b10" 164 | mkdir -path="/home/archivos/mia/fase2/b11" 165 | mkdir -path="/home/archivos/mia/fase2/b12" 166 | mkdir -path="/home/archivos/mia/fase2/b13" 167 | mkdir -path="/home/archivos/mia/fase2/b14" 168 | mkdir -path="/home/archivos/mia/fase2/b15" 169 | mkdir -path="/home/archivos/mia/fase2/b16" 170 | mkdir -path="/home/archivos/mia/fase2/b17" 171 | mkdir -path="/home/archivos/mia/fase2/b18" 172 | mkdir -path="/home/archivos/mia/fase2/b19" 173 | mkdir -path="/home/archivos/mia/fase2/b20" 174 | mkdir -path="/home/archivos/mia/fase2/b21" 175 | mkdir -path="/home/archivos/mia/fase2/b22" 176 | mkdir -path="/home/archivos/mia/fase2/b23" 177 | mkdir -path="/home/archivos/mia/fase2/b24" 178 | mkdir -path="/home/archivos/mia/fase2/b25" 179 | mkdir -path="/home/archivos/mia/fase2/b26" 180 | mkdir -path="/home/archivos/mia/fase2/b27" 181 | mkdir -path="/home/archivos/mia/fase2/b28" 182 | mkdir -path="/home/archivos/mia/fase2/b29" 183 | mkdir -path="/home/archivos/mia/fase2/b30" 184 | mkdir -path="/home/archivos/mia/fase2/b31" 185 | mkdir -path="/home/archivos/mia/fase2/b32" 186 | mkdir -path="/home/archivos/mia/fase2/b33" 187 | mkdir -path="/home/archivos/mia/fase2/b34" 188 | mkdir -path="/home/archivos/mia/fase2/b35" 189 | mkdir -path="/home/archivos/mia/fase2/b36" 190 | mkdir -path="/home/archivos/mia/fase2/b37" 191 | mkdir -path="/home/archivos/mia/fase2/b38" 192 | mkdir -path="/home/archivos/mia/fase2/b39" 193 | mkdir -path="/home/archivos/mia/fase2/b40" 194 | mkdir -path="/home/archivos/mia/fase2/b41" 195 | mkdir -path="/home/archivos/mia/fase2/b42" 196 | mkdir -path="/home/archivos/mia/fase2/b43" 197 | mkdir -path="/home/archivos/mia/fase2/b44" 198 | mkdir -path="/home/archivos/mia/fase2/b45" 199 | mkdir -path="/home/archivos/mia/fase2/b46" 200 | mkdir -path="/home/archivos/mia/fase2/b47" 201 | mkdir -path="/home/archivos/mia/fase2/b48" 202 | mkdir -path="/home/archivos/mia/fase2/b49" 203 | mkdir -path="/home/archivos/mia/fase2/b50" 204 | 205 | #----------------REPORTES 2---------------- 206 | rep -id=vda1 -path="/home/archivos/reports2/reporte2_vda1_sb.jpg" -name=sb 207 | rep -id=vda1 -path="/home/archivos/reports2/reporte2_vda1_tree.pdf" -name=tree 208 | #pause 209 | 210 | logout 211 | 212 | login -usr=user1 -pwd=user1 -id=vda1 213 | 214 | #CREACION DE ARCHIVOS 215 | mkfile -path="/home/b1.txt" -size=75 216 | mkfile -path ="/home/b1_1.txt" -size=1700 #1er indirecto 217 | #Archivo con parametro -p 218 | mkfile -p -path="/home/ahora/ya existe/b1.txt" -size=640 219 | #Debe dar error porque la ruta no existe 220 | mkfile -path="/home/NoExiste/b1.txt" -size=75 221 | #Debe dar error por size negativo 222 | mkfile -path="/home/b2.txt" -size=-45 223 | 224 | #----------------REPORTES 3---------------- 225 | rep -id=vda1 -path="/home/archivos/reports2/reporte3_vda1_sb.jpg" -name=sb 226 | rep -id=vda1 -path="/home/archivos/reports2/reporte3_vda1_tree.pdf" -name=tree 227 | #pause 228 | 229 | login -usr=user1 -pwd=user1 -id=vda1 230 | 231 | #REMOVER 232 | #Carpeta directos 233 | rem -path=/home/archivos/mia/fase2/a46 234 | #Carpeta indirectos 235 | rem -path=/home/archivos/mia/fase2/b1 236 | 237 | #----------------REPORTES 4---------------- 238 | rep -id=vda1 -path="/home/archivos/reports2/reporte4_vda1_sb.jpg" -name=sb 239 | rep -id=vda1 -path="/home/archivos/reports2/reporte4_vda1_tree.pdf" -name=tree 240 | pause 241 | 242 | #MOVER 243 | mv -path="/home/archivos/mia/fase2/b50" -dest="/home" 244 | #debe dar error porque no existe 245 | mv -path="/home/archivos/no existe" -dest="/home" 246 | 247 | #----------------REPORTES 5---------------- 248 | #Reportes antes de la perdida 249 | rep -id=vda1 -Path="/home/archivos/reports2/users.jpg" -ruta="/users.txt" -name=file 250 | rep -id=vda1 -Path="/home/archivos/reports2/ls.pdf" -ruta="/home" -name=ls 251 | rep -id=vda1 -Path="/home/archivos/reports2/reporte5_vda1_sb.jpg" -name=sb 252 | rep -id=vda1 -Path="/home/archivos/reports2/reporte5_vda1_tree.pdf" -name=tree 253 | rep -id=vda1 -Path="/home/archivos/reports2/reporte5_vda1_inode.pdf" -name=inode 254 | rep -id=vda1 -Path="/home/archivos/reports2/reporte5_vda1_block.pdf" -name=block 255 | rep -id=vda1 -Path="/home/archivos/reports2/reporte5_vda1_bm_inode.txt" -name=bm_inode 256 | rep -id=vda1 -Path="/home/archivos/reports2/reporte5_vda1_bm_block.txt" -name=bm_block 257 | rep -id=vda1 -Path="/home/archivos/reports2/reporte5_vda1_journaling.pdf" -name=journaling 258 | #pause 259 | 260 | #PERDIDA 261 | Loss -id=vda1 262 | 263 | #----------------REPORTES 6---------------- 264 | #Reportes despues de la perdida 265 | rep -id=vda1 -Path="/home/archivos/reports2/reporte6_vda1_sb.jpg" -name=sb 266 | rep -id=vda1 -Path="/home/archivos/reports2/reporte6_vda1_tree.pdf" -name=tree 267 | rep -id=vda1 -Path="/home/archivos/reports2/reporte6_vda1_inode.pdf" -name=inode 268 | rep -id=vda1 -Path="/home/archivos/reports2/reporte6_vda1_block.pdf" -name=block 269 | rep -id=vda1 -Path="/home/archivos/reports2/reporte6_vda1_bm_inode.txt" -name=bm_inode 270 | rep -id=vda1 -Path="/home/archivos/reports2/reporte6_vda1_bm_block.txt" -name=bm_block 271 | rep -id=vda1 -Path="/home/archivos/reports2/reporte6_vda1_journaling.pdf" -name=journaling 272 | #pause 273 | 274 | #RECUPERACION 275 | Recovery -id=vda1 276 | #----------------REPORTES 7---------------- 277 | #Reportes despues del recovery 278 | rep -id=vda1 -Path="/home/archivos/reports2/reporte7_vda1_sb.jpg" -name=sb 279 | rep -id=vda1 -Path="/home/archivos/reports2/reporte7_vda1_tree.pdf" -name=tree 280 | rep -id=vda1 -Path="/home/archivos/reports2/reporte7_vda1_inode.pdf" -name=inode 281 | rep -id=vda1 -Path="/home/archivos/reports2/reporte7_vda1_block.pdf" -name=block 282 | rep -id=vda1 -Path="/home/archivos/reports2/reporte7_vda1_bm_inode.txt" -name=bm_inode 283 | rep -id=vda1 -Path="/home/archivos/reports2/reporte7_vda1_bm_block.txt" -name=bm_block 284 | rep -id=vda1 -Path="/home/archivos/reports2/reporte7_vda1_journaling.pdf" -name=journaling 285 | pause 286 | 287 | logout 288 | 289 | login -pwd=123 -usr=root -id=vda1 290 | 291 | #CHMOD 292 | chmod -path="/home/archivos/mia/carpeta2" -ugo=001 -r 293 | chmod -path="/home/b1.txt" -ugo=001 294 | logout 295 | 296 | login -usr=user1 -pwd=user1 -id=vda1 297 | #No debe dejar por permisos de escritura 298 | Mkdir -p -path=/home/archivos/mia/carpeta2/esta/no/se/debe/crear/por/permisos 299 | #No debe dejar por permisos de lectura 300 | cat -file="/home/b1.txt" 301 | logout 302 | pause 303 | 304 | #exec -path=/home/raul/Desktop/archivoMaster.sh 305 | -------------------------------------------------------------------------------- /archivoNoobie.sh: -------------------------------------------------------------------------------- 1 | #Archivo de prueba fase 2 2 | 3 | #CREACION DE DISCO 4 | mkdisk -size=20 -unit=m -path=/home/Discos/Disco1.disk 5 | #CREACION DE PARTICION 6 | fdisk -type=P -unit=K -name=Part1 -size=7680 -path=/home/Discos/Disco1.disk -fit=BF 7 | #MOUNT 8 | mount -path=/home/Discos/Disco1.disk -name=Part1 #vda1 9 | #CREACION DE SISTEMA DE ARCHIVOS 10 | mkfs -type=fast -id=vda1 -fs=3fs 11 | 12 | #------------------------REPORTES 1---------------- 13 | rep -id=vda1 -path="/home/reportes/reporte1_sb.jpg" -name=sb 14 | rep -id=vda1 -path="/home/reportes/reporte1_tree.jpg" -name=tree 15 | pause 16 | 17 | #LOGIN 18 | login -usr=root -pwd=123 -id=vda1 19 | 20 | #CREACION DE GRUPOS 21 | mkgrp -name=usuarios 22 | mkgrp -name=adm 23 | mkgrp -name=mail 24 | mkgrp -name=news 25 | mkgrp -name=sys 26 | cat -file=/users.txt 27 | pause 28 | 29 | #ELIMINANDO GRUPOS 30 | rmgrp -name=mail 31 | cat -file=/users.txt 32 | pause 33 | 34 | #CREACION DE USUARIOS 35 | mkusr -usr="raulx" -pwd=password -grp=root 36 | mkusr -usr="user1" -pwd=abc -grp=usuarios 37 | mkusr -usr="user2" -pwd=abc -grp=usuarios 38 | cat -file=/users.txt 39 | pause 40 | 41 | #ELIMINANDO USUARIOS 42 | rmusr -usr=user2 43 | cat -file=/users.txt 44 | pause 45 | 46 | #CREACION DE CARPETAS 47 | mkdir -path=/bin 48 | mkdir -path=/boot 49 | mkdir -path=/cdrom 50 | mkdir -path=/dev 51 | mkdir -path=/etc 52 | mkdir -path=/home 53 | mkdir -path=/lib 54 | mkdir -path=/lib64 55 | mkdir -path=/media 56 | mkdir -path=/mnt 57 | mkdir -path=/opt 58 | mkdir -path=/proc 59 | mkdir -path=/run 60 | mkdir -path=/sbin 61 | mkdir -path=/snap 62 | mkdir -path=/srv 63 | mkdir -path=/sys 64 | mkdir -path=/tmp 65 | mkdir -path=/var 66 | mkdir -path="/home/archivos 19" 67 | mkdir -p -path=/home/user/docs/usac 68 | mkdir -p -path=/home/carpeta1/carpeta2/carpeta3/carpeta4/carpeta5 69 | 70 | #------------------------REPORTE 2---------------- 71 | rep -id=vda1 -path="/home/reportes/reporte2_tree.jpg" -name=tree 72 | pause 73 | 74 | logout 75 | 76 | login -usr=raulx -pwd=password -id=vda1 77 | 78 | #CREACION DE ARCHIVOS 79 | mkfile -path=/home/user/docs/Tarea.txt -size=75 80 | mkfile -path=/home/user/docs/Tarea2.txt -size=1700 81 | #Para este comando hay que crear un archivo en la computadora y en cont poner la ruta de ese archivo 82 | #En mi caso cree el archivo IA.txt en el escritorio 83 | mkfile -path=/home/user/docs/Tarea3.txt -cont=/home/raul/Desktop/IA.txt 84 | #Debe dar error porque la ruta no existe 85 | mkfile -path="/home/noexiste/b1.txt" 86 | #Debe dar error por size negativo 87 | mkfile -path="/home/b1.txt" -size=-45 88 | #Archivo con parametro -p 89 | mkfile -p -path=/home/user/docs/usac/archivos/proyectos/fase1/entrada.txt 90 | cat -file=/home/user/docs/Tarea2.txt 91 | cat -file=/home/user/docs/Tarea3.txt 92 | pause 93 | 94 | 95 | #------------------------REPORTE 3---------------- 96 | rep -id=vda1 -path="/home/reportes/reporte3_tree.jpg" -name=tree 97 | pause 98 | 99 | #REMOVER 100 | rem -path=/home/user/docs/usac #Carpeta 101 | rem -path=/home/user/docs/Tarea.txt #Archivo 102 | 103 | #------------------------REPORTE 4---------------- 104 | rep -id=vda1 -path="/home/reportes/reporte4_tree.jpg" -name=tree 105 | pause 106 | 107 | #MOVER 108 | mv -path=/home/user/docs/Tarea3.txt -dest=/home #archivo 109 | 110 | #------------------------REPORTES 5---------------- 111 | #Reporte antes de la perdida 112 | rep -id=vda1 -path="/home/reportes/reporte5_inode.jpg" -name=inode 113 | rep -id=vda1 -path="/home/reportes/reporte5_block.pdf" -name=block 114 | rep -id=vda1 -path="/home/reportes/reporte5_bm_inode.txt" -name=bm_inode 115 | rep -id=vda1 -path="/home/reportes/reporte5_bm_block.txt" -name=bm_block 116 | rep -id=vda1 -path="/home/reportes/reporte5_tree.jpg" -name=tree 117 | rep -id=vda1 -path="/home/reportes/reporte5_sb.jpg" -name=sb 118 | rep -id=vda1 -path="/home/reportes/reporte5_journaling.jpg" -name=journaling 119 | rep -id=vda1 -path="/home/reportes/reporte5_file.jpg" -ruta=/home/Tarea3.txt -name=file 120 | rep -id=vda1 -path="/home/reportes/reporte5_ls.jpg" -ruta=/home/Tarea3.txt -name=ls 121 | pause 122 | 123 | loss -id=vda1 124 | #------------------------REPORTES 6---------------- 125 | #Reporte despues de la perdida 126 | rep -id=vda1 -path="/home/reportes/reporte6_inode.jpg" -name=inode 127 | rep -id=vda1 -path="/home/reportes/reporte6_block.pdf" -name=block 128 | rep -id=vda1 -path="/home/reportes/reporte6_bm_inode.txt" -name=bm_inode 129 | rep -id=vda1 -path="/home/reportes/reporte6_bm_block.txt" -name=bm_block 130 | rep -id=vda1 -path="/home/reportes/reporte6_tree.jpg" -name=tree 131 | rep -id=vda1 -path="/home/reportes/reporte6_sb.jpg" -name=sb 132 | rep -id=vda1 -path="/home/reportes/reporte6_journaling.jpg" -name=journaling 133 | pause 134 | 135 | recovery -id=vda1 136 | #------------------------REPORTES 7---------------- 137 | #Reportes despues del recovery 138 | rep -id=vda1 -path="/home/reportes/reporte7_inode.jpg" -name=inode 139 | rep -id=vda1 -path="/home/reportes/reporte7_block.jpg" -name=block 140 | rep -id=vda1 -path="/home/reportes/reporte7_bm_inode.txt" -name=bm_inode 141 | rep -id=vda1 -path="/home/reportes/reporte7_bm_block.txt" -name=bm_block 142 | rep -id=vda1 -path="/home/reportes/reporte7_tree.jpg" -name=tree 143 | rep -id=vda1 -path="/home/reportes/reporte7_sb.jpg" -name=sb 144 | rep -id=vda1 -path="/home/reportes/reporte7_journaling.jpg" -name=journaling 145 | pause 146 | 147 | logout 148 | 149 | login -usr=root -pwd=123 -id=vda1 150 | 151 | #CHMOD cambio de permisos 152 | chmod -r -path="/home/archivos 19" -ugo=001 153 | chmod -path="/home/user/docs/Tarea2.txt" -ugo=001 154 | 155 | logout 156 | 157 | LOGIN -usr=raulx -pwd=password -id=vda1 158 | #No debe dejar por permisos de escritura 159 | mkdir -p -path="/home/archivos 19/no/tiene/que/hacerla/por/permisos" 160 | #No debe dejar por permisos de lectura 161 | cat -file=/home/user/docs/Tarea2.txt 162 | pause 163 | 164 | #Reportes despues de loss 165 | rep -id=vda1 -path=/home/reports/inodeReport_loss.jpg -name=inode 166 | rep -id=vda1 -path=/home/reports/blockReport_loss.jpg -name=block 167 | rep -id=vda1 -path=/home/reports/tree_report_loss.jpg -name=tree 168 | rep -id=vda1 -path=/home/reports/bm_block_report_loss.txt -name=bm_block 169 | rep -id=vda1 -path=/home/reports/bm_inode_report_loss.txt -name=bm_inode 170 | rep -id=vda1 -path=/home/reports/super_report_loss.jpg -name=sb 171 | rep -id=vda1 -path=/home/reports/journal_report.jpg -name=journaling 172 | pause 173 | 174 | #Reportes despues de recovery 175 | rep -id=vda1 -path=/home/reports/inodeReport_recovery.jpg -name=inode 176 | rep -id=vda1 -path=/home/reports/blockReport_recovery.jpg -name=block 177 | rep -id=vda1 -path=/home/reports/tree_report_recovery.jpg -name=tree 178 | rep -id=vda1 -path=/home/reports/bm_block_report_recovery.txt -name=bm_block 179 | rep -id=vda1 -path=/home/reports/bm_inode_report_recovery.txt -name=bm_inode 180 | rep -id=vda1 -path=/home/reports/super_report_recovery.jpg -name=sb 181 | rep -id=vda1 -path=/home/reports/journal_report_recovery.jpg -name=journaling 182 | 183 | #exec -path=/home/raul/Desktop/archivoPrueba.sh 184 | --------------------------------------------------------------------------------