Solved

Minix(Unix) recover blocks

Posted on 2003-11-16
6
343 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 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

21 Experts available now in Live!

Get 1:1 Help Now