Commit 39228ed9 authored by Petr Vandrovec's avatar Petr Vandrovec

Allow access to all 256 volumes from Netware server.

parent e70cad34
...@@ -307,6 +307,7 @@ __ncp_lookup_validate(struct dentry * dentry, int flags) ...@@ -307,6 +307,7 @@ __ncp_lookup_validate(struct dentry * dentry, int flags)
if (!res) if (!res)
res = ncp_obtain_info(server, dir, __name, &(finfo.i)); res = ncp_obtain_info(server, dir, __name, &(finfo.i));
} }
finfo.volume = finfo.i.volNumber;
DDPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n", DDPRINTK("ncp_lookup_validate: looked for %s/%s, res=%d\n",
dentry->d_parent->d_name.name, __name, res); dentry->d_parent->d_name.name, __name, res);
/* /*
...@@ -670,6 +671,7 @@ ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir, ...@@ -670,6 +671,7 @@ ncp_read_volume_list(struct file *filp, void *dirent, filldir_t filldir,
info.volume_name); info.volume_name);
continue; continue;
} }
entry.volume = entry.i.volNumber;
if (!ncp_fill_cache(filp, dirent, filldir, ctl, &entry)) if (!ncp_fill_cache(filp, dirent, filldir, ctl, &entry))
return; return;
} }
...@@ -704,6 +706,7 @@ ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir, ...@@ -704,6 +706,7 @@ ncp_do_readdir(struct file *filp, void *dirent, filldir_t filldir,
DPRINTK("ncp_do_readdir: search failed, err=%d\n", err); DPRINTK("ncp_do_readdir: search failed, err=%d\n", err);
return; return;
} }
entry.volume = entry.i.volNumber;
if (!ncp_fill_cache(filp, dirent, filldir, ctl, &entry)) if (!ncp_fill_cache(filp, dirent, filldir, ctl, &entry))
return; return;
} }
...@@ -788,6 +791,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry) ...@@ -788,6 +791,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry)
*/ */
finfo.opened = 0; finfo.opened = 0;
finfo.ino = iunique(dir->i_sb, 2); finfo.ino = iunique(dir->i_sb, 2);
finfo.volume = finfo.i.volNumber;
error = -EACCES; error = -EACCES;
inode = ncp_iget(dir->i_sb, &finfo); inode = ncp_iget(dir->i_sb, &finfo);
......
...@@ -51,12 +51,10 @@ int ncp_make_open(struct inode *inode, int right) ...@@ -51,12 +51,10 @@ int ncp_make_open(struct inode *inode, int right)
struct ncp_entry_info finfo; struct ncp_entry_info finfo;
int result; int result;
finfo.i.dirEntNum = NCP_FINFO(inode)->dirEntNum;
finfo.i.volNumber = NCP_FINFO(inode)->volNumber;
/* tries max. rights */ /* tries max. rights */
finfo.access = O_RDWR; finfo.access = O_RDWR;
result = ncp_open_create_file_or_subdir(NCP_SERVER(inode), result = ncp_open_create_file_or_subdir(NCP_SERVER(inode),
NULL, NULL, OC_MODE_OPEN, inode, NULL, OC_MODE_OPEN,
0, AR_READ | AR_WRITE, &finfo); 0, AR_READ | AR_WRITE, &finfo);
if (!result) if (!result)
goto update; goto update;
...@@ -65,13 +63,13 @@ int ncp_make_open(struct inode *inode, int right) ...@@ -65,13 +63,13 @@ int ncp_make_open(struct inode *inode, int right)
case O_RDONLY: case O_RDONLY:
finfo.access = O_RDONLY; finfo.access = O_RDONLY;
result = ncp_open_create_file_or_subdir(NCP_SERVER(inode), result = ncp_open_create_file_or_subdir(NCP_SERVER(inode),
NULL, NULL, OC_MODE_OPEN, inode, NULL, OC_MODE_OPEN,
0, AR_READ, &finfo); 0, AR_READ, &finfo);
break; break;
case O_WRONLY: case O_WRONLY:
finfo.access = O_WRONLY; finfo.access = O_WRONLY;
result = ncp_open_create_file_or_subdir(NCP_SERVER(inode), result = ncp_open_create_file_or_subdir(NCP_SERVER(inode),
NULL, NULL, OC_MODE_OPEN, inode, NULL, OC_MODE_OPEN,
0, AR_WRITE, &finfo); 0, AR_WRITE, &finfo);
break; break;
} }
......
...@@ -103,13 +103,9 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo) ...@@ -103,13 +103,9 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo)
{ {
NCP_FINFO(inode)->DosDirNum = nwinfo->i.DosDirNum; NCP_FINFO(inode)->DosDirNum = nwinfo->i.DosDirNum;
NCP_FINFO(inode)->dirEntNum = nwinfo->i.dirEntNum; NCP_FINFO(inode)->dirEntNum = nwinfo->i.dirEntNum;
NCP_FINFO(inode)->volNumber = nwinfo->i.volNumber; NCP_FINFO(inode)->volNumber = nwinfo->volume;
#ifdef CONFIG_NCPFS_STRONG
NCP_FINFO(inode)->nwattr = nwinfo->i.attributes;
#else
NCP_FINFO(inode)->nwattr = nwinfo->i.attributes; NCP_FINFO(inode)->nwattr = nwinfo->i.attributes;
#endif
NCP_FINFO(inode)->access = nwinfo->access; NCP_FINFO(inode)->access = nwinfo->access;
memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle, memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle,
sizeof(nwinfo->file_handle)); sizeof(nwinfo->file_handle));
...@@ -478,7 +474,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -478,7 +474,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
#ifdef CONFIG_NCPFS_SMALLDOS #ifdef CONFIG_NCPFS_SMALLDOS
finfo.i.NSCreator = NW_NS_DOS; finfo.i.NSCreator = NW_NS_DOS;
#endif #endif
finfo.i.volNumber = NCP_NUMBER_OF_VOLUMES + 1; /* illegal volnum */ finfo.volume = NCP_NUMBER_OF_VOLUMES;
/* set dates of mountpoint to Jan 1, 1986; 00:00 */ /* set dates of mountpoint to Jan 1, 1986; 00:00 */
finfo.i.creationTime = finfo.i.modifyTime finfo.i.creationTime = finfo.i.modifyTime
= cpu_to_le16(0x0000); = cpu_to_le16(0x0000);
...@@ -491,7 +487,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -491,7 +487,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
finfo.opened = 0; finfo.opened = 0;
finfo.ino = 2; /* tradition */ finfo.ino = 2; /* tradition */
server->name_space[finfo.i.volNumber] = NW_NS_DOS; server->name_space[finfo.volume] = NW_NS_DOS;
error = -ENOMEM; error = -ENOMEM;
root_inode = ncp_iget(sb, &finfo); root_inode = ncp_iget(sb, &finfo);
......
...@@ -201,7 +201,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp, ...@@ -201,7 +201,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
case NCP_IOC_SETROOT: case NCP_IOC_SETROOT:
{ {
struct ncp_setroot_ioctl sr; struct ncp_setroot_ioctl sr;
struct nw_info_struct i; unsigned int vnum, de, dosde;
struct dentry* dentry; struct dentry* dentry;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
...@@ -214,25 +214,31 @@ int ncp_ioctl(struct inode *inode, struct file *filp, ...@@ -214,25 +214,31 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
sizeof(sr))) return -EFAULT; sizeof(sr))) return -EFAULT;
if (sr.volNumber < 0) { if (sr.volNumber < 0) {
server->m.mounted_vol[0] = 0; server->m.mounted_vol[0] = 0;
i.volNumber = NCP_NUMBER_OF_VOLUMES + 1; vnum = NCP_NUMBER_OF_VOLUMES;
i.dirEntNum = 0; de = 0;
i.DosDirNum = 0; dosde = 0;
} else if (sr.volNumber >= NCP_NUMBER_OF_VOLUMES) { } else if (sr.volNumber >= NCP_NUMBER_OF_VOLUMES) {
return -EINVAL; return -EINVAL;
} else } else {
if (ncp_mount_subdir(server, &i, sr.volNumber, struct nw_info_struct ni;
if (ncp_mount_subdir(server, &ni, sr.volNumber,
sr.namespace, sr.dirEntNum)) sr.namespace, sr.dirEntNum))
return -ENOENT; return -ENOENT;
vnum = ni.volNumber;
de = ni.dirEntNum;
dosde = ni.DosDirNum;
}
dentry = inode->i_sb->s_root; dentry = inode->i_sb->s_root;
server->root_setuped = 1; server->root_setuped = 1;
if (dentry) { if (dentry) {
struct inode* inode = dentry->d_inode; struct inode* inode = dentry->d_inode;
if (inode) { if (inode) {
NCP_FINFO(inode)->volNumber = i.volNumber; NCP_FINFO(inode)->volNumber = vnum;
NCP_FINFO(inode)->dirEntNum = i.dirEntNum; NCP_FINFO(inode)->dirEntNum = de;
NCP_FINFO(inode)->DosDirNum = i.DosDirNum; NCP_FINFO(inode)->DosDirNum = dosde;
} else } else
DPRINTK("ncpfs: s_root->d_inode==NULL\n"); DPRINTK("ncpfs: s_root->d_inode==NULL\n");
} else } else
......
...@@ -640,15 +640,12 @@ int ncp_open_create_file_or_subdir(struct ncp_server *server, ...@@ -640,15 +640,12 @@ int ncp_open_create_file_or_subdir(struct ncp_server *server,
struct ncp_entry_info *target) struct ncp_entry_info *target)
{ {
__u16 search_attribs = ntohs(0x0600); __u16 search_attribs = ntohs(0x0600);
__u8 volnum = target->i.volNumber; __u8 volnum;
__u32 dirent = target->i.dirEntNum; __u32 dirent;
int result; int result;
if (dir) volnum = NCP_FINFO(dir)->volNumber;
{ dirent = NCP_FINFO(dir)->dirEntNum;
volnum = NCP_FINFO(dir)->volNumber;
dirent = NCP_FINFO(dir)->dirEntNum;
}
if ((create_attributes & aDIR) != 0) { if ((create_attributes & aDIR) != 0) {
search_attribs |= ntohs(0x0080); search_attribs |= ntohs(0x0080);
...@@ -672,6 +669,7 @@ int ncp_open_create_file_or_subdir(struct ncp_server *server, ...@@ -672,6 +669,7 @@ int ncp_open_create_file_or_subdir(struct ncp_server *server,
/* in target there's a new finfo to fill */ /* in target there's a new finfo to fill */
ncp_extract_file_info(ncp_reply_data(server, 6), &(target->i)); ncp_extract_file_info(ncp_reply_data(server, 6), &(target->i));
target->volume = target->i.volNumber;
ConvertToNWfromDWORD(ncp_reply_dword(server, 0), target->file_handle); ConvertToNWfromDWORD(ncp_reply_dword(server, 0), target->file_handle);
out: out:
......
...@@ -44,7 +44,7 @@ struct ncp_reply_header { ...@@ -44,7 +44,7 @@ struct ncp_reply_header {
}; };
#define NCP_VOLNAME_LEN (16) #define NCP_VOLNAME_LEN (16)
#define NCP_NUMBER_OF_VOLUMES (64) #define NCP_NUMBER_OF_VOLUMES (256)
struct ncp_volume_info { struct ncp_volume_info {
__u32 total_blocks; __u32 total_blocks;
__u32 free_blocks; __u32 free_blocks;
......
...@@ -182,6 +182,7 @@ struct ncp_entry_info { ...@@ -182,6 +182,7 @@ struct ncp_entry_info {
ino_t ino; ino_t ino;
int opened; int opened;
int access; int access;
unsigned int volume;
__u8 file_handle[6]; __u8 file_handle[6];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment