Prints 1
Prints 1
Name: Abhinand K R
USN: 1PI07IS002
Class: 5th sem ISE 'A'
*/
#include <iostream>
#include <cstring>
#include <sys/mount.h>
#include <errno.h>
else
{
if( umount( argv[2] ) == -1 )
errorExit( "umount() error\n" );
}
return 0;
}
/*
[abhinand@localhost src]$ su
Password:
[root@localhost src]# g++ mounting.cpp
root@localhost src]# mkdir h1 h2
[root@localhost src]# touch h1/f1.txt
[root@localhost src]# ./a.out h1 h2
[root@localhost src]# ls h1
f1.txt
[root@localhost src]# ls h2
f1.txt
[root@localhost src]# ./a.out -U h2
[root@localhost src]# ls h2
[root@localhost src]#
*/
/*9) Free space management using bitmap.
Name: Abhinand K R
USN: 1PI07IS002
Class: 5th sem ISE 'A'
*/
#include<iostream>
#define BITMAP_SIZE 20
int main()
{
cout << "Bitmap size is " << BITMAP_SIZE << endl;
int i , data[BITMAP_SIZE] , bmp[BITMAP_SIZE] , a[BITMAP_SIZE] , blocks , max , j;
cout << "Enter the free block's number (less than " << BITMAP_SIZE << ") : ";
for(i = 0 ; i < blocks ; i++)
cin >> data[i];
max = data[0];
for(i = 0 ; i < blocks ; i++)
{
if(data[i] > max)
max = data[i];
}
return 0;
}
/*OUTPUT
Bitmap size is 20
Enter the no of free blocks: 12
Enter the free block's number (less than 20) : 12 19 10 3 13 14 16 15 4 5 9 1
Sorted list: 1 3 4 5 9 10 12 13 14 15 16 19