Solved

Minix(Unix) recover blocks

Posted on 2003-11-16
6
345 Views
Last Modified: 2012-06-27
I am developing a C code to run on Minix(unix version) that recovers an unused block and guves it a name, the block number should be passed as a argument.

can any one find me a breif example of this being done.
0
Comment
Question by:thegameskeeper
  • 2
  • 2
6 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9777149
>that recovers an unused block and guves it a name
not very sure what you mean by this ? What sort of name ?
0
 

Author Comment

by:thegameskeeper
ID: 9782501
>that recovers an unused block and guves it a name
not very sure what you mean by this ? What sort of name ?

ILL get back to you on this, but on my last question, i have read the superblock and it doesnt do what i wanted, instead of read the file and lseek to the superblock, i think its best to lseek to the zonebitmap, but after i do this what does the information represent there and once again how can i use that for loop
0
 

Author Comment

by:thegameskeeper
ID: 9797911
>that recovers an unused block and guves it a name
not very sure what you mean by this ? What sort of name ?

a regular char *, provided by user, so it can be used as alias
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 9802698
sorry for the late reply ....
>instead of read the file and lseek to the superblock, i think its best to lseek to the zonebitmap
either way is fine ... you should be able to read them in .. thats all that matters

>what does the information represent there
check the documents to confirm that but I think they should be the bitmaps ... and that was what I assumed when I provided the code

>and once again how can i use that for loop
that loop reads in the bitmap 4 bytes at a time ... (use memcpy for this) ... it checks each bit in those 4 bytes and detrmines the status of the block accordingly ...

If the zonemap is not a bitvector, post the format here and I'll help with it

>a regular char *, provided by user, so it can be used as alias
that means you need to maintain a mapping of block number and names ... if the mapping is going to be bid, I would suggest keeping it sorted by block name and use binary search to locate the appropriate block number... you can keep this data in memory if it is not too voluminous ... else you may need to keep this table in a file ...

something like

char * name;
int num;

struct info
{
          char * alias;
          unsigned long block_number;
};

struct info array[MAX_NUMBER_OF_BLOCKS];
...
scanf ( " %s ", name );
scanf ( " %d ", num );
...
/* store sorted */

here you will face a tradeoff --- if you use array, buliding the database of indices will be resource consuming as inserting in the middle of an array will take longer ... If you use linked lists instead, inserting in place will be cheaper (atleast intially ) but later all searches will be sequential ...
you may consider using BST or B trees as alternatives depending on your application and your objectives...

Cheers!
Sunny:o)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to open external drive that have files from MACBook into Windows? 3 88
Windows 10 PRo Upgrade 21 71
Hibernate on windows 10 18 120
Thin secure Windows 10 5 75
Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now