Open
Conversation
Signed-off-by: Mara <maraioana9967@gmail.com>
Signed-off-by: Mara <maraioana9967@gmail.com>
|
Multumesc! Arata super! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Laborator 3:
Exercițiul 1:
/dev/so2_cdev c 42 0și am verficat corectitudinea acesteia culs -la /dev/ | grep so2și am obținut:crw-r--r-- 1 root root 42, 0 Mar 18 07:23 so2_cdev2) + 3) Register:
register_chrdev_region(MKDEV(MY_MAJOR, MY_MINOR), NUM_MINORS, "so2_cdev");Unregister:
unregister_chrdev_region(MKDEV(MY_MAJOR, MY_MINOR), NUM_MINORS);Am verificat corectitudinea urmărind mesajele de "Hello" și "Goodbye" când am dat load (insmod) și unload (rmmod) modulului. De asemenea, am găsit so2_cdev la rularea
/proc/devices | less.Exercițiul 2:
Am rulat cât
/proc/devicespentru a identifica un major ce deja este utilizat. Am modificatMY_MAJORcu valoarea 229. Am dat load modulului și am primit exit code 16 cuecho $?(Device or resource busy).Exercițiul 3:
Am completat comentariile TODO:
cdevîn interiorul structuriifopsa operațiilor corespunzătoare pentruopenșirelease(ce încă nu sunt finalizate)Exercițiul 4:
is_openedla 0 în init (resursa disponibila)container_ofis_openedpentru a garanta că resursele nu sunt deja ocupate în funtia de openis_openedla 0 pentru a permite acces ulterior în funcția de releaseExercițiul 5:
copy_to_userExercițiul 6:
Exercițiul 7:
Am afișat
IOCTL_MESSAGEpe ramura ce verifica valoarea parametrului formalcmdsă fie egala cuMY_IOCTL_PRINT. Output-ul comenzii./so2_cdev_test peste:Device opened!
Hello ioctl
Device closed!
Extra:
argpentru a simula operații de scriere și citire. Am verficat outputul pentru corectitudine:write:
./so2_cdev_test s anaaremeremulte
Device opened!
Extra write
Device closed!
read:
./so2_cdev_test g
Device opened!
Extra read
IOCTL buffer contains anaaremeremulte
Device closed!
wait_queue_head_tși o variabila de int pentruflag. După aceea am adăugat doua noi ramuri în switch-ul funcției ioctl ce se vor ocupa de adăugarea și ștergerea unui proces în coada. Fiecare device vă inițializa coada și flag-ul. Am comentat liniile 69-70, dar am întâmpinat probleme la testare:BUG: spinlock bad magic on CPU#0, so2_cdev_test/236