Solved

Minix(Unix) recover blocks

Posted on 2003-11-16
6
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
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.

763 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