Study Guide for Programming Assignment 3 | Operating Systems | COP 4600, Assignments of Operating Systems

Material Type: Assignment; Professor: Ligatti; Class: Operating Systems; Subject: Computer Programming; University: University of South Florida; Term: Fall 2006;

Typology: Assignments

Pre 2010

Uploaded on 09/17/2009

koofers-user-pwh-1
koofers-user-pwh-1 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Operating Systems (COP 4600) [Fall 2006]
Programming Assignment 3
Objectives
1. To become familiar with and implement common components of a file-system API.
2. To understand simple, dynamically updateable access-control policies.
3. To implement an access-control-enforcement mechanism.
Due Date: Sunday, December 3, 2006 (at 11:59pm).
Machine Details
Complete this assignment by yourself on the following CSEE network computers:
Obelix, Epidemix, Geriatrix, Asterix, Panoramix, or Dogmatix. These machines are
physically located in the Center 4 lab (Room 220). Do not use any server machines like
grad, babbage, sunblast, etc. You can connect to these machines from home using SSH.
(Example: Host name: obelix.csee.usf.edu Login ID and Password: <your undergrad
login id and password>) It is your responsibility to ensure that your program compiles
and executes properly on these machines.
Assignment Description
In this assignment, you will implement part of the all-new SFS (simple file system) API.
Your implementation will focus on enforcing access control (i.e., file permissions).
We will assume a simple, static, two-level directory structure. Because the directory
structure is static, we will ignore issues related to creating and deleting files and
directories. The two-level directory has the following format:
In words, there are users labeled u0 to ui, each user has directories labeled d0 to dj, and
each directory has files labeled f0 to fk. The values of i, j, and k are parameters to the file
system’s initialization method. Only one user is logged in at any time, and when a user
ui first logs in, the current directory is /ui/d0/. Hence, this file system uses the ‘/’
character to separate directories. For example, /u2/d0/f5 is a valid absolute filename. For
simplicity, SFS only allows users to have current directories of the form /ui/dj/, and SFS
allows every user to navigate to any directory of that form (even into the directories of
other users).
1
u0 ui
d0 dj
f0 fk
f0 fk
f0 fk
f0 fk
d0 dj
pf3

Partial preview of the text

Download Study Guide for Programming Assignment 3 | Operating Systems | COP 4600 and more Assignments Operating Systems in PDF only on Docsity!

Operating Systems (COP 4600) [Fall 2006]

Programming Assignment 3

Objectives

  1. To become familiar with and implement common components of a file-system API.
  2. To understand simple, dynamically updateable access-control policies.
  3. To implement an access-control-enforcement mechanism. Due Date: Sunday, December 3, 2006 (at 11:59pm). Machine Details Complete this assignment by yourself on the following CSEE network computers: Obelix, Epidemix, Geriatrix, Asterix, Panoramix, or Dogmatix. These machines are physically located in the Center 4 lab (Room 220). Do not use any server machines like grad, babbage, sunblast, etc. You can connect to these machines from home using SSH. (Example: Host name: obelix.csee.usf.edu Login ID and Password: ) It is your responsibility to ensure that your program compiles and executes properly on these machines. Assignment Description In this assignment, you will implement part of the all-new SFS (simple file system) API. Your implementation will focus on enforcing access control (i.e., file permissions). We will assume a simple, static, two-level directory structure. Because the directory structure is static, we will ignore issues related to creating and deleting files and directories. The two-level directory has the following format: In words, there are users labeled u0 to ui, each user has directories labeled d0 to dj, and each directory has files labeled f0 to fk. The values of i, j, and k are parameters to the file system’s initialization method. Only one user is logged in at any time, and when a user ui first logs in, the current directory is /ui/d0/. Hence, this file system uses the ‘/’ character to separate directories. For example, /u2/d0/f5 is a valid absolute filename. For simplicity, SFS only allows users to have current directories of the form /ui/dj/, and SFS allows every user to navigate to any directory of that form (even into the directories of other users). u0 … ui d0 … dj f0 …^ fk f0 …^ fk f0 …^ fk f0 …fk d0 … dj

File permissions consist of three octal digits in a traditional Unix-like format. The first digit grants permissions for the file’s owner (the user in whose directory the file sits), the second digit grants permissions for the file owner’s group (a set of users to which the owner belongs), and the final digit grants permissions for the universe (i.e., all users). Each digit is the sum of at most three numbers: 4, 2, and 1, which correspond to read, write, and execute permissions, respectively. For example, the file permission 751 gives the file’s owner read, write, and execute permissions (because 7 = 4 + 2 + 1), the file owner’s group read and execute permissions (because 5 = 4 + 1), and the universe execute permission (because 1 = 1). As another example, the permission 600 grants the file’s owner permission to read and write the file (because 6 = 4 + 2) but grants no other permissions. All files carry a three-digit permission, and permissions do not get associated with directories. Only the owner u of a file f, and members of u’s current group (when the group is not group zero—see below for further explanation), may change the permissions for f. Again for simplicity, we assume that all files initially have a permission of 700, user u0 is logged in, and the group number for every user is set to zero to indicate that no user is in a group. If a user’s group number is 0, that user belongs to no group; if a user’s group number is greater than 0, that user does belong to a group that may have other members. A user can belong to at most one group. Group-membership information only gets modified through the add2group API method (the source code contains further documentation). Also, group names are static; if the file system is initialized to have m+1 groups then the group names are fixed: g0, g1, ...gm. We have provided a file sfs.c , available at http://www.cse.usf.edu/~ligatti/4600-06/as3/, which contains some global variable declarations, eight unimplemented API methods, and a sample main method (we will grade using a different main method). Your task is to implement the unimplemented methods. In doing so, you should use the provided global variables and create reasonable additional global variables and data structures as needed. The file sfs.c contains further documentation explaining the existing global variables and intended API functionality. You are responsible for implementing the following SFS methods according to the documentation provided in sfs.c :  int sfs_init(int us, int ds, int fs, int gs)  int add2group(int group_num)  int chmod(int file_num, int owner_permission, int group_permission, int universe_permission)  int fopen(int file_num, int mode)  int su(int user_num)  int cd(int user_num, int dir_num)  void pwd()  void whoami()