Define protocol version of {mode,ino,uid,gid}_t
Change-Id: Ia2027749f2ce55a561d19eb895a5618505e9a2ac
This commit is contained in:
parent
c66fd312d4
commit
ab19ece134
|
|
@ -686,7 +686,7 @@ char **clist;
|
||||||
if (input(buf, 80)) ip->i_mode = atoo(buf);
|
if (input(buf, 80)) ip->i_mode = atoo(buf);
|
||||||
printf(" nlinks = %6u", ip->i_nlinks);
|
printf(" nlinks = %6u", ip->i_nlinks);
|
||||||
if (input(buf, 80)) ip->i_nlinks = atol(buf);
|
if (input(buf, 80)) ip->i_nlinks = atol(buf);
|
||||||
printf(" size = %6ld", ip->i_size);
|
printf(" size = %6d", ip->i_size);
|
||||||
if (input(buf, 80)) ip->i_size = atol(buf);
|
if (input(buf, 80)) ip->i_size = atol(buf);
|
||||||
if (yes("Write this back")) {
|
if (yes("Write this back")) {
|
||||||
devwrite(inoblock(ino), inooff(ino), (char *) ip,
|
devwrite(inoblock(ino), inooff(ino), (char *) ip,
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,12 @@ typedef struct {
|
||||||
gid_t vu_sgroups[NGROUPS_MAX];
|
gid_t vu_sgroups[NGROUPS_MAX];
|
||||||
} vfs_ucred_t;
|
} vfs_ucred_t;
|
||||||
|
|
||||||
|
/* Some system types are larger than what the protocol and FSes use */
|
||||||
|
typedef u16_t puid_t; /* Protocol version of uid_t */
|
||||||
|
typedef u16_t pgid_t; /* Protocol version of gid_t */
|
||||||
|
typedef u16_t pmode_t; /* Protocol version of mode_t */
|
||||||
|
typedef u32_t pino_t; /* Protocol version of ino_t */
|
||||||
|
|
||||||
/* Request numbers */
|
/* Request numbers */
|
||||||
#define REQ_GETNODE (VFS_BASE + 1) /* Should be removed */
|
#define REQ_GETNODE (VFS_BASE + 1) /* Should be removed */
|
||||||
#define REQ_PUTNODE (VFS_BASE + 2)
|
#define REQ_PUTNODE (VFS_BASE + 2)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ int fs_putnode(void)
|
||||||
*/
|
*/
|
||||||
struct puffs_node *pn;
|
struct puffs_node *pn;
|
||||||
int count = fs_m_in.REQ_COUNT;
|
int count = fs_m_in.REQ_COUNT;
|
||||||
ino_t inum = fs_m_in.REQ_INODE_NR;
|
pino_t inum = fs_m_in.REQ_INODE_NR;
|
||||||
|
|
||||||
if ((pn = puffs_pn_nodewalk(global_pu, 0, &inum)) == NULL) {
|
if ((pn = puffs_pn_nodewalk(global_pu, 0, &inum)) == NULL) {
|
||||||
/* XXX Probably removed from the list, see puffs_pn_remove() */
|
/* XXX Probably removed from the list, see puffs_pn_remove() */
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ int fs_mountpoint()
|
||||||
*/
|
*/
|
||||||
int r = OK;
|
int r = OK;
|
||||||
struct puffs_node *pn;
|
struct puffs_node *pn;
|
||||||
mode_t bits;
|
pmode_t bits;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX: we assume that lookup was done first, so pnode can be found with
|
* XXX: we assume that lookup was done first, so pnode can be found with
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ int fs_create()
|
||||||
int r;
|
int r;
|
||||||
struct puffs_node *pn_dir;
|
struct puffs_node *pn_dir;
|
||||||
struct puffs_node *pn;
|
struct puffs_node *pn;
|
||||||
mode_t omode;
|
pmode_t omode;
|
||||||
struct puffs_newinfo pni;
|
struct puffs_newinfo pni;
|
||||||
struct puffs_kcn pkcnp;
|
struct puffs_kcn pkcnp;
|
||||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||||
|
|
@ -36,7 +36,7 @@ int fs_create()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read request message */
|
/* Read request message */
|
||||||
omode = (mode_t) fs_m_in.REQ_MODE;
|
omode = (pmode_t) fs_m_in.REQ_MODE;
|
||||||
caller_uid = (uid_t) fs_m_in.REQ_UID;
|
caller_uid = (uid_t) fs_m_in.REQ_UID;
|
||||||
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ int fs_create()
|
||||||
|
|
||||||
memset(&va, 0, sizeof(va));
|
memset(&va, 0, sizeof(va));
|
||||||
va.va_type = VREG;
|
va.va_type = VREG;
|
||||||
va.va_mode = omode;
|
va.va_mode = (mode_t) omode;
|
||||||
va.va_uid = caller_uid;
|
va.va_uid = caller_uid;
|
||||||
va.va_gid = caller_gid;
|
va.va_gid = caller_gid;
|
||||||
va.va_atime = va.va_mtime = va.va_ctime = cur_time;
|
va.va_atime = va.va_mtime = va.va_ctime = cur_time;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ char dot2[3] = ".."; /* permissions for . and .. */
|
||||||
|
|
||||||
static char *get_name(char *name, char string[NAME_MAX+1]);
|
static char *get_name(char *name, char string[NAME_MAX+1]);
|
||||||
static int ltraverse(struct puffs_node *pn, char *suffix);
|
static int ltraverse(struct puffs_node *pn, char *suffix);
|
||||||
static int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
|
static int parse_path(pino_t dir_ino, pino_t root_ino, int flags, struct
|
||||||
puffs_node **res_inop, size_t *offsetp, int *symlinkp);
|
puffs_node **res_inop, size_t *offsetp, int *symlinkp);
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
|
@ -41,14 +41,14 @@ int fs_lookup()
|
||||||
int r, r1, flags, symlinks;
|
int r, r1, flags, symlinks;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
size_t offset = 0, path_size;
|
size_t offset = 0, path_size;
|
||||||
ino_t dir_ino, root_ino;
|
pino_t dir_ino, root_ino;
|
||||||
struct puffs_node *pn;
|
struct puffs_node *pn;
|
||||||
|
|
||||||
grant = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
grant = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
||||||
path_size = (size_t) fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */
|
path_size = (size_t) fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */
|
||||||
len = (int) fs_m_in.REQ_PATH_LEN; /* including terminating nul */
|
len = (int) fs_m_in.REQ_PATH_LEN; /* including terminating nul */
|
||||||
dir_ino = (ino_t) fs_m_in.REQ_DIR_INO;
|
dir_ino = (pino_t) fs_m_in.REQ_DIR_INO;
|
||||||
root_ino = (ino_t) fs_m_in.REQ_ROOT_INO;
|
root_ino = (pino_t) fs_m_in.REQ_ROOT_INO;
|
||||||
flags = (int) fs_m_in.REQ_FLAGS;
|
flags = (int) fs_m_in.REQ_FLAGS;
|
||||||
|
|
||||||
/* Check length. */
|
/* Check length. */
|
||||||
|
|
@ -128,14 +128,14 @@ int fs_lookup()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* parse_path *
|
* parse_path *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
|
static int parse_path(
|
||||||
ino_t dir_ino;
|
pino_t dir_ino,
|
||||||
ino_t root_ino;
|
pino_t root_ino,
|
||||||
int flags;
|
int flags,
|
||||||
struct puffs_node **res_inop;
|
struct puffs_node **res_inop,
|
||||||
size_t *offsetp;
|
size_t *offsetp,
|
||||||
int *symlinkp;
|
int *symlinkp
|
||||||
{
|
) {
|
||||||
/* Parse the path in user_path, starting at dir_ino. If the path is the empty
|
/* Parse the path in user_path, starting at dir_ino. If the path is the empty
|
||||||
* string, just return dir_ino. It is upto the caller to treat an empty
|
* string, just return dir_ino. It is upto the caller to treat an empty
|
||||||
* path in a special way. Otherwise, if the path consists of just one or
|
* path in a special way. Otherwise, if the path consists of just one or
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ int fs_getdents(void)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
register struct puffs_node *pn;
|
register struct puffs_node *pn;
|
||||||
ino_t ino;
|
pino_t ino;
|
||||||
cp_grant_id_t gid;
|
cp_grant_id_t gid;
|
||||||
size_t size, buf_left;
|
size_t size, buf_left;
|
||||||
off_t pos;
|
off_t pos;
|
||||||
|
|
@ -132,8 +132,8 @@ int fs_getdents(void)
|
||||||
size_t written;
|
size_t written;
|
||||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||||
|
|
||||||
ino = (ino_t) fs_m_in.REQ_INODE_NR;
|
ino = (pino_t) fs_m_in.REQ_INODE_NR;
|
||||||
gid = (gid_t) fs_m_in.REQ_GRANT;
|
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
||||||
size = buf_left = (size_t) fs_m_in.REQ_MEM_SIZE;
|
size = buf_left = (size_t) fs_m_in.REQ_MEM_SIZE;
|
||||||
pos = (off_t) fs_m_in.REQ_SEEK_POS_LO;
|
pos = (off_t) fs_m_in.REQ_SEEK_POS_LO;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ int fs_stat()
|
||||||
register struct puffs_node *pn; /* target pnode */
|
register struct puffs_node *pn; /* target pnode */
|
||||||
struct vattr va;
|
struct vattr va;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
mode_t mo;
|
pmode_t mo;
|
||||||
int s;
|
int s;
|
||||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,7 @@ struct inode *init_inode()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* find_inode *
|
* find_inode *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *find_inode(ino_nr)
|
struct inode *find_inode(pino_t ino_nr)
|
||||||
ino_t ino_nr;
|
|
||||||
{
|
{
|
||||||
/* Get an inode based on its inode number. Do not increase its reference count.
|
/* Get an inode based on its inode number. Do not increase its reference count.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ int mask; /* search access mask of the caller */
|
||||||
/* Check whether the given inode may be accessed as directory.
|
/* Check whether the given inode may be accessed as directory.
|
||||||
* Return OK or an appropriate error code.
|
* Return OK or an appropriate error code.
|
||||||
*/
|
*/
|
||||||
mode_t mode;
|
pmode_t mode;
|
||||||
|
|
||||||
assert(attr->a_mask & SFFS_ATTR_MODE);
|
assert(attr->a_mask & SFFS_ATTR_MODE);
|
||||||
|
|
||||||
|
|
@ -194,7 +194,7 @@ int do_lookup()
|
||||||
{
|
{
|
||||||
/* Resolve a path string to an inode.
|
/* Resolve a path string to an inode.
|
||||||
*/
|
*/
|
||||||
ino_t dir_ino_nr, root_ino_nr;
|
pino_t dir_ino_nr, root_ino_nr;
|
||||||
struct inode *cur_ino, *root_ino;
|
struct inode *cur_ino, *root_ino;
|
||||||
struct inode *next_ino = NULL;
|
struct inode *next_ino = NULL;
|
||||||
struct sffs_attr attr;
|
struct sffs_attr attr;
|
||||||
|
|
@ -202,7 +202,7 @@ int do_lookup()
|
||||||
char name[NAME_MAX+1];
|
char name[NAME_MAX+1];
|
||||||
char *ptr, *last;
|
char *ptr, *last;
|
||||||
vfs_ucred_t ucred;
|
vfs_ucred_t ucred;
|
||||||
mode_t mask;
|
pmode_t mask;
|
||||||
size_t len;
|
size_t len;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ void put_handle(struct inode *ino);
|
||||||
|
|
||||||
/* inode.c */
|
/* inode.c */
|
||||||
struct inode *init_inode(void);
|
struct inode *init_inode(void);
|
||||||
struct inode *find_inode(ino_t ino_nr);
|
struct inode *find_inode(pino_t ino_nr);
|
||||||
void get_inode(struct inode *ino);
|
void get_inode(struct inode *ino);
|
||||||
void put_inode(struct inode *ino);
|
void put_inode(struct inode *ino);
|
||||||
void link_inode(struct inode *parent, struct inode *ino);
|
void link_inode(struct inode *parent, struct inode *ino);
|
||||||
|
|
@ -58,7 +58,7 @@ int do_read(void);
|
||||||
int do_getdents(void);
|
int do_getdents(void);
|
||||||
|
|
||||||
/* stat.c */
|
/* stat.c */
|
||||||
mode_t get_mode(struct inode *ino, int mode);
|
pmode_t get_mode(struct inode *ino, int mode);
|
||||||
int do_stat(void);
|
int do_stat(void);
|
||||||
int do_chmod(void);
|
int do_chmod(void);
|
||||||
int do_utime(void);
|
int do_utime(void);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* get_mode *
|
* get_mode *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
mode_t get_mode(ino, mode)
|
pmode_t get_mode(ino, mode)
|
||||||
struct inode *ino;
|
struct inode *ino;
|
||||||
int mode;
|
int mode;
|
||||||
{
|
{
|
||||||
|
|
@ -47,7 +47,7 @@ int do_stat()
|
||||||
struct sffs_attr attr;
|
struct sffs_attr attr;
|
||||||
struct stat stat;
|
struct stat stat;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
ino_t ino_nr;
|
pino_t ino_nr;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
ino_nr = m_in.REQ_INODE_NR;
|
ino_nr = m_in.REQ_INODE_NR;
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,7 @@ struct inode *get_inode_by_index(struct inode *parent, index_t index)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* find_inode *
|
* find_inode *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *find_inode(ino_t num)
|
struct inode *find_inode(pino_t num)
|
||||||
{
|
{
|
||||||
/* Retrieve an inode by inode number.
|
/* Retrieve an inode by inode number.
|
||||||
*/
|
*/
|
||||||
|
|
@ -442,7 +442,7 @@ struct inode *find_inode(ino_t num)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* get_inode *
|
* get_inode *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *get_inode(ino_t num)
|
struct inode *get_inode(pino_t num)
|
||||||
{
|
{
|
||||||
/* Retrieve an inode by inode number, and increase its reference count.
|
/* Retrieve an inode by inode number, and increase its reference count.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ static int access_as_dir(struct inode *node, vfs_ucred_t *ucred)
|
||||||
/* Check whether the given inode may be accessed as directory.
|
/* Check whether the given inode may be accessed as directory.
|
||||||
* Return OK or an appropriate error code.
|
* Return OK or an appropriate error code.
|
||||||
*/
|
*/
|
||||||
mode_t mask;
|
pmode_t mask;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* The inode must be a directory to begin with. */
|
/* The inode must be a directory to begin with. */
|
||||||
|
|
@ -149,7 +149,7 @@ int fs_lookup(void)
|
||||||
{
|
{
|
||||||
/* Resolve a path string to an inode.
|
/* Resolve a path string to an inode.
|
||||||
*/
|
*/
|
||||||
ino_t dir_ino_nr, root_ino_nr;
|
pino_t dir_ino_nr, root_ino_nr;
|
||||||
struct inode *cur_ino, *next_ino, *root_ino;
|
struct inode *cur_ino, *next_ino, *root_ino;
|
||||||
char path[PATH_MAX], name[PNAME_MAX+1];
|
char path[PATH_MAX], name[PNAME_MAX+1];
|
||||||
char *ptr, *last;
|
char *ptr, *last;
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
void init_inodes(unsigned int inodes, struct inode_stat *stat, index_t
|
void init_inodes(unsigned int inodes, struct inode_stat *stat, index_t
|
||||||
nr_indexed_entries);
|
nr_indexed_entries);
|
||||||
void cleanup_inodes(void);
|
void cleanup_inodes(void);
|
||||||
struct inode *find_inode(ino_t num);
|
struct inode *find_inode(pino_t num);
|
||||||
struct inode *get_inode(ino_t num);
|
struct inode *get_inode(pino_t num);
|
||||||
void put_inode(struct inode *node);
|
void put_inode(struct inode *node);
|
||||||
void ref_inode(struct inode *node);
|
void ref_inode(struct inode *node);
|
||||||
int get_inode_number(struct inode *node);
|
int get_inode_number(struct inode *node);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
|
|
||||||
#define SUPER_BLOCK_BYTES (1024) /* bytes offset */
|
#define SUPER_BLOCK_BYTES (1024) /* bytes offset */
|
||||||
|
|
||||||
#define ROOT_INODE ((ino_t) 2) /* inode number for root directory */
|
#define ROOT_INODE ((pino_t) 2) /* inode number for root directory */
|
||||||
#define BOOT_BLOCK ((block_t) 0) /* block number of boot block */
|
#define BOOT_BLOCK ((block_t) 0) /* block number of boot block */
|
||||||
#define START_BLOCK ((block_t) 2) /* first block of FS (not counting SB) */
|
#define START_BLOCK ((block_t) 2) /* first block of FS (not counting SB) */
|
||||||
#define BLOCK_ADDRESS_BYTES 4 /* bytes per address */
|
#define BLOCK_ADDRESS_BYTES 4 /* bytes per address */
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ static void wipe_inode(struct inode *rip);
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* alloc_inode *
|
* alloc_inode *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *alloc_inode(struct inode *parent, mode_t bits)
|
struct inode *alloc_inode(struct inode *parent, pmode_t bits)
|
||||||
{
|
{
|
||||||
/* Allocate a free inode on parent's dev, and return a pointer to it. */
|
/* Allocate a free inode on parent's dev, and return a pointer to it. */
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ struct inode *parent; /* parent of newly allocated inode */
|
||||||
int is_dir; /* inode will be a directory if it is TRUE */
|
int is_dir; /* inode will be a directory if it is TRUE */
|
||||||
{
|
{
|
||||||
int group;
|
int group;
|
||||||
ino_t inumber = NO_BIT;
|
pino_t inumber = NO_BIT;
|
||||||
bit_t bit;
|
bit_t bit;
|
||||||
struct buf *bp;
|
struct buf *bp;
|
||||||
struct group_desc *gd;
|
struct group_desc *gd;
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ int fs_putnode(void)
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
rip = find_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR);
|
rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR);
|
||||||
|
|
||||||
if (!rip) {
|
if (!rip) {
|
||||||
printf("%s:%d put_inode: inode #%u dev: %d not found\n", __FILE__,
|
printf("%s:%d put_inode: inode #%u dev: %d not found\n", __FILE__,
|
||||||
__LINE__, (unsigned int) fs_m_in.REQ_INODE_NR, fs_dev);
|
__LINE__, (pino_t) fs_m_in.REQ_INODE_NR, fs_dev);
|
||||||
panic("fs_putnode failed");
|
panic("fs_putnode failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +120,7 @@ static void unhash_inode(struct inode *node)
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *get_inode(
|
struct inode *get_inode(
|
||||||
dev_t dev, /* device on which inode resides */
|
dev_t dev, /* device on which inode resides */
|
||||||
ino_t numb /* inode number (ANSI: may not be unshort) */
|
pino_t numb /* inode number (ANSI: may not be unshort) */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Find the inode in the hash table. If it is not there, get a free inode
|
/* Find the inode in the hash table. If it is not there, get a free inode
|
||||||
|
|
@ -198,7 +198,7 @@ struct inode *get_inode(
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *find_inode(
|
struct inode *find_inode(
|
||||||
dev_t dev, /* device on which inode resides */
|
dev_t dev, /* device on which inode resides */
|
||||||
ino_t numb /* inode number (ANSI: may not be unshort) */
|
pino_t numb /* inode number (ANSI: may not be unshort) */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Find the inode specified by the inode and device number. */
|
/* Find the inode specified by the inode and device number. */
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ EXTERN struct inode {
|
||||||
|
|
||||||
/* The following items are not present on the disk. */
|
/* The following items are not present on the disk. */
|
||||||
dev_t i_dev; /* which device is the inode on */
|
dev_t i_dev; /* which device is the inode on */
|
||||||
ino_t i_num; /* inode number on its (minor) device */
|
pino_t i_num; /* inode number on its (minor) device */
|
||||||
int i_count; /* # times inode used; 0 means slot is free */
|
int i_count; /* # times inode used; 0 means slot is free */
|
||||||
struct super_block *i_sp; /* pointer to super block for inode's device */
|
struct super_block *i_sp; /* pointer to super block for inode's device */
|
||||||
char i_dirt; /* CLEAN or DIRTY */
|
char i_dirt; /* CLEAN or DIRTY */
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ int fs_unlink()
|
||||||
NUL(string, len, sizeof(string));
|
NUL(string, len, sizeof(string));
|
||||||
|
|
||||||
/* Temporarily open the dir. */
|
/* Temporarily open the dir. */
|
||||||
if( (rldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* The last directory exists. Does the file also exist? */
|
/* The last directory exists. Does the file also exist? */
|
||||||
|
|
@ -191,7 +191,7 @@ int fs_rdlink()
|
||||||
copylen = min( (size_t) fs_m_in.REQ_MEM_SIZE, UMAX_FILE_POS);
|
copylen = min( (size_t) fs_m_in.REQ_MEM_SIZE, UMAX_FILE_POS);
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
if (rip->i_size >= MAX_FAST_SYMLINK_LENGTH) {
|
if (rip->i_size >= MAX_FAST_SYMLINK_LENGTH) {
|
||||||
|
|
@ -271,7 +271,7 @@ char file_name[NAME_MAX + 1]; /* name of file to be removed */
|
||||||
{
|
{
|
||||||
/* Unlink 'file_name'; rip must be the inode of 'file_name' or NULL. */
|
/* Unlink 'file_name'; rip must be the inode of 'file_name' or NULL. */
|
||||||
|
|
||||||
ino_t numb; /* inode number */
|
pino_t numb; /* inode number */
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* If rip is not NULL, it is used to get faster access to the inode. */
|
/* If rip is not NULL, it is used to get faster access to the inode. */
|
||||||
|
|
@ -310,7 +310,7 @@ int fs_rename()
|
||||||
int odir, ndir; /* TRUE iff {old|new} file is dir */
|
int odir, ndir; /* TRUE iff {old|new} file is dir */
|
||||||
int same_pdir = 0; /* TRUE iff parent dirs are the same */
|
int same_pdir = 0; /* TRUE iff parent dirs are the same */
|
||||||
char old_name[NAME_MAX + 1], new_name[NAME_MAX + 1];
|
char old_name[NAME_MAX + 1], new_name[NAME_MAX + 1];
|
||||||
ino_t numb;
|
pino_t numb;
|
||||||
phys_bytes len;
|
phys_bytes len;
|
||||||
|
|
||||||
/* Copy the last component of the old name */
|
/* Copy the last component of the old name */
|
||||||
|
|
@ -334,7 +334,7 @@ int fs_rename()
|
||||||
NUL(new_name, len, sizeof(new_name));
|
NUL(new_name, len, sizeof(new_name));
|
||||||
|
|
||||||
/* Get old dir inode */
|
/* Get old dir inode */
|
||||||
if( (old_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_OLD_DIR)) == NULL)
|
if( (old_dirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_REN_OLD_DIR)) == NULL)
|
||||||
return(err_code);
|
return(err_code);
|
||||||
|
|
||||||
old_ip = advance(old_dirp, old_name, IGN_PERM);
|
old_ip = advance(old_dirp, old_name, IGN_PERM);
|
||||||
|
|
@ -350,12 +350,12 @@ int fs_rename()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get new dir inode */
|
/* Get new dir inode */
|
||||||
if( (new_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL) {
|
if ((new_dirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL){
|
||||||
put_inode(old_ip);
|
put_inode(old_ip);
|
||||||
put_inode(old_dirp);
|
put_inode(old_dirp);
|
||||||
return(err_code);
|
return(err_code);
|
||||||
} else {
|
} else {
|
||||||
if (new_dirp->i_links_count == NO_LINK) { /* Dir does not actually exist */
|
if (new_dirp->i_links_count == NO_LINK) { /* Dir does not exist */
|
||||||
put_inode(old_ip);
|
put_inode(old_ip);
|
||||||
put_inode(old_dirp);
|
put_inode(old_dirp);
|
||||||
put_inode(new_dirp);
|
put_inode(new_dirp);
|
||||||
|
|
@ -482,9 +482,10 @@ int fs_rename()
|
||||||
} else {
|
} else {
|
||||||
r = search_dir(new_dirp, new_name, &numb, ENTER, IGN_PERM,
|
r = search_dir(new_dirp, new_name, &numb, ENTER, IGN_PERM,
|
||||||
old_ip->i_mode & I_TYPE);
|
old_ip->i_mode & I_TYPE);
|
||||||
if(r == OK)
|
if(r == OK) {
|
||||||
(void) search_dir(old_dirp, old_name, (ino_t *) 0, DELETE,
|
(void) search_dir(old_dirp, old_name, (pino_t *) 0,
|
||||||
IGN_PERM, 0);
|
DELETE, IGN_PERM, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If r is OK, the ctime and mtime of old_dirp and new_dirp have been marked
|
/* If r is OK, the ctime and mtime of old_dirp and new_dirp have been marked
|
||||||
|
|
@ -519,7 +520,7 @@ int fs_ftrunc(void)
|
||||||
off_t start, end;
|
off_t start, end;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if( (rip = find_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
start = fs_m_in.REQ_TRC_START_LO;
|
start = fs_m_in.REQ_TRC_START_LO;
|
||||||
|
|
@ -550,7 +551,7 @@ off_t newsize; /* inode must become this size */
|
||||||
* writing is done.
|
* writing is done.
|
||||||
*/
|
*/
|
||||||
int r;
|
int r;
|
||||||
mode_t file_type;
|
pmode_t file_type;
|
||||||
|
|
||||||
discard_preallocated_blocks(rip);
|
discard_preallocated_blocks(rip);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ int fs_mountpoint()
|
||||||
*/
|
*/
|
||||||
register struct inode *rip;
|
register struct inode *rip;
|
||||||
int r = OK;
|
int r = OK;
|
||||||
mode_t bits;
|
pmode_t bits;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
#include "super.h"
|
#include "super.h"
|
||||||
#include <minix/vfsif.h>
|
#include <minix/vfsif.h>
|
||||||
|
|
||||||
static struct inode *new_node(struct inode *ldirp, char *string, mode_t
|
static struct inode *new_node(struct inode *ldirp, char *string, pmode_t
|
||||||
bits, block_t z0);
|
bits, block_t z0);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -25,11 +25,11 @@ int fs_create()
|
||||||
int r;
|
int r;
|
||||||
struct inode *ldirp;
|
struct inode *ldirp;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
mode_t omode;
|
pmode_t omode;
|
||||||
char lastc[NAME_MAX + 1];
|
char lastc[NAME_MAX + 1];
|
||||||
|
|
||||||
/* Read request message */
|
/* Read request message */
|
||||||
omode = (mode_t) fs_m_in.REQ_MODE;
|
omode = (pmode_t) fs_m_in.REQ_MODE;
|
||||||
caller_uid = (uid_t) fs_m_in.REQ_UID;
|
caller_uid = (uid_t) fs_m_in.REQ_UID;
|
||||||
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ int fs_create()
|
||||||
NUL(lastc, len, sizeof(lastc));
|
NUL(lastc, len, sizeof(lastc));
|
||||||
|
|
||||||
/* Get last directory inode (i.e., directory that will hold the new inode) */
|
/* Get last directory inode (i.e., directory that will hold the new inode) */
|
||||||
if ((ldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if ((ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(ENOENT);
|
return(ENOENT);
|
||||||
|
|
||||||
/* Create a new inode by calling new_node(). */
|
/* Create a new inode by calling new_node(). */
|
||||||
|
|
@ -99,11 +99,11 @@ int fs_mknod()
|
||||||
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
||||||
|
|
||||||
/* Get last directory inode */
|
/* Get last directory inode */
|
||||||
if((ldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if((ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(ENOENT);
|
return(ENOENT);
|
||||||
|
|
||||||
/* Try to create the new node */
|
/* Try to create the new node */
|
||||||
ip = new_node(ldirp, lastc, (mode_t) fs_m_in.REQ_MODE,
|
ip = new_node(ldirp, lastc, (pmode_t) fs_m_in.REQ_MODE,
|
||||||
(block_t) fs_m_in.REQ_DEV);
|
(block_t) fs_m_in.REQ_DEV);
|
||||||
|
|
||||||
put_inode(ip);
|
put_inode(ip);
|
||||||
|
|
@ -118,7 +118,7 @@ int fs_mknod()
|
||||||
int fs_mkdir()
|
int fs_mkdir()
|
||||||
{
|
{
|
||||||
int r1, r2; /* status codes */
|
int r1, r2; /* status codes */
|
||||||
ino_t dot, dotdot; /* inode numbers for . and .. */
|
pino_t dot, dotdot; /* inode numbers for . and .. */
|
||||||
struct inode *rip, *ldirp;
|
struct inode *rip, *ldirp;
|
||||||
char lastc[NAME_MAX + 1]; /* last component */
|
char lastc[NAME_MAX + 1]; /* last component */
|
||||||
phys_bytes len;
|
phys_bytes len;
|
||||||
|
|
@ -137,11 +137,11 @@ int fs_mkdir()
|
||||||
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
||||||
|
|
||||||
/* Get last directory inode */
|
/* Get last directory inode */
|
||||||
if((ldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if((ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(ENOENT);
|
return(ENOENT);
|
||||||
|
|
||||||
/* Next make the inode. If that fails, return error code. */
|
/* Next make the inode. If that fails, return error code. */
|
||||||
rip = new_node(ldirp, lastc, (ino_t) fs_m_in.REQ_MODE, (block_t) 0);
|
rip = new_node(ldirp, lastc, (pino_t) fs_m_in.REQ_MODE, (block_t) 0);
|
||||||
|
|
||||||
if(rip == NULL || err_code == EEXIST) {
|
if(rip == NULL || err_code == EEXIST) {
|
||||||
put_inode(rip); /* can't make dir: it already exists */
|
put_inode(rip); /* can't make dir: it already exists */
|
||||||
|
|
@ -155,7 +155,7 @@ int fs_mkdir()
|
||||||
|
|
||||||
/* Now make dir entries for . and .. unless the disk is completely full. */
|
/* Now make dir entries for . and .. unless the disk is completely full. */
|
||||||
/* Use dot1 and dot2, so the mode of the directory isn't important. */
|
/* Use dot1 and dot2, so the mode of the directory isn't important. */
|
||||||
rip->i_mode = (mode_t) fs_m_in.REQ_MODE; /* set mode */
|
rip->i_mode = (pmode_t) fs_m_in.REQ_MODE; /* set mode */
|
||||||
/* enter . in the new dir*/
|
/* enter . in the new dir*/
|
||||||
r1 = search_dir(rip, dot1, &dot, ENTER, IGN_PERM, I_DIRECTORY);
|
r1 = search_dir(rip, dot1, &dot, ENTER, IGN_PERM, I_DIRECTORY);
|
||||||
/* enter .. in the new dir */
|
/* enter .. in the new dir */
|
||||||
|
|
@ -209,11 +209,11 @@ int fs_slink()
|
||||||
NUL(string, len, sizeof(string));
|
NUL(string, len, sizeof(string));
|
||||||
|
|
||||||
/* Temporarily open the dir. */
|
/* Temporarily open the dir. */
|
||||||
if( (ldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* Create the inode for the symlink. */
|
/* Create the inode for the symlink. */
|
||||||
sip = new_node(ldirp, string, (mode_t) (I_SYMBOLIC_LINK | RWX_MODES),
|
sip = new_node(ldirp, string, (pmode_t) (I_SYMBOLIC_LINK | RWX_MODES),
|
||||||
(block_t) 0);
|
(block_t) 0);
|
||||||
|
|
||||||
/* If we can then create fast symlink (store it in inode),
|
/* If we can then create fast symlink (store it in inode),
|
||||||
|
|
@ -278,7 +278,7 @@ int fs_slink()
|
||||||
* new_node *
|
* new_node *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static struct inode *new_node(struct inode *ldirp,
|
static struct inode *new_node(struct inode *ldirp,
|
||||||
char *string, mode_t bits, block_t b0)
|
char *string, pmode_t bits, block_t b0)
|
||||||
{
|
{
|
||||||
/* New_node() is called by fs_open(), fs_mknod(), and fs_mkdir().
|
/* New_node() is called by fs_open(), fs_mknod(), and fs_mkdir().
|
||||||
* In all cases it allocates a new inode, makes a directory entry for it in
|
* In all cases it allocates a new inode, makes a directory entry for it in
|
||||||
|
|
@ -355,7 +355,7 @@ int fs_inhibread()
|
||||||
{
|
{
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
|
|
||||||
if((rip = find_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if((rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* inhibit read ahead */
|
/* inhibit read ahead */
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ char dot2[3] = ".."; /* permissions for . and .. */
|
||||||
|
|
||||||
static char *get_name(char *name, char string[NAME_MAX+1]);
|
static char *get_name(char *name, char string[NAME_MAX+1]);
|
||||||
static int ltraverse(struct inode *rip, char *suffix);
|
static int ltraverse(struct inode *rip, char *suffix);
|
||||||
static int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
|
static int parse_path(pino_t dir_ino, pino_t root_ino, int flags, struct
|
||||||
inode **res_inop, size_t *offsetp, int *symlinkp);
|
inode **res_inop, size_t *offsetp, int *symlinkp);
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
|
@ -41,14 +41,14 @@ int fs_lookup()
|
||||||
int r, r1, flags, symlinks;
|
int r, r1, flags, symlinks;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
size_t offset = 0, path_size;
|
size_t offset = 0, path_size;
|
||||||
ino_t dir_ino, root_ino;
|
pino_t dir_ino, root_ino;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
|
|
||||||
grant = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
grant = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
||||||
path_size = (size_t) fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */
|
path_size = (size_t) fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */
|
||||||
len = (int) fs_m_in.REQ_PATH_LEN; /* including terminating nul */
|
len = (int) fs_m_in.REQ_PATH_LEN; /* including terminating nul */
|
||||||
dir_ino = (ino_t) fs_m_in.REQ_DIR_INO;
|
dir_ino = (pino_t) fs_m_in.REQ_DIR_INO;
|
||||||
root_ino = (ino_t) fs_m_in.REQ_ROOT_INO;
|
root_ino = (pino_t) fs_m_in.REQ_ROOT_INO;
|
||||||
flags = (int) fs_m_in.REQ_FLAGS;
|
flags = (int) fs_m_in.REQ_FLAGS;
|
||||||
|
|
||||||
/* Check length. */
|
/* Check length. */
|
||||||
|
|
@ -122,8 +122,8 @@ int fs_lookup()
|
||||||
* parse_path *
|
* parse_path *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
|
static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
|
||||||
ino_t dir_ino;
|
pino_t dir_ino;
|
||||||
ino_t root_ino;
|
pino_t root_ino;
|
||||||
int flags;
|
int flags;
|
||||||
struct inode **res_inop;
|
struct inode **res_inop;
|
||||||
size_t *offsetp;
|
size_t *offsetp;
|
||||||
|
|
@ -371,7 +371,7 @@ int chk_perm; /* check permissions when string is looked up*/
|
||||||
* the directory, find the inode, open it, and return a pointer to its inode
|
* the directory, find the inode, open it, and return a pointer to its inode
|
||||||
* slot.
|
* slot.
|
||||||
*/
|
*/
|
||||||
ino_t numb;
|
pino_t numb;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
|
|
||||||
/* If 'string' is empty, return an error. */
|
/* If 'string' is empty, return an error. */
|
||||||
|
|
@ -484,7 +484,7 @@ char string[NAME_MAX+1]; /* component extracted from 'old_name' */
|
||||||
int search_dir(ldir_ptr, string, numb, flag, check_permissions, ftype)
|
int search_dir(ldir_ptr, string, numb, flag, check_permissions, ftype)
|
||||||
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
|
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
|
||||||
const char string[NAME_MAX + 1]; /* component to search for */
|
const char string[NAME_MAX + 1]; /* component to search for */
|
||||||
ino_t *numb; /* pointer to inode number */
|
pino_t *numb; /* pointer to inode number */
|
||||||
int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
||||||
int check_permissions; /* check permissions when flag is !IS_EMPTY */
|
int check_permissions; /* check permissions when flag is !IS_EMPTY */
|
||||||
int ftype; /* used when ENTER and
|
int ftype; /* used when ENTER and
|
||||||
|
|
@ -503,7 +503,7 @@ int ftype; /* used when ENTER and
|
||||||
register struct ext2_disk_dir_desc *prev_dp = NULL;
|
register struct ext2_disk_dir_desc *prev_dp = NULL;
|
||||||
register struct buf *bp = NULL;
|
register struct buf *bp = NULL;
|
||||||
int i, r, e_hit, t, match;
|
int i, r, e_hit, t, match;
|
||||||
mode_t bits;
|
pmode_t bits;
|
||||||
off_t pos;
|
off_t pos;
|
||||||
unsigned new_slots;
|
unsigned new_slots;
|
||||||
int extended = 0;
|
int extended = 0;
|
||||||
|
|
@ -577,10 +577,10 @@ int ftype; /* used when ENTER and
|
||||||
r = OK;
|
r = OK;
|
||||||
if (flag == IS_EMPTY) r = ENOTEMPTY;
|
if (flag == IS_EMPTY) r = ENOTEMPTY;
|
||||||
else if (flag == DELETE) {
|
else if (flag == DELETE) {
|
||||||
if (dp->d_name_len >= sizeof(ino_t)) {
|
if (dp->d_name_len >= sizeof(pino_t)) {
|
||||||
/* Save d_ino for recovery. */
|
/* Save d_ino for recovery. */
|
||||||
t = dp->d_name_len - sizeof(ino_t);
|
t = dp->d_name_len - sizeof(pino_t);
|
||||||
*((ino_t *) &dp->d_name[t]) = dp->d_ino;
|
*((pino_t *) &dp->d_name[t])= dp->d_ino;
|
||||||
}
|
}
|
||||||
dp->d_ino = NO_ENTRY; /* erase entry */
|
dp->d_ino = NO_ENTRY; /* erase entry */
|
||||||
lmfs_markdirty(bp);
|
lmfs_markdirty(bp);
|
||||||
|
|
@ -620,7 +620,7 @@ int ftype; /* used when ENTER and
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* 'flag' is LOOK_UP */
|
/* 'flag' is LOOK_UP */
|
||||||
*numb = (ino_t) conv4(le_CPU, dp->d_ino);
|
*numb = (pino_t) conv4(le_CPU, dp->d_ino);
|
||||||
}
|
}
|
||||||
assert(lmfs_dev(bp) != NO_DEV);
|
assert(lmfs_dev(bp) != NO_DEV);
|
||||||
put_block(bp, DIRECTORY_BLOCK);
|
put_block(bp, DIRECTORY_BLOCK);
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,12 @@ int fs_chmod()
|
||||||
/* Perform the chmod(name, mode) system call. */
|
/* Perform the chmod(name, mode) system call. */
|
||||||
|
|
||||||
register struct inode *rip;
|
register struct inode *rip;
|
||||||
mode_t mode;
|
pmode_t mode;
|
||||||
|
|
||||||
mode = (mode_t) fs_m_in.REQ_MODE;
|
mode = (pmode_t) fs_m_in.REQ_MODE;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* Now make the change. Clear setgid bit if file is not in caller's grp */
|
/* Now make the change. Clear setgid bit if file is not in caller's grp */
|
||||||
|
|
@ -48,7 +48,7 @@ int fs_chown()
|
||||||
register int r;
|
register int r;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* Not permitted to change the owner of a file on a read-only file sys. */
|
/* Not permitted to change the owner of a file on a read-only file sys. */
|
||||||
|
|
@ -72,7 +72,7 @@ int fs_chown()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* forbidden *
|
* forbidden *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
int forbidden(register struct inode *rip, mode_t access_desired)
|
int forbidden(register struct inode *rip, pmode_t access_desired)
|
||||||
{
|
{
|
||||||
/* Given a pointer to an inode, 'rip', and the access desired, determine
|
/* Given a pointer to an inode, 'rip', and the access desired, determine
|
||||||
* if the access is allowed, and if not why not. The routine looks up the
|
* if the access is allowed, and if not why not. The routine looks up the
|
||||||
|
|
@ -81,7 +81,7 @@ int forbidden(register struct inode *rip, mode_t access_desired)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
register struct inode *old_rip = rip;
|
register struct inode *old_rip = rip;
|
||||||
register mode_t bits, perm_bits;
|
register pmode_t bits, perm_bits;
|
||||||
int r, shift;
|
int r, shift;
|
||||||
|
|
||||||
/* Isolate the relevant rwx bits from the mode. */
|
/* Isolate the relevant rwx bits from the mode. */
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,15 @@ block_t alloc_block(struct inode *rip, block_t goal);
|
||||||
void free_block(struct super_block *sp, bit_t bit);
|
void free_block(struct super_block *sp, bit_t bit);
|
||||||
|
|
||||||
/* ialloc.c */
|
/* ialloc.c */
|
||||||
struct inode *alloc_inode(struct inode *parent, mode_t bits);
|
struct inode *alloc_inode(struct inode *parent, pmode_t bits);
|
||||||
void free_inode(struct inode *rip);
|
void free_inode(struct inode *rip);
|
||||||
|
|
||||||
/* inode.c */
|
/* inode.c */
|
||||||
void dup_inode(struct inode *ip);
|
void dup_inode(struct inode *ip);
|
||||||
struct inode *find_inode(dev_t dev, ino_t numb);
|
struct inode *find_inode(dev_t dev, pino_t numb);
|
||||||
int fs_putnode(void);
|
int fs_putnode(void);
|
||||||
void init_inode_cache(void);
|
void init_inode_cache(void);
|
||||||
struct inode *get_inode(dev_t dev, ino_t numb);
|
struct inode *get_inode(dev_t dev, pino_t numb);
|
||||||
void put_inode(struct inode *rip);
|
void put_inode(struct inode *rip);
|
||||||
void update_times(struct inode *rip);
|
void update_times(struct inode *rip);
|
||||||
void rw_inode(struct inode *rip, int rw_flag);
|
void rw_inode(struct inode *rip, int rw_flag);
|
||||||
|
|
@ -62,14 +62,14 @@ int fs_slink(void);
|
||||||
int fs_lookup(void);
|
int fs_lookup(void);
|
||||||
struct inode *advance(struct inode *dirp, char string[NAME_MAX + 1], int
|
struct inode *advance(struct inode *dirp, char string[NAME_MAX + 1], int
|
||||||
chk_perm);
|
chk_perm);
|
||||||
int search_dir(struct inode *ldir_ptr, const char string [NAME_MAX + 1], ino_t
|
int search_dir(struct inode *ldir_ptr, const char string [NAME_MAX + 1], pino_t
|
||||||
*numb, int flag, int check_permissions, int ftype);
|
*numb, int flag, int check_permissions, int ftype);
|
||||||
|
|
||||||
/* protect.c */
|
/* protect.c */
|
||||||
int fs_chmod(void);
|
int fs_chmod(void);
|
||||||
int fs_chown(void);
|
int fs_chown(void);
|
||||||
int fs_getdents(void);
|
int fs_getdents(void);
|
||||||
int forbidden(struct inode *rip, mode_t access_desired);
|
int forbidden(struct inode *rip, pmode_t access_desired);
|
||||||
int read_only(struct inode *ip);
|
int read_only(struct inode *ip);
|
||||||
|
|
||||||
/* read.c */
|
/* read.c */
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ int fs_readwrite(void)
|
||||||
cp_grant_id_t gid;
|
cp_grant_id_t gid;
|
||||||
off_t position, f_size, bytes_left;
|
off_t position, f_size, bytes_left;
|
||||||
unsigned int off, cum_io, block_size, chunk;
|
unsigned int off, cum_io, block_size, chunk;
|
||||||
mode_t mode_word;
|
pmode_t mode_word;
|
||||||
int completed;
|
int completed;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
size_t nrbytes;
|
size_t nrbytes;
|
||||||
|
|
@ -44,7 +44,7 @@ int fs_readwrite(void)
|
||||||
r = OK;
|
r = OK;
|
||||||
|
|
||||||
/* Find the inode referred */
|
/* Find the inode referred */
|
||||||
if ((rip = find_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if ((rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
mode_word = rip->i_mode & I_TYPE;
|
mode_word = rip->i_mode & I_TYPE;
|
||||||
|
|
@ -621,7 +621,7 @@ int fs_getdents(void)
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
int o, r, done;
|
int o, r, done;
|
||||||
unsigned int block_size, len, reclen;
|
unsigned int block_size, len, reclen;
|
||||||
ino_t ino;
|
pino_t ino;
|
||||||
cp_grant_id_t gid;
|
cp_grant_id_t gid;
|
||||||
size_t size, tmpbuf_off, userbuf_off;
|
size_t size, tmpbuf_off, userbuf_off;
|
||||||
off_t pos, off, block_pos, new_pos, ent_pos;
|
off_t pos, off, block_pos, new_pos, ent_pos;
|
||||||
|
|
@ -629,8 +629,8 @@ int fs_getdents(void)
|
||||||
struct ext2_disk_dir_desc *d_desc;
|
struct ext2_disk_dir_desc *d_desc;
|
||||||
struct dirent *dep;
|
struct dirent *dep;
|
||||||
|
|
||||||
ino = (ino_t) fs_m_in.REQ_INODE_NR;
|
ino = (pino_t) fs_m_in.REQ_INODE_NR;
|
||||||
gid = (gid_t) fs_m_in.REQ_GRANT;
|
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
||||||
size = (size_t) fs_m_in.REQ_MEM_SIZE;
|
size = (size_t) fs_m_in.REQ_MEM_SIZE;
|
||||||
pos = (off_t) fs_m_in.REQ_SEEK_POS_LO;
|
pos = (off_t) fs_m_in.REQ_SEEK_POS_LO;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ static int stat_inode(
|
||||||
/* Common code for stat and fstat system calls. */
|
/* Common code for stat and fstat system calls. */
|
||||||
|
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
mode_t mo;
|
pmode_t mo;
|
||||||
int r, s;
|
int r, s;
|
||||||
|
|
||||||
/* Update the atime, ctime, and mtime fields in the inode, if need be. */
|
/* Update the atime, ctime, and mtime fields in the inode, if need be. */
|
||||||
|
|
@ -90,7 +90,7 @@ int fs_stat()
|
||||||
register int r; /* return value */
|
register int r; /* return value */
|
||||||
register struct inode *rip; /* target inode */
|
register struct inode *rip; /* target inode */
|
||||||
|
|
||||||
if ((rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if ((rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
r = stat_inode(rip, fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT);
|
r = stat_inode(rip, fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ int fs_utime()
|
||||||
register int r;
|
register int r;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ struct dir_record *get_free_dir_record(void)
|
||||||
* get_dir_record *
|
* get_dir_record *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct dir_record *get_dir_record(id_dir_record)
|
struct dir_record *get_dir_record(id_dir_record)
|
||||||
ino_t id_dir_record;
|
pino_t id_dir_record;
|
||||||
{
|
{
|
||||||
struct dir_record *dir = NULL;
|
struct dir_record *dir = NULL;
|
||||||
u32_t address;
|
u32_t address;
|
||||||
|
|
@ -209,8 +209,8 @@ u32_t address;
|
||||||
|
|
||||||
/* Set physical address of the dir record */
|
/* Set physical address of the dir record */
|
||||||
dir->d_phy_addr = address;
|
dir->d_phy_addr = address;
|
||||||
dir->d_ino_nr = (ino_t) address; /* u32_t e ino_t are the same datatype so
|
dir->d_ino_nr = (pino_t) address; /* u32_t e ino_t are the same datatype so
|
||||||
* the cast is safe */
|
* the cast is safe */
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ struct dir_record {
|
||||||
|
|
||||||
/* Memory attrs */
|
/* Memory attrs */
|
||||||
u8_t d_count; /* Count if the dir_record is in use or not */
|
u8_t d_count; /* Count if the dir_record is in use or not */
|
||||||
mode_t d_mode; /* file type, protection, etc. */
|
pmode_t d_mode; /* file type, protection, etc. */
|
||||||
/* struct hash_idi_entry *id; */ /* id associated */
|
/* struct hash_idi_entry *id; */ /* id associated */
|
||||||
u32_t d_phy_addr; /* physical address of this dir record */
|
u32_t d_phy_addr; /* physical address of this dir record */
|
||||||
ino_t d_ino_nr; /* inode number (identical to the address) */
|
pino_t d_ino_nr; /* inode number (identical to the address) */
|
||||||
char d_mountpoint; /* true if mounted on */
|
char d_mountpoint; /* true if mounted on */
|
||||||
struct dir_record *d_next; /* In case the file consists in more file sections
|
struct dir_record *d_next; /* In case the file consists in more file sections
|
||||||
this points to the next one */
|
this points to the next one */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include "buf.h"
|
#include "buf.h"
|
||||||
|
|
||||||
static char *get_name(char *name, char string[NAME_MAX+1]);
|
static char *get_name(char *name, char string[NAME_MAX+1]);
|
||||||
static int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
|
static int parse_path(pino_t dir_ino, pino_t root_ino, int flags, struct
|
||||||
dir_record **res_inop, size_t *offsetp);
|
dir_record **res_inop, size_t *offsetp);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -17,16 +17,16 @@ int fs_lookup() {
|
||||||
cp_grant_id_t grant;
|
cp_grant_id_t grant;
|
||||||
int r, len, flags;
|
int r, len, flags;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
ino_t dir_ino, root_ino;
|
pino_t dir_ino, root_ino;
|
||||||
struct dir_record *dir;
|
struct dir_record *dir;
|
||||||
|
|
||||||
grant = fs_m_in.REQ_GRANT;
|
grant = fs_m_in.REQ_GRANT;
|
||||||
len = fs_m_in.REQ_PATH_LEN; /* including terminating nul */
|
len = fs_m_in.REQ_PATH_LEN; /* including terminating nul */
|
||||||
dir_ino = fs_m_in.REQ_DIR_INO;
|
dir_ino = (pino_t) fs_m_in.REQ_DIR_INO;
|
||||||
root_ino = fs_m_in.REQ_ROOT_INO;
|
root_ino = (pino_t) fs_m_in.REQ_ROOT_INO;
|
||||||
flags = fs_m_in.REQ_FLAGS;
|
flags = fs_m_in.REQ_FLAGS;
|
||||||
caller_uid = fs_m_in.REQ_UID;
|
caller_uid = (uid_t) fs_m_in.REQ_UID;
|
||||||
caller_gid = fs_m_in.REQ_GID;
|
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
||||||
|
|
||||||
/* Check length. */
|
/* Check length. */
|
||||||
if(len > sizeof(user_path)) return(E2BIG); /* too big for buffer */
|
if(len > sizeof(user_path)) return(E2BIG); /* too big for buffer */
|
||||||
|
|
@ -80,11 +80,11 @@ int fs_lookup() {
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* search_dir *
|
* search_dir *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
int search_dir(ldir_ptr,string,numb)
|
int search_dir(
|
||||||
register struct dir_record *ldir_ptr; /* dir record parent */
|
register struct dir_record *ldir_ptr, /* dir record parent */
|
||||||
char string[NAME_MAX]; /* component to search for */
|
char string[NAME_MAX], /* component to search for */
|
||||||
ino_t *numb; /* pointer to new dir record */
|
pino_t *numb /* pointer to new dir record */
|
||||||
{
|
) {
|
||||||
struct dir_record *dir_tmp;
|
struct dir_record *dir_tmp;
|
||||||
register struct buf *bp;
|
register struct buf *bp;
|
||||||
int pos;
|
int pos;
|
||||||
|
|
@ -126,7 +126,7 @@ int search_dir(ldir_ptr,string,numb)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (create_dir_record(dir_tmp,b_data(bp) + pos,
|
if (create_dir_record(dir_tmp,b_data(bp) + pos,
|
||||||
ldir_ptr->loc_extent_l*v_pri.logical_block_size_l + pos) == EINVAL)
|
ldir_ptr->loc_extent_l*v_pri.logical_block_size_l + pos) == EINVAL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
if (dir_tmp->length == 0) {
|
if (dir_tmp->length == 0) {
|
||||||
|
|
@ -182,13 +182,13 @@ int search_dir(ldir_ptr,string,numb)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* parse_path *
|
* parse_path *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp)
|
static int parse_path(
|
||||||
ino_t dir_ino;
|
pino_t dir_ino,
|
||||||
ino_t root_ino;
|
pino_t root_ino,
|
||||||
int flags;
|
int flags,
|
||||||
struct dir_record **res_inop;
|
struct dir_record **res_inop,
|
||||||
size_t *offsetp;
|
size_t *offsetp
|
||||||
{
|
) {
|
||||||
int r;
|
int r;
|
||||||
char string[NAME_MAX+1];
|
char string[NAME_MAX+1];
|
||||||
char *cp, *ncp;
|
char *cp, *ncp;
|
||||||
|
|
@ -293,7 +293,7 @@ struct dir_record **resp; /* resulting inode */
|
||||||
|
|
||||||
register struct dir_record *rip = NULL;
|
register struct dir_record *rip = NULL;
|
||||||
int r;
|
int r;
|
||||||
ino_t numb;
|
pino_t numb;
|
||||||
|
|
||||||
/* If 'string' is empty, yield same inode straight away. */
|
/* If 'string' is empty, yield same inode straight away. */
|
||||||
if (string[0] == '\0') {
|
if (string[0] == '\0') {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ int create_dir_record(struct dir_record *dir, char *buffer, u32_t
|
||||||
int create_ext_attr(struct ext_attr_rec *ext, char *buffer);
|
int create_ext_attr(struct ext_attr_rec *ext, char *buffer);
|
||||||
int fs_getnode(void);
|
int fs_getnode(void);
|
||||||
int fs_putnode(void);
|
int fs_putnode(void);
|
||||||
struct dir_record *get_dir_record(ino_t id_dir);
|
struct dir_record *get_dir_record(pino_t id_dir);
|
||||||
struct dir_record *get_free_dir_record(void);
|
struct dir_record *get_free_dir_record(void);
|
||||||
struct ext_attr_rec *get_free_ext_attr(void);
|
struct ext_attr_rec *get_free_ext_attr(void);
|
||||||
struct dir_record *load_dir_record_from_disk(u32_t address);
|
struct dir_record *load_dir_record_from_disk(u32_t address);
|
||||||
|
|
@ -38,8 +38,7 @@ int fs_unmount(void);
|
||||||
int fs_lookup(void);
|
int fs_lookup(void);
|
||||||
int advance(struct dir_record *dirp, char string[NAME_MAX], struct
|
int advance(struct dir_record *dirp, char string[NAME_MAX], struct
|
||||||
dir_record **resp);
|
dir_record **resp);
|
||||||
int search_dir(struct dir_record *ldir_ptr, char string [NAME_MAX],
|
int search_dir(struct dir_record *ldir_ptr,char string [NAME_MAX],pino_t *numb);
|
||||||
ino_t *numb);
|
|
||||||
|
|
||||||
/* protect.c */
|
/* protect.c */
|
||||||
int fs_access(void);
|
int fs_access(void);
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ int fs_bread(void)
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
int fs_getdents(void) {
|
int fs_getdents(void) {
|
||||||
struct dir_record *dir;
|
struct dir_record *dir;
|
||||||
ino_t ino;
|
pino_t ino;
|
||||||
cp_grant_id_t gid;
|
cp_grant_id_t gid;
|
||||||
size_t block_size;
|
size_t block_size;
|
||||||
off_t pos, block_pos, block, cur_pos, tmpbuf_offset, userbuf_off;
|
off_t pos, block_pos, block, cur_pos, tmpbuf_offset, userbuf_off;
|
||||||
|
|
@ -246,7 +246,7 @@ int fs_getdents(void) {
|
||||||
/* The standard data structure is created using the
|
/* The standard data structure is created using the
|
||||||
* data in the buffer. */
|
* data in the buffer. */
|
||||||
dirp = (struct dirent *) &getdents_buf[tmpbuf_offset];
|
dirp = (struct dirent *) &getdents_buf[tmpbuf_offset];
|
||||||
dirp->d_ino = (ino_t)(b_data(bp) + block_pos);
|
dirp->d_ino = (pino_t)(b_data(bp) + block_pos);
|
||||||
dirp->d_off= cur_pos;
|
dirp->d_off= cur_pos;
|
||||||
dirp->d_reclen= reclen;
|
dirp->d_reclen= reclen;
|
||||||
memcpy(dirp->d_name, name, len);
|
memcpy(dirp->d_name, name, len);
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
#define END_OF_FILE (-104) /* eof detected */
|
#define END_OF_FILE (-104) /* eof detected */
|
||||||
|
|
||||||
#define ROOT_INODE ((ino_t) 1) /* inode number for root directory */
|
#define ROOT_INODE ((pino_t) 1) /* inode number for root directory */
|
||||||
#define BOOT_BLOCK ((block_t) 0) /* block number of boot block */
|
#define BOOT_BLOCK ((block_t) 0) /* block number of boot block */
|
||||||
#define SUPER_BLOCK_BYTES (1024) /* bytes offset */
|
#define SUPER_BLOCK_BYTES (1024) /* bytes offset */
|
||||||
#define START_BLOCK ((block_t) 2) /* first block of FS (not counting SB) */
|
#define START_BLOCK ((block_t) 2) /* first block of FS (not counting SB) */
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <minix/vfsif.h>
|
||||||
#include <minix/syslib.h>
|
#include <minix/syslib.h>
|
||||||
#include <minix/sysutil.h>
|
#include <minix/sysutil.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
static void addhash_inode(struct inode *node);
|
static void addhash_inode(struct inode *node);
|
||||||
|
|
||||||
static void free_inode(dev_t dev, ino_t numb);
|
static void free_inode(dev_t dev, pino_t numb);
|
||||||
static void new_icopy(struct inode *rip, d2_inode *dip, int direction,
|
static void new_icopy(struct inode *rip, d2_inode *dip, int direction,
|
||||||
int norm);
|
int norm);
|
||||||
static void old_icopy(struct inode *rip, d1_inode *dip, int direction,
|
static void old_icopy(struct inode *rip, d1_inode *dip, int direction,
|
||||||
|
|
@ -43,11 +43,11 @@ int fs_putnode(void)
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
rip = find_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR);
|
rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR);
|
||||||
|
|
||||||
if(!rip) {
|
if(!rip) {
|
||||||
printf("%s:%d put_inode: inode #%u dev: %d not found\n", __FILE__,
|
printf("%s:%d put_inode: inode #%u dev: %d not found\n", __FILE__,
|
||||||
__LINE__, (ino_t) fs_m_in.REQ_INODE_NR, fs_dev);
|
__LINE__, (pino_t) fs_m_in.REQ_INODE_NR, fs_dev);
|
||||||
panic("fs_putnode failed");
|
panic("fs_putnode failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,7 +124,7 @@ static void unhash_inode(struct inode *node)
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *get_inode(
|
struct inode *get_inode(
|
||||||
dev_t dev, /* device on which inode resides */
|
dev_t dev, /* device on which inode resides */
|
||||||
ino_t numb /* inode number */
|
pino_t numb /* inode number */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Find the inode in the hash table. If it is not there, get a free inode
|
/* Find the inode in the hash table. If it is not there, get a free inode
|
||||||
|
|
@ -186,7 +186,7 @@ struct inode *get_inode(
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *find_inode(
|
struct inode *find_inode(
|
||||||
dev_t dev, /* device on which inode resides */
|
dev_t dev, /* device on which inode resides */
|
||||||
ino_t numb /* inode number */
|
pino_t numb /* inode number */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Find the inode specified by the inode and device number.
|
/* Find the inode specified by the inode and device number.
|
||||||
|
|
@ -256,7 +256,7 @@ register struct inode *rip; /* pointer to inode to be released */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* alloc_inode *
|
* alloc_inode *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *alloc_inode(dev_t dev, mode_t bits)
|
struct inode *alloc_inode(dev_t dev, pmode_t bits)
|
||||||
{
|
{
|
||||||
/* Allocate a free inode on 'dev', and return a pointer to it. */
|
/* Allocate a free inode on 'dev', and return a pointer to it. */
|
||||||
|
|
||||||
|
|
@ -334,7 +334,7 @@ register struct inode *rip; /* the inode to be erased */
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static void free_inode(
|
static void free_inode(
|
||||||
dev_t dev, /* on which device is the inode? */
|
dev_t dev, /* on which device is the inode? */
|
||||||
ino_t inumb /* number of the inode to be freed */
|
pino_t inumb /* number of the inode to be freed */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Return an inode to the pool of unallocated inodes. */
|
/* Return an inode to the pool of unallocated inodes. */
|
||||||
|
|
@ -441,7 +441,7 @@ int norm; /* TRUE = do not swap bytes; FALSE = swap */
|
||||||
|
|
||||||
if (direction == READING) {
|
if (direction == READING) {
|
||||||
/* Copy V1.x inode to the in-core table, swapping bytes if need be. */
|
/* Copy V1.x inode to the in-core table, swapping bytes if need be. */
|
||||||
rip->i_mode = (mode_t) conv2(norm, (int) dip->d1_mode);
|
rip->i_mode = (pmode_t) conv2(norm, (int) dip->d1_mode);
|
||||||
rip->i_uid = (uid_t) conv2(norm, (int) dip->d1_uid );
|
rip->i_uid = (uid_t) conv2(norm, (int) dip->d1_uid );
|
||||||
rip->i_size = (off_t) conv4(norm, dip->d1_size);
|
rip->i_size = (off_t) conv4(norm, dip->d1_size);
|
||||||
rip->i_mtime = (time_t) conv4(norm, dip->d1_mtime);
|
rip->i_mtime = (time_t) conv4(norm, dip->d1_mtime);
|
||||||
|
|
@ -482,7 +482,7 @@ int norm; /* TRUE = do not swap bytes; FALSE = swap */
|
||||||
|
|
||||||
if (direction == READING) {
|
if (direction == READING) {
|
||||||
/* Copy V2.x inode to the in-core table, swapping bytes if need be. */
|
/* Copy V2.x inode to the in-core table, swapping bytes if need be. */
|
||||||
rip->i_mode = (mode_t) conv2(norm,dip->d2_mode);
|
rip->i_mode = (pmode_t) conv2(norm,dip->d2_mode);
|
||||||
rip->i_uid = (uid_t) conv2(norm,dip->d2_uid);
|
rip->i_uid = (uid_t) conv2(norm,dip->d2_uid);
|
||||||
rip->i_nlinks = (nlink_t) conv2(norm,dip->d2_nlinks);
|
rip->i_nlinks = (nlink_t) conv2(norm,dip->d2_nlinks);
|
||||||
rip->i_gid = (gid_t) conv2(norm,dip->d2_gid);
|
rip->i_gid = (gid_t) conv2(norm,dip->d2_gid);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
|
#include <minix/vfsif.h>
|
||||||
|
|
||||||
#include "super.h"
|
#include "super.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ int fs_link()
|
||||||
NUL(string, len, sizeof(string));
|
NUL(string, len, sizeof(string));
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* Check to see if the file has maximum number of links already. */
|
/* Check to see if the file has maximum number of links already. */
|
||||||
|
|
@ -67,7 +67,7 @@ int fs_link()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Temporarily open the last dir */
|
/* Temporarily open the last dir */
|
||||||
if( (ip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_DIR_INO)) == NULL) {
|
if( (ip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_DIR_INO)) == NULL) {
|
||||||
put_inode(rip);
|
put_inode(rip);
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ int fs_unlink()
|
||||||
NUL(string, len, sizeof(string));
|
NUL(string, len, sizeof(string));
|
||||||
|
|
||||||
/* Temporarily open the dir. */
|
/* Temporarily open the dir. */
|
||||||
if( (rldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* The last directory exists. Does the file also exist? */
|
/* The last directory exists. Does the file also exist? */
|
||||||
|
|
@ -181,7 +181,7 @@ int fs_rdlink()
|
||||||
copylen = min( (size_t) fs_m_in.REQ_MEM_SIZE, UMAX_FILE_POS);
|
copylen = min( (size_t) fs_m_in.REQ_MEM_SIZE, UMAX_FILE_POS);
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
if(!S_ISLNK(rip->i_mode))
|
if(!S_ISLNK(rip->i_mode))
|
||||||
|
|
@ -252,7 +252,7 @@ char file_name[MFS_NAME_MAX]; /* name of file to be removed */
|
||||||
{
|
{
|
||||||
/* Unlink 'file_name'; rip must be the inode of 'file_name' or NULL. */
|
/* Unlink 'file_name'; rip must be the inode of 'file_name' or NULL. */
|
||||||
|
|
||||||
ino_t numb; /* inode number */
|
pino_t numb; /* inode number */
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* If rip is not NULL, it is used to get faster access to the inode. */
|
/* If rip is not NULL, it is used to get faster access to the inode. */
|
||||||
|
|
@ -291,7 +291,7 @@ int fs_rename()
|
||||||
int odir, ndir; /* TRUE iff {old|new} file is dir */
|
int odir, ndir; /* TRUE iff {old|new} file is dir */
|
||||||
int same_pdir; /* TRUE iff parent dirs are the same */
|
int same_pdir; /* TRUE iff parent dirs are the same */
|
||||||
char old_name[MFS_NAME_MAX], new_name[MFS_NAME_MAX];
|
char old_name[MFS_NAME_MAX], new_name[MFS_NAME_MAX];
|
||||||
ino_t numb;
|
pino_t numb;
|
||||||
phys_bytes len;
|
phys_bytes len;
|
||||||
|
|
||||||
/* Copy the last component of the old name */
|
/* Copy the last component of the old name */
|
||||||
|
|
@ -309,7 +309,7 @@ int fs_rename()
|
||||||
NUL(new_name, len, sizeof(new_name));
|
NUL(new_name, len, sizeof(new_name));
|
||||||
|
|
||||||
/* Get old dir inode */
|
/* Get old dir inode */
|
||||||
if( (old_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_OLD_DIR)) == NULL)
|
if ((old_dirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_REN_OLD_DIR)) == NULL)
|
||||||
return(err_code);
|
return(err_code);
|
||||||
|
|
||||||
old_ip = advance(old_dirp, old_name, IGN_PERM);
|
old_ip = advance(old_dirp, old_name, IGN_PERM);
|
||||||
|
|
@ -328,7 +328,7 @@ int fs_rename()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get new dir inode */
|
/* Get new dir inode */
|
||||||
if( (new_dirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL) {
|
if ((new_dirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL){
|
||||||
put_inode(old_ip);
|
put_inode(old_ip);
|
||||||
put_inode(old_dirp);
|
put_inode(old_dirp);
|
||||||
return(err_code);
|
return(err_code);
|
||||||
|
|
@ -492,7 +492,7 @@ int fs_ftrunc(void)
|
||||||
off_t start, end;
|
off_t start, end;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if( (rip = find_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
if(rip->i_sp->s_rd_only) {
|
if(rip->i_sp->s_rd_only) {
|
||||||
|
|
@ -527,7 +527,7 @@ off_t newsize; /* inode must become this size */
|
||||||
* writing is done.
|
* writing is done.
|
||||||
*/
|
*/
|
||||||
int r;
|
int r;
|
||||||
mode_t file_type;
|
pmode_t file_type;
|
||||||
|
|
||||||
file_type = rip->i_mode & I_TYPE; /* check to see if file is special */
|
file_type = rip->i_mode & I_TYPE; /* check to see if file is special */
|
||||||
if (file_type == I_CHAR_SPECIAL || file_type == I_BLOCK_SPECIAL)
|
if (file_type == I_CHAR_SPECIAL || file_type == I_BLOCK_SPECIAL)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
#define MFS_DIRSIZ 60
|
#define MFS_DIRSIZ 60
|
||||||
|
|
||||||
struct direct {
|
struct direct {
|
||||||
ino_t mfs_d_ino;
|
pino_t mfs_d_ino;
|
||||||
char mfs_d_name[MFS_DIRSIZ];
|
char mfs_d_name[MFS_DIRSIZ];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,10 +130,10 @@ int fs_mountpoint()
|
||||||
*/
|
*/
|
||||||
register struct inode *rip;
|
register struct inode *rip;
|
||||||
int r = OK;
|
int r = OK;
|
||||||
mode_t bits;
|
pmode_t bits;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include "super.h"
|
#include "super.h"
|
||||||
#include <minix/vfsif.h>
|
#include <minix/vfsif.h>
|
||||||
|
|
||||||
static struct inode *new_node(struct inode *ldirp, char *string, mode_t
|
static struct inode *new_node(struct inode *ldirp, char *string, pmode_t
|
||||||
bits, zone_t z0);
|
bits, zone_t z0);
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
|
@ -19,11 +19,11 @@ int fs_create()
|
||||||
int r;
|
int r;
|
||||||
struct inode *ldirp;
|
struct inode *ldirp;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
mode_t omode;
|
pmode_t omode;
|
||||||
char lastc[MFS_NAME_MAX];
|
char lastc[MFS_NAME_MAX];
|
||||||
|
|
||||||
/* Read request message */
|
/* Read request message */
|
||||||
omode = (mode_t) fs_m_in.REQ_MODE;
|
omode = (pmode_t) fs_m_in.REQ_MODE;
|
||||||
caller_uid = (uid_t) fs_m_in.REQ_UID;
|
caller_uid = (uid_t) fs_m_in.REQ_UID;
|
||||||
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ int fs_create()
|
||||||
NUL(lastc, len, sizeof(lastc));
|
NUL(lastc, len, sizeof(lastc));
|
||||||
|
|
||||||
/* Get last directory inode (i.e., directory that will hold the new inode) */
|
/* Get last directory inode (i.e., directory that will hold the new inode) */
|
||||||
if ((ldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if ((ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(ENOENT);
|
return(ENOENT);
|
||||||
|
|
||||||
/* Create a new inode by calling new_node(). */
|
/* Create a new inode by calling new_node(). */
|
||||||
|
|
@ -87,11 +87,11 @@ int fs_mknod()
|
||||||
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
||||||
|
|
||||||
/* Get last directory inode */
|
/* Get last directory inode */
|
||||||
if((ldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if((ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(ENOENT);
|
return(ENOENT);
|
||||||
|
|
||||||
/* Try to create the new node */
|
/* Try to create the new node */
|
||||||
ip = new_node(ldirp, lastc, (mode_t) fs_m_in.REQ_MODE,
|
ip = new_node(ldirp, lastc, (pmode_t) fs_m_in.REQ_MODE,
|
||||||
(zone_t) fs_m_in.REQ_DEV);
|
(zone_t) fs_m_in.REQ_DEV);
|
||||||
|
|
||||||
put_inode(ip);
|
put_inode(ip);
|
||||||
|
|
@ -106,7 +106,7 @@ int fs_mknod()
|
||||||
int fs_mkdir()
|
int fs_mkdir()
|
||||||
{
|
{
|
||||||
int r1, r2; /* status codes */
|
int r1, r2; /* status codes */
|
||||||
ino_t dot, dotdot; /* inode numbers for . and .. */
|
pino_t dot, dotdot; /* inode numbers for . and .. */
|
||||||
struct inode *rip, *ldirp;
|
struct inode *rip, *ldirp;
|
||||||
char lastc[MFS_NAME_MAX]; /* last component */
|
char lastc[MFS_NAME_MAX]; /* last component */
|
||||||
phys_bytes len;
|
phys_bytes len;
|
||||||
|
|
@ -122,11 +122,11 @@ int fs_mkdir()
|
||||||
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
caller_gid = (gid_t) fs_m_in.REQ_GID;
|
||||||
|
|
||||||
/* Get last directory inode */
|
/* Get last directory inode */
|
||||||
if((ldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if((ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(ENOENT);
|
return(ENOENT);
|
||||||
|
|
||||||
/* Next make the inode. If that fails, return error code. */
|
/* Next make the inode. If that fails, return error code. */
|
||||||
rip = new_node(ldirp, lastc, (mode_t) fs_m_in.REQ_MODE, (zone_t) 0);
|
rip = new_node(ldirp, lastc, (pmode_t) fs_m_in.REQ_MODE, (zone_t) 0);
|
||||||
|
|
||||||
if(rip == NULL || err_code == EEXIST) {
|
if(rip == NULL || err_code == EEXIST) {
|
||||||
put_inode(rip); /* can't make dir: it already exists */
|
put_inode(rip); /* can't make dir: it already exists */
|
||||||
|
|
@ -140,7 +140,7 @@ int fs_mkdir()
|
||||||
|
|
||||||
/* Now make dir entries for . and .. unless the disk is completely full. */
|
/* Now make dir entries for . and .. unless the disk is completely full. */
|
||||||
/* Use dot1 and dot2, so the mode of the directory isn't important. */
|
/* Use dot1 and dot2, so the mode of the directory isn't important. */
|
||||||
rip->i_mode = (mode_t) fs_m_in.REQ_MODE; /* set mode */
|
rip->i_mode = (pmode_t) fs_m_in.REQ_MODE; /* set mode */
|
||||||
r1 = search_dir(rip, dot1, &dot, ENTER, IGN_PERM);/* enter . in the new dir*/
|
r1 = search_dir(rip, dot1, &dot, ENTER, IGN_PERM);/* enter . in the new dir*/
|
||||||
r2 = search_dir(rip, dot2, &dotdot, ENTER, IGN_PERM); /* enter .. in the new
|
r2 = search_dir(rip, dot2, &dotdot, ENTER, IGN_PERM); /* enter .. in the new
|
||||||
dir */
|
dir */
|
||||||
|
|
@ -189,11 +189,11 @@ int fs_slink()
|
||||||
NUL(string, len, sizeof(string));
|
NUL(string, len, sizeof(string));
|
||||||
|
|
||||||
/* Temporarily open the dir. */
|
/* Temporarily open the dir. */
|
||||||
if( (ldirp = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (ldirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* Create the inode for the symlink. */
|
/* Create the inode for the symlink. */
|
||||||
sip = new_node(ldirp, string, (mode_t) (I_SYMBOLIC_LINK | RWX_MODES),
|
sip = new_node(ldirp, string, (pmode_t) (I_SYMBOLIC_LINK | RWX_MODES),
|
||||||
(zone_t) 0);
|
(zone_t) 0);
|
||||||
|
|
||||||
/* Allocate a disk block for the contents of the symlink.
|
/* Allocate a disk block for the contents of the symlink.
|
||||||
|
|
@ -244,7 +244,7 @@ int fs_slink()
|
||||||
* new_node *
|
* new_node *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static struct inode *new_node(struct inode *ldirp,
|
static struct inode *new_node(struct inode *ldirp,
|
||||||
char *string, mode_t bits, zone_t z0)
|
char *string, pmode_t bits, zone_t z0)
|
||||||
{
|
{
|
||||||
/* New_node() is called by fs_open(), fs_mknod(), and fs_mkdir().
|
/* New_node() is called by fs_open(), fs_mknod(), and fs_mkdir().
|
||||||
* In all cases it allocates a new inode, makes a directory entry for it in
|
* In all cases it allocates a new inode, makes a directory entry for it in
|
||||||
|
|
@ -322,7 +322,7 @@ int fs_inhibread()
|
||||||
{
|
{
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
|
|
||||||
if((rip = find_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if((rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* inhibit read ahead */
|
/* inhibit read ahead */
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ char dot2[3] = ".."; /* permissions for . and .. */
|
||||||
|
|
||||||
static char *get_name(char *name, char string[MFS_NAME_MAX+1]);
|
static char *get_name(char *name, char string[MFS_NAME_MAX+1]);
|
||||||
static int ltraverse(struct inode *rip, char *suffix);
|
static int ltraverse(struct inode *rip, char *suffix);
|
||||||
static int parse_path(ino_t dir_ino, ino_t root_ino, int flags, struct
|
static int parse_path(pino_t dir_ino, pino_t root_ino, int flags, struct
|
||||||
inode **res_inop, size_t *offsetp, int *symlinkp);
|
inode **res_inop, size_t *offsetp, int *symlinkp);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -40,14 +40,14 @@ int fs_lookup()
|
||||||
int r, r1, flags, symlinks;
|
int r, r1, flags, symlinks;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
size_t offset = 0, path_size;
|
size_t offset = 0, path_size;
|
||||||
ino_t dir_ino, root_ino;
|
pino_t dir_ino, root_ino;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
|
|
||||||
grant = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
grant = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
||||||
path_size = (size_t) fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */
|
path_size = (size_t) fs_m_in.REQ_PATH_SIZE; /* Size of the buffer */
|
||||||
len = (int) fs_m_in.REQ_PATH_LEN; /* including terminating nul */
|
len = (int) fs_m_in.REQ_PATH_LEN; /* including terminating nul */
|
||||||
dir_ino = (ino_t) fs_m_in.REQ_DIR_INO;
|
dir_ino = (pino_t) fs_m_in.REQ_DIR_INO;
|
||||||
root_ino = (ino_t) fs_m_in.REQ_ROOT_INO;
|
root_ino = (pino_t) fs_m_in.REQ_ROOT_INO;
|
||||||
flags = (int) fs_m_in.REQ_FLAGS;
|
flags = (int) fs_m_in.REQ_FLAGS;
|
||||||
|
|
||||||
/* Check length. */
|
/* Check length. */
|
||||||
|
|
@ -120,14 +120,14 @@ int fs_lookup()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* parse_path *
|
* parse_path *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static int parse_path(dir_ino, root_ino, flags, res_inop, offsetp, symlinkp)
|
static int parse_path(
|
||||||
ino_t dir_ino;
|
pino_t dir_ino,
|
||||||
ino_t root_ino;
|
pino_t root_ino,
|
||||||
int flags;
|
int flags,
|
||||||
struct inode **res_inop;
|
struct inode **res_inop,
|
||||||
size_t *offsetp;
|
size_t *offsetp,
|
||||||
int *symlinkp;
|
int *symlinkp
|
||||||
{
|
) {
|
||||||
/* Parse the path in user_path, starting at dir_ino. If the path is the empty
|
/* Parse the path in user_path, starting at dir_ino. If the path is the empty
|
||||||
* string, just return dir_ino. It is upto the caller to treat an empty
|
* string, just return dir_ino. It is upto the caller to treat an empty
|
||||||
* path in a special way. Otherwise, if the path consists of just one or
|
* path in a special way. Otherwise, if the path consists of just one or
|
||||||
|
|
@ -355,7 +355,7 @@ int chk_perm; /* check permissions when string is looked up*/
|
||||||
* the directory, find the inode, open it, and return a pointer to its inode
|
* the directory, find the inode, open it, and return a pointer to its inode
|
||||||
* slot.
|
* slot.
|
||||||
*/
|
*/
|
||||||
ino_t numb;
|
pino_t numb;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
|
|
||||||
/* If 'string' is empty, return an error. */
|
/* If 'string' is empty, return an error. */
|
||||||
|
|
@ -463,7 +463,7 @@ char string[MFS_NAME_MAX+1]; /* component extracted from 'old_name' */
|
||||||
int search_dir(ldir_ptr, string, numb, flag, check_permissions)
|
int search_dir(ldir_ptr, string, numb, flag, check_permissions)
|
||||||
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
|
register struct inode *ldir_ptr; /* ptr to inode for dir to search */
|
||||||
char string[MFS_NAME_MAX]; /* component to search for */
|
char string[MFS_NAME_MAX]; /* component to search for */
|
||||||
ino_t *numb; /* pointer to inode number */
|
pino_t *numb; /* pointer to inode number */
|
||||||
int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
int flag; /* LOOK_UP, ENTER, DELETE or IS_EMPTY */
|
||||||
int check_permissions; /* check permissions when flag is !IS_EMPTY */
|
int check_permissions; /* check permissions when flag is !IS_EMPTY */
|
||||||
{
|
{
|
||||||
|
|
@ -479,7 +479,7 @@ int check_permissions; /* check permissions when flag is !IS_EMPTY */
|
||||||
register struct direct *dp = NULL;
|
register struct direct *dp = NULL;
|
||||||
register struct buf *bp = NULL;
|
register struct buf *bp = NULL;
|
||||||
int i, r, e_hit, t, match;
|
int i, r, e_hit, t, match;
|
||||||
mode_t bits;
|
pmode_t bits;
|
||||||
off_t pos;
|
off_t pos;
|
||||||
unsigned new_slots, old_slots;
|
unsigned new_slots, old_slots;
|
||||||
struct super_block *sp;
|
struct super_block *sp;
|
||||||
|
|
@ -558,8 +558,8 @@ int check_permissions; /* check permissions when flag is !IS_EMPTY */
|
||||||
if (flag == IS_EMPTY) r = ENOTEMPTY;
|
if (flag == IS_EMPTY) r = ENOTEMPTY;
|
||||||
else if (flag == DELETE) {
|
else if (flag == DELETE) {
|
||||||
/* Save d_ino for recovery. */
|
/* Save d_ino for recovery. */
|
||||||
t = MFS_NAME_MAX - sizeof(ino_t);
|
t = MFS_NAME_MAX - sizeof(pino_t);
|
||||||
*((ino_t *) &dp->mfs_d_name[t]) = dp->mfs_d_ino;
|
*((pino_t *) &dp->mfs_d_name[t]) = dp->mfs_d_ino;
|
||||||
dp->mfs_d_ino = NO_ENTRY; /* erase entry */
|
dp->mfs_d_ino = NO_ENTRY; /* erase entry */
|
||||||
MARKDIRTY(bp);
|
MARKDIRTY(bp);
|
||||||
ldir_ptr->i_update |= CTIME | MTIME;
|
ldir_ptr->i_update |= CTIME | MTIME;
|
||||||
|
|
@ -568,7 +568,7 @@ int check_permissions; /* check permissions when flag is !IS_EMPTY */
|
||||||
ldir_ptr->i_last_dpos = pos;
|
ldir_ptr->i_last_dpos = pos;
|
||||||
} else {
|
} else {
|
||||||
sp = ldir_ptr->i_sp; /* 'flag' is LOOK_UP */
|
sp = ldir_ptr->i_sp; /* 'flag' is LOOK_UP */
|
||||||
*numb = (ino_t) conv4(sp->s_native,
|
*numb = (pino_t) conv4(sp->s_native,
|
||||||
(int) dp->mfs_d_ino);
|
(int) dp->mfs_d_ino);
|
||||||
}
|
}
|
||||||
assert(lmfs_dev(bp) != NO_DEV);
|
assert(lmfs_dev(bp) != NO_DEV);
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ int fs_chmod()
|
||||||
/* Perform the chmod(name, mode) system call. */
|
/* Perform the chmod(name, mode) system call. */
|
||||||
|
|
||||||
register struct inode *rip;
|
register struct inode *rip;
|
||||||
mode_t mode;
|
pmode_t mode;
|
||||||
|
|
||||||
mode = (mode_t) fs_m_in.REQ_MODE;
|
mode = (pmode_t) fs_m_in.REQ_MODE;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
if(rip->i_sp->s_rd_only) {
|
if(rip->i_sp->s_rd_only) {
|
||||||
|
|
@ -49,7 +49,7 @@ int fs_chown()
|
||||||
register int r;
|
register int r;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/* Not permitted to change the owner of a file on a read-only file sys. */
|
/* Not permitted to change the owner of a file on a read-only file sys. */
|
||||||
|
|
@ -73,7 +73,7 @@ int fs_chown()
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* forbidden *
|
* forbidden *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
int forbidden(register struct inode *rip, mode_t access_desired)
|
int forbidden(register struct inode *rip, pmode_t access_desired)
|
||||||
{
|
{
|
||||||
/* Given a pointer to an inode, 'rip', and the access desired, determine
|
/* Given a pointer to an inode, 'rip', and the access desired, determine
|
||||||
* if the access is allowed, and if not why not. The routine looks up the
|
* if the access is allowed, and if not why not. The routine looks up the
|
||||||
|
|
@ -82,7 +82,7 @@ int forbidden(register struct inode *rip, mode_t access_desired)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
register struct inode *old_rip = rip;
|
register struct inode *old_rip = rip;
|
||||||
register mode_t bits, perm_bits;
|
register pmode_t bits, perm_bits;
|
||||||
int r, shift;
|
int r, shift;
|
||||||
|
|
||||||
/* Isolate the relevant rwx bits from the mode. */
|
/* Isolate the relevant rwx bits from the mode. */
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ zone_t alloc_zone(dev_t dev, zone_t z);
|
||||||
void free_zone(dev_t dev, zone_t numb);
|
void free_zone(dev_t dev, zone_t numb);
|
||||||
|
|
||||||
/* inode.c */
|
/* inode.c */
|
||||||
struct inode *alloc_inode(dev_t dev, mode_t bits);
|
struct inode *alloc_inode(dev_t dev, pmode_t bits);
|
||||||
void dup_inode(struct inode *ip);
|
void dup_inode(struct inode *ip);
|
||||||
struct inode *find_inode(dev_t dev, ino_t numb);
|
struct inode *find_inode(dev_t dev, pino_t numb);
|
||||||
int fs_putnode(void);
|
int fs_putnode(void);
|
||||||
void init_inode_cache(void);
|
void init_inode_cache(void);
|
||||||
struct inode *get_inode(dev_t dev, ino_t numb);
|
struct inode *get_inode(dev_t dev, pino_t numb);
|
||||||
void put_inode(struct inode *rip);
|
void put_inode(struct inode *rip);
|
||||||
void update_times(struct inode *rip);
|
void update_times(struct inode *rip);
|
||||||
void rw_inode(struct inode *rip, int rw_flag);
|
void rw_inode(struct inode *rip, int rw_flag);
|
||||||
|
|
@ -59,7 +59,7 @@ int fs_slink(void);
|
||||||
int fs_lookup(void);
|
int fs_lookup(void);
|
||||||
struct inode *advance(struct inode *dirp, char string[MFS_NAME_MAX], int
|
struct inode *advance(struct inode *dirp, char string[MFS_NAME_MAX], int
|
||||||
chk_perm);
|
chk_perm);
|
||||||
int search_dir(struct inode *ldir_ptr, char string [MFS_NAME_MAX], ino_t
|
int search_dir(struct inode *ldir_ptr, char string [MFS_NAME_MAX], pino_t
|
||||||
*numb, int flag, int check_permissions);
|
*numb, int flag, int check_permissions);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ int search_dir(struct inode *ldir_ptr, char string [MFS_NAME_MAX], ino_t
|
||||||
int fs_chmod(void);
|
int fs_chmod(void);
|
||||||
int fs_chown(void);
|
int fs_chown(void);
|
||||||
int fs_getdents(void);
|
int fs_getdents(void);
|
||||||
int forbidden(struct inode *rip, mode_t access_desired);
|
int forbidden(struct inode *rip, pmode_t access_desired);
|
||||||
int read_only(struct inode *ip);
|
int read_only(struct inode *ip);
|
||||||
|
|
||||||
/* read.c */
|
/* read.c */
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ int fs_readwrite(void)
|
||||||
cp_grant_id_t gid;
|
cp_grant_id_t gid;
|
||||||
off_t position, f_size, bytes_left;
|
off_t position, f_size, bytes_left;
|
||||||
unsigned int off, cum_io, block_size, chunk;
|
unsigned int off, cum_io, block_size, chunk;
|
||||||
mode_t mode_word;
|
pmode_t mode_word;
|
||||||
int completed;
|
int completed;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
size_t nrbytes;
|
size_t nrbytes;
|
||||||
|
|
@ -37,7 +37,7 @@ int fs_readwrite(void)
|
||||||
r = OK;
|
r = OK;
|
||||||
|
|
||||||
/* Find the inode referred */
|
/* Find the inode referred */
|
||||||
if ((rip = find_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if ((rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
mode_word = rip->i_mode & I_TYPE;
|
mode_word = rip->i_mode & I_TYPE;
|
||||||
|
|
@ -615,7 +615,7 @@ int fs_getdents(void)
|
||||||
register struct inode *rip;
|
register struct inode *rip;
|
||||||
int o, r, done;
|
int o, r, done;
|
||||||
unsigned int block_size, len, reclen;
|
unsigned int block_size, len, reclen;
|
||||||
ino_t ino;
|
pino_t ino;
|
||||||
cp_grant_id_t gid;
|
cp_grant_id_t gid;
|
||||||
size_t size, tmpbuf_off, userbuf_off;
|
size_t size, tmpbuf_off, userbuf_off;
|
||||||
off_t pos, off, block_pos, new_pos, ent_pos;
|
off_t pos, off, block_pos, new_pos, ent_pos;
|
||||||
|
|
@ -624,8 +624,8 @@ int fs_getdents(void)
|
||||||
struct dirent *dep;
|
struct dirent *dep;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
ino = (ino_t) fs_m_in.REQ_INODE_NR;
|
ino = (pino_t) fs_m_in.REQ_INODE_NR;
|
||||||
gid = (gid_t) fs_m_in.REQ_GRANT;
|
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
|
||||||
size = (size_t) fs_m_in.REQ_MEM_SIZE;
|
size = (size_t) fs_m_in.REQ_MEM_SIZE;
|
||||||
pos = (off_t) fs_m_in.REQ_SEEK_POS_LO;
|
pos = (off_t) fs_m_in.REQ_SEEK_POS_LO;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ static int stat_inode(
|
||||||
/* Common code for stat and fstat system calls. */
|
/* Common code for stat and fstat system calls. */
|
||||||
|
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
mode_t mo;
|
pmode_t mo;
|
||||||
int r, s;
|
int r, s;
|
||||||
|
|
||||||
/* Update the atime, ctime, and mtime fields in the inode, if need be. */
|
/* Update the atime, ctime, and mtime fields in the inode, if need be. */
|
||||||
|
|
@ -149,7 +149,7 @@ int fs_stat()
|
||||||
register int r; /* return value */
|
register int r; /* return value */
|
||||||
register struct inode *rip; /* target inode */
|
register struct inode *rip; /* target inode */
|
||||||
|
|
||||||
if ((rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if ((rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
r = stat_inode(rip, fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT);
|
r = stat_inode(rip, fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT);
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ int read_super(struct super_block *sp)
|
||||||
|
|
||||||
/* If the super block has the wrong byte order, swap the fields; the magic
|
/* If the super block has the wrong byte order, swap the fields; the magic
|
||||||
* number doesn't need conversion. */
|
* number doesn't need conversion. */
|
||||||
sp->s_ninodes = (ino_t) conv4(native, (int) sp->s_ninodes);
|
sp->s_ninodes = (pino_t) conv4(native, (int) sp->s_ninodes);
|
||||||
sp->s_nzones = (zone1_t) conv2(native, (int) sp->s_nzones);
|
sp->s_nzones = (zone1_t) conv2(native, (int) sp->s_nzones);
|
||||||
sp->s_imap_blocks = (short) conv2(native, (int) sp->s_imap_blocks);
|
sp->s_imap_blocks = (short) conv2(native, (int) sp->s_imap_blocks);
|
||||||
sp->s_zmap_blocks = (short) conv2(native, (int) sp->s_zmap_blocks);
|
sp->s_zmap_blocks = (short) conv2(native, (int) sp->s_zmap_blocks);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXTERN struct super_block {
|
EXTERN struct super_block {
|
||||||
ino_t s_ninodes; /* # usable inodes on the minor device */
|
pino_t s_ninodes; /* # usable inodes on the minor device */
|
||||||
zone1_t s_nzones; /* total device size, including bit maps etc */
|
zone1_t s_nzones; /* total device size, including bit maps etc */
|
||||||
short s_imap_blocks; /* # of blocks used by inode bit map */
|
short s_imap_blocks; /* # of blocks used by inode bit map */
|
||||||
short s_zmap_blocks; /* # of blocks used by zone bit map */
|
short s_zmap_blocks; /* # of blocks used by zone bit map */
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ int fs_utime()
|
||||||
register int r;
|
register int r;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* Temporarily open the file. */
|
||||||
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
if( (rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ struct buf {
|
||||||
/* Header portion of the buffer. */
|
/* Header portion of the buffer. */
|
||||||
struct buf *b_next; /* used to link all free bufs in a chain */
|
struct buf *b_next; /* used to link all free bufs in a chain */
|
||||||
struct buf *b_prev; /* used to link all free bufs the other way */
|
struct buf *b_prev; /* used to link all free bufs the other way */
|
||||||
ino_t b_num; /* inode number on minor device */
|
pino_t b_num; /* inode number on minor device */
|
||||||
dev_t b_dev; /* major | minor device where block resides */
|
dev_t b_dev; /* major | minor device where block resides */
|
||||||
int b_bytes; /* Number of bytes allocated in bp */
|
int b_bytes; /* Number of bytes allocated in bp */
|
||||||
int b_count; /* Number of users of this buffer */
|
int b_count; /* Number of users of this buffer */
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static struct buf *new_block(dev_t dev, ino_t inum);
|
static struct buf *new_block(dev_t dev, pino_t inum);
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* buf_pool *
|
* buf_pool *
|
||||||
|
|
@ -23,7 +23,7 @@ void buf_pool(void)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* get_block *
|
* get_block *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct buf *get_block(dev_t dev, ino_t inum)
|
struct buf *get_block(dev_t dev, pino_t inum)
|
||||||
{
|
{
|
||||||
struct buf *bp = front;
|
struct buf *bp = front;
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ struct buf *get_block(dev_t dev, ino_t inum)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* new_block *
|
* new_block *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
static struct buf *new_block(dev_t dev, ino_t inum)
|
static struct buf *new_block(dev_t dev, pino_t inum)
|
||||||
{
|
{
|
||||||
/* Allocate a new buffer and add it to the double linked buffer list */
|
/* Allocate a new buffer and add it to the double linked buffer list */
|
||||||
struct buf *bp;
|
struct buf *bp;
|
||||||
|
|
@ -77,7 +77,7 @@ static struct buf *new_block(dev_t dev, ino_t inum)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* put_block *
|
* put_block *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
void put_block(dev_t dev, ino_t inum)
|
void put_block(dev_t dev, pino_t inum)
|
||||||
{
|
{
|
||||||
struct buf *bp;
|
struct buf *bp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include <minix/sysutil.h>
|
#include <minix/sysutil.h>
|
||||||
#include <minix/keymap.h>
|
#include <minix/keymap.h>
|
||||||
#include <minix/bitmap.h>
|
#include <minix/bitmap.h>
|
||||||
|
#include <minix/vfsif.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ int fs_putnode(message *fs_m_in, message *fs_m_out)
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
int count;
|
int count;
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
ino_t inum;
|
pino_t inum;
|
||||||
|
|
||||||
rip = find_inode( (ino_t) fs_m_in->REQ_INODE_NR);
|
rip = find_inode( (pino_t) fs_m_in->REQ_INODE_NR);
|
||||||
|
|
||||||
if(!rip) {
|
if(!rip) {
|
||||||
printf("%s:%d put_inode: inode #%ld dev: %d not found\n", __FILE__,
|
printf("%s:%d put_inode: inode #%ld dev: %d not found\n", __FILE__,
|
||||||
|
|
@ -119,7 +119,7 @@ static void unhash_inode(struct inode * const node)
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *get_inode(
|
struct inode *get_inode(
|
||||||
dev_t dev, /* device on which inode resides */
|
dev_t dev, /* device on which inode resides */
|
||||||
ino_t numb /* inode number */
|
pino_t numb /* inode number */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Find the inode in the hash table. If it is not there, get a free inode
|
/* Find the inode in the hash table. If it is not there, get a free inode
|
||||||
|
|
@ -173,8 +173,7 @@ struct inode *get_inode(
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* find_inode *
|
* find_inode *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *find_inode(numb)
|
struct inode *find_inode(pino_t numb /* inode number */)
|
||||||
ino_t numb; /* inode number */
|
|
||||||
{
|
{
|
||||||
/* Find the inode specified by the inode and device number.
|
/* Find the inode specified by the inode and device number.
|
||||||
*/
|
*/
|
||||||
|
|
@ -238,13 +237,13 @@ struct inode *rip; /* pointer to inode to be released */
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* alloc_inode *
|
* alloc_inode *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
struct inode *alloc_inode(dev_t dev, mode_t bits)
|
struct inode *alloc_inode(dev_t dev, pmode_t bits)
|
||||||
{
|
{
|
||||||
/* Allocate a free inode on 'dev', and return a pointer to it. */
|
/* Allocate a free inode on 'dev', and return a pointer to it. */
|
||||||
|
|
||||||
register struct inode *rip;
|
register struct inode *rip;
|
||||||
bit_t b;
|
bit_t b;
|
||||||
ino_t i_num;
|
pino_t i_num;
|
||||||
int print_oos_msg = 1;
|
int print_oos_msg = 1;
|
||||||
|
|
||||||
b = alloc_bit();
|
b = alloc_bit();
|
||||||
|
|
@ -255,7 +254,7 @@ struct inode *alloc_inode(dev_t dev, mode_t bits)
|
||||||
print_oos_msg = 0; /* Don't repeat message */
|
print_oos_msg = 0; /* Don't repeat message */
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
i_num = (ino_t) b;
|
i_num = (pino_t) b;
|
||||||
print_oos_msg = 1;
|
print_oos_msg = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -309,7 +308,7 @@ struct inode *rip;
|
||||||
|
|
||||||
bit_t b;
|
bit_t b;
|
||||||
|
|
||||||
if (rip->i_num <= (ino_t) 0 || rip->i_num >= (ino_t) PFS_NR_INODES) return;
|
if (rip->i_num <= (pino_t) 0 || rip->i_num >= (pino_t) PFS_NR_INODES) return;
|
||||||
b = (bit_t) rip->i_num;
|
b = (bit_t) rip->i_num;
|
||||||
free_bit(b);
|
free_bit(b);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
|
|
||||||
EXTERN struct inode {
|
EXTERN struct inode {
|
||||||
mode_t i_mode; /* file type, protection, etc. */
|
pmode_t i_mode; /* file type, protection, etc. */
|
||||||
nlink_t i_nlinks; /* how many links to this file */
|
nlink_t i_nlinks; /* how many links to this file */
|
||||||
uid_t i_uid; /* user id of the file's owner */
|
uid_t i_uid; /* user id of the file's owner */
|
||||||
gid_t i_gid; /* group number */
|
gid_t i_gid; /* group number */
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ int fs_ftrunc(message *fs_m_in, message *fs_m_out)
|
||||||
{
|
{
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
off_t start;
|
off_t start;
|
||||||
ino_t inumb;
|
pino_t inumb;
|
||||||
|
|
||||||
inumb = (ino_t) fs_m_in->REQ_INODE_NR;
|
inumb = (pino_t) fs_m_in->REQ_INODE_NR;
|
||||||
|
|
||||||
if( (rip = find_inode(inumb)) == NULL) return(EINVAL);
|
if( (rip = find_inode(inumb)) == NULL) return(EINVAL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@
|
||||||
int fs_newnode(message *fs_m_in, message *fs_m_out)
|
int fs_newnode(message *fs_m_in, message *fs_m_out)
|
||||||
{
|
{
|
||||||
register int r = OK;
|
register int r = OK;
|
||||||
mode_t bits;
|
pmode_t bits;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
|
|
||||||
caller_uid = (uid_t) fs_m_in->REQ_UID;
|
caller_uid = (uid_t) fs_m_in->REQ_UID;
|
||||||
caller_gid = (gid_t) fs_m_in->REQ_GID;
|
caller_gid = (gid_t) fs_m_in->REQ_GID;
|
||||||
bits = (mode_t) fs_m_in->REQ_MODE;
|
bits = (pmode_t) fs_m_in->REQ_MODE;
|
||||||
dev = (dev_t) fs_m_in->REQ_DEV;
|
dev = (dev_t) fs_m_in->REQ_DEV;
|
||||||
|
|
||||||
/* Try to allocate the inode */
|
/* Try to allocate the inode */
|
||||||
|
|
|
||||||
|
|
@ -10,20 +10,20 @@ struct sockaddr_un;
|
||||||
struct ancillary;
|
struct ancillary;
|
||||||
|
|
||||||
/* buffer.c */
|
/* buffer.c */
|
||||||
struct buf *get_block(dev_t dev, ino_t inum);
|
struct buf *get_block(dev_t dev, pino_t inum);
|
||||||
void put_block(dev_t dev, ino_t inum);
|
void put_block(dev_t dev, pino_t inum);
|
||||||
|
|
||||||
/* cache.c */
|
/* cache.c */
|
||||||
void buf_pool(void);
|
void buf_pool(void);
|
||||||
|
|
||||||
/* inode.c */
|
/* inode.c */
|
||||||
struct inode *alloc_inode(dev_t dev, mode_t mode);
|
struct inode *alloc_inode(dev_t dev, pmode_t mode);
|
||||||
void dup_inode(struct inode *ip);
|
void dup_inode(struct inode *ip);
|
||||||
struct inode *find_inode(ino_t numb);
|
struct inode *find_inode(pino_t numb);
|
||||||
void free_inode(struct inode *rip);
|
void free_inode(struct inode *rip);
|
||||||
int fs_putnode(message *fs_m_in, message *fs_m_out);
|
int fs_putnode(message *fs_m_in, message *fs_m_out);
|
||||||
void init_inode_cache(void);
|
void init_inode_cache(void);
|
||||||
struct inode *get_inode(dev_t dev, ino_t numb);
|
struct inode *get_inode(dev_t dev, pino_t numb);
|
||||||
void put_inode(struct inode *rip);
|
void put_inode(struct inode *rip);
|
||||||
void update_times(struct inode *rip);
|
void update_times(struct inode *rip);
|
||||||
void wipe_inode(struct inode *rip);
|
void wipe_inode(struct inode *rip);
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,13 @@ int fs_readwrite(message *fs_m_in, message *fs_m_out)
|
||||||
cp_grant_id_t gid;
|
cp_grant_id_t gid;
|
||||||
off_t position, f_size;
|
off_t position, f_size;
|
||||||
unsigned int nrbytes, cum_io;
|
unsigned int nrbytes, cum_io;
|
||||||
mode_t mode_word;
|
pmode_t mode_word;
|
||||||
struct inode *rip;
|
struct inode *rip;
|
||||||
ino_t inumb;
|
pino_t inumb;
|
||||||
|
|
||||||
r = OK;
|
r = OK;
|
||||||
cum_io = 0;
|
cum_io = 0;
|
||||||
inumb = (ino_t) fs_m_in->REQ_INODE_NR;
|
inumb = (pino_t) fs_m_in->REQ_INODE_NR;
|
||||||
|
|
||||||
/* Find the inode referred */
|
/* Find the inode referred */
|
||||||
if ((rip = find_inode(inumb)) == NULL) return(EINVAL);
|
if ((rip = find_inode(inumb)) == NULL) return(EINVAL);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ static int stat_inode(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Common code for stat and fstat system calls. */
|
/* Common code for stat and fstat system calls. */
|
||||||
mode_t type;
|
pmode_t type;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
u32_t blocks; /* The unit of this is 512 */
|
u32_t blocks; /* The unit of this is 512 */
|
||||||
int r, s;
|
int r, s;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ struct uds_fd {
|
||||||
* uds_close(). Data is sent/written to a peer's PIPE.
|
* uds_close(). Data is sent/written to a peer's PIPE.
|
||||||
* Data is recv/read from this PIPE.
|
* Data is recv/read from this PIPE.
|
||||||
*/
|
*/
|
||||||
ino_t inode_nr;
|
pino_t inode_nr;
|
||||||
|
|
||||||
|
|
||||||
/* position in the PIPE where the data starts */
|
/* position in the PIPE where the data starts */
|
||||||
|
|
@ -78,7 +78,7 @@ struct uds_fd {
|
||||||
* for read and write, read only, write only, or neither.
|
* for read and write, read only, write only, or neither.
|
||||||
* default is S_IRUSR|S_IWUSR.
|
* default is S_IRUSR|S_IWUSR.
|
||||||
*/
|
*/
|
||||||
mode_t mode;
|
pmode_t mode;
|
||||||
|
|
||||||
/* Socket Info */
|
/* Socket Info */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ struct load {
|
||||||
*/
|
*/
|
||||||
struct file {
|
struct file {
|
||||||
char *name; /* file name, maximum length PNAME_MAX */
|
char *name; /* file name, maximum length PNAME_MAX */
|
||||||
mode_t mode; /* file mode, including file type */
|
pmode_t mode; /* file mode, including file type */
|
||||||
data_t data; /* custom data associated with this file */
|
data_t data; /* custom data associated with this file */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,14 +106,14 @@ int req_chmod(
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_CHMOD;
|
m.m_type = REQ_CHMOD;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_MODE = rmode;
|
m.REQ_MODE = (pmode_t) rmode;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
r = fs_sendrec(fs_e, &m);
|
r = fs_sendrec(fs_e, &m);
|
||||||
|
|
||||||
/* Copy back actual mode. */
|
/* Copy back actual mode. */
|
||||||
*new_modep = m.RES_MODE;
|
*new_modep = (mode_t) m.RES_MODE;
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
@ -135,15 +135,15 @@ int req_chown(
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_CHOWN;
|
m.m_type = REQ_CHOWN;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_UID = newuid;
|
m.REQ_UID = (puid_t) newuid;
|
||||||
m.REQ_GID = newgid;
|
m.REQ_GID = (pgid_t) newgid;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
r = fs_sendrec(fs_e, &m);
|
r = fs_sendrec(fs_e, &m);
|
||||||
|
|
||||||
/* Return new mode to caller. */
|
/* Return new mode to caller. */
|
||||||
*new_modep = m.RES_MODE;
|
*new_modep = (mode_t) m.RES_MODE;
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
@ -176,12 +176,12 @@ int req_create(
|
||||||
panic("req_create: cpf_grant_direct failed");
|
panic("req_create: cpf_grant_direct failed");
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_CREATE;
|
m.m_type = REQ_CREATE;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_MODE = omode;
|
m.REQ_MODE = (pmode_t) omode;
|
||||||
m.REQ_UID = uid;
|
m.REQ_UID = (puid_t) uid;
|
||||||
m.REQ_GID = gid;
|
m.REQ_GID = (pgid_t) gid;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_PATH_LEN = len;
|
m.REQ_PATH_LEN = len;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
|
|
@ -191,11 +191,11 @@ int req_create(
|
||||||
|
|
||||||
/* Fill in response structure */
|
/* Fill in response structure */
|
||||||
res->fs_e = m.m_source;
|
res->fs_e = m.m_source;
|
||||||
res->inode_nr = m.RES_INODE_NR;
|
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
||||||
res->fmode = m.RES_MODE;
|
res->fmode = (mode_t) m.RES_MODE;
|
||||||
res->fsize = m.RES_FILE_SIZE_LO;
|
res->fsize = m.RES_FILE_SIZE_LO;
|
||||||
res->uid = m.RES_UID;
|
res->uid = (uid_t) m.RES_UID;
|
||||||
res->gid = m.RES_GID;
|
res->gid = (gid_t) m.RES_GID;
|
||||||
res->dev = NO_DEV;
|
res->dev = NO_DEV;
|
||||||
|
|
||||||
return(OK);
|
return(OK);
|
||||||
|
|
@ -279,7 +279,7 @@ int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_FTRUNC;
|
m.m_type = REQ_FTRUNC;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_TRC_START_LO = start;
|
m.REQ_TRC_START_LO = start;
|
||||||
m.REQ_TRC_START_HI = 0; /* Not used for now, so clear it. */
|
m.REQ_TRC_START_HI = 0; /* Not used for now, so clear it. */
|
||||||
m.REQ_TRC_END_LO = end;
|
m.REQ_TRC_END_LO = end;
|
||||||
|
|
@ -320,7 +320,7 @@ int req_getdents(
|
||||||
grant_id);
|
grant_id);
|
||||||
|
|
||||||
m.m_type = REQ_GETDENTS;
|
m.m_type = REQ_GETDENTS;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_MEM_SIZE = size;
|
m.REQ_MEM_SIZE = size;
|
||||||
m.REQ_SEEK_POS_LO = ex64lo(pos);
|
m.REQ_SEEK_POS_LO = ex64lo(pos);
|
||||||
|
|
@ -346,7 +346,7 @@ int req_inhibread(endpoint_t fs_e, ino_t inode_nr)
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_INHIBREAD;
|
m.m_type = REQ_INHIBREAD;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
return fs_sendrec(fs_e, &m);
|
return fs_sendrec(fs_e, &m);
|
||||||
|
|
@ -374,8 +374,8 @@ int req_link(
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_LINK;
|
m.m_type = REQ_LINK;
|
||||||
m.REQ_INODE_NR = linked_file;
|
m.REQ_INODE_NR = (pino_t) linked_file;
|
||||||
m.REQ_DIR_INO = link_parent;
|
m.REQ_DIR_INO = (pino_t) link_parent;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_PATH_LEN = len;
|
m.REQ_PATH_LEN = len;
|
||||||
|
|
||||||
|
|
@ -420,8 +420,8 @@ int req_lookup(
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_PATH_LEN = len;
|
m.REQ_PATH_LEN = len;
|
||||||
m.REQ_PATH_SIZE = PATH_MAX + 1;
|
m.REQ_PATH_SIZE = PATH_MAX + 1;
|
||||||
m.REQ_DIR_INO = dir_ino;
|
m.REQ_DIR_INO = (pino_t) dir_ino;
|
||||||
m.REQ_ROOT_INO = root_ino;
|
m.REQ_ROOT_INO = (pino_t) root_ino;
|
||||||
|
|
||||||
if(rfp->fp_ngroups > 0) { /* Is the process member of multiple groups? */
|
if(rfp->fp_ngroups > 0) { /* Is the process member of multiple groups? */
|
||||||
/* In that case the FS has to copy the uid/gid credentials */
|
/* In that case the FS has to copy the uid/gid credentials */
|
||||||
|
|
@ -444,8 +444,8 @@ int req_lookup(
|
||||||
flags |= PATH_GET_UCRED;
|
flags |= PATH_GET_UCRED;
|
||||||
} else {
|
} else {
|
||||||
/* When there's only one gid, we can send it directly */
|
/* When there's only one gid, we can send it directly */
|
||||||
m.REQ_UID = uid;
|
m.REQ_UID = (pgid_t) uid;
|
||||||
m.REQ_GID = gid;
|
m.REQ_GID = (pgid_t) gid;
|
||||||
flags &= ~PATH_GET_UCRED;
|
flags &= ~PATH_GET_UCRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -461,15 +461,15 @@ int req_lookup(
|
||||||
|
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case OK:
|
case OK:
|
||||||
res->inode_nr = m.RES_INODE_NR;
|
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
||||||
res->fmode = m.RES_MODE;
|
res->fmode = (mode_t) m.RES_MODE;
|
||||||
res->fsize = m.RES_FILE_SIZE_LO;
|
res->fsize = m.RES_FILE_SIZE_LO;
|
||||||
res->dev = m.RES_DEV;
|
res->dev = m.RES_DEV;
|
||||||
res->uid= m.RES_UID;
|
res->uid = (uid_t) m.RES_UID;
|
||||||
res->gid= m.RES_GID;
|
res->gid = (gid_t) m.RES_GID;
|
||||||
break;
|
break;
|
||||||
case EENTERMOUNT:
|
case EENTERMOUNT:
|
||||||
res->inode_nr = m.RES_INODE_NR;
|
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
||||||
res->char_processed = m.RES_OFFSET;
|
res->char_processed = m.RES_OFFSET;
|
||||||
res->symloop = m.RES_SYMLOOP;
|
res->symloop = m.RES_SYMLOOP;
|
||||||
break;
|
break;
|
||||||
|
|
@ -513,10 +513,10 @@ int req_mkdir(
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_MKDIR;
|
m.m_type = REQ_MKDIR;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_MODE = dmode;
|
m.REQ_MODE = (pmode_t) dmode;
|
||||||
m.REQ_UID = uid;
|
m.REQ_UID = (puid_t) uid;
|
||||||
m.REQ_GID = gid;
|
m.REQ_GID = (pgid_t) gid;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_PATH_LEN = len;
|
m.REQ_PATH_LEN = len;
|
||||||
|
|
||||||
|
|
@ -553,11 +553,11 @@ int req_mknod(
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_MKNOD;
|
m.m_type = REQ_MKNOD;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_MODE = dmode;
|
m.REQ_MODE = (pmode_t) dmode;
|
||||||
m.REQ_DEV = dev;
|
m.REQ_DEV = dev;
|
||||||
m.REQ_UID = uid;
|
m.REQ_UID = (puid_t) uid;
|
||||||
m.REQ_GID = gid;
|
m.REQ_GID = (pgid_t) gid;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_PATH_LEN = len;
|
m.REQ_PATH_LEN = len;
|
||||||
|
|
||||||
|
|
@ -578,7 +578,7 @@ int req_mountpoint(endpoint_t fs_e, ino_t inode_nr)
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_MOUNTPOINT;
|
m.m_type = REQ_MOUNTPOINT;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
return fs_sendrec(fs_e, &m);
|
return fs_sendrec(fs_e, &m);
|
||||||
|
|
@ -602,21 +602,21 @@ int req_newnode(
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_NEWNODE;
|
m.m_type = REQ_NEWNODE;
|
||||||
m.REQ_MODE = dmode;
|
m.REQ_MODE = (pmode_t) dmode;
|
||||||
m.REQ_DEV = dev;
|
m.REQ_DEV = dev;
|
||||||
m.REQ_UID = uid;
|
m.REQ_UID = (puid_t) uid;
|
||||||
m.REQ_GID = gid;
|
m.REQ_GID = (pgid_t) gid;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
r = fs_sendrec(fs_e, &m);
|
r = fs_sendrec(fs_e, &m);
|
||||||
|
|
||||||
res->fs_e = m.m_source;
|
res->fs_e = m.m_source;
|
||||||
res->inode_nr = m.RES_INODE_NR;
|
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
||||||
res->fmode = m.RES_MODE;
|
res->fmode = (mode_t) m.RES_MODE;
|
||||||
res->fsize = m.RES_FILE_SIZE_LO;
|
res->fsize = m.RES_FILE_SIZE_LO;
|
||||||
res->dev = m.RES_DEV;
|
res->dev = m.RES_DEV;
|
||||||
res->uid = m.RES_UID;
|
res->uid = (uid_t) m.RES_UID;
|
||||||
res->gid = m.RES_GID;
|
res->gid = (gid_t) m.RES_GID;
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
@ -669,7 +669,7 @@ int count;
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_PUTNODE;
|
m.m_type = REQ_PUTNODE;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_COUNT = count;
|
m.REQ_COUNT = count;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
|
|
@ -702,7 +702,7 @@ int direct; /* set to 1 to use direct grants instead of magic grants */
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_RDLINK;
|
m.m_type = REQ_RDLINK;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_MEM_SIZE = len;
|
m.REQ_MEM_SIZE = len;
|
||||||
|
|
||||||
|
|
@ -760,14 +760,14 @@ int req_readsuper(
|
||||||
if(r == OK) {
|
if(r == OK) {
|
||||||
/* Fill in response structure */
|
/* Fill in response structure */
|
||||||
res_nodep->fs_e = m.m_source;
|
res_nodep->fs_e = m.m_source;
|
||||||
res_nodep->inode_nr = m.RES_INODE_NR;
|
res_nodep->inode_nr = (ino_t) m.RES_INODE_NR;
|
||||||
vmp->m_proto = m.RES_PROTO;
|
vmp->m_proto = m.RES_PROTO;
|
||||||
printf("%d: proto = 0x%x, version=%d conreqs=%d\n", fs_e, vmp->m_proto,
|
printf("%d: proto = 0x%x, version=%d conreqs=%d\n", fs_e, vmp->m_proto,
|
||||||
VFS_FS_PROTO_VERSION(vmp->m_proto), VFS_FS_PROTO_CONREQS(vmp->m_proto));
|
VFS_FS_PROTO_VERSION(vmp->m_proto), VFS_FS_PROTO_CONREQS(vmp->m_proto));
|
||||||
res_nodep->fmode = m.RES_MODE;
|
res_nodep->fmode = (mode_t) m.RES_MODE;
|
||||||
res_nodep->fsize = m.RES_FILE_SIZE_LO;
|
res_nodep->fsize = m.RES_FILE_SIZE_LO;
|
||||||
res_nodep->uid = m.RES_UID;
|
res_nodep->uid = (uid_t) m.RES_UID;
|
||||||
res_nodep->gid = m.RES_GID;
|
res_nodep->gid = (gid_t) m.RES_GID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
|
|
@ -803,7 +803,7 @@ unsigned int *cum_iop;
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = rw_flag == READING ? REQ_READ : REQ_WRITE;
|
m.m_type = rw_flag == READING ? REQ_READ : REQ_WRITE;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_SEEK_POS_LO = ex64lo(pos);
|
m.REQ_SEEK_POS_LO = ex64lo(pos);
|
||||||
m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */
|
m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */
|
||||||
|
|
@ -873,8 +873,8 @@ char *new_name;
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_RENAME;
|
m.m_type = REQ_RENAME;
|
||||||
m.REQ_REN_OLD_DIR = old_dir;
|
m.REQ_REN_OLD_DIR = (pino_t) old_dir;
|
||||||
m.REQ_REN_NEW_DIR = new_dir;
|
m.REQ_REN_NEW_DIR = (pino_t) new_dir;
|
||||||
m.REQ_REN_GRANT_OLD = gid_old;
|
m.REQ_REN_GRANT_OLD = gid_old;
|
||||||
m.REQ_REN_LEN_OLD = len_old;
|
m.REQ_REN_LEN_OLD = len_old;
|
||||||
m.REQ_REN_GRANT_NEW = gid_new;
|
m.REQ_REN_GRANT_NEW = gid_new;
|
||||||
|
|
@ -909,7 +909,7 @@ char *lastc;
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_RMDIR;
|
m.m_type = REQ_RMDIR;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_PATH_LEN = len;
|
m.REQ_PATH_LEN = len;
|
||||||
|
|
||||||
|
|
@ -953,9 +953,9 @@ int req_slink(
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_SLINK;
|
m.m_type = REQ_SLINK;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_UID = uid;
|
m.REQ_UID = (puid_t) uid;
|
||||||
m.REQ_GID = gid;
|
m.REQ_GID = (pgid_t) gid;
|
||||||
m.REQ_GRANT = gid_name;
|
m.REQ_GRANT = gid_name;
|
||||||
m.REQ_PATH_LEN = len;
|
m.REQ_PATH_LEN = len;
|
||||||
m.REQ_GRANT3 = gid_buf;
|
m.REQ_GRANT3 = gid_buf;
|
||||||
|
|
@ -987,7 +987,7 @@ int req_stat(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e, vir_bytes buf)
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_STAT;
|
m.m_type = REQ_STAT;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
|
|
@ -1034,7 +1034,7 @@ char *lastc;
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_UNLINK;
|
m.m_type = REQ_UNLINK;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_GRANT = grant_id;
|
m.REQ_GRANT = grant_id;
|
||||||
m.REQ_PATH_LEN = len;
|
m.REQ_PATH_LEN = len;
|
||||||
|
|
||||||
|
|
@ -1075,6 +1075,7 @@ int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actimespec,
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_UTIME;
|
m.m_type = REQ_UTIME;
|
||||||
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.REQ_INODE_NR = inode_nr;
|
||||||
m.REQ_ACTIME = actimespec->tv_sec;
|
m.REQ_ACTIME = actimespec->tv_sec;
|
||||||
m.REQ_MODTIME = modtimespec->tv_sec;
|
m.REQ_MODTIME = modtimespec->tv_sec;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user