Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vcp command #69

Open
jcmendoza2 opened this issue Sep 15, 2024 · 2 comments
Open

Add vcp command #69

jcmendoza2 opened this issue Sep 15, 2024 · 2 comments

Comments

@jcmendoza2
Copy link

jcmendoza2 commented Sep 15, 2024

stat command: Displays detailed information about a file, including the
last modification and access times of the file.

Plan:
Extend and enhance the functionality of the stat (fstat) command
Extend version control of files: allow user to be able to save current state of a file as a new version
and have it stored in a directory-like structure titled the name of the file and be stored as a separate file with a timestamp
and/or version number in its name. User can save current state of a file whenever and access the prior versions in case of needing to backtrack after exiting OS entirely. For now, the list of versions of a certain file will be 3 for memory/storage purposes. If user wants to save the current state of a file as a new version but 3 versions of the file already exist in storage, a message will ask if they want to proceed with overwriting the oldest version in the existing version list (to not require complex algorithms for version tracking just yet = simplified version management) and if yes, the oldest version will be overwritten.

Add flags/commands:
stat -listVersions [textfile.txt]
Description: display a list of all saved versions with their timestamps and access times etc.
stat -viewVersion [version num (1 to 3 only)] [textfile.txt]
or -viewVersion "2024-09-14 12:20:02" [textfile.txt]
Description: allows user to view the selected file version that existed at a specific timestamps
the output would be similar to if we were to say cat textfile.txt. To allow user to copy
functions or implementations they wish they didn't get rid of
stat -saveVersion [textfile.txt]
Description: save the current state of the file as a new version

Files to be added or modified tbd:
Create user/xstat.c: the main implementation of the stat command but defining the additonal flags/commands.
Modify user/user.h: add the new flags/commands that can be used by stat
Modify user/Makefile: to build and include xstat.c
Modify kernel/syscall.h: to define new system calls
Modify syscall.c: to add the new system calls and make sure they'll be handled
Modify sysfile.c: to ensure argument checking of the system calls

Future Implementation:
Add flag/commands: stat -restoreVersion "2024-09-14 12:20:02" [textfile.txt]
or stat -restoreVersion [version num in list] [textfile.txt]
Description: If user totally veered from the original implementation they wanted, they can have the option
to restore whatever version they had.
Extend version storage: Allow for a larger number of versions to be stored in a directory-like structure.
As each version is saved as a separate file with a timestamp in its name in a directory related to the file name,
extend the number of versions that can be kept. 3? 10? 20?
User Configuration: Allow users to set a preference in the maximum number of versions that can be kept or max storage space to use.

@malensek
Copy link
Contributor

This looks good to me, but I'd propose renaming this: the usual stat command outputs a lot of info that xv6 FS doesn't have (permissions, ownership, modification / access times, etc). So instead, I think what you're proposing is a straight up version control or backup program.

You could use the latest lab and last semester's date project to get the date info, and I like the idea of allowing rolling backups to be created automatically. So, I'd remove any usual unix stat related functionality and stick with the vc/backup aspects of your project. This would also mean you don't need to add any system calls (apart from date-related stuff)

@jcmendoza2
Copy link
Author

jcmendoza2 commented Sep 30, 2024

Add vcp command instead of enhance stat command

Changes:

  • removed date time in version saving to allow easier and faster execution for users inputting the version names into the command line
    ex: /vcp -viewVersion “12-2-2002 19:23:33 Version1_filename.txt” is now /vcp -viewVersion Version1_filename.txt
  • removed stat functionality and focused on adding new command: vcp (version control program / rolling backup utility)
  • Files to be added are user/vcp.c, Makefile changes, and testing programs/docs.

@jcmendoza2 jcmendoza2 changed the title Enhance functionality of stat command Add vcp command Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants