[Balls-cvs-act] CVS: linux/fs namei.c,1.12,1.13 open.c,1.13,1.14
Status: Pre-Alpha
Brought to you by:
quinnharris
|
From: Quinn H. <qui...@us...> - 2001-10-24 23:33:14
|
Update of /cvsroot/balls/linux/fs
In directory usw-pr-cvs1:/tmp/cvs-serv28956/fs
Modified Files:
namei.c open.c
Log Message:
Index: namei.c
===================================================================
RCS file: /cvsroot/balls/linux/fs/namei.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** namei.c 2001/10/20 06:13:50 1.12
--- namei.c 2001/10/24 23:33:11 1.13
***************
*** 652,659 ****
{
if (path_walk(name, nd))
! return 0;
! if (!nd->dentry->d_inode) {
struct nameidata nd_root;
nd_root.last_type = LAST_ROOT;
nd_root.flags = nd->flags;
--- 652,663 ----
{
if (path_walk(name, nd))
! return 0; /* something went wrong... */
! if (!nd->dentry->d_inode || S_ISDIR(nd->dentry->d_inode->i_mode)) {
struct nameidata nd_root;
+ /*
+ * NAME was not found in alternate root or it's a directory. Try to find
+ * it in the normal root:
+ */
nd_root.last_type = LAST_ROOT;
nd_root.flags = nd->flags;
Index: open.c
===================================================================
RCS file: /cvsroot/balls/linux/fs/open.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** open.c 2001/10/20 06:13:50 1.13
--- open.c 2001/10/24 23:33:11 1.14
***************
*** 110,114 ****
inode = nd.dentry->d_inode;
! error = -EACCES;
if (!S_ISREG(inode->i_mode))
goto dput_and_out;
--- 110,119 ----
inode = nd.dentry->d_inode;
! /* For directories it's -EISDIR, for other non-regulars - -EINVAL */
! error = -EISDIR;
! if (S_ISDIR(inode->i_mode))
! goto dput_and_out;
!
! error = -EINVAL;
if (!S_ISREG(inode->i_mode))
goto dput_and_out;
***************
*** 152,159 ****
asmlinkage long sys_truncate(const char * path, unsigned long length)
{
! return do_sys_truncate(path, length);
}
! static inline long do_sys_ftruncate(unsigned int fd, loff_t length)
{
struct inode * inode;
--- 157,165 ----
asmlinkage long sys_truncate(const char * path, unsigned long length)
{
! /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */
! return do_sys_truncate(path, (long)length);
}
! static inline long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
{
struct inode * inode;
***************
*** 169,179 ****
if (!file)
goto out;
dentry = file->f_dentry;
inode = dentry->d_inode;
! error = -EACCES;
if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
goto out_putf;
error = -EPERM;
! if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out_putf;
--- 175,196 ----
if (!file)
goto out;
+
+ /* explicitly opened as large or we are on 64-bit box */
+ if (file->f_flags & O_LARGEFILE)
+ small = 0;
+
dentry = file->f_dentry;
inode = dentry->d_inode;
! error = -EINVAL;
if (!S_ISREG(inode->i_mode) || !(file->f_mode & FMODE_WRITE))
goto out_putf;
+
+ error = -EINVAL;
+ /* Cannot ftruncate over 2^31 bytes without large file support */
+ if (small && length > MAX_NON_LFS)
+ goto out_putf;
+
error = -EPERM;
! if (IS_APPEND(inode))
goto out_putf;
***************
*** 189,193 ****
asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
{
! return do_sys_ftruncate(fd, length);
}
--- 206,210 ----
asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
{
! return do_sys_ftruncate(fd, length, 1);
}
***************
*** 201,205 ****
asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
{
! return do_sys_ftruncate(fd, length);
}
#endif
--- 218,222 ----
asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
{
! return do_sys_ftruncate(fd, length, 0);
}
#endif
***************
*** 513,517 ****
error = -ENOENT;
if (!(inode = dentry->d_inode)) {
! printk("chown_common: NULL inode\n");
goto out;
}
--- 530,534 ----
error = -ENOENT;
if (!(inode = dentry->d_inode)) {
! printk(KERN_ERR "chown_common: NULL inode\n");
goto out;
}
***************
*** 750,754 ****
/* Sanity check */
if (files->fd[fd] != NULL) {
! printk("get_unused_fd: slot %d not NULL!\n", fd);
files->fd[fd] = NULL;
}
--- 767,771 ----
/* Sanity check */
if (files->fd[fd] != NULL) {
! printk(KERN_WARNING "get_unused_fd: slot %d not NULL!\n", fd);
files->fd[fd] = NULL;
}
***************
*** 813,817 ****
if (!file_count(filp)) {
! printk("VFS: Close: file count is 0\n");
return 0;
}
--- 830,834 ----
if (!file_count(filp)) {
! printk(KERN_ERR "VFS: Close: file count is 0\n");
return 0;
}
|